edu.byu.deg.OntologyEditor.shapes
Class ObjectShape

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byedu.byu.deg.OntologyEditor.shapes.DrawShape
                      extended byedu.byu.deg.OntologyEditor.shapes.PlanarShape
                          extended byedu.byu.deg.OntologyEditor.shapes.ConnectableShape
                              extended byedu.byu.deg.OntologyEditor.shapes.ObjConnectableShape
                                  extended byedu.byu.deg.OntologyEditor.shapes.ObjectShape
All Implemented Interfaces:
Accessible, CustomCoordinatePlane, DocumentListener, EventListener, ImageObserver, ItemSelectable, MenuContainer, edu.byu.deg.osmx.OSMXElement.OSMXElementDeletionListener, edu.byu.deg.osmx.PositionListener, Serializable

public class ObjectShape
extends ObjConnectableShape
implements DocumentListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  ComponentAdapter canvasSizeListener
           
protected  Point centerPoint
           
protected  Ellipse2D centerRegion
           
protected static Color m_selColor
           
protected  edu.byu.deg.osmx.OSMXObjectType obj
           
protected static int OBJECT_RADIUS
           
protected  edu.byu.deg.OntologyEditor.shapes.ObjectShape.ObjectPanel objectPanel
           
protected  String objName
           
protected  TextShape objNameText
           
protected  boolean suppressDocEvents
           
 
Fields inherited from class edu.byu.deg.OntologyEditor.shapes.PlanarShape
posElem, positionChanging
 
Fields inherited from class edu.byu.deg.OntologyEditor.shapes.DrawShape
DEFAULT_FONT, DEFAULT_STROKE, DEFAULT_STYLE, element, elementListener, initialLocation, parentCanvas, rootCanvas, selected, shapeBorder
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ObjectShape(Container c, edu.byu.deg.osmx.OSMXElement elem)
          Creates a new instance of ObjectShape
 
Method Summary
protected  void centerPointMoved()
           
 void changedUpdate(DocumentEvent e)
           
 boolean contains(int x, int y)
           
 boolean contains(Point point)
           
 void delete()
          Passes a delete request to the internal OSMX element, which is responsible for removing itself from the model and firing deletion events to registered listeners (including this shape, so it can remove itself from its container).
 Rectangle getBoundingBox()
          Return the bounds of this shape (as opposed to the panel containing this shape.
 Point getCenterPoint()
          Calculates the center point of the shape, in the coordinate system of the shape.
protected  Ellipse2D getCenterRegion()
           
 Point2D.Double getIntersectionPoint(Point2D.Double pt)
           
 edu.byu.deg.osmx.binding.ObjectType getObject()
           
 Point getOrigin()
          Returns the origin point of this shape.
 Point getPosition()
          Returns the horizontal and vertical position of this shape's origin point relative to its container's origin point.
 String getShapeName()
           
protected  void initCenterPoint()
           
protected  void initName()
           
protected  void initObject()
           
protected  void initSize()
           
 void insertUpdate(DocumentEvent e)
           
protected  void locationChanged()
           
 boolean masksConnectionsAt(Point pt)
           
 void paintComponent(Graphics g)
           
 void removeUpdate(DocumentEvent e)
           
protected  void repositionName()
           
protected  void repositionObject()
           
protected  void setLocationFromPosition()
           
protected  void setPosition(int x, int y)
          Changes the shape's position to the specified x and y coordinates.
protected  void setPosition(Point pt)
          Changes the shape's position to the specified Point.
protected  void setShapeName(String s)
           
protected  void updatePosition()
           
protected  void updateSelectionState()
          Invoked from DrawShape.setSelected(boolean) after the DrawShape.selected flag has been updated, this method allows subclasses to respond to the change in selection state.
 
Methods inherited from class edu.byu.deg.OntologyEditor.shapes.PlanarShape
initBorder, initElement, initLocation, updateOrder, updateX, updateY
 
Methods inherited from class edu.byu.deg.OntologyEditor.shapes.DrawShape
addItemListener, createStyle, drag, elementDeleted, elementPropertyChange, getAbsoluteCenterPoint, getBottomPoint, getConnectionPoint, getDefaultStyle, getElement, getFillColor, getFontColor, getFontFamily, getFontSize, getFontStyle, getLeftPoint, getLineColor, getLineWidth, getParentCanvas, getRightPoint, getRootCanvas, getSelectedObjects, getStroke, getStyle, getTopPoint, isSelected, locationChanged, locationChanged, normalizeRect, removeItemListener, setLocation, setLocation, setSelected, setSelected
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, 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, getInsets, getInsets, 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, paintBorder, paintChildren, 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, setBorder, 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, 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, imageUpdate, 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, 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
 

Field Detail

objName

protected String objName

obj

protected edu.byu.deg.osmx.OSMXObjectType obj

suppressDocEvents

protected boolean suppressDocEvents

objNameText

protected TextShape objNameText

canvasSizeListener

protected ComponentAdapter canvasSizeListener

centerRegion

protected Ellipse2D centerRegion

objectPanel

protected edu.byu.deg.OntologyEditor.shapes.ObjectShape.ObjectPanel objectPanel

centerPoint

protected Point centerPoint

m_selColor

protected static Color m_selColor

OBJECT_RADIUS

protected static final int OBJECT_RADIUS
See Also:
Constant Field Values
Constructor Detail

ObjectShape

public ObjectShape(Container c,
                   edu.byu.deg.osmx.OSMXElement elem)
Creates a new instance of ObjectShape

Method Detail

centerPointMoved

protected void centerPointMoved()

contains

public boolean contains(int x,
                        int y)

contains

public boolean contains(Point point)

delete

public void delete()
Description copied from class: DrawShape
Passes a delete request to the internal OSMX element, which is responsible for removing itself from the model and firing deletion events to registered listeners (including this shape, so it can remove itself from its container).

Overrides:
delete in class DrawShape

getBoundingBox

public Rectangle getBoundingBox()
Description copied from class: DrawShape
Return the bounds of this shape (as opposed to the panel containing this shape. Used, for example, to compute the drawing bounds for EPS export purposes. Subclasses should override this method when the containing panel bounds are not the same as the shape bounds. This is the case with connectors, for example. Shapes need to be sure to include text decorations (e.g., participation constraints, relationship-set names) and special symbols when computing bounds.

Overrides:
getBoundingBox in class DrawShape
Returns:
The bounds of this shape.

getCenterPoint

public Point getCenterPoint()
Description copied from class: DrawShape
Calculates the center point of the shape, in the coordinate system of the shape.

Overrides:
getCenterPoint in class DrawShape
Returns:
The center point of the shape (width/2, height/2).

getCenterRegion

protected Ellipse2D getCenterRegion()

getIntersectionPoint

public Point2D.Double getIntersectionPoint(Point2D.Double pt)
Overrides:
getIntersectionPoint in class ConnectableShape

getPosition

public Point getPosition()
Description copied from class: DrawShape
Returns the horizontal and vertical position of this shape's origin point relative to its container's origin point. This may be different than the value returned by Component.getLocation() in situations where the shape's origin point is not at the northwest corner of the shape's bounding box.

Overrides:
getPosition in class DrawShape
Returns:
The position of the shape's origin point relative to its container's origin point.
See Also:
DrawShape.getOrigin(), CustomCoordinatePlane

getObject

public edu.byu.deg.osmx.binding.ObjectType getObject()

getOrigin

public Point getOrigin()
Description copied from class: DrawShape
Returns the origin point of this shape.

Specified by:
getOrigin in interface CustomCoordinatePlane
Overrides:
getOrigin in class DrawShape
Returns:
The origin point of the shape.
See Also:
CustomCoordinatePlane

getShapeName

public String getShapeName()

initCenterPoint

protected void initCenterPoint()

initName

protected void initName()

initObject

protected void initObject()

initSize

protected void initSize()

masksConnectionsAt

public boolean masksConnectionsAt(Point pt)

paintComponent

public void paintComponent(Graphics g)

repositionName

protected void repositionName()

repositionObject

protected void repositionObject()

setLocationFromPosition

protected void setLocationFromPosition()
Overrides:
setLocationFromPosition in class PlanarShape

setPosition

protected void setPosition(Point pt)
Description copied from class: DrawShape
Changes the shape's position to the specified Point.

Overrides:
setPosition in class PlanarShape

setPosition

protected void setPosition(int x,
                           int y)
Description copied from class: DrawShape
Changes the shape's position to the specified x and y coordinates.

Overrides:
setPosition in class PlanarShape

setShapeName

protected void setShapeName(String s)

updatePosition

protected void updatePosition()
Overrides:
updatePosition in class PlanarShape

updateSelectionState

protected void updateSelectionState()
Description copied from class: DrawShape
Invoked from DrawShape.setSelected(boolean) after the DrawShape.selected flag has been updated, this method allows subclasses to respond to the change in selection state.

Overrides:
updateSelectionState in class ObjConnectableShape

locationChanged

protected void locationChanged()
Overrides:
locationChanged in class PlanarShape

changedUpdate

public void changedUpdate(DocumentEvent e)
Specified by:
changedUpdate in interface DocumentListener

insertUpdate

public void insertUpdate(DocumentEvent e)
Specified by:
insertUpdate in interface DocumentListener

removeUpdate

public void removeUpdate(DocumentEvent e)
Specified by:
removeUpdate in interface DocumentListener