ilog.views.diagrammer.application
Class IlvDiagrammerPaletteBar

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
                      extended by ilog.views.diagrammer.application.IlvDiagrammerPaletteBar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class IlvDiagrammerPaletteBar
extends IlvDiagrammerToolBar

The IlvDiagrammerPaletteBar is a prebuilt toolbar containing actions to create new nodes and links in an IlvDiagrammer component.

The palette bar contains a set of actions created using the getActions method. To create a palette bar, you must specify a "palette" data file. Each object (node or link) contained in this file will be used to create a new icon in the palette.

The palette can also be populated automatically with sample nodes and links from an existing diagram (see setAutomatic).

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
IlvDiagrammerPaletteBar()
          Creates a new, horizontal diagrammer palette bar with a default palette URL and style sheet.
IlvDiagrammerPaletteBar(boolean automatic, int orientation)
          Creates a new empty palette bar with a specified orientation.
IlvDiagrammerPaletteBar(URL paletteURL, URL styleSheet, int orientation)
          Creates a new diagrammer palette bar.
 
Method Summary
 void addNotify()
           
static IlvDiagrammerAction[] getActions(IlvDiagrammer palette, IlvDiagrammerHashFunction hashFunction)
          Creates a set of palette actions.
 IlvDiagrammerHashFunction getHashFunction()
          Sets the hash function used to filter equivalent nodes or links is automatic mode.
 URL getPaletteURL()
          Returns the palette URL.
 URL getStyleSheet()
          Returns the style sheet.
 boolean isAutomatic()
          Returns true if this palette toolbar is populated automatically with sample objects from the current diagrammer component of the application.
 void removeNotify()
           
 void setAutomatic(boolean automatic)
          Enables or disable the "automatic" mode for this palette toolbar.
 void setHashFunction(IlvDiagrammerHashFunction hashFunction)
          Returns the hash function used to filter equivalent nodes or links is automatic mode.
 void setPaletteURL(URL paletteURL)
          Changes the palette URL, and updates the contents of the toolbar.
 void setStyleSheet(URL styleSheet)
          Changes the style sheet, and updates the contents of the toolbar.
 
Methods inherited from class ilog.views.diagrammer.application.IlvDiagrammerToolBar
addAction, addActions, getActions, indexOf, insertAction, removeAction, setActions
 
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, 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, 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

IlvDiagrammerPaletteBar

public IlvDiagrammerPaletteBar(URL paletteURL,
                               URL styleSheet,
                               int orientation)
                        throws IOException,
                               IlvDiagrammerException
Creates a new diagrammer palette bar.

Parameters:
paletteURL - The URL of the XML data file that defines the objects to add to the palette.
styleSheet - The URL of the style sheet used to render the icons representing the objects in the palette.
orientation - The orientation of the toolbar.
Throws:
IOException - if an I/O exception occurs while loading the palette URL or the style sheet.
IlvDiagrammerException - if an I/O exception occurs while loading the palette URL or the style sheet.

IlvDiagrammerPaletteBar

public IlvDiagrammerPaletteBar()
                        throws IOException,
                               IlvDiagrammerException
Creates a new, horizontal diagrammer palette bar with a default palette URL and style sheet.

Throws:
IOException - if an I/O exception occurs while loading the default palette URL or the default style sheet.
IlvDiagrammerException - if an I/O exception occurs while loading the default palette URL or the default style sheet.

IlvDiagrammerPaletteBar

public IlvDiagrammerPaletteBar(boolean automatic,
                               int orientation)
                        throws IOException,
                               IlvDiagrammerException
Creates a new empty palette bar with a specified orientation. The new palette bar can optionally be set to automatic mode.

Parameters:
automatic - If true, the new toolbar in is automatic mode. See setAutomatic(boolean) for an explanation of automatic mode.
orientation - The orientation of the toolbar.
Throws:
IOException - never, since this constructor does not populate the palette bar.
IlvDiagrammerException - never, since this constructor does not populate the palette bar.
Method Detail

isAutomatic

public boolean isAutomatic()
Returns true if this palette toolbar is populated automatically with sample objects from the current diagrammer component of the application.

See Also:
setAutomatic(boolean)

setAutomatic

public void setAutomatic(boolean automatic)
Enables or disable the "automatic" mode for this palette toolbar. In automatic mode, the palette is automatically populated with sample nodes and links from the current diagrammer object of the application. So, in automatic mode, the palette needs not be populated explicitely using setPaletteURL(java.net.URL) and setStyleSheet(java.net.URL).

Equivalent nodes and links are added only once in the palette. Two nodes or links are considered equivalent if the hash function returned by getHashFunction() return hash codes that are equal.

Parameters:
automatic - The new value of the automatic mode.
See Also:
isAutomatic(), setHashFunction(ilog.views.diagrammer.application.IlvDiagrammerHashFunction)

addNotify

public void addNotify()
Overrides:
addNotify in class JComponent

removeNotify

public void removeNotify()
Overrides:
removeNotify in class JComponent

getHashFunction

public IlvDiagrammerHashFunction getHashFunction()
Sets the hash function used to filter equivalent nodes or links is automatic mode. By default, an instanceof of the base class IlvDiagrammerHashFunction is used.

See Also:
setAutomatic(boolean)

setHashFunction

public void setHashFunction(IlvDiagrammerHashFunction hashFunction)
Returns the hash function used to filter equivalent nodes or links is automatic mode.

See Also:
setHashFunction(ilog.views.diagrammer.application.IlvDiagrammerHashFunction)

getPaletteURL

public URL getPaletteURL()
Returns the palette URL.


setPaletteURL

public void setPaletteURL(URL paletteURL)
                   throws IOException,
                          IlvDiagrammerException
Changes the palette URL, and updates the contents of the toolbar.

Parameters:
paletteURL - The new palette URL.
Throws:
IOException
IlvDiagrammerException

getStyleSheet

public URL getStyleSheet()
Returns the style sheet.


setStyleSheet

public void setStyleSheet(URL styleSheet)
                   throws IOException,
                          IlvDiagrammerException
Changes the style sheet, and updates the contents of the toolbar.

Parameters:
styleSheet - The new style sheet.
Throws:
IOException
IlvDiagrammerException

getActions

public static IlvDiagrammerAction[] getActions(IlvDiagrammer palette,
                                               IlvDiagrammerHashFunction hashFunction)
Creates a set of palette actions.

This method is useful to use an existing toolbar as a palette. The toolbar does not need to be an IlvDiagrammerPaletteBar (for example, it may be an ILOG JViews Application Framework toolbar).

For each object in the palette Diagrammer, an action is created, with an icon and a tooltip representing the rendered object.

The resulting action array can be used to populate any JToolBar.

You can pass an IlvDiagrammerHashFunction to populate the palette with only one instance of each "type" of node or link. Nodes or links are considered equal if the hash function returns the same hash code.

Parameters:
palette - The Diagrammer containing the set of nodes and links to use as "prototypes" in the palette.
hashFunction - The hash function used to filter equivalent nodes and links. If a node or link is considered "equal" to another node or link that is already in the palette, it will not be added. Nodes or links are considered equal if the hash function returns the same hash code. If this parameter is null, all objects from the palette diagrammer are added.


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