|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
kaapo.project.graphics.DirectTextArea
public class DirectTextArea
Text area component similar to JTextArea, suitable for diagram panel direct editing. The text area has two modes: mutable and immutable. The mode changes at run time. By default the area is immutable and merely renders the text. When double clicked, the text area switches to mutable mode and functions like a regular JTextArea. When focus is lost, the mode switches back to immutable.
JTextArea
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected String |
attributeName
|
protected DiagramComponent |
diagramComponent
|
protected boolean |
documentListenerEnabled
|
protected JTextArea |
immutableTextArea
Like a normal text area, but always non-editable and all mouse listeners are removed. |
protected boolean |
isEditable
|
protected ProjectManager |
projectManager
|
protected JTextArea |
textArea
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DirectTextArea()
Constructs a bare text area that has no associated diagram component. |
|
DirectTextArea(DiagramComponent dc,
String attributeName,
ProjectManager pm)
|
Method Summary | |
---|---|
void |
addDocumentListener(DocumentListener dl)
Adds a document listener to the contents of the text area. |
void |
changedUpdate(DocumentEvent e)
|
protected void |
disableDocumentListener()
Temporary disables the document listener that the DirectTextArea registered itself. |
protected void |
dispatchEventUp(MouseEvent e)
Routes mouse event to parent diagram panel. |
protected void |
enableDocumentListener()
Re-enables the document listener. |
void |
focusGained(FocusEvent e)
|
void |
focusLost(FocusEvent e)
|
Dimension |
getPreferredSize()
|
String |
getText()
Returns the contents of the text area. |
void |
insertUpdate(DocumentEvent e)
|
protected void |
modifyAttribute(Object value)
Sets the value of DC attribute using Project Manager. |
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
void |
removeUpdate(DocumentEvent e)
|
void |
setBounds(int x,
int y,
int width,
int height)
|
void |
setEditable(boolean editable)
Sets the text area into editable or non-editable mode. |
void |
setText(String text)
Sets the contents of the text area. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean isEditable
protected JTextArea textArea
protected JTextArea immutableTextArea
protected ProjectManager projectManager
protected DiagramComponent diagramComponent
protected String attributeName
protected boolean documentListenerEnabled
Constructor Detail |
---|
public DirectTextArea(DiagramComponent dc, String attributeName, ProjectManager pm)
dc
- Associated diagram componentattributeName
- Name of DC attribute that is
used as the content of the text area.pm
- Project Manager that is used for
modifying the DC attribute.public DirectTextArea()
Method Detail |
---|
public void addDocumentListener(DocumentListener dl)
dl
- Document listenerpublic void setEditable(boolean editable)
editable
- public String getText()
public void setText(String text)
text
- New contentspublic Dimension getPreferredSize()
getPreferredSize
in class JComponent
public void setBounds(int x, int y, int width, int height)
setBounds
in class Component
protected void dispatchEventUp(MouseEvent e)
e
- The mouse eventpublic void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
protected void modifyAttribute(Object value)
value
- The new valueprotected void disableDocumentListener()
protected void enableDocumentListener()
public void changedUpdate(DocumentEvent e)
changedUpdate
in interface DocumentListener
public void insertUpdate(DocumentEvent e)
insertUpdate
in interface DocumentListener
public void removeUpdate(DocumentEvent e)
removeUpdate
in interface DocumentListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |