org.efaps.ui.wicket.models.objects
Class UIStructurBrowser

java.lang.Object
  extended by org.efaps.ui.wicket.models.AbstractInstanceObject
      extended by org.efaps.ui.wicket.models.objects.AbstractUIObject
          extended by org.efaps.ui.wicket.models.objects.UIAbstractPageObject
              extended by org.efaps.ui.wicket.models.objects.UIStructurBrowser
All Implemented Interfaces:
java.io.Serializable, org.apache.wicket.IClusterable

public class UIStructurBrowser
extends UIAbstractPageObject

This class is used to provide the Model for the StructurBrowser for eFpas.
It is used in tow different cases. In one case it is a TreeTable, where the Table will be provided with additional information in columns. In the other case a Tree only.
The concept of this class is to provide a Model which connects through the eFaps-kernel to the eFaps-DataBase and turn it to a Standard TreeModel from javax.swing.tree. which will be used from the Component to render the Tree and the Table. This leads to a very similar behavior of the WebApp GUI to a swing GUI.
This model works asyncron. That means only the actually in the GUI rendered Nodes (and Columns) will be retrieved from the eFaps-DataBase. The next level in a tree will be retrieved on the expand of a TreeNode. To achieve this and to be able to render expand-links for every node it will only be checked if it is a potential parent (if it has children). In the case of expanding this Node the children will be retrieved and rendered.
To access the eFaps-Database a esjp is used, which will be used in three different cases. To distinguish the use of the esjp some extra Parameters will be passed to the esjp when calling it.

Version:
$Id: UIStructurBrowser.java 4678 2010-06-05 17:01:51Z jan.moxter $
Author:
The eFaps Team
See Also:
Serialized Form

Nested Class Summary
 class UIStructurBrowser.BogusNode
          This class is used to add a ChildNode under a ParentNode, if the ParentNode actually has some children.
static class UIStructurBrowser.ExecutionStatus
          Enum is used to set for this UIStructurBrowser which status of execution it is in.
 
Constructor Summary
UIStructurBrowser(org.apache.wicket.PageParameters _parameters)
          Constructor.
UIStructurBrowser(java.util.UUID _commandUUID, java.lang.String _instanceKey)
          Standard constructor, if called this StructurBrowserModel will be defined as root.
 
Method Summary
 void addBogusNode(javax.swing.tree.DefaultMutableTreeNode _parent)
          Method to add a new BogusNode to the given Node.
 void addChildren(javax.swing.tree.DefaultMutableTreeNode _parent)
          This method should be called to add children to a Node in the Tree.
e.g.
 void execute()
          This method should be called to actually execute this StructurBrowserModel, that means to retrieve the values from the eFaps-DataBase, create the TreeModel etc.
 java.lang.String getBrowserFieldName()
          This is the getter method for the instance variable browserFieldName.
 java.util.List<UIStructurBrowser> getChilds()
          Getter method for instance variable childs.
 java.lang.String getColumnValue(int _index)
          Get the Value of a Column identified by the index of the Column.
 java.lang.Boolean getDirection()
          This is the getter method for the instance variable direction.
 UIStructurBrowser.ExecutionStatus getExecutionStatus()
          Getter method for instance variable executionStatus.
 java.util.List<UITableHeader> getHeaders()
          This is the getter method for the instance variable headers.
 java.lang.String getImage()
          This is the getter method for the instance variable image.
 java.lang.String getLabel()
          Getter method for instance variable label.
 org.efaps.admin.ui.AbstractCommand.SortDirection getSortDirection()
          Getter method for instance variable sortDirection.
 org.efaps.admin.ui.Table getTable()
          This is the getter method for the instance variable #table.
 javax.swing.tree.TreeModel getTreeModel()
          Get the TreeModel used in the Component to construct the actual tree.
 boolean hasChilds()
          Has this StructurBrowserModel childs.
 boolean isExpanded()
          Getter method for instance variable expanded.
 void requeryLabel()
          This method is updating the Label, by querying the eFaps-DataBase.
 void resetModel()
          Method to reset the Model.
 void setDirection(java.lang.Boolean _direction)
          This is the setter method for the instance variable direction.
 void setExpanded(boolean _expanded)
          Setter method for instance variable expanded.
 void setParent(boolean _parent)
          This is the setter method for the instance variable parent.
 void setSortDirection(org.efaps.admin.ui.AbstractCommand.SortDirection _sortDirection)
          Setter method for instance variable sortDirection and for all children also.
 void sort()
          Method to sort this model and all child models.
 java.lang.String toString()
          (non-Javadoc).
 
Methods inherited from class org.efaps.ui.wicket.models.objects.UIAbstractPageObject
addHidden, getHelpTarget, getHiddenCells, getNewRandom, getTargetCmd, getTargetCmdUUID, getUiID2Oid, getValue4Wizard, getWizard, hasTargetCmd, isPartOfWizardCall, isRenderRevise, isTargetCmdRevise, isTargetShowFile, setPartOfWizardCall, setRenderRevise, setTargetCmdRevise, setTargetCmdUUID, setWizard
 
Methods inherited from class org.efaps.ui.wicket.models.objects.AbstractUIObject
executeEvents, getCallingCommand, getCallingCommandUUID, getCommand, getCommand, getCommandUUID, getInstanceFromManager, getMenuTreeKey, getMode, getOpenerId, getTarget, getTitle, hasInstanceManager, isCreateMode, isEditMode, isInitialized, isPrintMode, isSearchMode, isSubmit, isViewMode, setCallingCommandUUID, setCommandUUID, setInitialized, setMode, setOpenerId, setSubmit, validate
 
Methods inherited from class org.efaps.ui.wicket.models.AbstractInstanceObject
getInstance, getInstanceKey, setInstanceKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UIStructurBrowser

public UIStructurBrowser(org.apache.wicket.PageParameters _parameters)
                  throws org.efaps.util.EFapsException
Constructor.

Parameters:
_parameters - Page parameters
Throws:
org.efaps.util.EFapsException - on error

UIStructurBrowser

public UIStructurBrowser(java.util.UUID _commandUUID,
                         java.lang.String _instanceKey)
                  throws org.efaps.util.EFapsException
Standard constructor, if called this StructurBrowserModel will be defined as root.

Parameters:
_commandUUID - UUID of the calling command
_instanceKey - oid
Throws:
org.efaps.util.EFapsException - on error
Method Detail

execute

public void execute()
This method should be called to actually execute this StructurBrowserModel, that means to retrieve the values from the eFaps-DataBase, create the TreeModel etc. This method actually calls depending if we have a Tree or a TreeTabel the Methodes #executeTree(List) or #executeTreeTable(List)

Specified by:
execute in class AbstractUIObject
See Also:
#executeTree(List), #executeTreeTable(List)

sort

public void sort()
Method to sort this model and all child models.


setParent

public void setParent(boolean _parent)
This is the setter method for the instance variable parent.

Parameters:
_parent - the parent to set

resetModel

public void resetModel()
Method to reset the Model.

Specified by:
resetModel in class AbstractUIObject
See Also:
org.efaps.ui.wicket.models.AbstractModel#resetModel()

getTable

public org.efaps.admin.ui.Table getTable()
This is the getter method for the instance variable #table.

Returns:
value of instance variable #table
See Also:
#table

hasChilds

public boolean hasChilds()
Has this StructurBrowserModel childs.

Returns:
true if has children, else false

getTreeModel

public javax.swing.tree.TreeModel getTreeModel()
Get the TreeModel used in the Component to construct the actual tree.

Returns:
TreeModel of this StructurBrowseModel
See Also:
addNode(DefaultMutableTreeNode, List)

addChildren

public void addChildren(javax.swing.tree.DefaultMutableTreeNode _parent)
This method should be called to add children to a Node in the Tree.
e.g. in a standard implementation the children would be added to the Tree on the expand-Event of the tree. The children a retrieved from an esjp with the EventType UI_TABLE_EVALUATE.

Parameters:
_parent - the DefaultMutableTreeNode the new children should be added

getColumnValue

public java.lang.String getColumnValue(int _index)
Get the Value of a Column identified by the index of the Column.

Parameters:
_index - index of the Column
Returns:
String with the Value of the Column

getBrowserFieldName

public java.lang.String getBrowserFieldName()
This is the getter method for the instance variable browserFieldName.

Returns:
value of instance variable browserFieldName

getHeaders

public java.util.List<UITableHeader> getHeaders()
This is the getter method for the instance variable headers.

Returns:
value of instance variable headers

getImage

public java.lang.String getImage()
This is the getter method for the instance variable image.

Returns:
value of instance variable image

getDirection

public java.lang.Boolean getDirection()
This is the getter method for the instance variable direction.

Returns:
value of instance variable direction

setDirection

public void setDirection(java.lang.Boolean _direction)
This is the setter method for the instance variable direction.

Parameters:
_direction - the direction to set

getExecutionStatus

public UIStructurBrowser.ExecutionStatus getExecutionStatus()
Getter method for instance variable executionStatus.

Returns:
value of instance variable executionStatus

requeryLabel

public void requeryLabel()
This method is updating the Label, by querying the eFaps-DataBase.


addBogusNode

public void addBogusNode(javax.swing.tree.DefaultMutableTreeNode _parent)
Method to add a new BogusNode to the given Node.

Parameters:
_parent - Parent a BogusNode should be added

getChilds

public java.util.List<UIStructurBrowser> getChilds()
Getter method for instance variable childs.

Returns:
value of instance variable childs

getLabel

public java.lang.String getLabel()
Getter method for instance variable label.

Returns:
value of instance variable label

getSortDirection

public org.efaps.admin.ui.AbstractCommand.SortDirection getSortDirection()
Getter method for instance variable sortDirection.

Returns:
value of instance variable sortDirection

setSortDirection

public void setSortDirection(org.efaps.admin.ui.AbstractCommand.SortDirection _sortDirection)
Setter method for instance variable sortDirection and for all children also.

Parameters:
_sortDirection - value for instance variable sortDirection

isExpanded

public boolean isExpanded()
Getter method for instance variable expanded.

Returns:
value of instance variable expanded

setExpanded

public void setExpanded(boolean _expanded)
Setter method for instance variable expanded.

Parameters:
_expanded - value for instance variable expanded

toString

public java.lang.String toString()
(non-Javadoc).

Overrides:
toString in class java.lang.Object
Returns:
label
See Also:
Model.toString()


Copyright © 2003-2010 The eFaps Team. All Rights Reserved.