swingwtx.swing.text
Class PlainView

java.lang.Object
  extended byswingwtx.swing.text.View
      extended byswingwtx.swing.text.PlainView
All Implemented Interfaces:
SwingConstants

public class PlainView
extends View

Mapped view descendant that allows translation of a Document to a plain SWT Text component (works for JTextField, JPasswordField and JTextArea - ie. Is used by JTextComponent). Since it takes text either en-masse, this is appallingly inefficient. It will do for now (and since JTextField/ JPasswordField and JTextArea generally don't contain that much changeable text, it should be ok - we'll use something better for JEditorPane/JTextPane).


Field Summary
protected  JTextComponent comp
           
 
Fields inherited from class swingwtx.swing.text.View
doc
 
Fields inherited from interface swingwtx.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
PlainView(Document doc, JTextComponent component)
           
 
Method Summary
 void setDocument(Document doc)
          Sets a replacement Document - this routine calls updateComponentFromModel to load the model's content into the component
 void updateComponentFromModel()
          Reads the text from the model and replaces the text in the component.
 void updateModelFromComponent(java.lang.String newText)
          Copies the text passed in from the component to the model, replacing any content already there entirely.
 
Methods inherited from class swingwtx.swing.text.View
getAlignment, getView, getViewCount, isVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comp

protected JTextComponent comp
Constructor Detail

PlainView

public PlainView(Document doc,
                 JTextComponent component)
Method Detail

updateModelFromComponent

public void updateModelFromComponent(java.lang.String newText)
Copies the text passed in from the component to the model, replacing any content already there entirely.


updateComponentFromModel

public void updateComponentFromModel()
Reads the text from the model and replaces the text in the component.


setDocument

public void setDocument(Document doc)
Sets a replacement Document - this routine calls updateComponentFromModel to load the model's content into the component