Ontimize 5.2072EN

com.ontimize.gui.tree
Class OTreeNode

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended bycom.ontimize.gui.tree.OTreeNode
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, Internationalization, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode
Direct Known Subclasses:
PageFetchTreeNode

public class OTreeNode
extends javax.swing.tree.DefaultMutableTreeNode
implements java.lang.Comparable, Internationalization

Main class that represents a tree node. It implements Comparable to allow order the nodes. These ones could be organizational or data nodes. Organizational nodes creates the tree structure and data nodes are correspondent with database records.

XML parameters in constructor OTreeNode(Hashtable)

Since:
5.2000 Default implementation, 5.2060EN Pageable tree.
Author:
Imatia Innovation SL
See Also:
Serialized Form

Field Summary
protected  boolean ascending
           
protected  java.lang.String associateDataFieldString
           
protected  java.util.Hashtable associatedDataField
           
protected  java.util.Vector associatedOrderedDataField
          List that contains associatedFields(parentKeys) ordered.
static java.lang.String ATTR
           
protected  java.util.Hashtable attributeEquivalences
           
protected  java.lang.String attrString
           
protected  java.lang.String cachedText
           
static java.lang.String CAN_DELETE
           
protected  boolean canDelete
           
static java.lang.String CLASSIFY_NODE
           
protected  boolean classifyNode
           
protected static java.text.Collator comparator
           
protected static java.util.Locale componentLocale
           
protected  int count
           
static boolean defaultPageableEnabled
           
protected static java.text.SimpleDateFormat df
           
protected static java.text.SimpleDateFormat dfH
           
protected  boolean dynamic
           
static java.lang.String DYNAMIC
           
static java.lang.String DYNAMIC_FORM
           
static java.lang.String DYNAMICFORM
           
protected  java.lang.String dynamicFormClass
           
protected  DynamicFormManager dynamicFormManager
           
protected  boolean emptyNode
           
static java.lang.String ENTITY
           
protected  java.lang.String entityName
           
static java.lang.String FIX_ATTR
           
protected  java.util.Vector fixAtributtes
           
static java.lang.String FORM
           
protected  java.util.Vector hiddenAttributes
           
static java.lang.String HIDE_ATTR
           
static java.lang.String ICON_NO_ORG
           
static java.lang.String ICON_ORG
           
protected  javax.swing.ImageIcon iconnoorg
           
protected  java.lang.String iconnoorgStr
           
protected  javax.swing.ImageIcon iconorg
           
protected  java.lang.String iconorgStr
           
protected  java.lang.String id
           
static java.lang.String ID
           
protected  java.util.Vector keyList
           
static java.lang.String KEYS
           
static java.lang.String KEYS_VALUES
           
protected  java.lang.String keysString
           
protected  java.util.Hashtable keysValues
           
protected  boolean leaf
           
protected  java.lang.String orderByAttribute
           
protected  boolean orderToAdd
           
static java.lang.String ORG
           
protected  boolean organization
           
protected  boolean overrideLeaf
           
static java.lang.String PAGEABLE_ICON
           
protected  boolean pageableEnabled
           
protected  javax.swing.ImageIcon pageableIcon
           
protected  java.util.Hashtable parameters
           
static java.lang.String PARENT_KEYS
           
static java.lang.String QUERY_ROWS
           
protected  java.util.Hashtable queryResult
           
protected  boolean remark
           
protected  java.util.List renderTime
           
protected  java.util.ResourceBundle resourceArchive
           
protected  int rowsNumberToQuery
           
protected  java.lang.String separator
           
static java.lang.String SEPARATOR
           
protected  java.lang.String shownAttribute
           
protected  java.util.Vector shownAttributeList
           
protected  java.lang.String shownForm
           
static java.lang.String SORTATTR
           
protected  java.lang.String stringFixAttr
           
protected  java.lang.String stringHideAttr
           
protected  java.lang.Object text
           
static java.lang.String TEXT
           
static java.lang.String THERE_ARENT_RESULTS_KEY
           
static java.lang.String THERE_ARENT_RESULTS_KEY_es_ES
           
protected  int totalCount
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Fields inherited from interface com.ontimize.gui.i18n.Internationalization
DEBUG_LANGUAGE
 
Constructor Summary
OTreeNode(java.util.Hashtable parameters)
          This method uses the Hashtable and creates the tree node.
 
Method Summary
 void add(javax.swing.tree.MutableTreeNode node)
          Overrides the method add to insert a node in a sorted tree.
 boolean canDelete()
           
 java.lang.Object clone()
           
 OTreeNode cloneNodeAndChildren()
          Get a copy of the node and all the children
protected  OTreeNode cloneThisAndChildren()
           
 int compareTo(java.lang.Object object)
           
 void disableNodeSorting()
          Allows to disable sorting in nodes.
 void enableNodeSorting()
          Enables sorting in node.
protected  void finalize()
           
 boolean getAscending()
           
 java.util.Hashtable getAssociatedDataField()
           
 java.util.Vector getAssociatedOrderedDataField()
           
 java.lang.String getAttr()
           
 java.lang.String[] getAttributes()
           
 java.util.Vector getChildren()
          Method to obtain children of a node.
 int getCount()
           
 DynamicFormManager getDynamicFormManager()
           
 java.lang.String getDynamicFormManagerClass()
           
 java.lang.String getEntityName()
           
 java.lang.String getFixAttr()
           
 java.util.Vector getFixAttributes()
           
 java.lang.String getForm()
           
 java.lang.String getHideAttr()
           
 javax.swing.ImageIcon getIcon()
          Returns the icon to use with this node.
 java.lang.String getIconNoOrg()
           
 java.lang.String getIconOrg()
           
 java.lang.String getId()
           
 java.util.Vector getKeys()
           
 java.lang.String getKeysString()
           
 java.util.Hashtable getKeysValues()
          Returns a Hashtable where keys are attributes specified in keysValues, and values are their correspondent values.
 java.util.Hashtable getNodeData()
          Returns node keyvalues.
 java.lang.String getOrderByAttribute()
           
 javax.swing.ImageIcon getPageableIcon()
           
 java.util.Hashtable getParameters()
           
 java.lang.String getParentKeyNameInParentNode(java.lang.String parentKey)
           
 java.util.Vector getParentKeys()
           
 java.util.Hashtable getQueryResult()
           
 boolean getRemark()
           
 int getRowsNumberToQuery()
           
 java.lang.String getSeparator()
           
 java.util.Vector getShownAttributeList()
           
 java.lang.String getSortAttr()
           
 java.lang.String getStringAssociatedDataField()
           
 java.lang.String getText()
           
 java.util.Vector getTextsToTranslate()
          Returns all the texts in the element suitable for being translated.
 int getTotalCount()
           
 java.lang.Object getUserObject()
           
 java.lang.Object getValueForAttribute(java.lang.Object attribute)
           
 java.util.Vector getVisibleAttributes()
           
 boolean isClassifyNode()
           
 boolean isDynamic()
           
 boolean isEmptyNode()
           
 boolean isLeaf()
           
 boolean isOrganizational()
           
 boolean isPageableEnabled()
           
 void setAssociatedDataField(java.util.Hashtable associatedFields)
           
 void setAssociatedOrderedDataField(java.util.Vector associatedOrderedDataField)
           
 void setAttribute(java.lang.String attribute, java.lang.Object value)
           
 void setAttributes(java.util.Vector attributes)
           
 void setAttributeText(java.lang.String attr, java.lang.String equivalence)
           
 void setClassifyNode(boolean classify)
           
 void setComponentLocale(java.util.Locale l)
           
 void setCount(int c)
           
 void setDynamic(boolean d)
           
 void setDynamicFormManager(DynamicFormManager dfm)
           
 void setEmptyNode(boolean emptyNode)
           
 void setEntityName(java.lang.String entityName)
           
 void setForm(java.lang.String form)
           
 void setKeys(java.util.Vector keys)
           
 void setKeysValues(java.util.Hashtable keysValues)
          Establishes key values and attributes for this node, that is 'attr' and 'keys' specified in xml definition.
 void setKeysValues(java.lang.Object key, java.lang.Object value)
           
 void setOrganizational(boolean o)
           
 void setOverrideLeaf(boolean override, boolean leaf)
           
 void setPageableIcon(javax.swing.ImageIcon pageableIcon)
           
 void setQueryResult(java.util.Hashtable result)
           
 void setRemark(boolean remark)
          Indicates when node must show a special icon, for example, when its data have changed and tree has not been updated yet.
 void setResourceBundle(java.util.ResourceBundle resources)
          Sets the language resource bundle.
 void setSeparator(java.lang.String separator)
           
 void setSortAttr(java.lang.String sortAttr)
           
 void setSortOrder(boolean ascendingSort)
           
 void setText(java.lang.String textToShow)
           
 void setToString(java.lang.String s)
           
 void setTotalCount(int totalRecordCount)
           
 void setUserObject(java.lang.Object value)
           
 void sortNow()
          Sorts child nodes with order: ascending or descending.
 java.lang.String toString()
           
protected  void updateNodeTextCache()
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
breadthFirstEnumeration, children, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

THERE_ARENT_RESULTS_KEY

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

THERE_ARENT_RESULTS_KEY_es_ES

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

ENTITY

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

KEYS

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

KEYS_VALUES

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

ATTR

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

TEXT

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

FORM

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

ORG

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

PARENT_KEYS

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

ICON_ORG

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

ICON_NO_ORG

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

PAGEABLE_ICON

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

ID

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

SEPARATOR

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

SORTATTR

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

FIX_ATTR

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

HIDE_ATTR

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

CAN_DELETE

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

DYNAMIC_FORM

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

DYNAMICFORM

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

DYNAMIC

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

CLASSIFY_NODE

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

QUERY_ROWS

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

defaultPageableEnabled

public static boolean defaultPageableEnabled

shownForm

protected java.lang.String shownForm

entityName

protected java.lang.String entityName

shownAttribute

protected java.lang.String shownAttribute

text

protected java.lang.Object text

organization

protected boolean organization

keyList

protected java.util.Vector keyList

keysString

protected java.lang.String keysString

keysValues

protected java.util.Hashtable keysValues

associatedDataField

protected java.util.Hashtable associatedDataField

associatedOrderedDataField

protected java.util.Vector associatedOrderedDataField
List that contains associatedFields(parentKeys) ordered.


associateDataFieldString

protected java.lang.String associateDataFieldString

stringFixAttr

protected java.lang.String stringFixAttr

stringHideAttr

protected java.lang.String stringHideAttr

hiddenAttributes

protected java.util.Vector hiddenAttributes

canDelete

protected boolean canDelete

cachedText

protected java.lang.String cachedText

classifyNode

protected boolean classifyNode

dynamic

protected boolean dynamic

attributeEquivalences

protected java.util.Hashtable attributeEquivalences

queryResult

protected java.util.Hashtable queryResult

separator

protected java.lang.String separator

ascending

protected boolean ascending

shownAttributeList

protected java.util.Vector shownAttributeList

attrString

protected java.lang.String attrString

orderToAdd

protected boolean orderToAdd

iconorg

protected javax.swing.ImageIcon iconorg

iconnoorg

protected javax.swing.ImageIcon iconnoorg

pageableIcon

protected javax.swing.ImageIcon pageableIcon

iconorgStr

protected java.lang.String iconorgStr

iconnoorgStr

protected java.lang.String iconnoorgStr

emptyNode

protected boolean emptyNode

remark

protected boolean remark

pageableEnabled

protected boolean pageableEnabled

id

protected java.lang.String id

orderByAttribute

protected java.lang.String orderByAttribute

fixAtributtes

protected java.util.Vector fixAtributtes

dynamicFormClass

protected java.lang.String dynamicFormClass

dynamicFormManager

protected DynamicFormManager dynamicFormManager

resourceArchive

protected java.util.ResourceBundle resourceArchive

leaf

protected boolean leaf

overrideLeaf

protected boolean overrideLeaf

comparator

protected static java.text.Collator comparator

componentLocale

protected static java.util.Locale componentLocale

renderTime

protected java.util.List renderTime

rowsNumberToQuery

protected int rowsNumberToQuery

df

protected static java.text.SimpleDateFormat df

dfH

protected static java.text.SimpleDateFormat dfH

totalCount

protected int totalCount

parameters

protected java.util.Hashtable parameters

count

protected int count
Constructor Detail

OTreeNode

public OTreeNode(java.util.Hashtable parameters)
This method uses the Hashtable and creates the tree node.

Parameters:
parameters - the Hashtable with parameters

attribute values default required meaning
attr attr1;...;attrn yes Indicates the field attribute. This fields will be displayed in node text.
entity yes Entity where tree data are obtained.
keys yes Primary keys of entity.
text no Text to show in organizational nodes.
form no Form to show when node is clicked.
parentkeys parentk1;associparentk1;...;parentkn;associparentkn no Parent key and associated key for node. If parent key name and current-node key are the same name, this field will be filled with pairs of fields with the same name.
iconorg no Icon for organizational nodes.
iconnoorg no Icon for non-organizational nodes.
id no Identifier for an organizational node and its children placed in the inmediatly level.
separator no Separator character for attributes.
sortattr The first attribute indicated in attr no Attribute to sort the tree.
fixattr fixattr1;fixattr2;...;fixattrn no List of attributes that will be fixed by tree node in associated form.
hideattr hideattr1;hideattr2;...;hideattrn no Attributes that will be queried, but not showed in node.
candelete true/false false no Indicates if a node can be deleted.
dynamicform no Name of class to show dynamic forms.
rendertime render1;render2;...;rendern no Attribute to be renderized like a hour field.
classifynode no
queryrows positive values no For making pageable tree. Number of records that will be downloaded for each page. (since 5.2060EN)
Method Detail

getRowsNumberToQuery

public int getRowsNumberToQuery()

compareTo

public int compareTo(java.lang.Object object)
Specified by:
compareTo in interface java.lang.Comparable

setAttributes

public void setAttributes(java.util.Vector attributes)

setEntityName

public void setEntityName(java.lang.String entityName)

setForm

public void setForm(java.lang.String form)

setSeparator

public void setSeparator(java.lang.String separator)

clone

public java.lang.Object clone()

toString

public java.lang.String toString()

getForm

public java.lang.String getForm()

setToString

public void setToString(java.lang.String s)

getEntityName

public java.lang.String getEntityName()

getKeys

public java.util.Vector getKeys()

getParentKeys

public java.util.Vector getParentKeys()

setKeysValues

public void setKeysValues(java.lang.Object key,
                          java.lang.Object value)

getKeysValues

public java.util.Hashtable getKeysValues()
Returns a Hashtable where keys are attributes specified in keysValues, and values are their correspondent values.

Returns:
the Hashtable

getNodeData

public java.util.Hashtable getNodeData()
Returns node keyvalues.

Returns:
a Hashtable with keyvalues

getSortAttr

public java.lang.String getSortAttr()

getAttributes

public java.lang.String[] getAttributes()

setAttribute

public void setAttribute(java.lang.String attribute,
                         java.lang.Object value)

isOrganizational

public boolean isOrganizational()

cloneNodeAndChildren

public OTreeNode cloneNodeAndChildren()
Get a copy of the node and all the children


cloneThisAndChildren

protected OTreeNode cloneThisAndChildren()

setOverrideLeaf

public void setOverrideLeaf(boolean override,
                            boolean leaf)

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface javax.swing.tree.TreeNode

getChildren

public java.util.Vector getChildren()
Method to obtain children of a node.

Returns:
a Vector with children

add

public void add(javax.swing.tree.MutableTreeNode node)
Overrides the method add to insert a node in a sorted tree.


getAssociatedDataField

public java.util.Hashtable getAssociatedDataField()

setAssociatedDataField

public void setAssociatedDataField(java.util.Hashtable associatedFields)

getAssociatedOrderedDataField

public java.util.Vector getAssociatedOrderedDataField()

setAssociatedOrderedDataField

public void setAssociatedOrderedDataField(java.util.Vector associatedOrderedDataField)

getParentKeyNameInParentNode

public java.lang.String getParentKeyNameInParentNode(java.lang.String parentKey)

setKeys

public void setKeys(java.util.Vector keys)

getValueForAttribute

public java.lang.Object getValueForAttribute(java.lang.Object attribute)

getKeysString

public java.lang.String getKeysString()

getStringAssociatedDataField

public java.lang.String getStringAssociatedDataField()

getAttr

public java.lang.String getAttr()

setText

public void setText(java.lang.String textToShow)

setKeysValues

public void setKeysValues(java.util.Hashtable keysValues)
Establishes key values and attributes for this node, that is 'attr' and 'keys' specified in xml definition.

Parameters:
keysValues -

setQueryResult

public void setQueryResult(java.util.Hashtable result)

getQueryResult

public java.util.Hashtable getQueryResult()

setResourceBundle

public void setResourceBundle(java.util.ResourceBundle resources)
Description copied from interface: Internationalization
Sets the language resource bundle. When the application changes the configured language, for all the objects that implement this interface this method must be called with the new file.
The method must translate all the elements that have texts in the GUI

Specified by:
setResourceBundle in interface Internationalization
Parameters:
resources - the new language bundle.

disableNodeSorting

public void disableNodeSorting()
Allows to disable sorting in nodes.


enableNodeSorting

public void enableNodeSorting()
Enables sorting in node.


setSortAttr

public void setSortAttr(java.lang.String sortAttr)

sortNow

public void sortNow()
Sorts child nodes with order: ascending or descending.


getAscending

public boolean getAscending()

setComponentLocale

public void setComponentLocale(java.util.Locale l)
Specified by:
setComponentLocale in interface Internationalization

setSortOrder

public void setSortOrder(boolean ascendingSort)

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

getIcon

public javax.swing.ImageIcon getIcon()
Returns the icon to use with this node. In other case returns null. It is used by class TreeCellRenderer.

Returns:
the image icon

getIconOrg

public java.lang.String getIconOrg()

getIconNoOrg

public java.lang.String getIconNoOrg()

setUserObject

public void setUserObject(java.lang.Object value)
Specified by:
setUserObject in interface javax.swing.tree.MutableTreeNode

getUserObject

public java.lang.Object getUserObject()

setAttributeText

public void setAttributeText(java.lang.String attr,
                             java.lang.String equivalence)

getId

public java.lang.String getId()

setEmptyNode

public void setEmptyNode(boolean emptyNode)

isEmptyNode

public boolean isEmptyNode()

getSeparator

public java.lang.String getSeparator()

getOrderByAttribute

public java.lang.String getOrderByAttribute()

getText

public java.lang.String getText()

setRemark

public void setRemark(boolean remark)
Indicates when node must show a special icon, for example, when its data have changed and tree has not been updated yet.

Parameters:
remark - the condition of remark

getRemark

public boolean getRemark()

canDelete

public boolean canDelete()

getFixAttributes

public java.util.Vector getFixAttributes()

getFixAttr

public java.lang.String getFixAttr()

getHideAttr

public java.lang.String getHideAttr()

setOrganizational

public void setOrganizational(boolean o)

updateNodeTextCache

protected void updateNodeTextCache()

getDynamicFormManagerClass

public java.lang.String getDynamicFormManagerClass()

getDynamicFormManager

public DynamicFormManager getDynamicFormManager()

setDynamicFormManager

public void setDynamicFormManager(DynamicFormManager dfm)

getTextsToTranslate

public java.util.Vector getTextsToTranslate()
Description copied from interface: Internationalization
Returns all the texts in the element suitable for being translated.

Specified by:
getTextsToTranslate in interface Internationalization
Returns:
all the texts in the element suitable for being translated.

getShownAttributeList

public java.util.Vector getShownAttributeList()

getVisibleAttributes

public java.util.Vector getVisibleAttributes()

isClassifyNode

public boolean isClassifyNode()

setClassifyNode

public void setClassifyNode(boolean classify)

isDynamic

public boolean isDynamic()

setDynamic

public void setDynamic(boolean d)

setCount

public void setCount(int c)

getCount

public int getCount()

isPageableEnabled

public boolean isPageableEnabled()

getParameters

public java.util.Hashtable getParameters()

setTotalCount

public void setTotalCount(int totalRecordCount)

getTotalCount

public int getTotalCount()

getPageableIcon

public javax.swing.ImageIcon getPageableIcon()

setPageableIcon

public void setPageableIcon(javax.swing.ImageIcon pageableIcon)

Ontimize