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

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

public class RepeatIndexHandler
extends java.lang.Object

The repeat index handler. Only one instance of this class exists per document in the bubbling phase, all index values are set, and traversed indexes are unshown in the UI when the event comes to the root repeat, it starts to show nested repeat indexes if some nested repeat is outside the event target, then the nested repeat's index is set to 1 * FUNCTIONAL: o Repeat element listens for DOMFocusIn o When DOMFocusIn is received, repeat calls RepeatIndexHandler, which + unsets the previous cursors in event flow + sets the new cursors for the whole repeat hierarchy

Author:
Mikko Honkala

Field Summary
static java.lang.String CSS_CURSOR_BACKGROUND_COLOR_PROPERTY
           
static java.lang.String CSS_CURSOR_COLOR_PROPERTY
           
protected  java.awt.Color cursorBGColor
          the repeat cursors color
protected  java.awt.Color cursorFGColor
          the repeat cursors color
protected  java.util.Hashtable previousCursorValues
           
protected  java.util.Hashtable repeatsWithCursor
           
protected  XFormsContext xformsContext
           
 
Constructor Summary
RepeatIndexHandler(XFormsContext context)
           
 
Method Summary
 org.w3c.dom.Element findRepeatedId(org.w3c.dom.Element elem, java.lang.String id)
          Find the active instance of the given id as determined by enclosing repeat's indexes.
protected  int getIndex(org.w3c.dom.Node target, RepeatHandler handler)
          This method handles the event when the user selects a control in repeat Events are used to set the repeatcursor to whatever the user has selected
 RepeatItemPseudoElement getRepeatItem(RepeatHandler handler, int i)
           
protected  boolean hasAncestorRepeat(RepeatHandler handler)
          goes towards the root and reports if any repeat's are found as ancestors
 void repeatAboutToChange(RepeatHandler handler)
          call this before any changes to UI, it will clear out the previous cursor
 void repeatCaughtFocusEvent(org.w3c.dom.events.UIEvent event, RepeatHandler handler)
          the repeat has caught the DOMFocusIn event
 void repeatChanged(RepeatHandler handler)
          call this method when new items have been inserted into repeat or old ones removed.
 void repeatInitialized(RepeatHandler handler)
          call this method when a repeat has been initialized in the beginning.
protected  int resolveItemNumber(org.w3c.dom.Node target, RepeatHandler handler)
          find out which item was focused
protected  java.lang.String resolveRepeatId(RepeatHandler handler)
          find out the repeat id of this repeat handler
protected  void setIndexValue(java.lang.String repeatId, int item)
          set the cursor value thru model
 void setRepeatIndex(org.w3c.dom.Node target, RepeatHandler handler, int item)
           
 void setRepeatIndexRecursively(org.w3c.dom.Element elem)
           
protected  void unsetPreviousIndex(RepeatHandler handler)
          unset the previous cursors for all repeats in the document, leave prevCursor=-1 if you want to use the cursor value from model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repeatsWithCursor

protected java.util.Hashtable repeatsWithCursor

previousCursorValues

protected java.util.Hashtable previousCursorValues

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

cursorFGColor

protected java.awt.Color cursorFGColor
the repeat cursors color


cursorBGColor

protected java.awt.Color cursorBGColor
the repeat cursors color


xformsContext

protected XFormsContext xformsContext
Constructor Detail

RepeatIndexHandler

public RepeatIndexHandler(XFormsContext context)
Method Detail

repeatCaughtFocusEvent

public void repeatCaughtFocusEvent(org.w3c.dom.events.UIEvent event,
                                   RepeatHandler handler)
the repeat has caught the DOMFocusIn event


repeatChanged

public void repeatChanged(RepeatHandler handler)
call this method when new items have been inserted into repeat or old ones removed. Set index in the model before calling this!


repeatAboutToChange

public void repeatAboutToChange(RepeatHandler handler)
call this before any changes to UI, it will clear out the previous cursor


repeatInitialized

public void repeatInitialized(RepeatHandler handler)
call this method when a repeat has been initialized in the beginning. it will show the initial cursor


setRepeatIndex

public void setRepeatIndex(org.w3c.dom.Node target,
                           RepeatHandler handler,
                           int item)

setRepeatIndexRecursively

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

getRepeatItem

public RepeatItemPseudoElement getRepeatItem(RepeatHandler handler,
                                             int i)

hasAncestorRepeat

protected boolean hasAncestorRepeat(RepeatHandler handler)
goes towards the root and reports if any repeat's are found as ancestors


resolveItemNumber

protected int resolveItemNumber(org.w3c.dom.Node target,
                                RepeatHandler handler)
find out which item was focused


resolveRepeatId

protected java.lang.String resolveRepeatId(RepeatHandler handler)
find out the repeat id of this repeat handler


unsetPreviousIndex

protected void unsetPreviousIndex(RepeatHandler handler)
unset the previous cursors for all repeats in the document, leave prevCursor=-1 if you want to use the cursor value from model


setIndexValue

protected void setIndexValue(java.lang.String repeatId,
                             int item)
set the cursor value thru model


getIndex

protected int getIndex(org.w3c.dom.Node target,
                       RepeatHandler handler)
This method handles the event when the user selects a control in repeat Events are used to set the repeatcursor to whatever the user has selected


findRepeatedId

public org.w3c.dom.Element findRepeatedId(org.w3c.dom.Element elem,
                                          java.lang.String id)
Find the active instance of the given id as determined by enclosing repeat's indexes. This is called outside this class

Parameters:
elem - the element to search for
id - the elemnt's id
Returns:
the appropriate instance; if there are no enclosing repeat's then this is just elem


X-Smiles 1.2