fi.hut.tml.xsmiles.mlfc.xforms.ui
Class RepeatHandler

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.xforms.ui.RepeatHandler

public class RepeatHandler
extends java.lang.Object

The handler for repeats. This class handles "expanding" the UI dom depending on the nodeset that the repeat is bound. This class does not handle the index (cursor in the UI).

Author:
Mikko Honkala

Field Summary
static java.lang.String CSS_CURSOR_BACKGROUND_COLOR_PROPERTY
           
static java.lang.String CSS_CURSOR_COLOR_PROPERTY
           
protected  java.util.Vector current
           
protected  java.awt.Color cursorBGColor
          the repeat cursors color
protected  java.awt.Color cursorFGColor
          the repeat cursors color
protected  java.lang.String id
          the id of this repeat
protected  java.util.Hashtable instanceTable
          the map between the instance nodes, and corresponding first node in the UI
protected  org.w3c.dom.Element ownerElement
          the owner element for this handler (e.g.
protected  org.w3c.dom.Element prototypeUIElement
          the prototype for the UI nodes (cloned from the owner element, only children are used
protected  org.w3c.dom.NodeList refNodes
          the currently bound nodes
 short REPEAT_EXPANDED
           
 short REPEAT_UNINITIALIZED
           
protected  int repeatChildCount
          The number of children for a single repeat iteration
protected  InstanceNode repeatInstanceParent
          The parent node in the instance, that I will listen to for additions and deletions
protected  int startIndex
          The current repeat start index
protected  short status
          the current status of this repeat
protected  XFormsContext xformsContext
           
 
Constructor Summary
RepeatHandler(XFormsContext context)
           
 
Method Summary
protected  org.w3c.dom.Node addRemoveSelectively(org.w3c.dom.NodeList newList)
           
protected  void checkCursorInBounds()
           
 int countChildNodes(org.w3c.dom.Element parent)
           
 void createPresentationNodes(int cursor, org.w3c.dom.Node context, boolean append)
           
protected  void createPrototypeElement()
           
 void destroy()
           
 void expandUI()
          re-inits this repeat's UI elements totally
 org.w3c.dom.NodeList getBoundNodeset()
           
protected  int getIndex(org.w3c.dom.Node added)
          find a cursor value from a child node in UI DOM, used by selection events
protected  int getIndexOfInstanceNode(org.w3c.dom.Node child)
          1 -based index
static org.w3c.dom.Node getNthSibling(org.w3c.dom.Node start, int count)
           
 java.lang.String getRepeatId()
           
 org.w3c.dom.Element getUIElement()
           
 java.util.Vector getUINodesForIndex(int index)
           
protected  boolean hasNode(org.w3c.dom.Node n, org.w3c.dom.NodeList list)
          see, if a node is contained in a nodelist
protected  boolean hasNode(org.w3c.dom.Node n, java.util.Vector list)
          see, if a node is contained in a nodelist
 void notifyBindingChanged(org.w3c.dom.NodeList newBinding)
          notifies the listener that the binding and the value changed
protected  void notifyRefresh()
           
static void removeAllChildrenTest(org.w3c.dom.Element elem)
           
protected  void removeFromUI(org.w3c.dom.Node n)
           
protected  void setContextNodeRecursively(org.w3c.dom.Node p, org.w3c.dom.Node context)
           
protected  void setRefreshBlocking(boolean state)
           
protected  void setRepeatIndex(org.w3c.dom.Node n)
           
 void setUIElement(org.w3c.dom.Element elem)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSS_CURSOR_BACKGROUND_COLOR_PROPERTY

public static final java.lang.String CSS_CURSOR_BACKGROUND_COLOR_PROPERTY
See Also:
Constant Field Values

CSS_CURSOR_COLOR_PROPERTY

public static final java.lang.String CSS_CURSOR_COLOR_PROPERTY
See Also:
Constant Field Values

REPEAT_UNINITIALIZED

public final short REPEAT_UNINITIALIZED
See Also:
Constant Field Values

REPEAT_EXPANDED

public final short REPEAT_EXPANDED
See Also:
Constant Field Values

status

protected short status
the current status of this repeat


repeatInstanceParent

protected InstanceNode repeatInstanceParent
The parent node in the instance, that I will listen to for additions and deletions


startIndex

protected int startIndex
The current repeat start index


repeatChildCount

protected int repeatChildCount
The number of children for a single repeat iteration


cursorFGColor

protected java.awt.Color cursorFGColor
the repeat cursors color


cursorBGColor

protected java.awt.Color cursorBGColor
the repeat cursors color


refNodes

protected org.w3c.dom.NodeList refNodes
the currently bound nodes


ownerElement

protected org.w3c.dom.Element ownerElement
the owner element for this handler (e.g. the repeat element


prototypeUIElement

protected org.w3c.dom.Element prototypeUIElement
the prototype for the UI nodes (cloned from the owner element, only children are used


id

protected java.lang.String id
the id of this repeat


instanceTable

protected java.util.Hashtable instanceTable
the map between the instance nodes, and corresponding first node in the UI


xformsContext

protected XFormsContext xformsContext

current

protected java.util.Vector current
Constructor Detail

RepeatHandler

public RepeatHandler(XFormsContext context)
Method Detail

destroy

public void destroy()

setUIElement

public void setUIElement(org.w3c.dom.Element elem)

getUIElement

public org.w3c.dom.Element getUIElement()

getRepeatId

public java.lang.String getRepeatId()

createPrototypeElement

protected void createPrototypeElement()

countChildNodes

public int countChildNodes(org.w3c.dom.Element parent)

expandUI

public void expandUI()
re-inits this repeat's UI elements totally


getBoundNodeset

public org.w3c.dom.NodeList getBoundNodeset()

createPresentationNodes

public void createPresentationNodes(int cursor,
                                    org.w3c.dom.Node context,
                                    boolean append)

setContextNodeRecursively

protected void setContextNodeRecursively(org.w3c.dom.Node p,
                                         org.w3c.dom.Node context)

removeAllChildrenTest

public static void removeAllChildrenTest(org.w3c.dom.Element elem)

getIndex

protected int getIndex(org.w3c.dom.Node added)
find a cursor value from a child node in UI DOM, used by selection events


getUINodesForIndex

public java.util.Vector getUINodesForIndex(int index)

addRemoveSelectively

protected org.w3c.dom.Node addRemoveSelectively(org.w3c.dom.NodeList newList)

setRepeatIndex

protected void setRepeatIndex(org.w3c.dom.Node n)

getNthSibling

public static org.w3c.dom.Node getNthSibling(org.w3c.dom.Node start,
                                             int count)

hasNode

protected boolean hasNode(org.w3c.dom.Node n,
                          org.w3c.dom.NodeList list)
see, if a node is contained in a nodelist


hasNode

protected boolean hasNode(org.w3c.dom.Node n,
                          java.util.Vector list)
see, if a node is contained in a nodelist


removeFromUI

protected void removeFromUI(org.w3c.dom.Node n)

checkCursorInBounds

protected void checkCursorInBounds()

notifyBindingChanged

public void notifyBindingChanged(org.w3c.dom.NodeList newBinding)
notifies the listener that the binding and the value changed


notifyRefresh

protected void notifyRefresh()

setRefreshBlocking

protected void setRefreshBlocking(boolean state)

getIndexOfInstanceNode

protected int getIndexOfInstanceNode(org.w3c.dom.Node child)
1 -based index



X-Smiles 1.2