pipe.dataLayer
Class PlaceTransitionObject

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JLabel
                          |
                          +--pipe.dataLayer.PetriNetObject
                                |
                                +--pipe.dataLayer.PlaceTransitionObject
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, javax.swing.SwingConstants
Direct Known Subclasses:
Place, Token, Transition

public abstract class PlaceTransitionObject
extends PetriNetObject

PlaceTransitionObject - Petri-Net PLace or Transition SuperClass - Abstract

Version:
1.0
Author:
James D Bloom
See Also:

PNML - Petri-Net XMLSchema (stNet.xsd),

UML - PNML Package

, Serialized Form

Inner classes inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.ActionStandin, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
protected  int boundsLeftoffset
          LeftOffSet used for setBounds()
protected  int boundsTopoffset
          TopOffSet used for setBounds()
protected  double height
          Height of object
private  boolean isDragging
          Used in the mouse events to control dragging
protected  java.lang.String name
          Name
protected  java.lang.Double nameOffsetX
          Name X-axis Offset
protected  java.lang.Double nameOffsetY
          Name Y-axis Offset
protected  java.lang.Double positionX
          X-axis Position
protected  java.lang.Double positionY
          Y-axis Position
protected  double width
          Width of object
 
Fields inherited from class pipe.dataLayer.PetriNetObject
color, id, movable, pnname
 
Fields inherited from class javax.swing.JLabel
accessibleIcon, defaultIcon, disabledIcon, disabledIconSet, horizontalAlignment, horizontalTextPosition, iconTextGap, LABELED_BY_PROPERTY, labelFor, mnemonic, text, uiClassID, verticalAlignment, verticalTextPosition
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NORTH, NORTH_EAST, NORTH_WEST, 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
PlaceTransitionObject()
          Create empty Petri-Net Object
PlaceTransitionObject(double positionXInput, double positionYInput, java.awt.Color colorInput)
          Create Petri-Net Object This constructor does all the work, the others just call it.
PlaceTransitionObject(double positionXInput, double positionYInput, java.lang.String idInput, java.awt.Color colorInput)
          Create Petri-Net Object
PlaceTransitionObject(double positionXInput, double positionYInput, java.lang.String idInput, java.lang.String nameInput, double nameOffsetXInput, double nameOffsetYInput, java.awt.Color colorInput)
          Create Petri-Net Object
 
Method Summary
 int boundsHeight()
          Returns the height bounds we want to use when initially creating the place on the gui
 int boundsWidth()
          Returns the width bounds we want to use when initially creating the place on the gui
 void calculateBoundsOffsets()
          Calculates the BoundsOffsets used for setBounds() method
 java.lang.String getId()
          Get id
 java.lang.String getName()
          Get name
 double getNameOffsetX()
          Get X-axis offset for name position
 java.lang.Double getNameOffsetXObject()
          Get X-axis offset for name position returns null if value not yet entered
 double getNameOffsetY()
          Get Y-axis offset for name position
 java.lang.Double getNameOffsetYObject()
          Get Y-axis offset for name position returns null if value not yet entered
 double getPositionX()
          Get X-axis position
 java.lang.Double getPositionXObject()
          Get X-axis position returns null if value not yet entered
 double getPositionY()
          Get Y-axis position
 java.lang.Double getPositionYObject()
          Get Y-axis position returns null if value not yet entered
 int leftOffset()
          Returns the distance between the outside of the component to the centre, in order to position the centre of the place where the mouse clicks on the screen
 void mouseDragged(java.awt.event.MouseEvent e)
          Implemented the moving of the objects - now done in the handler
 void mousePressed(java.awt.event.MouseEvent e)
          Event handler for when the user presses down on the mouse, this is used in conjunction with mouseDragged and mouseReleased to implement the moving action
 void mouseReleased(java.awt.event.MouseEvent e)
          Implemented the moving action - now moved into the handler
 void paintComponent(java.awt.Graphics g)
           
 void setId(java.lang.String idInput)
          Set id
 void setName(java.lang.String nameInput)
          Set name
 void setNameOffsetX(double nameOffsetXInput)
          Set X-axis offset for name position
 void setNameOffsetY(double nameOffsetYInput)
          Set Y-axis offset for name position
 void setPositionX(double positionXInput)
          Set X-axis position
 void setPositionY(double positionYInput)
          Set Y-axis position
 int topOffset()
          Returns the distance between the outside of the component to the centre, in order to position the centre of the place where the mouse clicks on the screen
abstract  void updateSize(java.awt.event.MouseEvent e)
          Implemented in subclasses as involves some tailoring according to the shape
 
Methods inherited from class pipe.dataLayer.PetriNetObject
getColor, getMovable, getNameLabel, modify, mouseClicked, mouseEntered, mouseExited, mouseMoved, setColor, setMovable
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI, writeObject
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, , addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paintWithBuffer, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

positionX

protected java.lang.Double positionX
X-axis Position

positionY

protected java.lang.Double positionY
Y-axis Position

name

protected java.lang.String name
Name

nameOffsetX

protected java.lang.Double nameOffsetX
Name X-axis Offset

nameOffsetY

protected java.lang.Double nameOffsetY
Name Y-axis Offset

width

protected double width
Width of object

height

protected double height
Height of object

boundsTopoffset

protected int boundsTopoffset
TopOffSet used for setBounds()

boundsLeftoffset

protected int boundsLeftoffset
LeftOffSet used for setBounds()

isDragging

private boolean isDragging
Used in the mouse events to control dragging
Constructor Detail

PlaceTransitionObject

public PlaceTransitionObject(double positionXInput,
                             double positionYInput,
                             java.lang.String idInput,
                             java.lang.String nameInput,
                             double nameOffsetXInput,
                             double nameOffsetYInput,
                             java.awt.Color colorInput)
Create Petri-Net Object
Parameters:
positionXInput - X-axis Position
positionYInput - Y-axis Position
idInput - Place id
nameInput - Name
nameOffsetXInput - Name X-axis Position
nameOffsetYInput - Name Y-axis Position
colorInput - Color

PlaceTransitionObject

public PlaceTransitionObject(double positionXInput,
                             double positionYInput,
                             java.lang.String idInput,
                             java.awt.Color colorInput)
Create Petri-Net Object
Parameters:
positionXInput - X-axis Position
positionYInput - Y-axis Position
idInput - Place id
colorInput - Color

PlaceTransitionObject

public PlaceTransitionObject(double positionXInput,
                             double positionYInput,
                             java.awt.Color colorInput)
Create Petri-Net Object This constructor does all the work, the others just call it.
Parameters:
positionXInput - X-axis Position
positionYInput - Y-axis Position
colorInput - Color

PlaceTransitionObject

public PlaceTransitionObject()
Create empty Petri-Net Object
Method Detail

setPositionX

public void setPositionX(double positionXInput)
Set X-axis position
Parameters:
positionXInput - Double value for X-axis position

setPositionY

public void setPositionY(double positionYInput)
Set Y-axis position
Parameters:
positionYInput - Double value for Y-axis position

setId

public void setId(java.lang.String idInput)
Set id
Overrides:
setId in class PetriNetObject
Parameters:
idInput - String value for Place id;

setName

public void setName(java.lang.String nameInput)
Set name
Overrides:
setName in class java.awt.Component
Parameters:
nameInput - String value for Place name;

setNameOffsetX

public void setNameOffsetX(double nameOffsetXInput)
Set X-axis offset for name position
Parameters:
nameOffsetXInput - Double value for name X-axis offset

setNameOffsetY

public void setNameOffsetY(double nameOffsetYInput)
Set Y-axis offset for name position
Parameters:
nameOffsetYInput - Double value for name Y-axis offset

getPositionX

public double getPositionX()
Get X-axis position
Returns:
Double value for X-axis position

getPositionY

public double getPositionY()
Get Y-axis position
Returns:
Double value for Y-axis position

getId

public java.lang.String getId()
Get id
Overrides:
getId in class PetriNetObject
Returns:
String value for Place id;

getName

public java.lang.String getName()
Get name
Overrides:
getName in class java.awt.Component
Returns:
String value for Place name;

getNameOffsetX

public double getNameOffsetX()
Get X-axis offset for name position
Returns:
Double value for name X-axis offset

getNameOffsetY

public double getNameOffsetY()
Get Y-axis offset for name position
Returns:
Double value for name Y-axis offset

getPositionXObject

public java.lang.Double getPositionXObject()
Get X-axis position returns null if value not yet entered
Returns:
Double value for X-axis position

getPositionYObject

public java.lang.Double getPositionYObject()
Get Y-axis position returns null if value not yet entered
Returns:
Double value for Y-axis position

getNameOffsetXObject

public java.lang.Double getNameOffsetXObject()
Get X-axis offset for name position returns null if value not yet entered
Returns:
Double value for name X-axis offset

getNameOffsetYObject

public java.lang.Double getNameOffsetYObject()
Get Y-axis offset for name position returns null if value not yet entered
Returns:
Double value for name Y-axis offset

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Event handler for when the user presses down on the mouse, this is used in conjunction with mouseDragged and mouseReleased to implement the moving action
Overrides:
mousePressed in class PetriNetObject
Parameters:
e - Mouse Event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Implemented the moving action - now moved into the handler
Overrides:
mouseReleased in class PetriNetObject
Parameters:
e - Mouse Event

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Implemented the moving of the objects - now done in the handler
Overrides:
mouseDragged in class PetriNetObject
Parameters:
e - Mouse Event

updateSize

public abstract void updateSize(java.awt.event.MouseEvent e)
Implemented in subclasses as involves some tailoring according to the shape
Overrides:
updateSize in class PetriNetObject
Parameters:
e - Mouse Event

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class PetriNetObject

boundsWidth

public int boundsWidth()
Returns the width bounds we want to use when initially creating the place on the gui
Returns:
Width bounds of Place

boundsHeight

public int boundsHeight()
Returns the height bounds we want to use when initially creating the place on the gui
Returns:
Height bounds of Place

topOffset

public int topOffset()
Returns the distance between the outside of the component to the centre, in order to position the centre of the place where the mouse clicks on the screen
Returns:
Top offset of Place

leftOffset

public int leftOffset()
Returns the distance between the outside of the component to the centre, in order to position the centre of the place where the mouse clicks on the screen
Returns:
Left offset of Place

calculateBoundsOffsets

public void calculateBoundsOffsets()
Calculates the BoundsOffsets used for setBounds() method