com.tensegrity.gui.swing.repository
Class VisualGraphObjectRepositoryItem

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JLabel
                  extended bycom.tensegrity.gui.swing.repository.AbstractRepositoryItem
                      extended bycom.tensegrity.gui.swing.repository.VisualGraphObjectRepositoryItem
All Implemented Interfaces:
javax.accessibility.Accessible, Evaluable, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable, javax.swing.SwingConstants
Direct Known Subclasses:
TemplateRepositoryItem

public class VisualGraphObjectRepositoryItem
extends AbstractRepositoryItem
implements Evaluable

The VisualGraphObjectRepositoryItem is used to display a VisualGraphObject into a JLabel and can be used within any context of the java swing API.

Additionally to display the VisualGraphObject this VisualGraphObjectRepositoryItem enables the drag and drop mechanism of the java swing API such that the VisualGraphObject can be dragged out of the repository item and dropped onto any appropriate control.

Version:
$Id: VisualGraphObjectRepositoryItem.java,v 1.46 2005/12/01 15:55:41 BurkhardWick Exp $
Author:
MichaelKegel
See Also:
Serialized Form

Nested Class Summary
static interface VisualGraphObjectRepositoryItem.DragActionListener
           A listener that will be notified when a drag action started or ended concerning a VisualGraphObjectRepositoryItem item.
 
Nested classes inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JLabel
labelFor
 
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
VisualGraphObjectRepositoryItem(DragContext vgoDragSource, VisualGraphObject vgo, java.lang.String tooltip)
          Deprecated. Do not use this constructor anymore to avoid hardwired non-localized tooltip. Use VisualGraphObjectRepositoryItem(DragContext, VisualGraphObject, UIManager, String) instead.
VisualGraphObjectRepositoryItem(DragContext vgoDragSource, VisualGraphObject vgo, java.lang.String tooltip, java.lang.String iconpath, java.lang.Class resourceclass)
          Deprecated. Do not use this constructor anymore to avoid hardwired non-localized tooltip. Use VisualGraphObjectRepositoryItem(DragContext, VisualGraphObject, UIManager, String, String, Class) instead.
VisualGraphObjectRepositoryItem(DragContext vgoDragSource, VisualGraphObject vgo, UIManager uiManager, java.lang.String tooltipID)
          Constructor for VisualGraphObjectRepositoryItem based on the VisualGraphObject and a DragContext required for proper drag and drop support.
VisualGraphObjectRepositoryItem(DragContext vgoDragSource, VisualGraphObject vgo, UIManager uiManager, java.lang.String tooltip, java.lang.String iconpath, java.lang.Class resourceclass)
          Constructor for VisualGraphObjectRepositoryItem based on the VisualGraphObject.
 
Method Summary
 void addDragActionListener(VisualGraphObjectRepositoryItem.DragActionListener dal)
          Adds an listener that will be called when a drag operation started
 void applyEvList()
          Tells the component to apply its UIItemEvaluationList.
protected  void endDrag(java.awt.dnd.DragSourceDropEvent event)
          Called when a dragging operation ends.
 VisualGraphObject[] getAdditionalVGOS()
           
 BaseComposite getComposite()
          Returns the BaseComposite of the internal VisualGraphObject.
 java.util.List getComposites()
          Returns all basecomposites that are referenced by the repository item - The drag representation (which was given as constructor argument) - The base composite used to render the icon - Additional objects that have been added to this item
 void installEvList()
          Tells the component to setup its internal state.
 void removeDragActionListener(VisualGraphObjectRepositoryItem.DragActionListener dal)
          Removes an listener that will be called when a drag operation started
 void revalidateIcon()
          Revalidates the icon representation for this repository item after changes to the visual graph object.
 void setAdditionalVGOS(VisualGraphObject[] additional_vgos)
           
 void setBorder(javax.swing.border.Border border)
           
 void setIcon(javax.swing.Icon icon)
           
protected  boolean startDrag(java.awt.dnd.DragGestureEvent event)
          Called when a dragging operation starts.
 
Methods inherited from class com.tensegrity.gui.swing.repository.AbstractRepositoryItem
getDefaultBackground, getDefaultBorder, getDefaultInsets, getHighlightColor, getHoveredBorder, getHoveredInsets, getInsets, getInsets, getPressedBackground, getPressedColor, getUnpressedColor, isHighlighted, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, paintBorder, setDefaultBackground, setDefaultBorder, setDefaultInsets, setHighlightColor, setHighlighted, setHoveredBorder, setHoveredInsets, setPressedBackground
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, 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, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

VisualGraphObjectRepositoryItem

public VisualGraphObjectRepositoryItem(DragContext vgoDragSource,
                                       VisualGraphObject vgo,
                                       java.lang.String tooltip,
                                       java.lang.String iconpath,
                                       java.lang.Class resourceclass)
Deprecated. Do not use this constructor anymore to avoid hardwired non-localized tooltip. Use VisualGraphObjectRepositoryItem(DragContext, VisualGraphObject, UIManager, String, String, Class) instead.

Constructor for VisualGraphObjectRepositoryItem based on the VisualGraphObject.

Parameters:
vgoDragSource - the DragContext instance to use and update when the VisualGraphObject is transferred via drag and drop
vgo - the VisualGraphObject instance to display and transfer.
tooltip - the tooltip to display.
iconpath - string representing a path to an icon to be used instead of the VisualGraphObject.
resourceclass - Class to be used to load the icon.

VisualGraphObjectRepositoryItem

public VisualGraphObjectRepositoryItem(DragContext vgoDragSource,
                                       VisualGraphObject vgo,
                                       UIManager uiManager,
                                       java.lang.String tooltip,
                                       java.lang.String iconpath,
                                       java.lang.Class resourceclass)
Constructor for VisualGraphObjectRepositoryItem based on the VisualGraphObject.

Parameters:
vgoDragSource - the DragContext instance to use and update when the VisualGraphObject is transferred via drag and drop
vgo - the VisualGraphObject instance to display and transfer.
uiManager - UIManager to obtain localized text from.
tooltip - the tooltip to display.
iconpath - string representing a path to an icon to be used instead of the VisualGraphObject.
resourceclass - Class to be used to load the icon.

VisualGraphObjectRepositoryItem

public VisualGraphObjectRepositoryItem(DragContext vgoDragSource,
                                       VisualGraphObject vgo,
                                       UIManager uiManager,
                                       java.lang.String tooltipID)
Constructor for VisualGraphObjectRepositoryItem based on the VisualGraphObject and a DragContext required for proper drag and drop support. Use the UIManager to enable this item to have a localized tooltip, which changes to the selected language whenever the enclosing application changes the language.

Parameters:
vgoDragSource - DragContext for proper drag and drop support.
vgo - the VisualGraphObject for this RepositoryItem.
uiManager - UIManager to obtain localized text from.
tooltipID - the GUI id for the text resource for the tooltip.

VisualGraphObjectRepositoryItem

public VisualGraphObjectRepositoryItem(DragContext vgoDragSource,
                                       VisualGraphObject vgo,
                                       java.lang.String tooltip)
Deprecated. Do not use this constructor anymore to avoid hardwired non-localized tooltip. Use VisualGraphObjectRepositoryItem(DragContext, VisualGraphObject, UIManager, String) instead.

Creates a new VisualGraphObjectRepositoryItem based on the given vgo. A DragContext is required for the proper drag and drop support and a tooltip to be displayed whenever the system considers this as useful.

Parameters:
vgoDragSource - DragContext for proper drag and drop support.
vgo - the VisualGraphObject for this RepositoryItem.
tooltip - the tooltip.
Method Detail

revalidateIcon

public void revalidateIcon()
Revalidates the icon representation for this repository item after changes to the visual graph object.


setAdditionalVGOS

public void setAdditionalVGOS(VisualGraphObject[] additional_vgos)

getAdditionalVGOS

public VisualGraphObject[] getAdditionalVGOS()

getComposite

public BaseComposite getComposite()
Returns the BaseComposite of the internal VisualGraphObject.

Returns:

getComposites

public java.util.List getComposites()
Returns all basecomposites that are referenced by the repository item - The drag representation (which was given as constructor argument) - The base composite used to render the icon - Additional objects that have been added to this item

Returns:
A list of all base composites referenced by this item

startDrag

protected boolean startDrag(java.awt.dnd.DragGestureEvent event)
Called when a dragging operation starts. Might be overridden to alter the behavior

Parameters:
event - The event that started the drag
Returns:
false to cancel the dragging

endDrag

protected void endDrag(java.awt.dnd.DragSourceDropEvent event)
Called when a dragging operation ends. Might be overridden to alter the behavior

Parameters:
event - The event that triggered the call

installEvList

public void installEvList()
Description copied from interface: Evaluable
Tells the component to setup its internal state.

Specified by:
installEvList in interface Evaluable

applyEvList

public void applyEvList()
Description copied from interface: Evaluable
Tells the component to apply its UIItemEvaluationList.

Specified by:
applyEvList in interface Evaluable

addDragActionListener

public void addDragActionListener(VisualGraphObjectRepositoryItem.DragActionListener dal)
Adds an listener that will be called when a drag operation started

Parameters:
dal - The listener to add

removeDragActionListener

public void removeDragActionListener(VisualGraphObjectRepositoryItem.DragActionListener dal)
Removes an listener that will be called when a drag operation started

Parameters:
dal - The listener to remove

setBorder

public void setBorder(javax.swing.border.Border border)

setIcon

public void setIcon(javax.swing.Icon icon)


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.