ilog.views.diagrammer.application
Class IlvDiagrammerToolBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JToolBar
                  extended by ilog.views.diagrammer.application.IlvDiagrammerToolBar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
IlvDiagrammerEditBar, IlvDiagrammerPaletteBar, IlvDiagrammerViewBar

public class IlvDiagrammerToolBar
extends JToolBar

The IlvDiagrammerToolBar is a toolbar that can be attached to a diagram component, IlvDiagrammer.

An IlvDiagrammerToolBar contains buttons linked to Diagrammer actions, IlvDiagrammerAction. The contents of the toolbar are specified through an array of actions (either in the constructor, or through the setActions(javax.swing.Action[]) method).

You can use this class directly and populate it with the actions of your choice, or you can use the subclasses that are already populated with predefined action sets: IlvDiagrammerViewBar, IlvDiagrammerEditBar, IlvDiagrammerPaletteBar.

Note that this class is only a convenient way to create toolbars attached to a diagram component. You can also use a standard JToolBar and add Diagrammer actions to it using the standard Swing API.

Diagrammer actions are routed automatically to the "current" IlvDiagrammer instance of a Swing hierarchy, so in most cases you have nothing to do to associate a toolbar to its diagram component. In some cases, though, you may need to use the method IlvDiagrammer.setCurrentDiagrammer(Component, IlvDiagrammer, boolean) (passing the toolbar as the Component parameter) to specify which diagram component a toolbar will act on. See IlvDiagrammer.getCurrentDiagrammer(Component) for more details.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JToolBar
JToolBar.AccessibleJToolBar, JToolBar.Separator
 
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.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IlvDiagrammerToolBar()
          Creates a new, empty, horizontal Diagrammer toolbar.
IlvDiagrammerToolBar(Action[] actions, int orientation)
          Creates a new Diagrammer toolbar attached to the specified diagram component, containing the specified actions, and with the specified orientation.
IlvDiagrammerToolBar(Action[] actions, int orientation, boolean cloneActions)
          Creates a new Diagrammer toolbar attached to the specified diagram component, containing the specified actions, and with the specified orientation.
 
Method Summary
 AbstractButton addAction(Action action)
          Adds a button linked to a specified action to this toolbar.
 void addActions(Action[] actions)
          Adds a set of actions.
 Action[] getActions()
          Returns the actions contained in this toolbar.
 int indexOf(Action action)
          Returns the index of the button associated with the specified action.
 AbstractButton insertAction(Action action, int index)
          Adds a button linked to a specified action to this toolbar.
 void removeAction(Action action)
          Removes the button linked to the specified action from this toolbar.
 void setActions(Action[] actions)
          Sets the actions contained in this toolbar.
 
Methods inherited from class javax.swing.JToolBar
add, addImpl, addSeparator, addSeparator, createActionChangeListener, createActionComponent, getAccessibleContext, getComponentAtIndex, getComponentIndex, getMargin, getOrientation, getUI, getUIClassID, isBorderPainted, isFloatable, isRollover, paintBorder, paramString, setBorderPainted, setFloatable, setLayout, setMargin, setOrientation, setRollover, 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, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, 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, 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, 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
 

Constructor Detail

IlvDiagrammerToolBar

public IlvDiagrammerToolBar(Action[] actions,
                            int orientation,
                            boolean cloneActions)
Creates a new Diagrammer toolbar attached to the specified diagram component, containing the specified actions, and with the specified orientation.

Parameters:
actions - The actions contained in the toolbar. This parameter can be null: in that case, you must populate the toolbar by calling setActions(javax.swing.Action[]) or {#link #addAction}.
orientation - The orientation of the toolbar. This can be SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
cloneActions - If this parameter is true, the toolbar will contain cloned copies of the actions instead of the original actions. This is useful to use toolbars with the same actions but that will act on different Diagrammer instances.
Since:
JViews 6.5

IlvDiagrammerToolBar

public IlvDiagrammerToolBar(Action[] actions,
                            int orientation)
Creates a new Diagrammer toolbar attached to the specified diagram component, containing the specified actions, and with the specified orientation.

Parameters:
actions - The actions contained in the toolbar. This parameter can be null: in that case, you must populate the toolbar by calling setActions(javax.swing.Action[]) or {#link #addAction}.
orientation - The orientation of the toolbar. This can be SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.

IlvDiagrammerToolBar

public IlvDiagrammerToolBar()
Creates a new, empty, horizontal Diagrammer toolbar. You must populate the toolbar by calling setActions(javax.swing.Action[]) or {#link #addAction}.

Method Detail

setActions

public void setActions(Action[] actions)
Sets the actions contained in this toolbar. For each action, a button will be added to the toolbar. The button will be a JToggleButton or a JButton, depending on whether ComponentAction.isSelectable() returns true or false. All the existing buttons are removed from the toolbar before adding the new actions.

Parameters:
actions - The actions that will be added to the toolbar.

getActions

public Action[] getActions()
Returns the actions contained in this toolbar.

See Also:
setActions(javax.swing.Action[])

addAction

public AbstractButton addAction(Action action)
Adds a button linked to a specified action to this toolbar. The button will be a JToggleButton or a JButton, depending on whether ComponentAction.isSelectable() returns true or false.

Parameters:
action - The action to perform when the button is pressed.

removeAction

public void removeAction(Action action)
Removes the button linked to the specified action from this toolbar.

Parameters:
action - The action to remove.

insertAction

public AbstractButton insertAction(Action action,
                                   int index)
Adds a button linked to a specified action to this toolbar. The button will be a JToggleButton or a JButton, depending on whether ComponentAction.isSelectable() returns true or false.

This method is similar to addAction(javax.swing.Action), but it lets you specify the position of the new button.

Parameters:
action - The action to perform when the button is pressed.
index - The index at which the new button must be inserted.

addActions

public void addActions(Action[] actions)
Adds a set of actions. This method calls addAction(javax.swing.Action) for all the actions in the array.

Parameters:
actions - The actions to add.

indexOf

public int indexOf(Action action)
Returns the index of the button associated with the specified action.

Parameters:
action - The action whose index is requested, or -1 if the action was not found in this toolbar.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.