|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.event.PBasicInputEventHandler
edu.umd.cs.piccolox.event.PStyledTextEventHandler
public class PStyledTextEventHandler
Field Summary | |
---|---|
protected PCanvas |
canvas
Canvas onto which this event handler is attached. |
protected DocumentListener |
docListener
A listener that will handle programatic changes to the underlying document and update the view accordingly. |
protected PStyledText |
editedText
The Styled text being edited. |
protected JTextComponent |
editor
Editor used to edit a PStyledText's content when it is in edit mode. |
Constructor Summary | |
---|---|
PStyledTextEventHandler(PCanvas canvas)
Basic constructor for PStyledTextEventHandler. |
|
PStyledTextEventHandler(PCanvas canvas,
JTextComponent editor)
Constructor for PStyledTextEventHandler that allows an editor to be specified. |
Method Summary | |
---|---|
protected JTextComponent |
createDefaultEditor()
Creates a default editor component to be used when editing a PStyledText node. |
protected DocumentListener |
createDocumentListener()
Returns a document listener that will reshape the editor whenever a change occurs to its attached document. |
PStyledText |
createText()
Creates a PStyledText instance and attaches a simple document to it. |
void |
dispatchEventToEditor(PInputEvent event)
Intercepts Piccolo2D events and dispatches the underlying swing one to the current editor. |
protected void |
initEditor(JTextComponent newEditor)
Installs the editor onto the canvas. |
void |
mousePressed(PInputEvent event)
A callback that is invoked any time the mouse is pressed on the canvas. |
void |
reshapeEditor()
Adjusts the shape of the editor to fit the current document. |
protected void |
reshapeEditorLater()
Sometimes we need to invoke this later because the document events seem to get fired before the text is actually incorporated into the document. |
void |
startEditing(PInputEvent event,
PStyledText text)
Begins editing the provided text node as a result of the provided event. |
void |
stopEditing(PInputEvent event)
Stops editing the current text node. |
Methods inherited from class edu.umd.cs.piccolo.event.PBasicInputEventHandler |
---|
acceptsEvent, getEventFilter, keyboardFocusGained, keyboardFocusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased, mouseWheelRotated, mouseWheelRotatedByBlock, paramString, processEvent, setEventFilter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PCanvas canvas
protected JTextComponent editor
protected DocumentListener docListener
protected PStyledText editedText
Constructor Detail |
---|
public PStyledTextEventHandler(PCanvas canvas)
canvas
- canvas to which this handler will be attachedpublic PStyledTextEventHandler(PCanvas canvas, JTextComponent editor)
canvas
- canvas to which this handler will be attachededitor
- component to display when editing a PStyledText nodeMethod Detail |
---|
protected void initEditor(JTextComponent newEditor)
newEditor
- component responsible for a PStyledText node while it is
being edited.protected JTextComponent createDefaultEditor()
protected DocumentListener createDocumentListener()
public PStyledText createText()
public void mousePressed(PInputEvent event)
mousePressed
in class PBasicInputEventHandler
event
- mouse click event that can be queriedpublic void startEditing(PInputEvent event, PStyledText text)
event
- the event responsible for starting the editingtext
- text node being editedpublic void stopEditing(PInputEvent event)
event
- the event responsible for stopping the editingpublic void dispatchEventToEditor(PInputEvent event)
event
- the swing event being interceptedpublic void reshapeEditor()
protected void reshapeEditorLater()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |