|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sub_arctic.lib.min_interactor | +--sub_arctic.lib.base_interactor | +--sub_arctic.lib.text_display
Text edit area displayer. This class displays a multi-line area of text with a selection point or area in a fashion suitable for use by a small text editor interactor. Selection positions are given as a line number and position with a line. Positions with a line refer to the spaces before the characters (numbered from 0). So for example a selection from line 0, character 0 to line 0, character 0 places the cursor before the first character being displayed, while a selection from line 1 character 1 to line 2 character 2 selects from the second character of the second line, up to and including the second character of the third line.
Field Summary | |
protected int |
_first_line
First line to display. |
protected java.awt.Font |
_font
Font that interactor displays in |
protected int |
_h_spacing
Extra horizontal spacing at left and right of text |
protected java.awt.FontMetrics |
_metric
Cached font metrics object for the current font |
protected int |
_selection_end_line
Ending line of the current selection. |
protected int |
_selection_end_pos
Position of end of selection within the ending line. |
protected int |
_selection_start_line
Start line of the current selection. |
protected int |
_selection_start_pos
Position of start of selection within the start line. |
protected java.util.Vector |
_text
Text to be displayed stored as a Vector of Strings |
protected int |
_v_spacing
Extra vertical spacing at top and bottom of text |
static int |
BOXED
Constant used to store boxed flag within interactor flags |
static int |
NO_SELECTION
Constant for a special selection point used to denote that there is no selection. |
static int |
SELECT_END
Constant used to denote that the selection is at the end of a line or line is the last one in the text. |
protected static int |
xpos
X position of current line. |
protected static int |
ypos
Y position of current line . |
protected static int |
ypos_cutoff
Max Y position we need to do text drawing at (taking into account the ascent of the font). |
Fields inherited from class sub_arctic.lib.base_interactor |
_child_index,
_child_list,
_clip_bounds,
_constraint_flags,
_enabled_constraint,
_flags,
_h,
_h_constraint,
_parent,
_part_a_constraint,
_part_b_constraint,
_user_data,
_visible_constraint,
_w,
_w_constraint,
_x,
_x_constraint,
_y,
_y_constraint,
default_child_hint |
Constructor Summary | |
text_display(int xv,
int yv,
int wv,
int hv,
java.lang.String contents,
java.awt.Font fnt,
boolean boxed)
Full constructor with explicit size. |
|
text_display(int xv,
int yv,
java.lang.String contents)
Constructor with computed size, default font, and default boxed status. |
|
text_display(int xv,
int yv,
java.lang.String contents,
java.awt.Font fnt,
boolean boxed)
Full constructor with size determined by initial text. |
Method Summary | |
boolean |
boxed()
Does the interactor have a box drawn around it. |
static java.util.Vector |
break_into_lines(java.lang.String all_text)
Convert a single string into a series of line strings stored in a Vector. |
protected void |
draw_highlighted_lines(drawable d,
int first_ln,
int last_ln)
Draw a series of fully highlighted lines. |
protected void |
draw_norm_lines(drawable d,
int st_ln,
int end_ln)
Draw a series of lines of unhighlighted text. |
protected void |
draw_self_local(drawable d)
Draw image of text with selection and optional box |
protected void |
draw_split_line(drawable d,
int ln_num,
int st_pos,
int end_pos)
Draw line that is partially highlighted. |
void |
dump_text()
Do a human readable dump of the text and selection to System.out |
int |
first_line()
First line to display. |
void |
first_line(int frst_ln)
Set the first line to display. |
java.awt.Font |
font()
Font that interactor displays in |
java.lang.String |
get_string(java.lang.String terminator)
Get a single string with lines terminated by the given string. |
int |
h_spacing()
Extra horizontal spacing at left and right of text. |
int |
intrinsic_constraints()
Parts that we intrinsically constrain. |
int |
part_a()
Return the value of the part_a component of this object. |
int |
selection_end_line()
Ending line of the current selection. |
protected int |
selection_end_pos()
Position of end of selection within the ending line. |
int |
selection_start_line()
Start line of the current selection. |
protected int |
selection_start_pos()
Position of start of selection within the start line. |
void |
set_boxed(boolean bxv)
Set the flag indicating whether interactor is drawn with a surrounding box. |
void |
set_font(java.awt.Font fnt)
Set font that interactor displays in |
void |
set_h_spacing(int v)
Set extra horizontal spacing at left and right of text. |
void |
set_part_a(int v)
Set the part_a component of this object. |
protected void |
set_raw_part_a(int v)
Set part_a value directly bypassing the constraint system (but doing damage). |
void |
set_selection(int st_line,
int st_pos,
int end_line,
int end_pos)
Set the current selection. |
void |
set_text(java.lang.String txt)
Set text contents from a single string with lines terminated by newlines or carriage returns. |
void |
set_text(java.util.Vector txt)
Set text contents from Vector of Strings. |
void |
set_v_spacing(int v)
Set extra vertical spacing at top and bottom of text. |
void |
size_by_content()
Compute a size based on current content. |
java.util.Vector |
text()
Text to be displayed stored as a Vector of Strings. |
int |
v_spacing()
Extra vertical spacing at top and bottom of text. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected int _v_spacing
protected int _h_spacing
protected java.awt.FontMetrics _metric
protected java.awt.Font _font
protected java.util.Vector _text
public static final int NO_SELECTION
public static final int SELECT_END
protected int _selection_start_line
protected int _selection_start_pos
protected int _selection_end_line
protected int _selection_end_pos
public static final int BOXED
protected int _first_line
protected static int xpos
protected static int ypos
protected static int ypos_cutoff
Constructor Detail |
public text_display(int xv, int yv, int wv, int hv, java.lang.String contents, java.awt.Font fnt, boolean boxed)
int
- xv x position of this interactor.int
- yv y position of this interactor.int
- wv width of this interactor.int
- hv height of this interactor.String
- contents the text to display in this box.Font
- fnt the font to use for drawing these strings.boolean
- boxed true if this object should have a box around it.public text_display(int xv, int yv, java.lang.String contents, java.awt.Font fnt, boolean boxed)
int
- xv x position of this interactor.int
- yv y position of this interactor.String
- contents the text to display in this box.Font
- fnt the font to use for drawing these strings.boolean
- boxed true if this object should have a box around it.public text_display(int xv, int yv, java.lang.String contents)
int
- xv x position of this interactor.int
- yv y position of this interactor.String
- contents the text to display in this box.Method Detail |
public int v_spacing()
public void set_v_spacing(int v)
int
- v the new spacing value.public int h_spacing()
public void set_h_spacing(int v)
int
- v the new spacing value.public java.awt.Font font()
public void set_font(java.awt.Font fnt)
Font
- fnt the font to use for this interactor (use null to get the
system's default fontpublic java.util.Vector text()
public void set_text(java.lang.String txt)
String
- text the text to display.public void set_text(java.util.Vector txt)
Vector
- txt the array of strings to display.public java.lang.String get_string(java.lang.String terminator)
String
- terminator the line terminator for the return value.public void dump_text()
public static java.util.Vector break_into_lines(java.lang.String all_text)
String
- all_text the text to break up into linesVector
- the array of lines of the broken up textpublic int selection_start_line()
protected int selection_start_pos()
public int selection_end_line()
protected int selection_end_pos()
public void set_selection(int st_line, int st_pos, int end_line, int end_pos)
int
- st_line the starting line of the new selection.int
- st_pos the starting position of the new selection.int
- end_line the ending line of the new selection.int
- end_pos the ending position of the new selection.public boolean boxed()
public void set_boxed(boolean bxv)
boolean
- box true if this interactor is boxed.public void size_by_content()
public int intrinsic_constraints()
public int part_a()
protected void set_raw_part_a(int v)
int
- v the new value.public void set_part_a(int v)
int
- v the new valuepublic int first_line()
public void first_line(int frst_ln)
int
- frst_ln the first line to display.protected void draw_norm_lines(drawable d, int st_ln, int end_ln)
drawable
- d the surface to do the drawing on.int
- st_ln starting line.int
- end_ln ending line.protected void draw_split_line(drawable d, int ln_num, int st_pos, int end_pos)
drawable
- d the surface to do the drawing on.int
- ln_num the line number of the split line.int
- st_pos the position in the line of the start of the
split.int
- end_pos the position in the line of the end of the split.protected void draw_highlighted_lines(drawable d, int first_ln, int last_ln)
drawable
- d the surface to do the drawing on.int
- first_ln the line number of the first highlighted line.int
- last_ln the line number of the last highlighted line.protected void draw_self_local(drawable d)
drawable
- d the drawable to work on
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |