Class LabelComponent
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.graffiti.plugin.view.AttributeComponent
org.graffiti.plugin.attributecomponent.AbstractAttributeComponent
org.graffiti.plugins.attributecomponents.simplelabel.LabelComponent
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,GraphicAttributeConstants
,PreferencesInterface
,GraffitiViewComponent
- Direct Known Subclasses:
SimpleLabelComponent
public class LabelComponent extends AbstractAttributeComponent implements GraphicAttributeConstants, PreferencesInterface
This component represents a label for a node or an edge.
- Version:
- $Revision: 1.59 $
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Fields Modifier and Type Field Description static String
PREF_DRAWRECT_MINSIZE
static String
PREF_MINSIZE_VISIBILITY
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 org.graffiti.graphics.GraphicAttributeConstants
ABOVE, ABOVELEFT, ABOVERIGHT, ABSHOR, ABSVERT, ALIGNMENT, ALIGNSEGMENT, ANCHOR, ARROWHEAD, ARROWTAIL, AUTO_OUTSIDE, AXISCOLOR, BELOW, BELOWLEFT, BELOWRIGHT, BENDS, BENDS_PATH, BGIMAGE, BLUE, BORDER_BOTTOM_CENTER, BORDER_BOTTOM_LEFT, BORDER_BOTTOM_RIGHT, BORDER_LEFT_BOTTOM, BORDER_LEFT_CENTER, BORDER_LEFT_TOP, BORDER_RIGHT_BOTTOM, BORDER_RIGHT_CENTER, BORDER_RIGHT_TOP, BORDER_TOP_CENTER, BORDER_TOP_LEFT, BORDER_TOP_RIGHT, CATEGORY_BACKGROUND_A, CATEGORY_BACKGROUND_B, CATEGORY_BACKGROUND_C, CENTERED, CENTERED_FIT, CHARTBACKGROUNDCOLOR, CIRCLE_CLASSNAME, COLOR, COMMON, COORD_PATH, COORDINATE, COORDX_PATH, COORDY_PATH, CUBICSPLINE, CUBICSPLINE_CLASSNAME, DEFAULT_CAP_B, DEFAULT_CAP_R, DEFAULT_JOIN, DEFAULT_MITER, DIM_PATH, DIMENSION, DIMH_PATH, DIMW_PATH, DOCKING, DOCKING_PATH, ELLIPSE_CLASSNAME, FILLCOLOR, FILLCOLOR_PATH, FONTNAME, FONTSIZE, FONTSTYLE, FRAMECOLOR, FRAMETHICKNESS, FRAMETHICKNESS_PATH, GRADIENT, GRAPHICS, GREEN, GRIDCOLOR, HEATMAP_LOWER_COL, HEATMAP_MIDDLE_COL, HEATMAP_UPPER_COL, HEIGHT, HIDDEN, IMAGE, IN, INSIDEBOTTOM, INSIDEBOTTOMLEFT, INSIDEBOTTOMRIGHT, INSIDELEFT, INSIDERIGHT, INSIDETOP, INSIDETOPLEFT, INSIDETOPRIGHT, LABEL, LABEL_ATTRIBUTE_PATH, LABEL_DISTANCE, LABELGRAPHICS, LABELOFFSET, LEFT, LINEMODE, LINETYPE, LINEWIDTH_PATH, LOCALALIGN, MAXIMIZE, NAME, NEARSOURCE, NEARTARGET, OPAC, OUT, OUTLINE_PATH, POLYCLOSED_CLASSNAME, POLYLINE, POLYLINE_CLASSNAME, PORT, PORTS, PORTS_PATH, POSITION, RECTANGLE_CLASSNAME, RED, REF, RELALIGN, RELHOR, RELVERT, RIGHT, ROUNDING, SHADOWCOLOR, SHADOWOFFSET, SHAPE, SHAPE_DESC_PATH, SHAPE_PATH, SHAPEDESCRIPTION, SMOOTH_CLASSNAME, SMOOTHLINE, SOURCE, SQUARESPLINE, SQUARESPLINE_CLASSNAME, STRAIGHTLINE, STRAIGHTLINE_CLASSNAME, TARGET, TEXTCOLOR, THICKNESS, TILED, WIDTH, X, Y
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors Constructor Description LabelComponent()
Constructs a newLabelComponent
-
Method Summary
Modifier and Type Method Description void
adjustComponentPosition()
adjust the component position onlyvoid
adjustComponentSize()
adjust the component size and positionvoid
attributeChanged(Attribute attr)
Called when an attribute of the attribute represented by this component has changed.static String
getBestAutoOutsideSetting(Node n)
List<Parameter>
getDefaultParameters()
On first start or on reset there will be no preferences available.LabelFrameSetting
getLabelFrameSetting()
String
getPreferencesAlternativeName()
return a custom preference category, that this class will reside in.void
highlight(boolean value, MouseEvent e)
void
paint(Graphics g)
void
recreate()
Used when the shape changed in the datastructure.void
setAttribute(Attribute attr)
obviousvoid
updateLabelPosition()
Using the information from the associatedLabelAttribute
and the shape and position of theGraphElement
to calculate and set the position of the label.void
updatePreferences(Preferences preferences)
This method will be called, when preferences for this class have changed and the implementing class gets the chance of setting class (static) variables having the values of the parameters.Methods inherited from class org.graffiti.plugin.attributecomponent.AbstractAttributeComponent
checkVisibility, createNewShape, getAttribute, paintComponent, setGraphElementShape, setShift
Methods inherited from class org.graffiti.plugin.view.AttributeComponent
setAlpha, setHidden
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
PREF_MINSIZE_VISIBILITY
-
PREF_DRAWRECT_MINSIZE
-
-
Constructor Details
-
LabelComponent
public LabelComponent()Constructs a newLabelComponent
-
-
Method Details
-
getDefaultParameters
Description copied from interface:PreferencesInterface
On first start or on reset there will be no preferences available. The PreferenceManager will read this list containing the set of settings, that the implementing class thinks can be configured provide default values. All Parameters in this list will also appear in the PreferenceDialog. Entities providing preferences should add parameters to this array.- Specified by:
getDefaultParameters
in interfacePreferencesInterface
-
updatePreferences
Description copied from interface:PreferencesInterface
This method will be called, when preferences for this class have changed and the implementing class gets the chance of setting class (static) variables having the values of the parameters. Setting static class variables will help increase speed, when querying the parameters. Direct variable access VS querying the Preferences Object for this class- Specified by:
updatePreferences
in interfacePreferencesInterface
-
getPreferencesAlternativeName
Description copied from interface:PreferencesInterface
return a custom preference category, that this class will reside in. If null is returned, this class will be put into a standard category dependent on its Super class- Specified by:
getPreferencesAlternativeName
in interfacePreferencesInterface
- Returns:
-
highlight
- Overrides:
highlight
in classAttributeComponent
-
setAttribute
obvious- Overrides:
setAttribute
in classAbstractAttributeComponent
- Parameters:
attr
-
-
attributeChanged
Called when an attribute of the attribute represented by this component has changed.- Specified by:
attributeChanged
in interfaceGraffitiViewComponent
- Specified by:
attributeChanged
in classAbstractAttributeComponent
- Parameters:
attr
- the attribute that has triggered the event.- Throws:
ShapeNotFoundException
- DOCUMENT ME!
-
recreate
public void recreate()Used when the shape changed in the datastructure. Makes the painter create a new shape.- Specified by:
recreate
in classAbstractAttributeComponent
- Throws:
ShapeNotFoundException
- DOCUMENT ME!
-
paint
- Overrides:
paint
in classAbstractAttributeComponent
-
adjustComponentSize
public void adjustComponentSize()Description copied from class:AttributeComponent
adjust the component size and position- Overrides:
adjustComponentSize
in classAbstractAttributeComponent
-
adjustComponentPosition
public void adjustComponentPosition()Description copied from class:AttributeComponent
adjust the component position only- Overrides:
adjustComponentPosition
in classAbstractAttributeComponent
-
updateLabelPosition
public void updateLabelPosition()Using the information from the associatedLabelAttribute
and the shape and position of theGraphElement
to calculate and set the position of the label. -
getBestAutoOutsideSetting
-
getLabelFrameSetting
-