com.borland.primetime.actions
Class ActionToolBarPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.borland.primetime.actions.ActionToolBarPane

public class ActionToolBarPane
extends javax.swing.JPanel

The ActionToolBarPane defines a pane of toolbars dynamically built from the contents of the ActionGroups it is associated with.

ActionToolBarPanes are constructed with a source Object, which will be passed as the source of the ActionEvent when the actionPerformed methods are called in the associated actions. This allows the ActionToolBarPane to pass a particular source object (not the buttons themselves), so the associated actions can have direct access to a specific Object. This source is determined by the code that instantiates the ActionToolBarPane.

Once instantiated, you can add toolbars to the ActionToolBarPane by calling the addGroup(ActionGroup) methods. An ActionToolBar will be constructed and placed in the pane.

See Also:
ActionToolBar, ActionGroup, Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
protected  ActionGroup contextGroup
           
protected  java.awt.FlowLayout flowLayout
           
protected  java.util.ArrayList groups
           
protected  boolean horizontal
           
protected  ActionPopupMenu pop
           
protected  boolean rebuilding
           
protected  java.lang.Object source
           
protected  java.util.HashMap toolbarHash
           
protected  VerticalFlowLayout vertFlowLayout
           
 
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
 
Constructor Summary
ActionToolBarPane(java.lang.Object source)
          Constructs an ActionToolBarPane with the specified source object.
 
Method Summary
 void addGroup(ActionGroup group)
          Adds an ActionGroup (toolbar) to this ActionToolBarPane at the end.
 void addGroup(int index, ActionGroup group)
          Inserts an ActionGroup (toolbar) into this ActionToolBarPane at the specified index.
 void doLayout()
           
protected  ActionToolBar getActionToolBar(ActionGroup group)
           
 ActionGroup getContextGroup()
          Returns the context pop-up ActionGroup.
 ActionGroup getGroup(int index)
          Returns the ActionGroup (toolbar) at the specified index.
 int getGroupCount()
          Returns the count of ActionGroups (toolbars) in this ActionToolBarPane.
 ActionGroup[] getGroups()
          Returns an array containing all ActionGroups (toolbars) in this ActionToolBarPane.
 java.awt.Dimension getPreferredSize()
           
 java.lang.Object getSource()
          Returns the object source for this ActionToolBarPane.
 boolean isHorizontal()
          Returns the horizontal property setting.
 boolean isToolBarVisible(ActionGroup group)
          Returns the visible state for the specified ActionGroup (toolbar).
protected  void rebuildComplete(boolean visible)
          Subclasses should override this to hide/show the toolbar completely
 void removeGroup(ActionGroup group)
          Removes the specified ActionGroup (toolbar) from this ActionToolBarPane.
 void setContextGroup(ActionGroup group)
          Sets the context pop-up ActionGroup for this ActionToolBarPane.
 void setHorizontal(boolean horz)
          Sets the horizontal property for this ActionToolBarPane.
 void setToolBarVisible(ActionGroup group, boolean visible)
          Sets the specified ActionGroup (toolbar) to the specified visible state.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, 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, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, 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, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, 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
 

Field Detail

contextGroup

protected ActionGroup contextGroup

horizontal

protected boolean horizontal

groups

protected java.util.ArrayList groups

toolbarHash

protected java.util.HashMap toolbarHash

pop

protected ActionPopupMenu pop

source

protected java.lang.Object source

flowLayout

protected java.awt.FlowLayout flowLayout

vertFlowLayout

protected VerticalFlowLayout vertFlowLayout

rebuilding

protected boolean rebuilding
Constructor Detail

ActionToolBarPane

public ActionToolBarPane(java.lang.Object source)
Constructs an ActionToolBarPane with the specified source object.
Parameters:
source - The source object
Method Detail

getSource

public java.lang.Object getSource()
Returns the object source for this ActionToolBarPane.
Returns:
The source for this ActionToolBarPane

getGroupCount

public int getGroupCount()
Returns the count of ActionGroups (toolbars) in this ActionToolBarPane.
Returns:
An int representing the count of ActionGroups

getGroup

public ActionGroup getGroup(int index)
Returns the ActionGroup (toolbar) at the specified index.
Parameters:
index - The index of the ActionGroup
Returns:
The ActionGroup at the specified index

getGroups

public ActionGroup[] getGroups()
Returns an array containing all ActionGroups (toolbars) in this ActionToolBarPane.
Returns:
The ActionGroups in this ActionToolBarPane

addGroup

public void addGroup(ActionGroup group)
Adds an ActionGroup (toolbar) to this ActionToolBarPane at the end.
Parameters:
group - The ActionGroup to add

addGroup

public void addGroup(int index,
                     ActionGroup group)
Inserts an ActionGroup (toolbar) into this ActionToolBarPane at the specified index.
Parameters:
index - The index at which to insert the ActionGroup
group - The ActionGroup to insert

removeGroup

public void removeGroup(ActionGroup group)
Removes the specified ActionGroup (toolbar) from this ActionToolBarPane.
Parameters:
group - The ActionGroup to remove

setHorizontal

public void setHorizontal(boolean horz)
Sets the horizontal property for this ActionToolBarPane. By default, the ActionToolBarPane is oriented horizontally.
Parameters:
horz - The horizontal property setting

isHorizontal

public boolean isHorizontal()
Returns the horizontal property setting.
Returns:
True if horizontal, false if vertical

setContextGroup

public void setContextGroup(ActionGroup group)
Sets the context pop-up ActionGroup for this ActionToolBarPane. The context group defines the right-click menu contents.
Parameters:
group - The right-click context ActionGroup

getContextGroup

public ActionGroup getContextGroup()
Returns the context pop-up ActionGroup.
Returns:
The context pop-up ActionGroup.

setToolBarVisible

public void setToolBarVisible(ActionGroup group,
                              boolean visible)
Sets the specified ActionGroup (toolbar) to the specified visible state.
Parameters:
group - The ActionGroup to set the visible state for
visible - true for visible, false for invisible

isToolBarVisible

public boolean isToolBarVisible(ActionGroup group)
Returns the visible state for the specified ActionGroup (toolbar).
Parameters:
group - The ActionGroup to get the visible state for
Returns:
true for visible, false for invisible

rebuildComplete

protected void rebuildComplete(boolean visible)
Subclasses should override this to hide/show the toolbar completely

getActionToolBar

protected ActionToolBar getActionToolBar(ActionGroup group)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

doLayout

public void doLayout()
Overrides:
doLayout in class java.awt.Container