Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.nwoods.jgo
Class JGoControl

    java.lang.Object
      com.nwoods.jgo.JGoObject
          com.nwoods.jgo.JGoControl

All Implemented Interfaces:
  JGoXMLSaveRestore, java.io.Serializable

Direct Known Subclasses:
  JGoButton, JGoScrollBar, JGoTextEdit

public abstract class JGoControl
extends JGoObject

The parent of any class that defines a JGoObject represented by a Swing JComponent. Subclasses of JGoControl allow standard JComponents to be used in a view with other JGoObjects, with some restrictions.

Normally JGoControls should be used as part of a view, not part of a document. If the JGoControl is part of a document it will have to create a separate, independent Swing JComponent for each view, and each view will have to resize, reposition, and repaint them.

See Also:
  Serialized Form

Field Summary

Fields inherited from class com.nwoods.jgo.JGoObject
`Bottom, BottomCenter, BottomLeft, BottomMiddle, BottomRight, Center, CenterLeft, CenterRight, Changed4ResizeHandles, ChangedAutoRescale, ChangedBrush, ChangedDraggable, ChangedDragsNode, ChangedGeometry, ChangedGrabChildSelection, ChangedInitializing, ChangedPen, ChangedResizable, ChangedSelectable, ChangedUpdatePartner, ChangedVisible, ChangedZOrder, LastChangedHint, Left, LeftCenter, NoHandle, NoSpot, NumReservedHandles, RepaintAll, Right, RightCenter, SideLeft, SideRight, Top, TopCenter, TopLeft, TopMiddle, TopRight`

Constructor Summary
`JGoControl()` Construct a new JGoControl.
`JGoControl(java.awt.Point location, java.awt.Dimension size)` Construct a JGoControl at a given location with a given size.
`JGoControl(java.awt.Rectangle rect)` Construct a JGoControl with a bounding rectangle.

Method Summary
`abstract javax.swing.JComponent` | `createComponent(JGoView view)` Each JGoControl subclass is responsible for representing the JGoControl with a JComponent that will be added to the JGoView's canvas.
`protected void` | `geometryChange(java.awt.Rectangle prevRect)` If the object has been moved or resized, adjust the Swing JComponents in all views accordingly.
`javax.swing.JComponent` | `getComponent(JGoView view)` Returns a Swing JComponent associated with the JGoControl.
`java.util.Iterator` | `getIterator()` Return an iterator for getting all the known JGoView/JComponent mappings.
`protected void` | `ownerChange(JGoObjectCollection oldOwner, JGoObjectCollection newOwner, JGoObject mainObject)` We need to remove the Swing JComponent from the all of this document's JGoViews when this JGoControl is removed from the document.
`void` | `paint(java.awt.Graphics2D g, JGoView view)` Cause the Swing JComponent associated with this JGoControl, as returned by getComponent(), to be drawn on the screen.
`void` | `setVisible(boolean bFlag)` If this JGoObject becomes visible, we need to make sure the Swing JComponent is created and is visible.

Methods inherited from class com.nwoods.jgo.JGoObject
`canView, changeValue, computeBoundingRect, computeMove, computeResize, copy, copyNewValueForRedo, copyObject, copyObjectDelayed, copyOldValueForUndo, copyRect, doMouseClick, doMouseDblClick, doUncapturedMouseMove, expandRectByPenWidth, findCommonParent, foredate, gainedSelection, geometryChangeChild, getBoundingRect, getDocument, getDraggingObject, getFlags, getHeight, getLayer, getLeft, getLocation, getLocation, getNearestIntersectionPoint, getParent, getParentJGoNode, getParentNode, getPartner, getRectangleSpotLocation, getSize, getSize, getSpotLocation, getSpotLocation, getToolTipText, getTop, getTopLeft, getTopLeft, getTopLevelObject, getView, getWidth, growRect, handleMove, handleResize, hideSelectionHandles, is4ResizeHandles, isAutoRescale, isBoundingRectInvalid, isChildOf, isDraggable, isDragsNode, isInitializing, isPointInObj, isResizable, isSelectable, isSkipsUndoManager, isSuspendChildUpdates, isSuspendUpdates, isTopLevel, isUpdatePartner, isVisible, lostSelection, partnerUpdate, pick, redirectSelection, remove, set4ResizeHandles, setAutoRescale, setBoundingRect, setBoundingRect, setBoundingRect, setBoundingRectForce, setBoundingRectForce, setBoundingRectInvalid, setBoundsRect, setDraggable, setDragsNode, setFlags, setHeight, setInitializing, setLeft, setLocation, setLocation, setLocationOffset, setLocationOffset, setParent, setPartner, setRectangleSpotLocation, setResizable, setSelectable, setSize, setSize, setSizeKeepingLocation, setSkipsUndoManager, setSpotLocation, setSpotLocation, setSpotLocation, setSpotLocationOffset, setSuspendChildUpdates, setSuspendUpdates, setTop, setTopLeft, setTopLeft, setUpdatePartner, setWidth, showSelectionHandles, spotOpposite, SVGReadAttributes, SVGReadObject, SVGUpdateReference, SVGWriteAttributes, SVGWriteObject, update, update`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JGoControl

    public JGoControl()

  Construct a new JGoControl.

### JGoControl

    public JGoControl(java.awt.Rectangle rect)

  Construct a JGoControl with a bounding rectangle.

Parameters:
  `rect` - the bounding rectangle

### JGoControl

    public JGoControl(java.awt.Point location,
                      java.awt.Dimension size)

  Construct a JGoControl at a given location with a given size.

Parameters:
  `location` - the upper left corner, in document coordinates
  `size` - the dimensions of the rectangle, in document coordinates

Method Detail

### ownerChange

    protected void ownerChange(JGoObjectCollection oldOwner,
                               JGoObjectCollection newOwner,
                               JGoObject mainObject)

  We need to remove the Swing JComponent from the all of this document's JGoViews when this JGoControl is removed from the document. When it is added to a document, we need to make sure the Swing JComponent exists in each of the views, if this object is visible.

  We need to remove the Swing JComponent from the JGoView's canvas when this JGoControl is removed from the view. When it is added to a view, we need to make sure the Swing JComponent exists, if this object is visible.

  Overrides:
    `ownerChange` in class `JGoObject`
  Parameters:
    `oldOwner` - the previous owner object
    `newOwner` - the new owner object
    `mainObject` - the object being inserted or removed from the document or view

### getComponent

    public javax.swing.JComponent getComponent(JGoView view)

  Returns a Swing JComponent associated with the JGoControl. If there is not already a JComponent for this JGoControl in this JGoView, the method calls createComponent(), caches the result, and adds the new JComponent to the view's canvas.

  Parameters:
    `view` - the view for which this control should be found or created
  Returns:
    a JComponent for this particular view

### createComponent

    public abstract javax.swing.JComponent createComponent(JGoView view)

  Each JGoControl subclass is responsible for representing the JGoControl with a JComponent that will be added to the JGoView's canvas.

  You may wish to return null when no JComponent is desired for this JGoControl, perhaps just for the given view.

  Parameters:
    `view` - the view for which this control should be created
  Returns:
    a JComponent

### setVisible

    public void setVisible(boolean bFlag)

  If this JGoObject becomes visible, we need to make sure the Swing JComponent is created and is visible. If this JGoObject becomes invisible, we need to remove the Swing JComponent from the view.

  Overrides:
    `setVisible` in class `JGoObject`
  Parameters:
    `bFlag` - true if visible, false if not

### geometryChange

    protected void geometryChange(java.awt.Rectangle prevRect)

  If the object has been moved or resized, adjust the Swing JComponents in all views accordingly.

  Overrides:
    `geometryChange` in class `JGoObject`

### paint

    public void paint(java.awt.Graphics2D g,
                      JGoView view)

  Cause the Swing JComponent associated with this JGoControl, as returned by getComponent(), to be drawn on the screen.

  Subclasses will need to override this to handle the scaling issues involved with positioning and sizing the component. Painting should not be done with JGo's translated/scaled Graphics2D but later with the normal Graphics when this view's JComponent children are painted.

  Overrides:
    `paint` in class `JGoObject`
  Parameters:
    `g` - this Graphics should be ignored, because it is transformed
    `view` - the view in which this control should be displayed

### getIterator

    public java.util.Iterator getIterator()

  Return an iterator for getting all the known JGoView/JComponent mappings.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD