org.openbp.jaspira.propertybrowser
Class PropertyBrowserImpl

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by org.openbp.swing.components.treetable.JTreeTable
                      extended by org.openbp.jaspira.propertybrowser.PropertyBrowserImpl
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.RowSorterListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.event.TreeSelectionListener, javax.swing.Scrollable, PropertyBrowser

public class PropertyBrowserImpl
extends JTreeTable
implements PropertyBrowser, java.awt.event.MouseListener, javax.swing.event.TreeSelectionListener, java.awt.event.FocusListener

This provides a JTreeTable implementation of the property browser interface. The PropertyBrowserModel provides the model for the JTreeTable which internally builds the tree and table structure according to the object passed to this property browser by the setObject(Object, boolean) method. The property browser implementation will retrieve an object descriptor for the class of the passed object and initialize its user interface accordingly.

Author:
Erich Lauterbach
See Also:
Serialized Form

Nested Class Summary
static class PropertyBrowserImpl.PropertyCellEditor
          Cell editor for the item type properties.
static class PropertyBrowserImpl.PropertyCellRenderer
          Cell renderer for the property editor column.
 class PropertyBrowserImpl.TreeCellRenderer
          Renderer for the tree cell.
 
Nested classes/interfaces inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.DropLocation, javax.swing.JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class org.openbp.swing.components.treetable.JTreeTable
actionMap, CMD_BACKTAB, CMD_BOTTOM, CMD_CODE_MASK, CMD_DOWN, CMD_END, CMD_ENTER, CMD_ESC, CMD_EXTEND_SELECTION, CMD_HOME, CMD_LEFT, CMD_MOUSE, CMD_NONE, CMD_PGDN, CMD_PGUP, CMD_RIGHT, CMD_SELECTION_MASK, CMD_SET_SELECTION, CMD_SPACE, CMD_SWITCH_TREE, CMD_TAB, CMD_TOGGLE_SELECTION, CMD_TOP, CMD_UP, currentCol, currentRow, focusAncestorInputMap, focusInputMap, listenerSupport, SELECTION_MULTI, SELECTION_NONE, SELECTION_SINGLE
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PropertyBrowserImpl(SaveStrategy saveStrategy, ResourceCollection resourceCollection)
          Default Constructor.
 
Method Summary
 AbstractNode addNewNode()
          Adds a new node to the object collection the current node refers to
 void addObjectChangeListener(ObjectChangeListener listener)
          Adds an object change listener.
 void addPropertyBrowserListener(PropertyBrowserListener listener)
          Adds a property browser event listener.
 void changeSelection(int newRow, int newCol, boolean toggle, boolean extend)
          Override in order to prevent redraw problems when scrolling.
 void copyNode()
          Copys the value of the current node to the clipboard.
protected  javax.swing.JPopupMenu createContextMenu()
           
 void defaultHandlePropertyBrowserEvent(PropertyBrowserEvent event)
          Default property browser event handler.
 void disableSave()
          Temporarily disables save operations.
 void enableSave()
          Enables save operations.
 void fireObjectChanged()
          Notifies this property browser that changes have occurred on the object that this editor is responsible for.
 void fireObjectModified()
          Notifies this property browser that changes have occurred on the object that this editor is responsible for.
 void firePropertyBrowserEvent(PropertyBrowserEvent e)
          Notifies all registered property browser event listeners of the given edit event.
 void focusGained(java.awt.event.FocusEvent e)
          Called when the object gets the focus.
 void focusLost(java.awt.event.FocusEvent e)
          Called when the object loses the focus.
 JaspiraAction getAddAction()
          Gets the 'Add element' action
 JaspiraAction getCopyAction()
          Gets the 'Copy element' action
 JaspiraAction getCutAction()
          Gets the 'Cut element' action
 java.lang.Object getModifiedObject()
          Gets the clone of the edited object that has been modified.
 JaspiraAction getMoveDownAction()
          Gets the 'Move element down' action
 JaspiraAction getMoveUpAction()
          Gets the 'Move element up' action
 java.lang.Object getObject()
          Gets the object that is currently edited.
 java.lang.Object getOriginalObject()
          Gets the optional object the 'object' is based upon.
 JaspiraAction getPasteAction()
          Gets the 'Paste element' action
 javax.swing.tree.TreePath getPathByNode(javax.swing.tree.TreeNode treeNode)
          Gets the TreePath for a specified TreeTableNode in the visible tree table.
 ResourceCollection getPropertyBrowserResource()
          Gets the resource containing the column headers.
 JaspiraAction getRemoveAction()
          Gets the 'Remove element' action
 SaveStrategy getSaveStrategy()
          Gets the save stratergy used to save the edited object.
 java.lang.String[] getVisibleMembers()
          Gets the array of property names that should be displayed or null for all.
protected  void handleEscape()
          Handles the escape key.
 void handleKeyEvent(java.awt.event.KeyEvent e)
          Processses a key event.
 boolean isObjectModified()
          Gets the flag used to determine if the original object has changed.
 boolean isObjectNew()
          Gets the flag that determines if the object has just been created.
 boolean isReadOnly()
          Gets wheter the object is read only.
 boolean isSaveImmediately()
          Gets the save after modifying property flag.
 boolean isShowTooltips()
          Gets the show tooltips.
 void mouseClicked(java.awt.event.MouseEvent event)
          Mouse listener to detect when the user has clicked to open the context menu and when the user started dragging a node.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent event)
           
 void mouseReleased(java.awt.event.MouseEvent event)
           
protected  void moveNodeDown()
          Move the current node one position down in the collection
protected  void moveNodeUp()
          Move the current node one position up in the collection
 AbstractNode pasteNode()
          Pastes a node value from the clipboard into a new node of the object collection the current node refers to.
protected  void processCommand(int command)
          Handles a command.
protected  void processSelection(javax.swing.tree.TreePath path)
          Updates the property browser according to the selected row.
 AbstractNode removeNode()
          Removes the current node from the object collection the node refers to.
 void removeObjectChangeListener(ObjectChangeListener listener)
          Removes an object change listener.
 void removePropertyBrowserListener(PropertyBrowserListener listener)
          Removes a property browser event listener.
 boolean reset()
          Resets the contents of the property browser by re-copying the content of the original object to the modified object.
 boolean saveObject()
          Save the object.
 void selectNode(AbstractNode node, int rowOffset, int column)
          Selects the given node.
 void setObject(java.lang.Object object, boolean isObjectNew)
          Sets the object to be displayed/edited.
 void setObject(java.lang.Object object, boolean isObjectNew, MultiIcon rootIcon)
          Sets the object to be displayed/edited.
 void setObject(java.lang.Object object, boolean isObjectNew, ObjectNode rootNode)
          Sets the object to be displayed/edited.
 void setObject(java.lang.Object object, java.lang.Object modifiedObject, boolean isObjectNew, MultiIcon rootIcon)
          Sets the object to be displayed/edited.
 void setObject(java.lang.Object object, java.lang.Object modifiedObject, boolean isObjectNew, MultiIcon rootIcon, ObjectNode rootNode)
          Sets the object to be displayed/edited.
 void setObjectModified(boolean objectModified)
          Sets the flag used to determine if the original object has changed.
 void setObjectNew(boolean isObjectNew)
          Sets the flag that determines if the object has just been created.
 void setOriginalObject(java.lang.Object originalObject)
          Sets the optional object the 'object' is based upon.
 void setReadOnly(boolean readOnly)
          Sets the propertybrowser readonly.
 void setSaveImmediately(boolean saveImmediately)
          Sets the save after modifying property flag.
 void setSaveStrategy(SaveStrategy saveStrategy)
          Sets the save stratergy used to save the edited object.
 void setShowTooltips(boolean showTooltips)
          Sets the show tooltips.
protected  void setupActionKeys()
          Sets up the keyboard shortcuts of the actions that modify collection elements.
 void setVisibleMembers(java.lang.String[] visibleMembers)
          Sets the array of property names that should be displayed or null for all.
protected  void updateActionState()
          Updates the enabled state of the property browser's actions according to the current node.
 void valueChanged(javax.swing.event.TreeSelectionEvent event)
           
 
Methods inherited from class org.openbp.swing.components.treetable.JTreeTable
addTreeTableListener, addWeakTreeTableListener, collapsePath, collapseRow, configureSubComponent, createDescriptionCellValue, doLayout, editCellAt, editCellAt, expandAll, expandAll, expandPath, expandRow, expandTreeLevels, expandTreeLevels, fireCommand, getDefaultRowHeight, getEditingRow, getFirstVisibleRow, getLastVisibleRow, getNodeByPath, getNodeByPoint, getNodeByRow, getPathByPoint, getPathByRow, getRowByPath, getScrollPane, getSelection, getSelectionMode, getToolTipText, getTree, getTreeCol, getTreeTableModel, getValueAt, getVisibleRowCount, isCellSelectable, removeTreeTableListener, repaintCell, restoreCurrentPosition, saveCurrentPosition, selectCell, selectDefaultCell, selectDefaultCell, selectNode, setColumnSizeConstraint, setDefaultRowHeight, setModel, setRootVisible, setSelectionMode, sizeColumnsToFit, sizeColumnsToFit, sizeRowsToFit, togglePath, toggleRow, updateUI
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, getUpdateSelectionOnSort, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sorterChanged, tableChanged, unconfigureEnclosingScrollPane, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openbp.jaspira.propertybrowser.PropertyBrowser
configureSubComponent
 

Constructor Detail

PropertyBrowserImpl

public PropertyBrowserImpl(SaveStrategy saveStrategy,
                           ResourceCollection resourceCollection)
Default Constructor.

Parameters:
saveStrategy - Strategy class used to save the object
resourceCollection - Resource containing the column headers
Method Detail

setupActionKeys

protected void setupActionKeys()
Sets up the keyboard shortcuts of the actions that modify collection elements.


setObject

public void setObject(java.lang.Object object,
                      boolean isObjectNew)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited.

Specified by:
setObject in interface PropertyBrowser
Parameters:
object - The object to edit or null
isObjectNew - Flag that determines if the object has just been created
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException - If the object is not cloneable

setObject

public void setObject(java.lang.Object object,
                      boolean isObjectNew,
                      ObjectNode rootNode)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited.

Specified by:
setObject in interface PropertyBrowser
Parameters:
object - The object to edit or null
isObjectNew - Flag that determines if the object has just been created
rootNode - Root node of the property browser tree or null if the property browser should create an appropriate property browser tree based on the class of the object
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException - If the object is not cloneable

setObject

public void setObject(java.lang.Object object,
                      boolean isObjectNew,
                      MultiIcon rootIcon)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited. The class of the object will be used to determine the object descriptor from.

Specified by:
setObject in interface PropertyBrowser
Parameters:
object - Object to edit
isObjectNew - Flag that determines if the object has just been created
rootIcon - Image of the root node
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException

setObject

public void setObject(java.lang.Object object,
                      java.lang.Object modifiedObject,
                      boolean isObjectNew,
                      MultiIcon rootIcon)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited. The class of the object will be used to determine the object descriptor from.

Specified by:
setObject in interface PropertyBrowser
Parameters:
object - Object to edit
modifiedObject - The modified Object
isObjectNew - Flag that determines if the object has just been created
rootIcon - Image of the root node
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException

setObject

public void setObject(java.lang.Object object,
                      java.lang.Object modifiedObject,
                      boolean isObjectNew,
                      MultiIcon rootIcon,
                      ObjectNode rootNode)
               throws XMLDriverException,
                      java.lang.CloneNotSupportedException
Sets the object to be displayed/edited. The class of the object will be used to determine the object descriptor from.

Specified by:
setObject in interface PropertyBrowser
Parameters:
object - Object to edit
modifiedObject - The modified Object
isObjectNew - Flag that determines if the object has just been created
rootIcon - Image of the root node
rootNode - Root node of the property browser tree or null if the property browser should create an appropriate property browser tree based on the class of the object
Throws:
XMLDriverException - If no object descriptor could be found for the specified object
java.lang.CloneNotSupportedException

getObject

public java.lang.Object getObject()
Gets the object that is currently edited.

Specified by:
getObject in interface PropertyBrowser
Returns:
The object that is currently edited or null

getModifiedObject

public java.lang.Object getModifiedObject()
Gets the clone of the edited object that has been modified. The clone is usually a first-level clone (see the Copyable class).

Specified by:
getModifiedObject in interface PropertyBrowser
Returns:
The modified object or null if nothing has been changed

getOriginalObject

public java.lang.Object getOriginalObject()
Gets the optional object the 'object' is based upon. This is used for name uniqueness checks by the model object validator if the object passed to the property browser has been cloned. Since the property browser clones the given object once more (into the modifiedObject) we loose the reference to the original. originalObject will refer the non-cloned original.

Specified by:
getOriginalObject in interface PropertyBrowser
Returns:
The modified object or null if there is no original

setOriginalObject

public void setOriginalObject(java.lang.Object originalObject)
Sets the optional object the 'object' is based upon. This is used for name uniqueness checks by the model object validator if the object passed to the property browser has been cloned. Since the property browser clones the given object once more (into the modifiedObject) we loose the reference to the original. originalObject will refer the non-cloned original.

Specified by:
setOriginalObject in interface PropertyBrowser
Parameters:
originalObject - The modified object or null if there is no original

isObjectNew

public boolean isObjectNew()
Gets the flag that determines if the object has just been created.

Specified by:
isObjectNew in interface PropertyBrowser

setObjectNew

public void setObjectNew(boolean isObjectNew)
Sets the flag that determines if the object has just been created.

Specified by:
setObjectNew in interface PropertyBrowser

getSaveStrategy

public SaveStrategy getSaveStrategy()
Gets the save stratergy used to save the edited object.


setSaveStrategy

public void setSaveStrategy(SaveStrategy saveStrategy)
Sets the save stratergy used to save the edited object.


isObjectModified

public boolean isObjectModified()
Gets the flag used to determine if the original object has changed.

Specified by:
isObjectModified in interface PropertyBrowser

setObjectModified

public void setObjectModified(boolean objectModified)
Sets the flag used to determine if the original object has changed.

Specified by:
setObjectModified in interface PropertyBrowser

disableSave

public void disableSave()
Temporarily disables save operations. This can be useful if context menus or popup boxes need to be displayed that will cause the object editor to loose its focus and thus force it to save the edited object.
The flag will be automatically reset if the property browser gains the focus again.


enableSave

public void enableSave()
Enables save operations. Call this method to explicitely enable save operations after you have called disableSave().


saveObject

public boolean saveObject()
Save the object.

Specified by:
saveObject in interface PropertyBrowser
Returns:
true The object has been successfully saved or the change was discarded
false The object has not been saved, return

reset

public boolean reset()
Resets the contents of the property browser by re-copying the content of the original object to the modified object. Also resets the object modified flag.

Specified by:
reset in interface PropertyBrowser
See Also:
PropertyBrowser.reset()

addNewNode

public AbstractNode addNewNode()
Adds a new node to the object collection the current node refers to

Returns:
The newly added node or null if no node has been added

removeNode

public AbstractNode removeNode()
Removes the current node from the object collection the node refers to.

Returns:
The node that should become the current node after removal of the current node
This is the node that succeeds the current node in the collection or - if not present - the node that preceeds the current node or - if the list is empty - the collection node itself (or null if not removal has taken place).

copyNode

public void copyNode()
Copys the value of the current node to the clipboard.


pasteNode

public AbstractNode pasteNode()
Pastes a node value from the clipboard into a new node of the object collection the current node refers to.

Returns:
The newly added node or null if no node has been added

moveNodeUp

protected void moveNodeUp()
Move the current node one position up in the collection


moveNodeDown

protected void moveNodeDown()
Move the current node one position down in the collection


selectNode

public void selectNode(AbstractNode node,
                       int rowOffset,
                       int column)
Selects the given node.

Parameters:
node - Node to select
rowOffset - Number of rows to add to the row of the node
column - Column to place the cursor in:
0: The tree column
1: The editable cell column
-1: The current column

changeSelection

public void changeSelection(int newRow,
                            int newCol,
                            boolean toggle,
                            boolean extend)
Override in order to prevent redraw problems when scrolling. If some keyboard action causes the property browser to scroll in it's enclosing scroll pane, the highlighted selection in string property editors is not being removed properly from the field that looses the focus. In order to prevent this, we explicitely unhighlight the current property editor before changing the selection in the table.

Overrides:
changeSelection in class JTreeTable
See Also:
JTreeTable.changeSelection(int, int, boolean, boolean)

handleKeyEvent

public void handleKeyEvent(java.awt.event.KeyEvent e)
Processses a key event.

Specified by:
handleKeyEvent in interface PropertyBrowser
Overrides:
handleKeyEvent in class JTreeTable
Parameters:
e - Event

processCommand

protected void processCommand(int command)
Handles a command.

Overrides:
processCommand in class JTreeTable
Parameters:
command - Command to process

handleEscape

protected void handleEscape()
Handles the escape key. Resets the object if it is modified and closes the dialog (cancel) if the property browser is embedded in a dialog.


getPropertyBrowserResource

public ResourceCollection getPropertyBrowserResource()
Gets the resource containing the column headers.


setReadOnly

public void setReadOnly(boolean readOnly)
Sets the propertybrowser readonly.

Specified by:
setReadOnly in interface PropertyBrowser

isReadOnly

public boolean isReadOnly()
Gets wheter the object is read only.

Specified by:
isReadOnly in interface PropertyBrowser

isSaveImmediately

public boolean isSaveImmediately()
Gets the save after modifying property flag.

Specified by:
isSaveImmediately in interface PropertyBrowser

setSaveImmediately

public void setSaveImmediately(boolean saveImmediately)
Sets the save after modifying property flag.

Specified by:
setSaveImmediately in interface PropertyBrowser

isShowTooltips

public boolean isShowTooltips()
Gets the show tooltips.


setShowTooltips

public void setShowTooltips(boolean showTooltips)
Sets the show tooltips.


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.

Specified by:
getVisibleMembers in interface PropertyBrowser

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.

Specified by:
setVisibleMembers in interface PropertyBrowser

getAddAction

public JaspiraAction getAddAction()
Gets the 'Add element' action


getCopyAction

public JaspiraAction getCopyAction()
Gets the 'Copy element' action


getCutAction

public JaspiraAction getCutAction()
Gets the 'Cut element' action


getPasteAction

public JaspiraAction getPasteAction()
Gets the 'Paste element' action


getRemoveAction

public JaspiraAction getRemoveAction()
Gets the 'Remove element' action


getMoveUpAction

public JaspiraAction getMoveUpAction()
Gets the 'Move element up' action


getMoveDownAction

public JaspiraAction getMoveDownAction()
Gets the 'Move element down' action


getPathByNode

public javax.swing.tree.TreePath getPathByNode(javax.swing.tree.TreeNode treeNode)
Gets the TreePath for a specified TreeTableNode in the visible tree table.

Overrides:
getPathByNode in class JTreeTable
Parameters:
treeNode - The TreeTableNode for which the TreePath is desired
Returns:
The TreePath, if the node exists in the visible tree, else null

valueChanged

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

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Called when the object gets the focus.

Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Called when the object loses the focus.

Specified by:
focusLost in interface java.awt.event.FocusListener

processSelection

protected void processSelection(javax.swing.tree.TreePath path)
Updates the property browser according to the selected row.

Parameters:
path - Path of the selected node

updateActionState

protected void updateActionState()
Updates the enabled state of the property browser's actions according to the current node.


mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Mouse listener to detect when the user has clicked to open the context menu and when the user started dragging a node.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class JTreeTable

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class JTreeTable

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class JTreeTable

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Overrides:
mouseEntered in class JTreeTable

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Overrides:
mouseExited in class JTreeTable

createContextMenu

protected javax.swing.JPopupMenu createContextMenu()

addPropertyBrowserListener

public void addPropertyBrowserListener(PropertyBrowserListener listener)
Adds a property browser event listener.

Specified by:
addPropertyBrowserListener in interface PropertyBrowser
Parameters:
listener - Listener to add

removePropertyBrowserListener

public void removePropertyBrowserListener(PropertyBrowserListener listener)
Removes a property browser event listener.

Specified by:
removePropertyBrowserListener in interface PropertyBrowser
Parameters:
listener - Listener to remove

firePropertyBrowserEvent

public void firePropertyBrowserEvent(PropertyBrowserEvent e)
Notifies all registered property browser event listeners of the given edit event.

Specified by:
firePropertyBrowserEvent in interface PropertyBrowser
Parameters:
e - Event

defaultHandlePropertyBrowserEvent

public void defaultHandlePropertyBrowserEvent(PropertyBrowserEvent event)
Default property browser event handler.

Parameters:
event - Event

fireObjectModified

public void fireObjectModified()
Notifies this property browser that changes have occurred on the object that this editor is responsible for.


fireObjectChanged

public void fireObjectChanged()
Notifies this property browser that changes have occurred on the object that this editor is responsible for.


addObjectChangeListener

public void addObjectChangeListener(ObjectChangeListener listener)
Adds an object change listener.

Parameters:
listener - The object change listener to add

removeObjectChangeListener

public void removeObjectChangeListener(ObjectChangeListener listener)
Removes an object change listener.

Parameters:
listener - The object change listener to remove


Copyright © 2011. All Rights Reserved.