com.sibvisions.rad.ui.swing.impl.control
Class SwingTree

java.lang.Object
  extended by com.sibvisions.rad.ui.awt.impl.AwtResource<C>
      extended by com.sibvisions.rad.ui.awt.impl.AwtComponent<C>
          extended by com.sibvisions.rad.ui.awt.impl.AwtContainer<C>
              extended by com.sibvisions.rad.ui.swing.impl.SwingComponent<C>
                  extended by com.sibvisions.rad.ui.swing.impl.SwingScrollComponent<JVxTree,javax.swing.JTree>
                      extended by com.sibvisions.rad.ui.swing.impl.control.SwingTree
All Implemented Interfaces:
ICellFormatter, INodeFormatter, java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.util.EventListener, IControl, ITranslatable, ITreeControl, ICellFormatable, ITree, IAlignmentConstants, IComponent, IContainer, IResource, INamedObject, ITranslator

public class SwingTree
extends SwingScrollComponent<JVxTree,javax.swing.JTree>
implements ITree, ICellFormatter, INodeFormatter

The SwingTree is the ITree implementation for swing.

See Also:
JTree

Field Summary
 
Fields inherited from class com.sibvisions.rad.ui.swing.impl.SwingScrollComponent
component
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
bComponentListener, bFocusListener, bKeyListener, bMouseListener, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, eventSource, factory, parent
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
resource
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
SwingTree()
          Creates a new instance of SwingTable.
 
Method Summary
 void cancelEditing()
          Informs the GUI control, that the last edit should be canceled(restored) the correct value is in the DataBook.
 IDataBook getActiveDataBook()
          Gets the active data book.
 CellFormat getCellFormat(IDataBook pDataBook, IDataPage pDataPage, IDataRow pDataRow, java.lang.String pColumnName, int pRow, int pColumn)
          Gets the format for the given cell.
 ICellFormatter getCellFormatter()
          Gets the ICellFormatter.
 IDataBook[] getDataBooks()
          Returns the DataBooks displayed by this control.
 INodeFormatter getNodeFormatter()
          Gets the node formatter.
 javax.swing.Icon getNodeImage(IDataBook pDataBook, IDataPage pDataPage, IDataRow pDataRow, java.lang.String pColumnName, int pRow, boolean pExpanded, boolean pLeaf)
          Gets the image for the given node.
 TranslationMap getTranslation()
          Gets the possible translation mapping.
 boolean isDetectEndNode()
          Gets if a node should be detected to be an end node or not.
 boolean isEditable()
          Gets if editable or not.
 boolean isMouseEventOnSelectedCell()
          True, if the mouse event occured on current selected cell.
 boolean isTranslationEnabled()
          Gets whether the translation is en- or disabled.
 void notifyRepaint()
          The control need to check if the part is visible and then repaint the part.
 void saveEditing()
          Informs the GUI control, that the last edit should be set into the IDataBook or IDataRow.
 void setCellFormatter(ICellFormatter pCellFormatter)
          Sets the ICellFormatter.
 void setDataBooks(IDataBook... pDataBooks)
          Sets the DataBooks displayed by this control.
 void setDetectEndNode(boolean pDetectEndNode)
          Sets if a node should be detected to be an end node or not.
 void setEditable(boolean pEditable)
          Sets if editable or not.
 void setNodeFormatter(INodeFormatter pNodeFormatter)
          Sets the node formatter.
 void setTranslation(TranslationMap pTranslation)
          Sets the possible translations.
 void setTranslationEnabled(boolean pEnabled)
          Sets the translation en- or disabled.
 void startEditing()
          Informs the GUI control, that the editor should be opened.
 java.lang.String translate(java.lang.String pText)
          Method to translate a given text.
 
Methods inherited from class com.sibvisions.rad.ui.swing.impl.SwingScrollComponent
addFocusListener, addKeyListener, addMouseListener, getBackground, getComponent, getCursor, getFont, getForeground, getName, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setForeground, setName, setTabIndex, setToolTipText
 
Methods inherited from class com.sibvisions.rad.ui.swing.impl.SwingComponent
capture
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtContainer
add, add, add, add, addIntern, checkAdd, getComponent, getComponentCount, getLayout, indexOf, remove, remove, removeAll, removeIntern, setLayout, setLayoutIntern
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
addComponentListener, componentHidden, componentMoved, componentResized, componentShown, createImage, createMouseEvent, equals, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, focusGained, focusLost, getBounds, getEventSource, getFactory, getHorizontalAlignment, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getStyle, getTabIndex, getVerticalAlignment, hashCode, invalidateLayout, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, setBounds, setEventSource, setFactory, setHorizontalAlignment, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setParent, setPreferredSize, setSize, setStyle, setVerticalAlignment, setVisible, validate
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
getResource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.ui.IComponent
capture, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getStyle, getTabIndex, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, requestFocus, setBackground, setBounds, setCursor, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setStyle, setTabIndex, setToolTipText, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Constructor Detail

SwingTree

public SwingTree()
Creates a new instance of SwingTable.

Method Detail

getDataBooks

public IDataBook[] getDataBooks()
Returns the DataBooks displayed by this control.

Specified by:
getDataBooks in interface ITreeControl
Returns:
the DataBooks.
See Also:
ITreeControl.setDataBooks(javax.rad.model.IDataBook...)

setDataBooks

public void setDataBooks(IDataBook... pDataBooks)
Sets the DataBooks displayed by this control.

Specified by:
setDataBooks in interface ITreeControl
Parameters:
pDataBooks - the DataBooks
See Also:
ITreeControl.getDataBooks()

getActiveDataBook

public IDataBook getActiveDataBook()
Gets the active data book.

Specified by:
getActiveDataBook in interface ITreeControl
Returns:
the active data book.

isEditable

public boolean isEditable()
Gets if editable or not.

Specified by:
isEditable in interface ITree
Returns:
if editable or not.

setEditable

public void setEditable(boolean pEditable)
Sets if editable or not.

Specified by:
setEditable in interface ITree
Parameters:
pEditable - if editable or not.

isDetectEndNode

public boolean isDetectEndNode()
Gets if a node should be detected to be an end node or not. Depending on the used model, the detection can cause additional client server communication.

Specified by:
isDetectEndNode in interface ITree
Returns:
true, if end node detection is enabled.

setDetectEndNode

public void setDetectEndNode(boolean pDetectEndNode)
Sets if a node should be detected to be an end node or not. Depending on the used model, the detection can cause additional client server communication.

Specified by:
setDetectEndNode in interface ITree
Parameters:
pDetectEndNode - true, if end node detection is enabled.

notifyRepaint

public void notifyRepaint()
The control need to check if the part is visible and then repaint the part. Notify repaint is called on every change. The IControl has to catch the change, and return immediate. The change analysis and display has to be done with invoke later by the control.

Specified by:
notifyRepaint in interface IControl

startEditing

public void startEditing()
Informs the GUI control, that the editor should be opened.

Specified by:
startEditing in interface ITreeControl

cancelEditing

public void cancelEditing()
Informs the GUI control, that the last edit should be canceled(restored) the correct value is in the DataBook.

Specified by:
cancelEditing in interface IControl

saveEditing

public void saveEditing()
                 throws ModelException
Informs the GUI control, that the last edit should be set into the IDataBook or IDataRow.

Specified by:
saveEditing in interface IControl
Throws:
ModelException - if the value can not be stored.

setTranslation

public void setTranslation(TranslationMap pTranslation)
Sets the possible translations.

Specified by:
setTranslation in interface ITranslatable
Parameters:
pTranslation - the translation mapping

getTranslation

public TranslationMap getTranslation()
Gets the possible translation mapping.

Specified by:
getTranslation in interface ITranslatable
Returns:
the translation mapping

setTranslationEnabled

public void setTranslationEnabled(boolean pEnabled)
Sets the translation en- or disabled.

Specified by:
setTranslationEnabled in interface ITranslatable
Parameters:
pEnabled - true to enable the translation, false to disable

isTranslationEnabled

public boolean isTranslationEnabled()
Gets whether the translation is en- or disabled.

Specified by:
isTranslationEnabled in interface ITranslatable
Returns:
true if translation is performed, false otherwise

translate

public java.lang.String translate(java.lang.String pText)
Method to translate a given text.

Specified by:
translate in interface ITranslator
Parameters:
pText - the text to translate.
Returns:
the translated text.

getCellFormatter

public ICellFormatter getCellFormatter()
Gets the ICellFormatter.

The ICellFormatter will be called for every cell and can return a style for that cell.

Specified by:
getCellFormatter in interface ICellFormatable
Returns:
the ICellFormatter.
See Also:
ICellFormatable.setCellFormatter(ICellFormatter)

setCellFormatter

public void setCellFormatter(ICellFormatter pCellFormatter)
Sets the ICellFormatter.

The ICellFormatter will be called for every cell and can return a style for that cell.

Specified by:
setCellFormatter in interface ICellFormatable
Parameters:
pCellFormatter - the ICellFormatter.
See Also:
ICellFormatable.getCellFormatter()

getNodeFormatter

public INodeFormatter getNodeFormatter()
Gets the node formatter.

Specified by:
getNodeFormatter in interface ITree
Returns:
the node formatter.

setNodeFormatter

public void setNodeFormatter(INodeFormatter pNodeFormatter)
Sets the node formatter.

Specified by:
setNodeFormatter in interface ITree
Parameters:
pNodeFormatter - the node formatter.

getCellFormat

public CellFormat getCellFormat(IDataBook pDataBook,
                                IDataPage pDataPage,
                                IDataRow pDataRow,
                                java.lang.String pColumnName,
                                int pRow,
                                int pColumn)
                         throws java.lang.Throwable
Gets the format for the given cell.

Specified by:
getCellFormat in interface ICellFormatter
Parameters:
pDataBook - the DataBook
pDataPage - the DataPage
pDataRow - the DataRow
pColumnName - the column name
pRow - the Row number
pColumn - the Column number
Returns:
the format for the given cell.
Throws:
java.lang.Throwable - if an exception, it is ignored.

getNodeImage

public javax.swing.Icon getNodeImage(IDataBook pDataBook,
                                     IDataPage pDataPage,
                                     IDataRow pDataRow,
                                     java.lang.String pColumnName,
                                     int pRow,
                                     boolean pExpanded,
                                     boolean pLeaf)
Gets the image for the given node.

Specified by:
getNodeImage in interface INodeFormatter
Parameters:
pDataBook - the IDataBook.
pDataPage - the IDataPage.
pDataRow - the IDataRow.
pColumnName - the column name.
pRow - the row index.
pExpanded - true if expanded.
pLeaf - true if leaf.
Returns:
the ICellFormat for the specified cell.

isMouseEventOnSelectedCell

public boolean isMouseEventOnSelectedCell()
True, if the mouse event occured on current selected cell.

Specified by:
isMouseEventOnSelectedCell in interface ITree
Returns:
True, if the mouse event occured on current selected cell.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.