com.sap.tc.mobile.wdlite.progmodel.api
Interface IWDNode

All Known Implementing Classes:
ContextNode, ContextNodeForCMIModel, ContextNodeForCMIModelRelation, ContextNodeMapped

public interface IWDNode

Generic API of all Web Dynpro Lite context nodes.

Create and add NodeElement example
   
        public final class SomeController extends Controller {
                ...
                public void wdInit()
                {
                        IWDNodeElement nodeElement = wdContext.createElement();
                        wdContext.addElement(nodeElement);
                }
                ...
        } 
        
Get and remove current nodeElement example
   
        public final class SomeController extends Controller {
                ...
                public void wdInit()
                {
                        IWDNodeElement nodeElement = wdContext.getCurrentElement();
                        wdContext.removeCurrentElement();                       
                }
                ...
        } 
        

Author:
I032295

Method Summary
 void addElement(int index, IWDNodeElement element)
          Adds an element to the node collection at the given index.
 void addElement(IWDNodeElement element)
          Adds an element to the node collection.
 void bind(java.util.Collection items)
          NOTE: To invoke from supplyFunction ONLY.
 void clearSelection()
          TODO misspelling - should be clearLeadSelection()
 void clearSelections()
          Clears the node's multiple selection; does not change the lead selection.
 IWDNodeElement createElement()
          Creates a new node element of the type used for this value node.
 IWDNodeElement createElement(java.lang.Object model)
          Creates a new node element of the type used for this model node.
 IWDNode getChildNode(java.lang.String nodeName)
          Returns the current element (at the lead selection) or null if no element is selected.
 Context getContext()
          Returns the context this node belongs to.
 IWDNodeElement getCurrentElement()
          Returns the current element (at the lead selection) or null if no element is selected.
 IWDNodeElement getElementAt(int pos)
          Deprecated. Use getElementsIterator() to traverse through elements.
 java.util.Iterator getElementIterator()
          Gets iterator for node elements.
 void invalidate()
          Deprecated. not used more. Use reload() instead of.
 boolean isEmpty()
           
 boolean isMultiSelected(int index)
          Returns whether the element at the given index is selected.
 void reload()
          Reloads contents with notify all listener about Node content changed.
 void removeCurrentElement()
          Removes an element from the node collection.
 void removeElement(IWDNodeElement element)
           
 void setLeadSelection(int index)
          Sets the lead selection to the given index.
 void setSelected(int index, boolean selected)
          Selects or unselects the element at the given index.
 int size()
           
 

Method Detail

addElement

void addElement(int index,
                IWDNodeElement element)
Adds an element to the node collection at the given index. If an ICMIObservableList is bound to the node, this list is modified.

Parameters:
index - The index where the element shall be inserted.
element - An element that matches the node.
Throws:
ContextException - if the element does not match the node or if the node is singleton and the parent node has no valid lead selection element. TODO: Not yet

addElement

void addElement(IWDNodeElement element)
Adds an element to the node collection. If an ICMIObservableList is bound to the node, this list is modified.

Parameters:
element - An element that matches the node.
Throws:
ContextException - if the element does not match the node or if the node is singleton and the parent node has no valid lead selection element. TODO: Not yet

bind

void bind(java.util.Collection items)
NOTE: To invoke from supplyFunction ONLY. With this method you can bind a new Collection to the node. It is allowed to bind null; in which case the node is valid containing an empty list. This collection may contain elements for the node, (in case of mapping) elements of any origin node of the node, or (for a model node) instances of the model class. The node internally creates a List of NodeElements, either being the ones supplied or wrappers thereof. The collection itself is thrown away. The order of the elements in the List is the order of the Collection 'sIterator. The Collection must obey the cardinalities of the node. It is not allowed to bind an empty collection to a node of cardinality 1..1 or 1..n, and it is not allowed to bind more than one item to a node of cardinality 0..1 or 1..1. If the Collection is an ICMIObservableList, the node behaves differently. In that case, the list is passed to the origin node (in case of mapped nodes). This node does not copy the elements and throw the list away, but uses the list itself to store the elements. An ICMIObservableList is not accessed at all during bind, if cardinality is 0..n and the selection cardinality is 0..1 or 0..n. Otherwise, isEmpty() or even size() (cardinality 0..1 or 1..1) is called. TODO: Not yet Take care: If a node has an ICMIObservableList attached, modifications to the node ( addElement(IWDNodeElement), removeElement(IWDNodeElement)) change the list and vice versa! Warning: Never use bind if the node has a supplying relation role. You effectively get the node and the underlying model out of sync. It is a bad practice to use bind outside the supply function, if there is one, too. Future releases will probably throw an exception in such cases, but old application will still be allowed to for compatibility reasons.

Parameters:
items - The collection of items, which should be bound to this node
Throws:
ContextException - if any of the items do not match the node and/or the node is singleton and the parent node is empty or does not have a valid lead selection.

clearSelections

void clearSelections()
Clears the node's multiple selection; does not change the lead selection.


clearSelection

void clearSelection()
TODO misspelling - should be clearLeadSelection()


invalidate

void invalidate()
Deprecated. not used more. Use reload() instead of.


reload

void reload()
Reloads contents with notify all listener about Node content changed.


createElement

IWDNodeElement createElement()
Creates a new node element of the type used for this value node. The element is not yet inserted in the node collection, its IWDNodeElement.node() method will return null. It can be added only to this node, either via bind or via addElement.

Returns:
The created node element as IWDNodeElement.

createElement

IWDNodeElement createElement(java.lang.Object model)
Creates a new node element of the type used for this model node. The element is not yet inserted in the node collection, its IWDNodeElement.node() method will return null. It can be added only to this node, either via bind or via addElement.

Parameters:
model - The model class object for new node to be created
Returns:
The created node element as IWDNodeElement.

getContext

Context getContext()
Returns the context this node belongs to.

Returns:
The context this node belongs to as IWDContext.

getChildNode

IWDNode getChildNode(java.lang.String nodeName)
Returns the current element (at the lead selection) or null if no element is selected.

Returns:
The current element (at the lead selection) as IWDNodeElement or null if no element is selected.

getCurrentElement

IWDNodeElement getCurrentElement()
Returns the current element (at the lead selection) or null if no element is selected.

Returns:
The current element (at the lead selection) as IWDNodeElement or null if no element is selected.

getElementAt

IWDNodeElement getElementAt(int pos)
Deprecated. Use getElementsIterator() to traverse through elements.

Parameters:
pos -
Returns:

getElementIterator

java.util.Iterator getElementIterator()
Gets iterator for node elements.

Returns:
iterator

isMultiSelected

boolean isMultiSelected(int index)
Returns whether the element at the given index is selected. Does not look at the lead selection.

Parameters:
index - The index of the element.
Returns:
true if the element is selected.

removeCurrentElement

void removeCurrentElement()
Removes an element from the node collection. If an ICMIObservableList is bound to the node, this list is modified!


setLeadSelection

void setLeadSelection(int index)
Sets the lead selection to the given index. It may be called with NO_SELECTION to reset (clear) the lead selection. TODO: Not yet for NO_SELECTION

Parameters:
index - The index of the element.
Throws:
ContextException - TODO: Not yet if caller tries to reset the selection, but selection is mandatory.
java.lang.IndexOutOfBoundsException - if the given index is not within the element list.

setSelected

void setSelected(int index,
                 boolean selected)
Selects or unselects the element at the given index.

Parameters:
index - The index of the element.
selected - The flag, which indicates, whether the element should be selected or unselected.

removeElement

void removeElement(IWDNodeElement element)

size

int size()

isEmpty

boolean isEmpty()


(c) 2007, SAP AG. All rights reserved.