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
-
alignOptions
-
-
BACKWARD_CHAR
- Commands this view can execute.
-
BACKWARD_WORD
-
-
BEGINNING_OF_BUFFER
-
-
BEGINNING_OF_LINE
-
-
BEGINNING_OF_VIEW_LINE
-
-
CARET
-
-
caretColor
-
-
COPY
-
-
CUT
-
-
defaultInsets
-
-
defaultKeymap
- The default keymap to use.
-
DELETE_NEXT_CHAR
-
-
DELETE_NEXT_WORD
-
-
DELETE_PREVIOUS_CHAR
-
-
DELETE_PREVIOUS_WORD
-
-
END_OF_BUFFER
-
-
END_OF_LINE
-
-
END_OF_VIEW_LINE
-
-
F_BOXED
-
-
F_EDITABLE
-
-
F_MAX_FLAG
-
-
F_MODIFIED
-
-
F_REPAINT
-
-
F_SAVE_TEXT
-
-
F_SCROLLING_OK
-
-
F_SELECTIONS_OK
-
-
FORWARD_CHAR
-
-
FORWARD_WORD
-
-
FORWARD_WORD_START
-
-
insets
- Insets.
-
KILL_REGION
-
-
KILL_TO_EOL
-
-
level
-
-
LOCATE
-
-
MAKE_BOLD
-
-
MAKE_EMBOSS
-
-
MAKE_ITALICS
-
-
MAKE_LARGER
-
-
MAKE_PLAIN
-
-
MAKE_SMALLER
-
-
makePosVisible
- A buffer position that must be visible after the next
redisplay.
-
markList
- List of markers on this text.
-
NEWLINE_AND_BACKUP
-
-
newLines
- "New" lines, used for doing smart screen updates.
-
NEXT_FOCUS
-
-
NEXT_LINE
-
-
NEXT_PAGE
-
-
NPOS
-
-
OUTPUT
-
-
PASTE
-
-
pivot
- Mouse handling.
-
POSITION
-
-
positions
- Various text position of interest which need updating as
characters are inserted into and deleted from the buffer.
-
PREVIOUS_LINE
-
-
PREVIOUS_PAGE
-
-
sbar
- Scrollbar associated with this widget.
-
SELECTION_END
-
-
SELECTION_START
-
-
SELF_INSERT
-
-
SET_MARK
-
-
shadowColor
-
-
styleIndex
- The current style index, while we're formatting.
-
styleOptions
-
-
text
- Text we're displaying.
-
TOP
-
-
visibleLines
- Visible lines on the screen.
-
wrapOptions
-
-
TextView()
-
-
TextView(Text)
-
-
addFlag(int)
-
-
applyStyleChange(StyleChange)
- This applies a style change to the current region.
-
applyStyleChange(StyleChange, int, int)
- This applies a style change to the specified region.
-
autoScroll()
- Run the autoscrolling of selections.
-
clearFlag(int)
-
-
delete(int)
-
-
deleteSelection()
-
-
deleteTo(int)
- Delete from the caret to the specified position.
-
dirtyRegion(int, int, boolean)
-
-
extendSelection(int)
-
-
focusInterest()
- Keyboard input handling.
-
getAlign()
- Get the align of the text.
-
getBoxed()
-
-
getCaret()
-
-
getCaretColor()
- Get the color of the caret.
-
getCommand(String, int)
-
-
getDefaultStyle()
-
-
getEditable()
-
-
getEditor()
- Get the name of the class that can be used for
in-place editing.
-
getInset()
-
-
getInsets()
-
-
getMark(int)
-
-
getProperties(PropertyList)
- Get the properties of this widget.
-
getRichText()
- Get the value of the view as rich text
-
getSavetext()
-
-
getScrolling()
-
-
getSelection()
-
-
getSelectionEnd()
-
-
getSelectionPivot()
-
-
getSelections()
-
-
getSelectionStart()
-
-
getSettableKeymap()
-
-
getShadowColor()
- Get the shadow color.
-
getStringValue()
- Return the text as a string.
-
getStyle()
- Get the current style of the text.
-
getText()
- Return the text as a string.
-
getTextProperties(PropertyList)
-
-
getTextValue()
- Get this view's text object.
-
getValue()
- Return the text as a string.
-
getWrap()
- Get the current wrap mode.
-
handleCommand(Event, KeyboardCommand)
-
-
handleEvent(Event)
- Handle an event.
-
insert(int)
-
-
insert(String)
-
-
invalidate()
- Invalidate the widget (the size has changed).
-
isSet(int)
-
-
locateHit(int, int)
- Returns the buffer position that corresponds to the specified
x/y position.
-
locateLineContainingY(int)
- Locates a line object based on a Y position.
-
lookupCmd(String)
-
-
measureLine(Line, float, int)
-
-
mouseDown(Event, int, int)
- By default a widget calls this function when a
mouseDown event occurs.
-
mouseDrag(Event, int, int)
- By default a widget calls this function when a
mouseDrag event occurs.
-
mouseUp(Event, int, int)
- By default a widget calls this function when a
mouseUp event occurs.
-
notifyDelete(int, int)
- Updates the line structures and styles list based on LENGTH
characters being deleted from position POS.
-
notifyDirtyRegion(int, int)
- Text object notifies us that a region of text has changed,
probably because of a style change.
-
notifyInsert(int, int)
- Updates the line structures and styles list based on LENGTH
characters being inserted at POS.
-
paint(Graphics)
- Paint from scratch.
-
paintLine(Graphics, Line, boolean)
- Paint a line.
-
posVisible(int)
-
-
preferredSize()
-
-
repaint()
- Repaint the entrire widget as soon as possible.
-
repaintRegion(int, int, boolean)
-
-
scanLine(Line, Graphics, int, float, int)
- This is a duplicate of the measureLine method without the
measuring overhead.
-
scrollAbsolute(int, int)
-
-
scrollLine(int)
-
-
scrollPage(int)
-
-
scrollPage(int, boolean)
-
-
scrollTo(int, int)
- Try to get the line containing pos positioned at Y in the
window.
-
select(int, int)
-
-
select(int, int, int)
- Sets the selection, expanding it to words or lines if level is
2 or 3 respectively.
-
selectionLength()
-
-
setAlign(int)
- Set the align of the text.
-
setBoxed(boolean)
-
-
setCaret(int)
-
-
setCaretColor(Color)
- Set the color of the caret.
-
setDefaultStyle(Style)
-
-
setEditable(boolean)
-
-
setFlag(int, boolean)
-
-
setFontFamily(FontFamily)
-
-
setInset(int)
-
-
setInsets(Insets)
-
-
setKeymap(Keymap)
-
-
setModified()
-
-
setProperties(PropertyList)
- Set the properties of this widget.
-
setRichText(String)
- Set the value of the view as rich text
-
setSavetext(boolean)
-
-
setScrollbar(ScrollbarWidget)
-
-
setScrollbarValues()
-
-
setScrolling(boolean)
-
-
setSelections(boolean)
-
-
setShadowColor(Color)
- Set the shadow color.
-
setStyle(int)
- Set the style of the text to plain, boxed or filled.
-
setText(String)
- Set the text to the specified string.
-
setText(Text)
- Set this view's text object.
-
setTextProperties(PropertyList)
-
-
setValue(Object)
- Set the text to the specified string.
-
setWrap(int)
- Set the wrap mode to char, word, truncate.
-
tick(long, Object)
- The clock is ticking...
-
update(Graphics)
- Incremental redisplay of the screen.
-
validate()
- Validate the widget.
TOP
protected final static int TOP
CARET
protected final static int CARET
SELECTION_START
protected final static int SELECTION_START
SELECTION_END
protected final static int SELECTION_END
NPOS
protected final static int NPOS
F_MODIFIED
protected final static int F_MODIFIED
F_EDITABLE
protected final static int F_EDITABLE
F_BOXED
protected final static int F_BOXED
F_SELECTIONS_OK
protected final static int F_SELECTIONS_OK
F_SCROLLING_OK
protected final static int F_SCROLLING_OK
F_SAVE_TEXT
protected final static int F_SAVE_TEXT
F_REPAINT
protected final static int F_REPAINT
F_MAX_FLAG
protected final static int F_MAX_FLAG
text
protected Text text
- Text we're displaying.
insets
protected Insets insets
- Insets.
caretColor
protected Color caretColor
shadowColor
protected Color shadowColor
positions
protected int positions[]
- Various text position of interest which need updating as
characters are inserted into and deleted from the buffer.
makePosVisible
protected int makePosVisible
- A buffer position that must be visible after the next
redisplay. Ignored when it's -1.
styleIndex
protected int styleIndex
- The current style index, while we're formatting.
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.
visibleLines
protected LinePool visibleLines
- Visible lines on the screen.
newLines
protected LinePool newLines
- "New" lines, used for doing smart screen updates.
sbar
protected ScrollbarWidget sbar
- Scrollbar associated with this widget.
styleOptions
public static Options styleOptions
defaultInsets
protected final static Insets defaultInsets
OUTPUT
protected final int OUTPUT
LOCATE
protected final int LOCATE
POSITION
protected final int POSITION
pivot
protected int pivot
- Mouse handling.
level
protected int level
defaultKeymap
protected static Keymap defaultKeymap
- The default keymap to use.
BACKWARD_CHAR
public final static int BACKWARD_CHAR
- Commands this view can execute.
BACKWARD_WORD
public final static int BACKWARD_WORD
BEGINNING_OF_LINE
public final static int BEGINNING_OF_LINE
END_OF_LINE
public final static int END_OF_LINE
FORWARD_CHAR
public final static int FORWARD_CHAR
FORWARD_WORD
public final static int FORWARD_WORD
KILL_TO_EOL
public final static int KILL_TO_EOL
NEXT_PAGE
public final static int NEXT_PAGE
PREVIOUS_PAGE
public final static int PREVIOUS_PAGE
SELF_INSERT
public final static int SELF_INSERT
DELETE_PREVIOUS_CHAR
public final static int DELETE_PREVIOUS_CHAR
DELETE_NEXT_CHAR
public final static int DELETE_NEXT_CHAR
BEGINNING_OF_BUFFER
public final static int BEGINNING_OF_BUFFER
END_OF_BUFFER
public final static int END_OF_BUFFER
DELETE_NEXT_WORD
public final static int DELETE_NEXT_WORD
DELETE_PREVIOUS_WORD
public final static int DELETE_PREVIOUS_WORD
MAKE_ITALICS
public final static int MAKE_ITALICS
MAKE_BOLD
public final static int MAKE_BOLD
MAKE_EMBOSS
public final static int MAKE_EMBOSS
MAKE_LARGER
public final static int MAKE_LARGER
MAKE_SMALLER
public final static int MAKE_SMALLER
MAKE_PLAIN
public final static int MAKE_PLAIN
COPY
public final static int COPY
CUT
public final static int CUT
PASTE
public final static int PASTE
NEWLINE_AND_BACKUP
public final static int NEWLINE_AND_BACKUP
SET_MARK
public final static int SET_MARK
KILL_REGION
public final static int KILL_REGION
NEXT_FOCUS
public final static int NEXT_FOCUS
END_OF_VIEW_LINE
public final static int END_OF_VIEW_LINE
BEGINNING_OF_VIEW_LINE
public final static int BEGINNING_OF_VIEW_LINE
NEXT_LINE
public final static int NEXT_LINE
PREVIOUS_LINE
public final static int PREVIOUS_LINE
FORWARD_WORD_START
public final static int FORWARD_WORD_START
alignOptions
public static Options alignOptions
wrapOptions
public static Options wrapOptions
TextView
public TextView()
TextView
public TextView(Text text)
getProperties
public void getProperties(PropertyList list)
- Get the properties of this widget.
- Overrides:
- getProperties in class Widget
getTextProperties
public void getTextProperties(PropertyList list)
setProperties
public void setProperties(PropertyList list)
- Set the properties of this widget.
- Overrides:
- setProperties in class Widget
setTextProperties
public void setTextProperties(PropertyList list)
getRichText
public String getRichText()
- Get the value of the view as rich text
setRichText
public void setRichText(String txt)
- Set the value of the view as rich text
setScrollbar
public void setScrollbar(ScrollbarWidget sbar)
invalidate
public synchronized void invalidate()
- Invalidate the widget (the size has changed).
- Overrides:
- invalidate in class Widget
getStyle
public int getStyle()
- Get the current style of the text.
- See Also:
- setStyle
setStyle
public void setStyle(int style)
- Set the style of the text to plain, boxed or filled.
- See Also:
- getStyle
getDefaultStyle
public Style getDefaultStyle()
setDefaultStyle
public void setDefaultStyle(Style s)
setFontFamily
public void setFontFamily(FontFamily family)
getAlign
public int getAlign()
- Get the align of the text.
- See Also:
- setAlign
setAlign
public void setAlign(int align)
- Set the align of the text.
- See Also:
- getAlign
getWrap
public int getWrap()
- Get the current wrap mode.
Returns a widgetConstant: CHAR, TRUNCATE or WORD.
- See Also:
- setWrap
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
validate
public void validate()
- Validate the widget.
- Overrides:
- validate in class Widget
getEditor
public String getEditor()
- Get the name of the class that can be used for
in-place editing.
- Overrides:
- getEditor in class Widget
setText
public void setText(Text text)
- Set this view's text object.
addFlag
protected final void addFlag(int bits)
setFlag
protected final void setFlag(int bits,
boolean on)
clearFlag
protected final void clearFlag(int bits)
isSet
protected final boolean isSet(int bits)
notifyInsert
protected void notifyInsert(int pos,
int length)
- Updates the line structures and styles list based on LENGTH
characters being inserted at POS.
notifyDelete
protected void notifyDelete(int pos,
int length)
- Updates the line structures and styles list based on LENGTH
characters being deleted from position POS.
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.
dirtyRegion
protected void dirtyRegion(int pos0,
int pos1,
boolean notIfEmpty)
repaintRegion
protected void repaintRegion(int pos0,
int pos1,
boolean notIfEmpty)
locateLineContainingY
protected Line locateLineContainingY(int y)
- Locates a line object based on a Y position.
locateHit
public int locateHit(int x,
int y)
- Returns the buffer position that corresponds to the specified
x/y position.
measureLine
protected final int measureLine(Line line,
float xlimit,
int poslimit)
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.
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.
setScrollbarValues
protected void setScrollbarValues()
posVisible
protected boolean posVisible(int pos)
setModified
protected void setModified()
repaint
public synchronized void repaint()
- Repaint the entrire widget as soon as possible.
- Overrides:
- repaint in class Widget
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.
select
public synchronized void select(int pos0,
int pos1)
extendSelection
public synchronized void extendSelection(int pos)
getSelectionPivot
public synchronized int getSelectionPivot()
selectionLength
public int selectionLength()
getSelection
public String getSelection()
getSelectionStart
public final int getSelectionStart()
getSelectionEnd
public final int getSelectionEnd()
setCaret
public void setCaret(int caret)
getCaret
public final int getCaret()
getMark
public Mark getMark(int pos)
getCaretColor
public Color getCaretColor()
- Get the color of the caret.
setCaretColor
public void setCaretColor(Color caretColor)
- Set the color of the caret.
getShadowColor
public Color getShadowColor()
- Get the shadow color.
setShadowColor
public void setShadowColor(Color shadowColor)
- Set the shadow color.
setEditable
public void setEditable(boolean on)
setBoxed
public void setBoxed(boolean on)
setSelections
public void setSelections(boolean on)
setScrolling
public void setScrolling(boolean on)
setSavetext
public void setSavetext(boolean on)
setInsets
public void setInsets(Insets insets)
setInset
public void setInset(int inset)
getEditable
public boolean getEditable()
getBoxed
public boolean getBoxed()
getSelections
public boolean getSelections()
getScrolling
public boolean getScrolling()
getSavetext
public boolean getSavetext()
getInsets
public Insets getInsets()
getInset
public int getInset()
getTextValue
public Text getTextValue()
- Get this view's text object.
getStringValue
public String getStringValue()
- Return the text as a string.
getValue
public Object getValue()
- Return the text as a string.
- Overrides:
- getValue in class Widget
setValue
public synchronized void setValue(Object value)
- Set the text to the specified string.
- Overrides:
- setValue in class Widget
getText
public String getText()
- Return the text as a string.
- Overrides:
- getText in class Widget
setText
public synchronized void setText(String value)
- Set the text to the specified string.
- Overrides:
- setText in class Widget
focusInterest
public boolean focusInterest()
- Keyboard input handling.
- Overrides:
- focusInterest in class Widget
deleteSelection
public void deleteSelection()
insert
public void insert(int key)
insert
public void insert(String s)
deleteTo
public void deleteTo(int pos)
- Delete from the caret to the specified position.
delete
public void delete(int arg)
setKeymap
public void setKeymap(Keymap map)
getSettableKeymap
public Keymap getSettableKeymap()
handleEvent
public boolean handleEvent(Event evt)
- Handle an event.
- Overrides:
- handleEvent in class Widget
handleCommand
protected void handleCommand(Event evt,
KeyboardCommand cmd)
applyStyleChange
public void applyStyleChange(StyleChange sc)
- This applies a style change to the current region.
applyStyleChange
public void applyStyleChange(StyleChange sc,
int pos0,
int pos1)
- This applies a style change to the specified region.
tick
public long tick(long tm,
Object arg)
- The clock is ticking...
- Overrides:
- tick in class Widget
paint
public void paint(Graphics g)
- Paint from scratch.
- Overrides:
- paint in class Widget
update
public void update(Graphics g)
- Incremental redisplay of the screen. Just paints lines which
have changed.
- Overrides:
- update in class Widget
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.
preferredSize
public Dimension preferredSize()
scrollAbsolute
public void scrollAbsolute(int pos,
int y)
scrollLine
public void scrollLine(int dir)
scrollPage
public void scrollPage(int dir)
scrollPage
public void scrollPage(int dir,
boolean moveCaret)
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
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
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
autoScroll
public boolean autoScroll()
- Run the autoscrolling of selections.
lookupCmd
protected static KeyboardCommand lookupCmd(String name)
getCommand
protected static KeyboardCommand getCommand(String name,
int code)
All Packages Class Hierarchy This Package Previous Next Index