com.zfqjava.swing
Class JSidePane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.zfqjava.swing.JSidePane
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
JSideBar

public class JSidePane
extends javax.swing.JComponent
implements javax.accessibility.Accessible

JSidePane provides a component to add group panel.

See Also:
ValueAction, Serialized Form

Inner Class Summary
protected  class JSidePane.AccessibleJSidePane
          This class implements accessibility support for the JSidePane class.
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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
JSidePane()
          Constructs a JSidePane.
 
Method Summary
 void addGroup(java.awt.Component comp)
          Adds the group component.
 void addGroup(java.awt.Component comp, javax.swing.Action action)
          Adds the group componet with the group header action.
 void addGroupAt(java.awt.Component comp, javax.swing.Action action, int index)
          Adds the group component at the specify index with the group header action.
 void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
          Adds a listener to the list that's notified each time a change to the selection occurs.
 javax.swing.JButton createDefaultButton()
           
protected  javax.swing.ListSelectionModel createSelectionModel()
          Returns an instance of DefaultListSelectionModel.
protected  void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
          Notifies JList ListSelectionListeners that the selection model has changed.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this JSidePane.
 javax.swing.Action getActionAt(int index)
          Returns the action at the specify index.
 java.awt.Component getComponentAt(int index)
          Returns the component at the specify index.
 int getGroupCount()
          Returns the group count.
 javax.swing.event.ListSelectionListener[] getListSelectionListeners()
          Returns an array of all the ListSelectionListeners added to this JList with addListSelectionListener().
 java.awt.Component getSelectedComponent()
          Returns the currently selected component for this sidepane.
 int getSelectedIndex()
          Returns the currently selected index for this sidepane.
 int getSelectionMode()
          Returns whether single-item or multiple-item selections are allowed.
 javax.swing.ListSelectionModel getSelectionModel()
          Returns the value of the current selection model.
 int indexOfAction(javax.swing.Action action)
          Returns the action at the specify index.
 int indexOfComponent(java.awt.Component comp)
          Returns the index for the specify component.
protected  void paintComponent(java.awt.Graphics g)
           
protected  java.lang.String paramString()
          Returns a string representation of this JSidePane.
 void removeAllGroup()
          Removes all group component.
 void removeGroup(java.awt.Component comp)
          Removes the group component.
 void removeGroupAt(int index)
          Removes the group component at the specified index.
 void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
          Removes a listener from the list that's notified each time a change to the selection occurs.
 void setActionAt(int index, javax.swing.Action action)
          Sets the action at the specify index.
 void setComponentAt(int index, java.awt.Component comp)
          Sets the group component at the specify index.
 void setLayout(java.awt.LayoutManager mgr)
           
 void setSelectedComponent(java.awt.Component comp)
          Sets the selected component for this sidepane.
 void setSelectedIndex(int index)
          Sets the selected index for this sidepane.
 void setSelectionMode(int selectionMode)
          Determines whether single-item or multiple-item selections are allowed.
 void setSelectionModel(javax.swing.ListSelectionModel selectionModel)
          Sets the selectionModel for the list to a non-null ListSelectionModel implementation.
 void updateUI()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSidePane

public JSidePane()
Constructs a JSidePane.
Method Detail

updateUI

public void updateUI()
Overrides:
updateUI in class javax.swing.JComponent

createSelectionModel

protected javax.swing.ListSelectionModel createSelectionModel()
Returns an instance of DefaultListSelectionModel. This method is used by the constructor to initialize the selectionModel property.
Returns:
the ListSelectionModel used by this JList.
See Also:
setSelectionModel(javax.swing.ListSelectionModel), DefaultListSelectionModel

getSelectionModel

public javax.swing.ListSelectionModel getSelectionModel()
Returns the value of the current selection model. The selection model handles the task of making single selections, selections of contiguous ranges, and non-contiguous selections.
Returns:
the ListSelectionModel that implements list selections
See Also:
setSelectionModel(javax.swing.ListSelectionModel), ListSelectionModel

fireSelectionValueChanged

protected void fireSelectionValueChanged(int firstIndex,
                                         int lastIndex,
                                         boolean isAdjusting)
Notifies JList ListSelectionListeners that the selection model has changed. It's used to forward ListSelectionEvents from the selectionModel to the ListSelectionListeners added directly to the JList.
Parameters:
firstIndex - the first selected index
lastIndex - the last selected index
isAdjusting - true if multiple changes are being made
See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener), removeListSelectionListener(javax.swing.event.ListSelectionListener), EventListenerList

addListSelectionListener

public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Adds a listener to the list that's notified each time a change to the selection occurs. Listeners added directly to the JList will have their ListSelectionEvent.getSource() == this JList (instead of the ListSelectionModel).
Parameters:
listener - the ListSelectionListener to add
See Also:
getSelectionModel(), getListSelectionListeners()

removeListSelectionListener

public void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
Removes a listener from the list that's notified each time a change to the selection occurs.
Parameters:
listener - the ListSelectionListener to remove
See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener), getSelectionModel()

getListSelectionListeners

public javax.swing.event.ListSelectionListener[] getListSelectionListeners()
Returns an array of all the ListSelectionListeners added to this JList with addListSelectionListener().
Returns:
all of the ListSelectionListeners added or an empty array if no listeners have been added
See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener)

setSelectionModel

public void setSelectionModel(javax.swing.ListSelectionModel selectionModel)
Sets the selectionModel for the list to a non-null ListSelectionModel implementation. The selection model handles the task of making single selections, selections of contiguous ranges, and non-contiguous selections.

This is a JavaBeans bound property.

Parameters:
selectionModel - the ListSelectionModel that implements the selections
Throws:
java.lang.IllegalArgumentException - if selectionModel is null
See Also:
getSelectionModel()

setSelectionMode

public void setSelectionMode(int selectionMode)
Determines whether single-item or multiple-item selections are allowed. The following selectionMode values are allowed:
Parameters:
selectionMode - an integer specifying the type of selections that are permissible
See Also:
getSelectionMode()

getSelectionMode

public int getSelectionMode()
Returns whether single-item or multiple-item selections are allowed.
Returns:
the value of the selectionMode property
See Also:
setSelectionMode(int)

setSelectedIndex

public void setSelectedIndex(int index)
Sets the selected index for this sidepane. The index must be a valid component index or -1, which indicates that no component should be selected (can also be used when there are no components in the sidepane). If a -1 value is specified when the sidepane contains one or more components, then the results will be implementation defined.
Parameters:
index - the index to be selected
Throws:
java.lang.IndexOutOfBoundsException - if index is out of range (index < -1 || index >= component count)
See Also:
getSelectedIndex(), SingleSelectionModel.setSelectedIndex(int)

getSelectedIndex

public int getSelectedIndex()
Returns the currently selected index for this sidepane. Returns -1 if there is no currently selected .
Returns:
the index of the selected component
See Also:
setSelectedIndex(int)

setSelectedComponent

public void setSelectedComponent(java.awt.Component comp)
Sets the selected component for this sidepane. This will automatically set the selectedIndex to the index corresponding to the specified component.
Throws:
java.lang.IllegalArgumentException - if component not found in componentbed pane
See Also:
getSelectedComponent()

getSelectedComponent

public java.awt.Component getSelectedComponent()
Returns the currently selected component for this sidepane. Returns null if there is no currently display card.
Returns:
the component corresponding to the selected component
See Also:
setSelectedComponent(java.awt.Component)

setLayout

public final void setLayout(java.awt.LayoutManager mgr)
Overrides:
setLayout in class java.awt.Container

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

addGroup

public void addGroup(java.awt.Component comp)
Adds the group component.
Parameters:
comp - the component to add

addGroup

public void addGroup(java.awt.Component comp,
                     javax.swing.Action action)
Adds the group componet with the group header action.
Parameters:
comp - the group component
action - the group action

addGroupAt

public void addGroupAt(java.awt.Component comp,
                       javax.swing.Action action,
                       int index)
Adds the group component at the specify index with the group header action.
Parameters:
comp - the component to add
action - the group action
index - the component index
Throws:
java.lang.IndexOutOfBoundsException -  

removeGroupAt

public void removeGroupAt(int index)
Removes the group component at the specified index.
Parameters:
index - the specified group index

removeGroup

public void removeGroup(java.awt.Component comp)
Removes the group component.
Parameters:
comp - the component to remove

removeAllGroup

public void removeAllGroup()
Removes all group component.

getGroupCount

public int getGroupCount()
Returns the group count.
Returns:
the group count

setComponentAt

public void setComponentAt(int index,
                           java.awt.Component comp)
Sets the group component at the specify index.
Parameters:
index - the specify index
component - the component

getComponentAt

public java.awt.Component getComponentAt(int index)
Returns the component at the specify index.
Parameters:
index - the specify index
Returns:
the component at the specify index

indexOfComponent

public int indexOfComponent(java.awt.Component comp)
Returns the index for the specify component.
Parameters:
comp - the specify component
Returns:
the index for the specify component

setActionAt

public void setActionAt(int index,
                        javax.swing.Action action)
Sets the action at the specify index. This action used by group header.
Parameters:
action - the group header action

getActionAt

public javax.swing.Action getActionAt(int index)
Returns the action at the specify index.
Parameters:
index - the specify index
Returns:
the action at the specify index

indexOfAction

public int indexOfAction(javax.swing.Action action)
Returns the action at the specify index.
Parameters:
index - the specify index
Returns:
the action for the specify component

createDefaultButton

public javax.swing.JButton createDefaultButton()

paramString

protected java.lang.String paramString()
Returns a string representation of this JSidePane. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
Overrides:
paramString in class javax.swing.JComponent
Returns:
a string representation of this JSidePane.

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JSidePane. For JSidePanes, the AccessibleContext takes the form of an AccessibleJSidePane. A new AccessibleJSidePane instance is created if necessary.
Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class javax.swing.JComponent
Returns:
an AccessibleJSidePane that serves as the AccessibleContext of this JSidePane


Copyright © 2001-2003 Extreme Component, Inc. All rights reserved.