org.openbp.jaspira.propertybrowser
Class PropertyBrowserModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.openbp.swing.components.treetable.SimpleTreeTableModel
          extended by org.openbp.jaspira.propertybrowser.PropertyBrowserModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, javax.swing.tree.TreeModel, TreeTableModel

public class PropertyBrowserModel
extends SimpleTreeTableModel

The property browser is used for displayment and modifcation of object. The object is always expected to have properties with its corresponding values, which are displayed in appropriate property editors. The property browser consits of a TreeTable combination. This model is used by the JTreeTable to build up its structure. The model class also serves as property change listener for the tree nodes and will forward any property changes to the fireObjectModified event of the property browser itself.

Author:
Andreas Putz
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.openbp.swing.components.treetable.SimpleTreeTableModel
columnHeader, root, treeTable
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
PropertyBrowserModel()
          Default Constructor.
PropertyBrowserModel(ResourceCollection resourceCollection)
          Default Constructor.
 
Method Summary
 java.lang.Class getColumnClass(int column)
          Returns the class type for column number column.
 int getColumnCount()
          Returns the number of available columns.
 java.lang.String getColumnName(int column)
          Returns the name for column number column.
 PropertyBrowser getPropertyBrowser()
          Gets the property browser.
 java.lang.String[] getVisibleMembers()
          Gets the array of property names that should be displayed or null for all.
 boolean isCellEditable(int row, int column)
          By default, make the column with the Tree in it the only editable one.
 boolean isCellSelectable(int row, int column)
          Used by the JTreeTable if a specified cell is seletable.
protected  void performDefaultExpansion(AbstractNode node)
          Performs the default expansion.
 void setObject(java.lang.Object object)
          Sets the object to edit.
 void setObject(java.lang.Object object, ObjectNode rootNode)
          Sets the object to edit.
 void setPropertyBrowser(PropertyBrowserImpl propertyBrowser)
          Sets the property browser.
 void setResourceCollection(ResourceCollection resourceCollection)
          Sets the property browser resource.
 void setVisibleMembers(java.lang.String[] visibleMembers)
          Sets the array of property names that should be displayed or null for all.
 void structureChanged(AbstractNode node)
          Called when the tree structure changed
 
Methods inherited from class org.openbp.swing.components.treetable.SimpleTreeTableModel
addTreeModelListener, delayedFireTableDataChanged, fireNodeChanged, fireNodeInserted, fireNodeRemoved, fireNodeStructureChanged, fireTableChangesCompleted, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getRowCount, getTreeModelListeners, getValueAt, isLeaf, removeTreeModelListener, setColumnHeader, setRoot, setTreeTable, setValueAt, valueForPathChanged
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener, setValueAt
 

Constructor Detail

PropertyBrowserModel

public PropertyBrowserModel()
Default Constructor.


PropertyBrowserModel

public PropertyBrowserModel(ResourceCollection resourceCollection)
Default Constructor.

Parameters:
resourceCollection - Used for column headers
Method Detail

setResourceCollection

public void setResourceCollection(ResourceCollection resourceCollection)
Sets the property browser resource.

Parameters:
resourceCollection - Resource used for column headers

getVisibleMembers

public java.lang.String[] getVisibleMembers()
Gets the array of property names that should be displayed or null for all. This can be used to limit the number of properties that are displayed for complex objects.


setVisibleMembers

public void setVisibleMembers(java.lang.String[] visibleMembers)
Sets the array of property names that should be displayed or null for all. This can be used to limit the number of properties that are displayed for complex objects.


setObject

public void setObject(java.lang.Object object)
Sets the object to edit. The model will create an appropriate property browser tree based on the class of the object.

Parameters:
object - The object to set

setObject

public void setObject(java.lang.Object object,
                      ObjectNode rootNode)
Sets the object to edit.

Parameters:
object - The object to set
rootNode - Root node of the property browser tree or null if the model should create an appropriate property browser tree based on the class of the object

getPropertyBrowser

public PropertyBrowser getPropertyBrowser()
Gets the property browser.


setPropertyBrowser

public void setPropertyBrowser(PropertyBrowserImpl propertyBrowser)
Sets the property browser.


isCellEditable

public boolean isCellEditable(int row,
                              int column)
By default, make the column with the Tree in it the only editable one. Making this column editable causes the JTable to forward mouse and keyboard events in the Tree column to the underlying JTree.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class SimpleTreeTableModel

isCellSelectable

public boolean isCellSelectable(int row,
                                int column)
Used by the JTreeTable if a specified cell is seletable.

Specified by:
isCellSelectable in interface TreeTableModel
Overrides:
isCellSelectable in class SimpleTreeTableModel
Parameters:
row - The row index of the specified cell;
column - The column index of the specified cell;
Returns:
true - if the cell is selectable
false - if the cell isn't selectable.

getColumnCount

public int getColumnCount()
Returns the number of available columns.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Overrides:
getColumnCount in class SimpleTreeTableModel

getColumnName

public java.lang.String getColumnName(int column)
Returns the name for column number column.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class SimpleTreeTableModel

getColumnClass

public java.lang.Class getColumnClass(int column)
Returns the class type for column number column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class SimpleTreeTableModel

performDefaultExpansion

protected void performDefaultExpansion(AbstractNode node)
Performs the default expansion. Expands all nodes that should be initially visible.

Parameters:
node - Parent node to start the default expansion with. The method will go down recursively the node tree.

structureChanged

public void structureChanged(AbstractNode node)
Called when the tree structure changed



Copyright © 2011. All Rights Reserved.