/*
Uiml.Net: a .Net UIML renderer (http://lumumba.uhasselt.be/kris/research/uiml.net)
Copyright (C) 2003 Kris Luyten (kris.luyten@uhasselt.be)
Expertise Centre for Digital Media (http://edm.uhasselt.be)
Hasselt University
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
namespace Uiml{
using System;
using System.Xml;
using System.Collections;
using Uiml.Executing;
///
///Represents the behavior element:
/// <!ELEMENT behavior (rule*)>
/// <!ATTLIST behavior id NMTOKEN #IMPLIED
/// source CDATA #IMPLIED
/// how (union|cascade|replace) "replace"
/// export (hidden|optional|required) "optional">
///
public class Behavior : UimlAttributes, IUimlElement{
private ArrayList m_rules;
private Part m_partTree;
private XmlNode m_waitingNode;
public Behavior()
{
m_rules = new ArrayList();
}
public Behavior(XmlNode n, Part topPart) : this()
{
m_partTree = topPart;
Process(n);
}
public Behavior(XmlNode n) : this()
{
m_waitingNode = n;
}
///
///Factory method that resolves this Behavior for a given Part
///
public Behavior Resolve(Part partTop)
{
if(m_waitingNode != null)
return new Behavior(m_waitingNode, partTop);
else
return null;//this should never happen!
}
public void Process(XmlNode n)
{
ReadAttributes(n);
if(n.Name == IAM)
{
if(n.HasChildNodes)
{
XmlNodeList xnl = n.ChildNodes;
for(int i=0; i";
return str;
}
public ArrayList Children
{
get { return m_rules; }
}
public const string IAM = "behavior";
}
}