Business Components

oracle.jbo.uicli.jui
Class JUTreeBinding

java.lang.Object
  |
  +--oracle.jbo.uicli.binding.JUControlBinding
        |
        +--oracle.jbo.uicli.binding.JUCtrlValueBinding
              |
              +--oracle.jbo.uicli.binding.JUCtrlRangeBinding
                    |
                    +--oracle.jbo.uicli.binding.JUCtrlHierBinding
                          |
                          +--oracle.jbo.uicli.jui.JUTreeBinding
All Implemented Interfaces:
AttributeList, java.util.EventListener, javax.swing.event.TreeExpansionListener, javax.swing.tree.TreeModel, javax.swing.event.TreeSelectionListener

public class JUTreeBinding
extends JUCtrlHierBinding
implements javax.swing.event.TreeExpansionListener, javax.swing.event.TreeSelectionListener, javax.swing.tree.TreeModel

A lightweight Document model that implements binding a javax.swing.JTree to a BC4J RowIterator and display a selected attribute. Each tree node may display a set of child nodes bound to another Iterator that's retrieved via an accessor on the rows of the first iterator.

This binding allows Trees that can have two types of nodes:

  • JUTreeAccessorTypeBinding - that display a selected attribute for all rows of a ViewObject/Iterator and on expansion, expand the same accessor for all rows.
  • JUTreeDiscrAttrTypeBinding - that allow displaying different attributes for each row of a ViewObject/Iterator determined by a unique value of the same or a different attribute in the same row, and on expansion, potentially expands to display rows from a different accessor for each row based on the discriminator attribute value. This type of node binding can be used to display polymorphic Rows in a ViewObject or display different attributes/accessors for each row based on the discriminator attribute value on that row, e.g., For an EmpView, display EmployeeSal for all Employees of deptid=10 while display EmployeeRate for all Employees of deptid=20 and so on.

    See Also:
    RowIterator, JTree, TreeModel, TreeNode

    Fields inherited from class oracle.jbo.uicli.binding.JUCtrlHierBinding
    mTypeBindings
     
    Constructor Summary
    JUTreeBinding(javax.swing.JTree tr, JUIteratorBinding iterBinding, JUCtrlHierTypeBinding[] typeBindings)
              This constructor binds a JTree with Rows from a given JUIteratorBinding and displays data as per the node-types passed in typeBindings.
    JUTreeBinding(javax.swing.JTree tr, JUIteratorBinding iterBinding, java.lang.String attrName, JUCtrlHierTypeBinding[] typeBindings)
              *** For internal framework use only ***
     
    Method Summary
    TypeMethod
     void addControlToPanel(java.lang.Object panel, java.lang.Object layoutObject, java.lang.Object layoutCons)
              *** For internal framework use only ***
     void addTreeModelListener(javax.swing.event.TreeModelListener l)
               
    static javax.swing.tree.DefaultTreeModel createTreeNodeTypeBinding(JUFormBinding formBinding, javax.swing.JTree control, java.lang.String voInstanceName, java.lang.String voIterName, java.lang.String voIterBindingName, JUCtrlHierTypeBinding[] nodeBindings)
              This method is used by the JClient model-binding editors to bind a JTree to this binding.
     java.lang.String[] getAttributeNames()
              Returns the attribute that's displayed in the first level nodes of this tree.
     java.lang.Object getChild(java.lang.Object parent, int index)
               
     int getChildCount(java.lang.Object parent)
               
     int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
               
    static javax.swing.tree.DefaultTreeModel getInstance(JUFormBinding formBinding, javax.swing.JTree control, java.lang.String voInstanceName, java.lang.String voIterName, java.lang.String voIterBindingName, JUCtrlHierTypeBinding[] nodeBindings)
              Deprecated. since 9.0.2
     java.lang.Object getLayoutObject()
              *** For internal framework use only ***
    protected  javax.swing.tree.DefaultTreeModel getModelImpl(javax.swing.JTree control)
              Returns the TreeModel that the associated JTree is bound to.
     java.lang.Object getRoot()
               
     JUTreeNodeBinding getRootBinding()
              Returns the root node binding that contains the iterator that the root node is displaying
     java.lang.Object getValueAt(int rowIndex, int attrIndex)
              Returns null, as tree is not implemented to return attribute values for a given Row.
     boolean isLeaf(java.lang.Object node)
               
     void removeTreeModelListener(javax.swing.event.TreeModelListener l)
               
     void setLayoutObject(javax.swing.JScrollPane scrollPane)
              *** For internal framework use only ***
     void setValueAt(java.lang.Object value, int rowIndex, int attrIndex)
              This method is a noop.
     void treeCollapsed(javax.swing.event.TreeExpansionEvent e)
               
     void treeExpanded(javax.swing.event.TreeExpansionEvent e)
               
     void updateValuesFromRows(Row[] rows, boolean clear)
              Updates the nodes in the tree based on the given set of rows.
     void valueChanged(javax.swing.event.TreeSelectionEvent e)
               
     void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
               
     
    Methods inherited from class oracle.jbo.uicli.binding.JUCtrlHierBinding
    getTypeBindings
     
    Methods inherited from class oracle.jbo.uicli.binding.JUCtrlRangeBinding
    getEstimatedRowCount, updateNavigated, updateRangeScrolled, updateValuesFromRow
     
    Methods inherited from class oracle.jbo.uicli.binding.JUCtrlValueBinding
    findAttributeDef, getAttribute, getAttribute, getAttributeCount, getAttributeDef, getAttributeDefs, getAttributeFromRow, getAttributeFromRow, getAttributeFromRow, getAttributeFromRow, getAttributeFromRow, getAttributeIndexOf, isAttributeUpdateable, setAttribute, setAttribute, setAttributeInRow, setAttributeInRow, setAttributeInRow, setAttributeInRow, setAttributeInRow, setAttributeInRow, stopEditing, updateRowDeleted, updateRowInserted
     
    Methods inherited from class oracle.jbo.uicli.binding.JUControlBinding
    executeQuery, executeQueryIfNeeded, getAllRowsInRange, getApplicationModule, getControl, getCurrentRow, getDef, getFormBinding, getIteratorBinding, getName, getRowAtRangeIndex, getRowIterator, getTransaction, getViewObject, isControlQueriable, reportException, setFormBinding, setName
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    JUTreeBinding

    public JUTreeBinding(javax.swing.JTree tr,
                         JUIteratorBinding iterBinding,
                         JUCtrlHierTypeBinding[] typeBindings)
    This constructor binds a JTree with Rows from a given JUIteratorBinding and displays data as per the node-types passed in typeBindings.

    JUTreeBinding

    public JUTreeBinding(javax.swing.JTree tr,
                         JUIteratorBinding iterBinding,
                         java.lang.String attrName,
                         JUCtrlHierTypeBinding[] typeBindings)
    *** For internal framework use only ***
    Method Detail

    createTreeNodeTypeBinding

    public static javax.swing.tree.DefaultTreeModel createTreeNodeTypeBinding(JUFormBinding formBinding,
                                                                              javax.swing.JTree control,
                                                                              java.lang.String voInstanceName,
                                                                              java.lang.String voIterName,
                                                                              java.lang.String voIterBindingName,
                                                                              JUCtrlHierTypeBinding[] nodeBindings)
    This method is used by the JClient model-binding editors to bind a JTree to this binding. The rules for ViewObjects that will be displayed in this binding are passed in the nodeBindings array.

    The rules the govern the node bindings are:

  • Each ViewObject in the tree can either be displayed using a JUTreeAccessorTypeBinding or a JUTreeDiscrAttrTypeBinding.
  • JUTreeAccessorTypeBinding takes precedence
  • Only one attribute is displayed for each node based on the attribute setting in the corresponding JUCtrlHierTypeBinding object.
  • Only one accessor is expanded for each node based on the accessor setting in the corresponding JUCtrlHierTypeBinding object.
  • The order of nodes determine the search order for discriminator values in case of JUTreeDiscrAttrTypeBinding bindings and the first matching value determines the attribute and accessor for that node.

  • getInstance

    public static javax.swing.tree.DefaultTreeModel getInstance(JUFormBinding formBinding,
                                                                javax.swing.JTree control,
                                                                java.lang.String voInstanceName,
                                                                java.lang.String voIterName,
                                                                java.lang.String voIterBindingName,
                                                                JUCtrlHierTypeBinding[] nodeBindings)
    Deprecated. since 9.0.2


    getModelImpl

    protected javax.swing.tree.DefaultTreeModel getModelImpl(javax.swing.JTree control)
    Returns the TreeModel that the associated JTree is bound to. Unlinke JUTableBinding, tree binding does not implement a custom TreeModel, but rather reuses the existing TreeModel in JTree and simply attaches itself as an associate to the TreeModel and passes BC4J data to it.

    addControlToPanel

    public void addControlToPanel(java.lang.Object panel,
                                  java.lang.Object layoutObject,
                                  java.lang.Object layoutCons)
    *** For internal framework use only ***
    Overrides:
    addControlToPanel in class JUControlBinding

    getLayoutObject

    public java.lang.Object getLayoutObject()
    *** For internal framework use only ***
    Overrides:
    getLayoutObject in class JUControlBinding

    setLayoutObject

    public void setLayoutObject(javax.swing.JScrollPane scrollPane)
    *** For internal framework use only ***

    getValueAt

    public java.lang.Object getValueAt(int rowIndex,
                                       int attrIndex)
    Returns null, as tree is not implemented to return attribute values for a given Row. The displayed value is accessible via the TreeModel.
    Overrides:
    getValueAt in class JUCtrlRangeBinding

    setValueAt

    public void setValueAt(java.lang.Object value,
                           int rowIndex,
                           int attrIndex)
    This method is a noop. JUTreeBinding is currently only a readonly binding
    Overrides:
    setValueAt in class JUCtrlRangeBinding

    getAttributeNames

    public java.lang.String[] getAttributeNames()
    Returns the attribute that's displayed in the first level nodes of this tree.
    Overrides:
    getAttributeNames in class JUCtrlValueBinding

    updateValuesFromRows

    public void updateValuesFromRows(Row[] rows,
                                     boolean clear)
    Updates the nodes in the tree based on the given set of rows. Clears the existing display if clear flag is true.
    Overrides:
    updateValuesFromRows in class JUCtrlRangeBinding

    getRootBinding

    public JUTreeNodeBinding getRootBinding()
    Returns the root node binding that contains the iterator that the root node is displaying

    treeCollapsed

    public void treeCollapsed(javax.swing.event.TreeExpansionEvent e)
    Specified by:
    treeCollapsed in interface javax.swing.event.TreeExpansionListener

    treeExpanded

    public void treeExpanded(javax.swing.event.TreeExpansionEvent e)
    Specified by:
    treeExpanded in interface javax.swing.event.TreeExpansionListener

    valueChanged

    public void valueChanged(javax.swing.event.TreeSelectionEvent e)
    Specified by:
    valueChanged in interface javax.swing.event.TreeSelectionListener

    getRoot

    public java.lang.Object getRoot()
    Specified by:
    getRoot in interface javax.swing.tree.TreeModel

    getChild

    public java.lang.Object getChild(java.lang.Object parent,
                                     int index)
    Specified by:
    getChild in interface javax.swing.tree.TreeModel

    getChildCount

    public int getChildCount(java.lang.Object parent)
    Specified by:
    getChildCount in interface javax.swing.tree.TreeModel

    isLeaf

    public boolean isLeaf(java.lang.Object node)
    Specified by:
    isLeaf in interface javax.swing.tree.TreeModel

    valueForPathChanged

    public void valueForPathChanged(javax.swing.tree.TreePath path,
                                    java.lang.Object newValue)
    Specified by:
    valueForPathChanged in interface javax.swing.tree.TreeModel

    getIndexOfChild

    public int getIndexOfChild(java.lang.Object parent,
                               java.lang.Object child)
    Specified by:
    getIndexOfChild in interface javax.swing.tree.TreeModel

    addTreeModelListener

    public void addTreeModelListener(javax.swing.event.TreeModelListener l)
    Specified by:
    addTreeModelListener in interface javax.swing.tree.TreeModel

    removeTreeModelListener

    public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
    Specified by:
    removeTreeModelListener in interface javax.swing.tree.TreeModel

    Business Components