public class IlvDiagrammerPaletteBar extends IlvDiagrammerToolBar
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
).
JToolBar.AccessibleJToolBar, JToolBar.Separator
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
addNotify()
Notifies this component that it now has a parent component.
|
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()
Notifies this component that it no longer has a parent component.
|
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.
|
addAction, addActions, getActions, indexOf, insertAction, removeAction, setActions
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
addAncestorListener, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public IlvDiagrammerPaletteBar(URL paletteURL, URL styleSheet, int orientation) throws IOException, IlvDiagrammerException
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.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.public IlvDiagrammerPaletteBar() throws IOException, IlvDiagrammerException
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.public IlvDiagrammerPaletteBar(boolean automatic, int orientation) throws IOException, IlvDiagrammerException
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.IOException
- never, since this constructor does not populate
the palette bar.IlvDiagrammerException
- never, since this constructor does not
populate the palette bar.public boolean isAutomatic()
true
if this palette toolbar is populated
automatically with sample objects from the current diagrammer component
of the application.setAutomatic(boolean)
public void setAutomatic(boolean automatic)
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.
automatic
- The new value of the automatic mode.isAutomatic()
,
setHashFunction(ilog.views.diagrammer.application.IlvDiagrammerHashFunction)
public void addNotify()
addNotify
in class JComponent
public void removeNotify()
removeNotify
in class JComponent
public IlvDiagrammerHashFunction getHashFunction()
IlvDiagrammerHashFunction
is used.setAutomatic(boolean)
public void setHashFunction(IlvDiagrammerHashFunction hashFunction)
public URL getPaletteURL()
public void setPaletteURL(URL paletteURL) throws IOException, IlvDiagrammerException
paletteURL
- The new palette URL.IOException
IlvDiagrammerException
public URL getStyleSheet()
public void setStyleSheet(URL styleSheet) throws IOException, IlvDiagrammerException
styleSheet
- The new style sheet.IOException
IlvDiagrammerException
public static IlvDiagrammerAction[] getActions(IlvDiagrammer palette, IlvDiagrammerHashFunction hashFunction)
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 a Perforce 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.
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 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.