|
||||||||||
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
com.nwoods.jgo.JGoTextEdit
JGoTextEdit displays an SWT Text Control 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 SWT Controls 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.
JGoText
,
Serialized FormField 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 an SWT Text Control. |
|
JGoTextEdit(org.eclipse.swt.graphics.Point location,
Dimension size,
java.lang.String origText,
boolean multiline,
JGoText obj)
Create a text editor object associated with a JGoText object. |
|
JGoTextEdit(org.eclipse.swt.graphics.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. |
org.eclipse.swt.widgets.Control |
createControl(JGoView view)
Create an SWT Text Control that implements the text editor. |
void |
doEndEdit()
Convenience routine to stop user editing of the JGoText object. |
void |
focusGained(org.eclipse.swt.events.FocusEvent e)
|
void |
focusLost(org.eclipse.swt.events.FocusEvent e)
|
JGoText |
getTextObject()
Return the JGoText object that this control object is an editor for. |
void |
keyPressed(org.eclipse.swt.events.KeyEvent e)
|
void |
keyReleased(org.eclipse.swt.events.KeyEvent e)
|
void |
paint(Graphics2D g,
JGoView view)
Draw the Control 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, getControl, getIterator, ownerChange, setVisible |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JGoTextEdit()
The TextObject property must be set to a valid JGoText before this JGoControl can be used, even for painting.
public JGoTextEdit(org.eclipse.swt.graphics.Point location, Dimension size, java.lang.String origText, boolean multiline, JGoText obj)
location
- the top-left position, in document coordinatessize
- the width and height, in document coordinatesorigText
- the initial text stringmultiline
- whether more than one line of text is allowedobj
- the JGoText object for which this object represents the editorpublic JGoTextEdit(org.eclipse.swt.graphics.Rectangle rect, java.lang.String origText, boolean multiline, JGoText obj)
rect
- the initial bounding rectangle, in document coordinatesorigText
- the initial text stringmultiline
- whether more than one line of text is allowedobj
- the JGoText object for which this object represents the editorMethod Detail |
public JGoObject copyObject(JGoCopyEnvironment env)
JGoObject
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.
copyObject
in class JGoObject
env
- the environment for the copy operation - keeps track of copied objects.
public JGoText getTextObject()
public void setTextObject(JGoText obj)
public void keyPressed(org.eclipse.swt.events.KeyEvent e)
keyPressed
in interface org.eclipse.swt.events.KeyListener
public void keyReleased(org.eclipse.swt.events.KeyEvent e)
keyReleased
in interface org.eclipse.swt.events.KeyListener
public void focusGained(org.eclipse.swt.events.FocusEvent e)
focusGained
in interface org.eclipse.swt.events.FocusListener
public void focusLost(org.eclipse.swt.events.FocusEvent e)
focusLost
in interface org.eclipse.swt.events.FocusListener
public org.eclipse.swt.widgets.Control createControl(JGoView view)
createControl
in class JGoControl
view
- the view for which this control should be created
public void paint(Graphics2D g, JGoView view)
paint
in class JGoControl
g
- this Graphics should be ignored, because it is transformedview
- the view in which this control should be drawnpublic boolean setEditedText(java.lang.String newtext, JGoView view)
public void doEndEdit()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |