Class EditorRuler
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- org.processmining.objectcentricconstraintchecking.algorithms.editor.EditorRuler
-
- All Implemented Interfaces:
java.awt.dnd.DropTargetListener,java.awt.event.MouseMotionListener,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener
public class EditorRuler extends javax.swing.JComponent implements java.awt.event.MouseMotionListener, java.awt.dnd.DropTargetListenerComponent that displays a ruler for a JGraph component.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intactivelengthSpecified that start and length of the active region, ie the region to paint with the background border.protected intactiveoffsetSpecified that start and length of the active region, ie the region to paint with the background border.protected static booleanDEFAULT_ISMETRICInternal constant used to describe the screen resolution (DPI).protected static intDEFAULT_PAGESCALEInternal constant used to describe the screen resolution (DPI).protected mxGraphComponentgraphComponentReference to the attached graph.protected java.awt.ColorinactiveBackgroundDefines the inactive background border.protected static intINCHInternal constant used to describe the screen resolution (DPI).protected doubleincrementParameters to control the display.protected java.awt.FontlabelFontprotected booleanmetricSpecifies the unit system.protected java.awt.PointmouseHolds the current and first mouse point.static java.text.NumberFormatnumberFormatHolds the shared number formatter.protected intorientationSpecifies the orientation.static intORIENTATION_HORIZONTALDefines the constants for horizontal and vertical orientation.static intORIENTATION_VERTICALDefines the constants for horizontal and vertical orientation.protected mxEventSource.mxIEventListenerrepaintHandlerprotected intrulerSizeSpecifies height or width of the ruler.protected doublescaleSpecifies the scale for the metrics.protected inttickDistanceSpecifies the minimum distance between two major ticks.protected doubleunitsParameters 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_WINDOW
-
-
Constructor Summary
Constructors Constructor Description EditorRuler(mxGraphComponent graphComponent, int orientation)Constructs a new ruler for the specified graph and orientation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddragEnter(java.awt.dnd.DropTargetDragEvent arg0)voiddragExit(java.awt.dnd.DropTargetEvent arg0)voiddragOver(java.awt.dnd.DropTargetDragEvent arg0)voiddrop(java.awt.dnd.DropTargetDropEvent arg0)voiddropActionChanged(java.awt.dnd.DropTargetDragEvent arg0)java.awt.DimensiongetPreferredSize()Returns the preferred size by replacing the respective component of the graph's preferred size withrulerSize.intgetRulerSize()Returns the ruler's horizontal or vertical size.intgetTickDistance()booleanisMetric()Returns true if the ruler uses metric units.voidmouseDragged(java.awt.event.MouseEvent e)voidmouseMoved(java.awt.event.MouseEvent e)voidpaintComponent(java.awt.Graphics g)Paints 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 voidupdateIncrementAndUnits()Updates the local variables used for painting based on the current scale and unit system.protected voidupdateMousePosition(java.awt.Point pt)Repaints 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, updateUI
-
Methods 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, 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, 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 Detail
-
ORIENTATION_HORIZONTAL
public static int ORIENTATION_HORIZONTAL
Defines the constants for horizontal and vertical orientation.
-
ORIENTATION_VERTICAL
public static int ORIENTATION_VERTICAL
Defines the constants for horizontal and vertical orientation.
-
INCH
protected static int INCH
Internal constant used to describe the screen resolution (DPI). Default is 72.
-
DEFAULT_PAGESCALE
protected static int DEFAULT_PAGESCALE
Internal constant used to describe the screen resolution (DPI). Default is 72.
-
DEFAULT_ISMETRIC
protected static boolean DEFAULT_ISMETRIC
Internal constant used to describe the screen resolution (DPI). Default is 72.
-
numberFormat
public static final java.text.NumberFormat numberFormat
Holds the shared number formatter.- See Also:
NumberFormat.getInstance()
-
inactiveBackground
protected java.awt.Color inactiveBackground
Defines the inactive background border. Default is a not-so-dark gray.
-
orientation
protected int orientation
Specifies the orientation.
-
activeoffset
protected int activeoffset
Specified 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 activelength
Specified 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 scale
Specifies the scale for the metrics. Default isJGraphEditorDiagramPane#DEFAULT_PAGESCALE.
-
metric
protected boolean metric
Specifies the unit system. Default isJGraphEditorDiagramPane#DEFAULT_ISMETRIC.
-
labelFont
protected java.awt.Font labelFont
-
rulerSize
protected int rulerSize
Specifies height or width of the ruler. Default is 15 pixels.
-
tickDistance
protected int tickDistance
Specifies the minimum distance between two major ticks. Default is 30.
-
graphComponent
protected mxGraphComponent graphComponent
Reference to the attached graph.
-
mouse
protected java.awt.Point mouse
Holds the current and first mouse point.
-
increment
protected double increment
Parameters to control the display.
-
units
protected double units
Parameters to control the display.
-
repaintHandler
protected transient mxEventSource.mxIEventListener repaintHandler
-
-
Constructor Detail
-
EditorRuler
public EditorRuler(mxGraphComponent graphComponent, int orientation)
Constructs a new ruler for the specified graph and orientation.- Parameters:
graph- The graph to create the ruler for.orientation- The orientation to use for the ruler.
-
-
Method Detail
-
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.
-
setTickDistance
public void setTickDistance(int tickDistance)
-
getTickDistance
public int getTickDistance()
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns the preferred size by replacing the respective component of the graph's preferred size withrulerSize.- Overrides:
getPreferredSizein classjavax.swing.JComponent- Returns:
- Returns the preferred size for the ruler.
-
dragEnter
public void dragEnter(java.awt.dnd.DropTargetDragEvent arg0)
- Specified by:
dragEnterin interfacejava.awt.dnd.DropTargetListener
-
dragExit
public void dragExit(java.awt.dnd.DropTargetEvent arg0)
- Specified by:
dragExitin interfacejava.awt.dnd.DropTargetListener
-
dragOver
public void dragOver(java.awt.dnd.DropTargetDragEvent arg0)
- Specified by:
dragOverin interfacejava.awt.dnd.DropTargetListener
-
drop
public void drop(java.awt.dnd.DropTargetDropEvent arg0)
- Specified by:
dropin interfacejava.awt.dnd.DropTargetListener
-
dropActionChanged
public void dropActionChanged(java.awt.dnd.DropTargetDragEvent arg0)
- Specified by:
dropActionChangedin interfacejava.awt.dnd.DropTargetListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener
-
updateMousePosition
protected void updateMousePosition(java.awt.Point pt)
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
public void paintComponent(java.awt.Graphics g)
Paints the ruler.- Overrides:
paintComponentin classjavax.swing.JComponent- Parameters:
g- The graphics to paint the ruler to.
-
-