Class marimba.text.TextView
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class marimba.text.TextView

java.lang.Object
   |
   +----marimba.gui.Widget
           |
           +----marimba.text.TextView

public class TextView
extends Widget
implements TimerClient
Abstract view of a Text object. Multi-line and single-line subclasses fill in the few methods required to make it work properly in those situations.
Version:
1.93, 01/09/97
Author:
Jonathan Payne

Variable Index

 o alignOptions
 o BACKWARD_CHAR
Commands this view can execute.
 o BACKWARD_WORD
 o BEGINNING_OF_BUFFER
 o BEGINNING_OF_LINE
 o BEGINNING_OF_VIEW_LINE
 o CARET
 o caretColor
 o COPY
 o CUT
 o defaultInsets
 o defaultKeymap
The default keymap to use.
 o DELETE_NEXT_CHAR
 o DELETE_NEXT_WORD
 o DELETE_PREVIOUS_CHAR
 o DELETE_PREVIOUS_WORD
 o END_OF_BUFFER
 o END_OF_LINE
 o END_OF_VIEW_LINE
 o F_BOXED
 o F_EDITABLE
 o F_MAX_FLAG
 o F_MODIFIED
 o F_REPAINT
 o F_SAVE_TEXT
 o F_SCROLLING_OK
 o F_SELECTIONS_OK
 o FORWARD_CHAR
 o FORWARD_WORD
 o FORWARD_WORD_START
 o insets
Insets.
 o KILL_REGION
 o KILL_TO_EOL
 o level
 o LOCATE
 o MAKE_BOLD
 o MAKE_EMBOSS
 o MAKE_ITALICS
 o MAKE_LARGER
 o MAKE_PLAIN
 o MAKE_SMALLER
 o makePosVisible
A buffer position that must be visible after the next redisplay.
 o markList
List of markers on this text.
 o NEWLINE_AND_BACKUP
 o newLines
"New" lines, used for doing smart screen updates.
 o NEXT_FOCUS
 o NEXT_LINE
 o NEXT_PAGE
 o NPOS
 o OUTPUT
 o PASTE
 o pivot
Mouse handling.
 o POSITION
 o positions
Various text position of interest which need updating as characters are inserted into and deleted from the buffer.
 o PREVIOUS_LINE
 o PREVIOUS_PAGE
 o sbar
Scrollbar associated with this widget.
 o SELECTION_END
 o SELECTION_START
 o SELF_INSERT
 o SET_MARK
 o shadowColor
 o styleIndex
The current style index, while we're formatting.
 o styleOptions
 o text
Text we're displaying.
 o TOP
 o visibleLines
Visible lines on the screen.
 o wrapOptions

Constructor Index

 o TextView()
 o TextView(Text)

Method Index

 o addFlag(int)
 o applyStyleChange(StyleChange)
This applies a style change to the current region.
 o applyStyleChange(StyleChange, int, int)
This applies a style change to the specified region.
 o autoScroll()
Run the autoscrolling of selections.
 o clearFlag(int)
 o delete(int)
 o deleteSelection()
 o deleteTo(int)
Delete from the caret to the specified position.
 o dirtyRegion(int, int, boolean)
 o extendSelection(int)
 o focusInterest()
Keyboard input handling.
 o getAlign()
Get the align of the text.
 o getBoxed()
 o getCaret()
 o getCaretColor()
Get the color of the caret.
 o getCommand(String, int)
 o getDefaultStyle()
 o getEditable()
 o getEditor()
Get the name of the class that can be used for in-place editing.
 o getInset()
 o getInsets()
 o getMark(int)
 o getProperties(PropertyList)
Get the properties of this widget.
 o getRichText()
Get the value of the view as rich text
 o getSavetext()
 o getScrolling()
 o getSelection()
 o getSelectionEnd()
 o getSelectionPivot()
 o getSelections()
 o getSelectionStart()
 o getSettableKeymap()
 o getShadowColor()
Get the shadow color.
 o getStringValue()
Return the text as a string.
 o getStyle()
Get the current style of the text.
 o getText()
Return the text as a string.
 o getTextProperties(PropertyList)
 o getTextValue()
Get this view's text object.
 o getValue()
Return the text as a string.
 o getWrap()
Get the current wrap mode.
 o handleCommand(Event, KeyboardCommand)
 o handleEvent(Event)
Handle an event.
 o insert(int)
 o insert(String)
 o invalidate()
Invalidate the widget (the size has changed).
 o isSet(int)
 o locateHit(int, int)
Returns the buffer position that corresponds to the specified x/y position.
 o locateLineContainingY(int)
Locates a line object based on a Y position.
 o lookupCmd(String)
 o measureLine(Line, float, int)
 o mouseDown(Event, int, int)
By default a widget calls this function when a mouseDown event occurs.
 o mouseDrag(Event, int, int)
By default a widget calls this function when a mouseDrag event occurs.
 o mouseUp(Event, int, int)
By default a widget calls this function when a mouseUp event occurs.
 o notifyDelete(int, int)
Updates the line structures and styles list based on LENGTH characters being deleted from position POS.
 o notifyDirtyRegion(int, int)
Text object notifies us that a region of text has changed, probably because of a style change.
 o notifyInsert(int, int)
Updates the line structures and styles list based on LENGTH characters being inserted at POS.
 o paint(Graphics)
Paint from scratch.
 o paintLine(Graphics, Line, boolean)
Paint a line.
 o posVisible(int)
 o preferredSize()
 o repaint()
Repaint the entrire widget as soon as possible.
 o repaintRegion(int, int, boolean)
 o scanLine(Line, Graphics, int, float, int)
This is a duplicate of the measureLine method without the measuring overhead.
 o scrollAbsolute(int, int)
 o scrollLine(int)
 o scrollPage(int)
 o scrollPage(int, boolean)
 o scrollTo(int, int)
Try to get the line containing pos positioned at Y in the window.
 o select(int, int)
 o select(int, int, int)
Sets the selection, expanding it to words or lines if level is 2 or 3 respectively.
 o selectionLength()
 o setAlign(int)
Set the align of the text.
 o setBoxed(boolean)
 o setCaret(int)
 o setCaretColor(Color)
Set the color of the caret.
 o setDefaultStyle(Style)
 o setEditable(boolean)
 o setFlag(int, boolean)
 o setFontFamily(FontFamily)
 o setInset(int)
 o setInsets(Insets)
 o setKeymap(Keymap)
 o setModified()
 o setProperties(PropertyList)
Set the properties of this widget.
 o setRichText(String)
Set the value of the view as rich text
 o setSavetext(boolean)
 o setScrollbar(ScrollbarWidget)
 o setScrollbarValues()
 o setScrolling(boolean)
 o setSelections(boolean)
 o setShadowColor(Color)
Set the shadow color.
 o setStyle(int)
Set the style of the text to plain, boxed or filled.
 o setText(String)
Set the text to the specified string.
 o setText(Text)
Set this view's text object.
 o setTextProperties(PropertyList)
 o setValue(Object)
Set the text to the specified string.
 o setWrap(int)
Set the wrap mode to char, word, truncate.
 o tick(long, Object)
The clock is ticking...
 o update(Graphics)
Incremental redisplay of the screen.
 o validate()
Validate the widget.

Variables

 o TOP
  protected final static int TOP
 o CARET
  protected final static int CARET
 o SELECTION_START
  protected final static int SELECTION_START
 o SELECTION_END
  protected final static int SELECTION_END
 o NPOS
  protected final static int NPOS
 o F_MODIFIED
  protected final static int F_MODIFIED
 o F_EDITABLE
  protected final static int F_EDITABLE
 o F_BOXED
  protected final static int F_BOXED
 o F_SELECTIONS_OK
  protected final static int F_SELECTIONS_OK
 o F_SCROLLING_OK
  protected final static int F_SCROLLING_OK
 o F_SAVE_TEXT
  protected final static int F_SAVE_TEXT
 o F_REPAINT
  protected final static int F_REPAINT
 o F_MAX_FLAG
  protected final static int F_MAX_FLAG
 o text
  protected Text text
Text we're displaying.
 o insets
  protected Insets insets
Insets.
 o caretColor
  protected Color caretColor
 o shadowColor
  protected Color shadowColor
 o positions
  protected int positions[]
Various text position of interest which need updating as characters are inserted into and deleted from the buffer.
 o makePosVisible
  protected int makePosVisible
A buffer position that must be visible after the next redisplay. Ignored when it's -1.
 o styleIndex
  protected int styleIndex
The current style index, while we're formatting.
 o markList
  protected Mark markList
List of markers on this text. Markers have positions which are updated whenever inserts or deletes are made on the text.
 o visibleLines
  protected LinePool visibleLines
Visible lines on the screen.
 o newLines
  protected LinePool newLines
"New" lines, used for doing smart screen updates.
 o sbar
  protected ScrollbarWidget sbar
Scrollbar associated with this widget.
 o styleOptions
  public static Options styleOptions
 o defaultInsets
  protected final static Insets defaultInsets
 o OUTPUT
  protected final int OUTPUT
 o LOCATE
  protected final int LOCATE
 o POSITION
  protected final int POSITION
 o pivot
  protected int pivot
Mouse handling.
 o level
  protected int level
 o defaultKeymap
  protected static Keymap defaultKeymap
The default keymap to use.
 o BACKWARD_CHAR
  public final static int BACKWARD_CHAR
Commands this view can execute.
 o BACKWARD_WORD
  public final static int BACKWARD_WORD
 o BEGINNING_OF_LINE
  public final static int BEGINNING_OF_LINE
 o END_OF_LINE
  public final static int END_OF_LINE
 o FORWARD_CHAR
  public final static int FORWARD_CHAR
 o FORWARD_WORD
  public final static int FORWARD_WORD
 o KILL_TO_EOL
  public final static int KILL_TO_EOL
 o NEXT_PAGE
  public final static int NEXT_PAGE
 o PREVIOUS_PAGE
  public final static int PREVIOUS_PAGE
 o SELF_INSERT
  public final static int SELF_INSERT
 o DELETE_PREVIOUS_CHAR
  public final static int DELETE_PREVIOUS_CHAR
 o DELETE_NEXT_CHAR
  public final static int DELETE_NEXT_CHAR
 o BEGINNING_OF_BUFFER
  public final static int BEGINNING_OF_BUFFER
 o END_OF_BUFFER
  public final static int END_OF_BUFFER
 o DELETE_NEXT_WORD
  public final static int DELETE_NEXT_WORD
 o DELETE_PREVIOUS_WORD
  public final static int DELETE_PREVIOUS_WORD
 o MAKE_ITALICS
  public final static int MAKE_ITALICS
 o MAKE_BOLD
  public final static int MAKE_BOLD
 o MAKE_EMBOSS
  public final static int MAKE_EMBOSS
 o MAKE_LARGER
  public final static int MAKE_LARGER
 o MAKE_SMALLER
  public final static int MAKE_SMALLER
 o MAKE_PLAIN
  public final static int MAKE_PLAIN
 o COPY
  public final static int COPY
 o CUT
  public final static int CUT
 o PASTE
  public final static int PASTE
 o NEWLINE_AND_BACKUP
  public final static int NEWLINE_AND_BACKUP
 o SET_MARK
  public final static int SET_MARK
 o KILL_REGION
  public final static int KILL_REGION
 o NEXT_FOCUS
  public final static int NEXT_FOCUS
 o END_OF_VIEW_LINE
  public final static int END_OF_VIEW_LINE
 o BEGINNING_OF_VIEW_LINE
  public final static int BEGINNING_OF_VIEW_LINE
 o NEXT_LINE
  public final static int NEXT_LINE
 o PREVIOUS_LINE
  public final static int PREVIOUS_LINE
 o FORWARD_WORD_START
  public final static int FORWARD_WORD_START
 o alignOptions
  public static Options alignOptions
 o wrapOptions
  public static Options wrapOptions

Constructors

 o TextView
  public TextView()
 o TextView
  public TextView(Text text)

Methods

 o getProperties
  public void getProperties(PropertyList list)
Get the properties of this widget.
Overrides:
getProperties in class Widget
 o getTextProperties
  public void getTextProperties(PropertyList list)
 o setProperties
  public void setProperties(PropertyList list)
Set the properties of this widget.
Overrides:
setProperties in class Widget
 o setTextProperties
  public void setTextProperties(PropertyList list)
 o getRichText
  public String getRichText()
Get the value of the view as rich text
 o setRichText
  public void setRichText(String txt)
Set the value of the view as rich text
 o setScrollbar
  public void setScrollbar(ScrollbarWidget sbar)
 o invalidate
  public synchronized void invalidate()
Invalidate the widget (the size has changed).
Overrides:
invalidate in class Widget
 o getStyle
  public int getStyle()
Get the current style of the text.
See Also:
setStyle
 o setStyle
  public void setStyle(int style)
Set the style of the text to plain, boxed or filled.
See Also:
getStyle
 o getDefaultStyle
  public Style getDefaultStyle()
 o setDefaultStyle
  public void setDefaultStyle(Style s)
 o setFontFamily
  public void setFontFamily(FontFamily family)
 o getAlign
  public int getAlign()
Get the align of the text.
See Also:
setAlign
 o setAlign
  public void setAlign(int align)
Set the align of the text.
See Also:
getAlign
 o getWrap
  public int getWrap()
Get the current wrap mode. Returns a widgetConstant: CHAR, TRUNCATE or WORD.
See Also:
setWrap
 o setWrap
  public void setWrap(int wrap)
Set the wrap mode to char, word, truncate. A widgetConstant must be given: CHAR, TRUNCATE or WORD.
See Also:
getWrap
 o validate
  public void validate()
Validate the widget.
Overrides:
validate in class Widget
 o getEditor
  public String getEditor()
Get the name of the class that can be used for in-place editing.
Overrides:
getEditor in class Widget
 o setText
  public void setText(Text text)
Set this view's text object.
 o addFlag
  protected final void addFlag(int bits)
 o setFlag
  protected final void setFlag(int bits,
                               boolean on)
 o clearFlag
  protected final void clearFlag(int bits)
 o isSet
  protected final boolean isSet(int bits)
 o notifyInsert
  protected void notifyInsert(int pos,
                              int length)
Updates the line structures and styles list based on LENGTH characters being inserted at POS.
 o notifyDelete
  protected void notifyDelete(int pos,
                              int length)
Updates the line structures and styles list based on LENGTH characters being deleted from position POS.
 o notifyDirtyRegion
  protected void notifyDirtyRegion(int pos0,
                                   int pos1)
Text object notifies us that a region of text has changed, probably because of a style change.
 o dirtyRegion
  protected void dirtyRegion(int pos0,
                             int pos1,
                             boolean notIfEmpty)
 o repaintRegion
  protected void repaintRegion(int pos0,
                               int pos1,
                               boolean notIfEmpty)
 o locateLineContainingY
  protected Line locateLineContainingY(int y)
Locates a line object based on a Y position.
 o locateHit
  public int locateHit(int x,
                       int y)
Returns the buffer position that corresponds to the specified x/y position.
 o measureLine
  protected final int measureLine(Line line,
                                  float xlimit,
                                  int poslimit)
 o scanLine
  protected final int scanLine(Line line,
                               Graphics g,
                               int what,
                               float xlimit,
                               int poslimit)
This is a duplicate of the measureLine method without the measuring overhead. This was separated out to make painting, position and x/y location faster, since they are very common operations.
 o paintLine
  protected void paintLine(Graphics g,
                           Line line,
                           boolean doSelections)
Paint a line. The work is done by scanLine, but this does a little work itself to figure out selection stuff. When a line is partially selected, the backgrounds are drawn first, and then the text is drawn on top. Portions of this are kludgy because I didn't completely separate painting a selection and painting a caret. They are slightly different cases.
 o setScrollbarValues
  protected void setScrollbarValues()
 o posVisible
  protected boolean posVisible(int pos)
 o setModified
  protected void setModified()
 o repaint
  public synchronized void repaint()
Repaint the entrire widget as soon as possible.
Overrides:
repaint in class Widget
 o select
  public void select(int pos0,
                     int pos1,
                     int level)
Sets the selection, expanding it to words or lines if level is 2 or 3 respectively. pos1 is where the mouse is, which is where the caret should end up.
 o select
  public synchronized void select(int pos0,
                                  int pos1)
 o extendSelection
  public synchronized void extendSelection(int pos)
 o getSelectionPivot
  public synchronized int getSelectionPivot()
 o selectionLength
  public int selectionLength()
 o getSelection
  public String getSelection()
 o getSelectionStart
  public final int getSelectionStart()
 o getSelectionEnd
  public final int getSelectionEnd()
 o setCaret
  public void setCaret(int caret)
 o getCaret
  public final int getCaret()
 o getMark
  public Mark getMark(int pos)
 o getCaretColor
  public Color getCaretColor()
Get the color of the caret.
 o setCaretColor
  public void setCaretColor(Color caretColor)
Set the color of the caret.
 o getShadowColor
  public Color getShadowColor()
Get the shadow color.
 o setShadowColor
  public void setShadowColor(Color shadowColor)
Set the shadow color.
 o setEditable
  public void setEditable(boolean on)
 o setBoxed
  public void setBoxed(boolean on)
 o setSelections
  public void setSelections(boolean on)
 o setScrolling
  public void setScrolling(boolean on)
 o setSavetext
  public void setSavetext(boolean on)
 o setInsets
  public void setInsets(Insets insets)
 o setInset
  public void setInset(int inset)
 o getEditable
  public boolean getEditable()
 o getBoxed
  public boolean getBoxed()
 o getSelections
  public boolean getSelections()
 o getScrolling
  public boolean getScrolling()
 o getSavetext
  public boolean getSavetext()
 o getInsets
  public Insets getInsets()
 o getInset
  public int getInset()
 o getTextValue
  public Text getTextValue()
Get this view's text object.
 o getStringValue
  public String getStringValue()
Return the text as a string.
 o getValue
  public Object getValue()
Return the text as a string.
Overrides:
getValue in class Widget
 o setValue
  public synchronized void setValue(Object value)
Set the text to the specified string.
Overrides:
setValue in class Widget
 o getText
  public String getText()
Return the text as a string.
Overrides:
getText in class Widget
 o setText
  public synchronized void setText(String value)
Set the text to the specified string.
Overrides:
setText in class Widget
 o focusInterest
  public boolean focusInterest()
Keyboard input handling.
Overrides:
focusInterest in class Widget
 o deleteSelection
  public void deleteSelection()
 o insert
  public void insert(int key)
 o insert
  public void insert(String s)
 o deleteTo
  public void deleteTo(int pos)
Delete from the caret to the specified position.
 o delete
  public void delete(int arg)
 o setKeymap
  public void setKeymap(Keymap map)
 o getSettableKeymap
  public Keymap getSettableKeymap()
 o handleEvent
  public boolean handleEvent(Event evt)
Handle an event.
Overrides:
handleEvent in class Widget
 o handleCommand
  protected void handleCommand(Event evt,
                               KeyboardCommand cmd)
 o applyStyleChange
  public void applyStyleChange(StyleChange sc)
This applies a style change to the current region.
 o applyStyleChange
  public void applyStyleChange(StyleChange sc,
                               int pos0,
                               int pos1)
This applies a style change to the specified region.
 o tick
  public long tick(long tm,
                   Object arg)
The clock is ticking...
Overrides:
tick in class Widget
 o paint
  public void paint(Graphics g)
Paint from scratch.
Overrides:
paint in class Widget
 o update
  public void update(Graphics g)
Incremental redisplay of the screen. Just paints lines which have changed.
Overrides:
update in class Widget
 o scrollTo
  protected void scrollTo(int destpos,
                          int y)
Try to get the line containing pos positioned at Y in the window. This works by backing up from destpos to line bounderies, formatting them until "y" pixels worth of lines are formatted.
 o preferredSize
  public Dimension preferredSize()
 o scrollAbsolute
  public void scrollAbsolute(int pos,
                             int y)
 o scrollLine
  public void scrollLine(int dir)
 o scrollPage
  public void scrollPage(int dir)
 o scrollPage
  public void scrollPage(int dir,
                         boolean moveCaret)
 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
By default a widget calls this function when a mouseDown event occurs.
Overrides:
mouseDown in class Widget
 o mouseDrag
  public boolean mouseDrag(Event e,
                           int x,
                           int y)
By default a widget calls this function when a mouseDrag event occurs.
Overrides:
mouseDrag in class Widget
 o mouseUp
  public boolean mouseUp(Event e,
                         int x,
                         int y)
By default a widget calls this function when a mouseUp event occurs.
Overrides:
mouseUp in class Widget
 o autoScroll
  public boolean autoScroll()
Run the autoscrolling of selections.
 o lookupCmd
  protected static KeyboardCommand lookupCmd(String name)
 o getCommand
  protected static KeyboardCommand getCommand(String name,
                                              int code)

All Packages  Class Hierarchy  This Package  Previous  Next  Index