JIDE 3.5.15

com.jidesoft.grid
Class PropertyPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.grid.PropertyPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener

public class PropertyPane
extends JPanel
implements ListSelectionListener

The PropertyPane is a wrapper around PropertyTable. It adds a toolbar and a description area so that make it more like a component.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JComponent _descriptionPanel
           
protected  JLabel _nameLabel
          Display name of the beaninfo.
 String ACTION_ALPHEBETIC_VIEW
          Action name of action to switch to alphabetic view.
 String ACTION_CATEGORIED_VIEW
          Action name of action to switch to categorical view.
 String ACTION_COLLAPSE
          Action name of action to collapse all.
 String ACTION_EXPAND
          Action name of action to expand all.
 String ACTION_TOGGLE_DESCRIPTION
          Action name of action to toggle description.
static int BUTTONS_ALL
           
static int BUTTONS_DESCRIPTION
           
static int BUTTONS_EXPAND_COLLAPSE
           
static int BUTTONS_SORT
           
 
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
PropertyPane()
          Creates PropertyPane with an empty PropertyTable.
PropertyPane(PropertyTable table)
          Creates a new PropertyPane using PropertyTable.
PropertyPane(PropertyTable table, int visibleButtons)
          Creates a new PropertyPane using PropertyTable and specify which buttons are visible.
 
Method Summary
protected  JideButton createButton(Action action)
           
protected  JComponent createDescriptionArea()
          Creates the description area.
protected  JComponent createDescriptionPanel()
          Creates the description panel.
protected  JPanel createDescriptionPanel(JComponent nameLabel, JComponent descriptionArea)
          Creates the description panel.
protected  Component createPropertyTablePanel(PropertyTable table)
          Creates a panel that holds the property table.
protected  JComponent createToolBar()
          Creates the tool bar component on top of the PropertyTable.
protected  JComponent createToolBarComponent()
          Creates the toolbar component for the PropertyPane.
 Action getAction(String action)
          Gets the built-in action.
 Color getBorderColor()
          Gets the border color.
protected  ImageIcon getImageIcon(String name)
          Gets the image icons that is used in PropertyPane.
 int getOrder()
          Gets the order PropertyPane.
 PropertyTable getPropertyTable()
          Gets the property table.
protected  String getResourceString(String key)
          Gets the localized string from resource bundle.
 JScrollPane getScrollPane()
          Gets the scroll pane that contains the PropertyTable.
 JComponent getToolBar()
          Gets the toolbar which has the categorized and sorted buttons.
 boolean isShowDescription()
          Is the description area visible.
 boolean isShowToolBar()
          Is the toolbar visible.
protected  void resetDescription()
          Resets the description to default name and description.
 void setBorderColor(Color borderColor)
          Sets the border color.
 void setFont(Font font)
          Override to set the font of description area along with the pane itself.
 void setOrder(int order)
          Sets the order of property pane.
 void setShowDescription(boolean showDescription)
          Sets the visibility of description area.
 void setShowToolBar(boolean showToolBar)
          Sets the visibility of toolbar.
 void setViewportBackground(Color color)
          Sets the bottom empty space of the PropertyPane background color.
protected  void updateDescription(String name, String description)
          Updates the name and description to description panel.
 void valueChanged(ListSelectionEvent e)
          Called whenever the value of the selection changes.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, 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, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, 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, doLayout, 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
 

Field Detail

ACTION_CATEGORIED_VIEW

public final String ACTION_CATEGORIED_VIEW
Action name of action to switch to categorical view.

See Also:
Constant Field Values

ACTION_ALPHEBETIC_VIEW

public final String ACTION_ALPHEBETIC_VIEW
Action name of action to switch to alphabetic view.

See Also:
Constant Field Values

ACTION_TOGGLE_DESCRIPTION

public final String ACTION_TOGGLE_DESCRIPTION
Action name of action to toggle description.

See Also:
Constant Field Values

ACTION_EXPAND

public final String ACTION_EXPAND
Action name of action to expand all.

See Also:
Constant Field Values

ACTION_COLLAPSE

public final String ACTION_COLLAPSE
Action name of action to collapse all.

See Also:
Constant Field Values

_nameLabel

protected JLabel _nameLabel
Display name of the beaninfo.


_descriptionPanel

protected JComponent _descriptionPanel

BUTTONS_SORT

public static final int BUTTONS_SORT
See Also:
Constant Field Values

BUTTONS_DESCRIPTION

public static final int BUTTONS_DESCRIPTION
See Also:
Constant Field Values

BUTTONS_EXPAND_COLLAPSE

public static final int BUTTONS_EXPAND_COLLAPSE
See Also:
Constant Field Values

BUTTONS_ALL

public static final int BUTTONS_ALL
See Also:
Constant Field Values
Constructor Detail

PropertyPane

public PropertyPane()
Creates PropertyPane with an empty PropertyTable.


PropertyPane

public PropertyPane(PropertyTable table)
Creates a new PropertyPane using PropertyTable.

Parameters:
table - PropertyTable to be used in this PropertyPane

PropertyPane

public PropertyPane(PropertyTable table,
                    int visibleButtons)
Creates a new PropertyPane using PropertyTable and specify which buttons are visible.

Parameters:
table - PropertyTable to be used in this PropertyPane
visibleButtons - visible buttons. The value is a bitwise OR of BUTTONS_SORT, BUTTONS_DESCRIPTION and BUTTONS_EXPAND_COLLAPSE.
Method Detail

createPropertyTablePanel

protected Component createPropertyTablePanel(PropertyTable table)
Creates a panel that holds the property table. Default implementation adds the property table to a scroll pane and return the scroll pane.

Parameters:
table - the property table.
Returns:
the scroll pane which contains the property table.

getScrollPane

public JScrollPane getScrollPane()
Gets the scroll pane that contains the PropertyTable.

Returns:
the scroll pane that contains the PropertyTable.

setViewportBackground

public void setViewportBackground(Color color)
Sets the bottom empty space of the PropertyPane background color. It's the same as JTable background by default.

Parameters:
color - the new viewport background color

createToolBar

protected JComponent createToolBar()
Creates the tool bar component on top of the PropertyTable.

Returns:
a JToolBar component.

createToolBarComponent

protected JComponent createToolBarComponent()
Creates the toolbar component for the PropertyPane.

Returns:
a JToolBar. You can subclass it to create a CommandBar if you have JIDE Action Framework.

createButton

protected JideButton createButton(Action action)

getAction

public Action getAction(String action)
Gets the built-in action.

Parameters:
action - the name of action
Returns:
the action

createDescriptionPanel

protected JComponent createDescriptionPanel()
Creates the description panel. If you override this method to create your own description panel, you also need to override updateDescription(String,String) to update the new value of name and description to the components you created.

Returns:
the description panel.

createDescriptionArea

protected JComponent createDescriptionArea()
Creates the description area. It is a MultilineLabel by default.

Returns:
the description area.

updateDescription

protected void updateDescription(String name,
                                 String description)
Updates the name and description to description panel. If you override createDescriptionPanel() to create your own name and description, you will have to override this method to set the new name and description to your components.

Parameters:
name - the name of the description panel
description - the description of the description panel

resetDescription

protected void resetDescription()
Resets the description to default name and description. It usually happens when there is no property is selected.


createDescriptionPanel

protected JPanel createDescriptionPanel(JComponent nameLabel,
                                        JComponent descriptionArea)
Creates the description panel. Subclass can overwrite this to provide your own description panel. Below is the default implementation.

 JPanel panel = new JPanel(new BorderLayout(0, 0));
 panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(getBorderColor()),
 BorderFactory.createEmptyBorder(1, 1, 1, 1)));
 panel.add(nameLabel, BorderLayout.BEFORE_FIRST_LINE);
 panel.add(descriptionArea, BorderLayout.CENTER);
 return panel;
 

Parameters:
nameLabel - the name component
descriptionArea - the description area component
Returns:
the description panel.

valueChanged

public void valueChanged(ListSelectionEvent e)
Called whenever the value of the selection changes.

Specified by:
valueChanged in interface ListSelectionListener
Parameters:
e - the event that characterizes the change.

getBorderColor

public Color getBorderColor()
Gets the border color.

Returns:
the border color

setBorderColor

public void setBorderColor(Color borderColor)
Sets the border color.

Parameters:
borderColor - the color of the border

getToolBar

public JComponent getToolBar()
Gets the toolbar which has the categorized and sorted buttons. You can add your own buttons or whatever component to it.

Returns:
toolbar

isShowToolBar

public boolean isShowToolBar()
Is the toolbar visible.

Returns:
the visibility of toolbar

setShowToolBar

public void setShowToolBar(boolean showToolBar)
Sets the visibility of toolbar.

Parameters:
showToolBar - true to show toolbar and false to hide toolbar.

isShowDescription

public boolean isShowDescription()
Is the description area visible.

Returns:
true if the description is visible and false if not.

setShowDescription

public void setShowDescription(boolean showDescription)
Sets the visibility of description area.

Parameters:
showDescription - true to show description area and false to hide description area.

setFont

public void setFont(Font font)
Override to set the font of description area along with the pane itself.

Overrides:
setFont in class JComponent
Parameters:
font - new font to be used by this pane

getPropertyTable

public PropertyTable getPropertyTable()
Gets the property table.

Returns:
property table

getOrder

public int getOrder()
Gets the order PropertyPane. Please note, PropertyPane doesn't listen to the order of underlying PropertyTableModel. If you ever called setOrder on PropertyTableModel directly, the value returned here might be the same as the order in PropertyTableModel. To avoid this, always use setOrder(int) on PropertyPane to change the order of underlying PropertyTableModel.

Returns:
the order of PropertyPane.

setOrder

public void setOrder(int order)
Sets the order of property pane. This method will set the order of property table model. And it will set the buttons (sorted button and categorized button) to the correct selection state.

Parameters:
order - the order

getImageIcon

protected ImageIcon getImageIcon(String name)
Gets the image icons that is used in PropertyPane. By default it will use GridIconsFactory to get the image icons.

Subclass can override this method to provide their own icon. The the value of the name parameter will be constants defined in GridIconsFactory.PropertyPane. For example, GridIconsFactory.PropertyPane.SORT is for the sort icon.

Parameters:
name - the name
Returns:
the image icon of a name.

getResourceString

protected String getResourceString(String key)
Gets the localized string from resource bundle. Subclass can override it to provide its own string. Available keys are defined in grids.properties that begin with "Pane.".

Parameters:
key - the key
Returns:
the localized string.

JIDE 3.5.15