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 JGoTextEdit

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

All Implemented Interfaces:
  JGoXMLSaveRestore, java.io.Serializable

public class JGoTextEdit
extends JGoControl

JGoTextEdit displays a Swing JTextComponent to allow end-user editing of the text in the associated JGoText object.

This class is normally only used by JGoView to implement in-place text editing for JGoText. Only one instance of this class will exist at a time per view, and then only in a view (not in a document).

Note that, like all other JGoControls, the Swing JComponents created to be displayed as the representation of these JGoObjects, will appear in front of (on top of) all other JGoObjects. Thus it is wise to either use these objects as view objects or make sure they don't overlap with other document objects.

See Also:
  `JGoText`, 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
`JGoTextEdit()` Create a standard JGoObject/JGoControl corresponding to a Swing JTextComponent.
`JGoTextEdit(java.awt.Point location, java.awt.Dimension size, java.lang.String origText, boolean multiline, JGoText obj)` Create a text editor object associated with a JGoText object.
`JGoTextEdit(java.awt.Rectangle rect, java.lang.String origText, boolean multiline, JGoText obj)` Create a text editor object associated with a JGoText object.

Method Summary
`JGoObject` | `copyObject(JGoCopyEnvironment env)` Called during the first phase of the copy process to produce a copy of this object within the given copy dictionary.
`javax.swing.JComponent` | `createComponent(JGoView view)` Return the JTextComponent associated with this JGoObject.
`void` | `doEndEdit()` Convenience routine to stop user editing of the JGoText object.
`javax.swing.text.JTextComponent` | `getTextComponent(JGoView view)` Find the JTextComponent, if any, that is visible in the given JGoView that is being managed by this JGoTextEdit.
`JGoText` | `getTextObject()` Return the JGoText object that this control object is an editor for.
`void` | `paint(java.awt.Graphics2D g, JGoView view)` Draw the JComponent associated with this JGoTextEdit.
`boolean` | `setEditedText(java.lang.String newtext, JGoView view)` Convenience routine to commit user editing of the JGoText object.
`void` | `setTextObject(JGoText obj)` Set the JGoText object that this JGoControl is supposed to be an editor for.

Methods inherited from class com.nwoods.jgo.JGoControl
`geometryChange, getComponent, getIterator, ownerChange, setVisible`

Methods inherited from class com.nwoods.jgo.JGoObject
`canView, changeValue, computeBoundingRect, computeMove, computeResize, copy, copyNewValueForRedo, 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

### JGoTextEdit

    public JGoTextEdit()

  Create a standard JGoObject/JGoControl corresponding to a Swing JTextComponent.

  The TextObject property must be set to a valid JGoText before this JGoControl can be used, even for painting.

### JGoTextEdit

    public JGoTextEdit(java.awt.Point location,
                       java.awt.Dimension size,
                       java.lang.String origText,
                       boolean multiline,
                       JGoText obj)

  Create a text editor object associated with a JGoText object.

Parameters:
  `location` - the top-left position, in document coordinates
  `size` - the width and height, in document coordinates
  `origText` - the initial text string
  `multiline` - whether more than one line of text is allowed
  `obj` - the JGoText object for which this object represents the editor

### JGoTextEdit

    public JGoTextEdit(java.awt.Rectangle rect,
                       java.lang.String origText,
                       boolean multiline,
                       JGoText obj)

  Create a text editor object associated with a JGoText object.

Parameters:
  `rect` - the initial bounding rectangle, in document coordinates
  `origText` - the initial text string
  `multiline` - whether more than one line of text is allowed
  `obj` - the JGoText object for which this object represents the editor

Method Detail

### copyObject

    public JGoObject copyObject(JGoCopyEnvironment env)

  Description copied from class: `JGoObject`
  Called during the first phase of the copy process to produce a copy of this object within the given copy dictionary. If you just need to make a copy of a JGoObject, call JGoObject.copy(), or JGoDocument.addCopy, or JGoDocument.copyFromCollection if you have more than one object to copy.

  You should override this method in your derived classes when it has some fields that have reference objects that need to be copied. Your override method should first call super.copyObject(env) to get the newly copied object. The standard implementation of this method for JGoObject is to do a shallow copy, by Object.getClass().newInstance(). This depends on the existence of a zero-argument constructor. The result should be the object you return, after performing any other deeper copying of referenced objects that you deem necessary, and after removing references that should not be shared (such as to cached data structures). If super.copyObject(env) returns null, it's either already copied, or mapped to an existing object in this document, or shouldn't be copied at all.

  The copied object does not belong to any layer or any group, nor does it have any observers; the ultimate caller (i.e. JGoDocument.copyFromCollection) is responsible for adding it to the appropriate collection and copyObjectDelayed is responsible for adding the appropriate observers.

  You probably should not be calling this method for any reason but the initial super.copyObject(env) call in an override of this method; normally only JGoCopyEnvironment.copy is the caller. Within an override of this method, if you need to make a copy of another object, call JGoCopyEnvironment.copy instead.

  Overrides:
    `copyObject` in class `JGoObject`
  Parameters:
    `env` - the environment for the copy operation - keeps track of copied objects.
  Returns:
    a newly allocated copy of this object, or null

### getTextObject

    public JGoText getTextObject()

  Return the JGoText object that this control object is an editor for.

### setTextObject

    public void setTextObject(JGoText obj)

  Set the JGoText object that this JGoControl is supposed to be an editor for.

### createComponent

    public javax.swing.JComponent createComponent(JGoView view)

  Return the JTextComponent associated with this JGoObject. This will be either a JTextArea or a JTextField.

  Specified by:
    `createComponent` in class `JGoControl`
  Parameters:
    `view` - the view for which this control should be created
  Returns:
    a JComponent

### paint

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

  Draw the JComponent associated with this JGoTextEdit.

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

### getTextComponent

    public javax.swing.text.JTextComponent getTextComponent(JGoView view)

  Find the JTextComponent, if any, that is visible in the given JGoView that is being managed by this JGoTextEdit.

### setEditedText

    public boolean setEditedText(java.lang.String newtext,
                                 JGoView view)

  Convenience routine to commit user editing of the JGoText object.

### doEndEdit

    public void doEndEdit()

  Convenience routine to stop user editing of the JGoText object.

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