Class EditorRuler
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
de.uni_trier.wi2.procake.gui.objecteditor.nestworkfloweditor.editor.EditorRuler
- All Implemented Interfaces:
DropTargetListener,MouseMotionListener,ImageObserver,MenuContainer,Serializable,EventListener
Component that displays a ruler for a JGraph component.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intSpecified that start and length of the active region, ie the region to paint with the background border.protected intSpecified that start and length of the active region, ie the region to paint with the background border.protected static booleanInternal constant used to describe the screen resolution (DPI).protected static intInternal constant used to describe the screen resolution (DPI).protected com.mxgraph.swing.mxGraphComponentReference to the attached graph.protected ColorDefines the inactive background border.protected static intInternal constant used to describe the screen resolution (DPI).protected doubleParameters to control the display.protected Fontprotected booleanSpecifies the unit system.protected PointHolds the current and first mouse point.static final NumberFormatHolds the shared number formatter.protected intSpecifies the orientation.static intDefines the constants for horizontal and vertical orientation.static intDefines the constants for horizontal and vertical orientation.protected com.mxgraph.util.mxEventSource.mxIEventListenerprotected intSpecifies height or width of the ruler.protected doubleSpecifies the scale for the metrics.protected intSpecifies the minimum distance between two major ticks.protected doubleParameters to control the display.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionEditorRuler(com.mxgraph.swing.mxGraphComponent graphComponent, int orientation) Constructs a new ruler for the specified graph and orientation. -
Method Summary
Modifier and TypeMethodDescriptionvoiddragEnter(DropTargetDragEvent arg0) voiddragExit(DropTargetEvent arg0) voiddragOver(DropTargetDragEvent arg0) voiddrop(DropTargetDropEvent arg0) voidReturns the preferred size by replacing the respective component of the graph's preferred size withrulerSize.intReturns the ruler's horizontal or vertical size.intbooleanisMetric()Returns true if the ruler uses metric units.voidvoidvoidPaints the ruler.voidrepaint(int x, int y) Repaints the ruler between the specified 0 and x or y depending on the orientation.voidsetActiveLength(int length) Sets the length of the active region in pixels.voidsetActiveOffset(int offset) Sets the start of the active region in pixels.voidsetMetric(boolean isMetric) Sets if the ruler uses metric units.voidsetRulerSize(int rulerSize) Sets the ruler's horizontal or vertical size.voidsetTickDistance(int tickDistance) protected voidUpdates the local variables used for painting based on the current scale and unit system.protected voidRepaints the mouse position.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, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUIMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, setLayout, transferFocusDownCycle, validate, validateTreeMethods 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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, 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
-
numberFormat
Holds the shared number formatter.- See Also:
-
ORIENTATION_HORIZONTAL
public static int ORIENTATION_HORIZONTALDefines the constants for horizontal and vertical orientation. -
ORIENTATION_VERTICAL
public static int ORIENTATION_VERTICALDefines the constants for horizontal and vertical orientation. -
INCH
protected static int INCHInternal constant used to describe the screen resolution (DPI). Default is 72. -
DEFAULT_PAGESCALE
protected static int DEFAULT_PAGESCALEInternal constant used to describe the screen resolution (DPI). Default is 72. -
DEFAULT_ISMETRIC
protected static boolean DEFAULT_ISMETRICInternal constant used to describe the screen resolution (DPI). Default is 72. -
inactiveBackground
Defines the inactive background border. Default is a not-so-dark gray. -
orientation
protected int orientationSpecifies the orientation. -
activeoffset
protected int activeoffsetSpecified that start and length of the active region, ie the region to paint with the background border. This is used for example to indicate the printable region of a graph. -
activelength
protected int activelengthSpecified that start and length of the active region, ie the region to paint with the background border. This is used for example to indicate the printable region of a graph. -
scale
protected double scaleSpecifies the scale for the metrics. Default isDEFAULT_PAGESCALE. -
metric
protected boolean metricSpecifies the unit system. Default isDEFAULT_ISMETRIC. -
labelFont
-
rulerSize
protected int rulerSizeSpecifies height or width of the ruler. Default is 15 pixels. -
tickDistance
protected int tickDistanceSpecifies the minimum distance between two major ticks. Default is 30. -
graphComponent
protected com.mxgraph.swing.mxGraphComponent graphComponentReference to the attached graph. -
mouse
Holds the current and first mouse point. -
increment
protected double incrementParameters to control the display. -
units
protected double unitsParameters to control the display. -
repaintHandler
protected transient com.mxgraph.util.mxEventSource.mxIEventListener repaintHandler
-
-
Constructor Details
-
EditorRuler
public EditorRuler(com.mxgraph.swing.mxGraphComponent graphComponent, int orientation) Constructs a new ruler for the specified graph and orientation.- Parameters:
graphComponent- The graph to create the ruler for.orientation- The orientation to use for the ruler.
-
-
Method Details
-
setActiveOffset
public void setActiveOffset(int offset) Sets the start of the active region in pixels.- Parameters:
offset- The start of the active region.
-
setActiveLength
public void setActiveLength(int length) Sets the length of the active region in pixels.- Parameters:
length- The length of the active region.
-
isMetric
public boolean isMetric()Returns true if the ruler uses metric units.- Returns:
- Returns if the ruler is metric.
-
setMetric
public void setMetric(boolean isMetric) Sets if the ruler uses metric units.- Parameters:
isMetric- Whether to use metric units.
-
getRulerSize
public int getRulerSize()Returns the ruler's horizontal or vertical size.- Returns:
- Returns the rulerSize.
-
setRulerSize
public void setRulerSize(int rulerSize) Sets the ruler's horizontal or vertical size.- Parameters:
rulerSize- The rulerSize to set.
-
getTickDistance
public int getTickDistance() -
setTickDistance
public void setTickDistance(int tickDistance) -
getPreferredSize
Returns the preferred size by replacing the respective component of the graph's preferred size withrulerSize.- Overrides:
getPreferredSizein classJComponent- Returns:
- Returns the preferred size for the ruler.
-
dragEnter
- Specified by:
dragEnterin interfaceDropTargetListener
-
dragExit
- Specified by:
dragExitin interfaceDropTargetListener
-
dragOver
- Specified by:
dragOverin interfaceDropTargetListener
-
drop
- Specified by:
dropin interfaceDropTargetListener
-
dropActionChanged
- Specified by:
dropActionChangedin interfaceDropTargetListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
updateMousePosition
Repaints the mouse position. -
updateIncrementAndUnits
protected void updateIncrementAndUnits()Updates the local variables used for painting based on the current scale and unit system. -
repaint
public void repaint(int x, int y) Repaints the ruler between the specified 0 and x or y depending on the orientation.- Parameters:
x- The endpoint for repainting a horizontal ruler.y- The endpoint for repainting a vertical ruler.
-
paintComponent
Paints the ruler.- Overrides:
paintComponentin classJComponent- Parameters:
g- The graphics to paint the ruler to.
-