|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nwoods.jgo.JGoObject
com.nwoods.jgo.JGoControl
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.
| 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JGoControl()
public JGoControl(java.awt.Rectangle rect)
rect - the bounding rectangle
public JGoControl(java.awt.Point location,
java.awt.Dimension size)
location - the upper left corner, in document coordinatessize - the dimensions of the rectangle, in document coordinates| Method Detail |
protected void ownerChange(JGoObjectCollection oldOwner,
JGoObjectCollection newOwner,
JGoObject mainObject)
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.
ownerChange in class JGoObjectoldOwner - the previous owner objectnewOwner - the new owner objectmainObject - the object being inserted or removed from the document or viewpublic javax.swing.JComponent getComponent(JGoView view)
view - the view for which this control should be found or created
public abstract javax.swing.JComponent createComponent(JGoView view)
You may wish to return null when no JComponent is desired for this JGoControl, perhaps just for the given view.
view - the view for which this control should be created
public void setVisible(boolean bFlag)
setVisible in class JGoObjectbFlag - true if visible, false if notprotected void geometryChange(java.awt.Rectangle prevRect)
geometryChange in class JGoObject
public void paint(java.awt.Graphics2D g,
JGoView view)
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.
paint in class JGoObjectg - this Graphics should be ignored, because it is transformedview - the view in which this control should be displayedpublic java.util.Iterator getIterator()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||