|
org.netbeans.lib.terminalemulator 1.2 | |||||||||
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
org.netbeans.lib.terminalemulator.Term
public class Term
Term is a pure Java multi-purpose terminal emulator.
It has the following generic features:
This is how an application (like 'vi' etc) views the screen. This coordinate system primarily comes into play in the cursor addressing directive, op_cm() and otherwise is not really used in the implementation.
Cursor motion is in cell coordinates, so to move past a Japanese character you need the cursor to move right twice. A cursor can also be placed on the second cell of a double-width character.
Note that this is strictly an internal coordinate system. For example Term.getCursorCol() and getCursorCoord() return buffer coordinates.
The main purpose of this coordinate system is to capture logical columns. In the vertical direction sometimes it extends only the height of the screen and sometimes the height of the buffer.
The BCoord class captures the value of such coordinates. It is more akin to the 'int offset' used in the Java text package as opposed to javax.swing.text.Position.
If there are no double-width characters the buffer coords pretty much overlap with cell coords. If double-width characters are added then the buffer column and cell column will have a larger skew the more right you go.
What good is this? The ActiveRegion mechanism maintains coordinates for its' boundaries. As text scrolls out of history buffer row coordinates have to shift and all ActiveRegions' coords need to be relocated. This can get expensive because as soon as the history buffer becomes full each newline will require a relocation. This is the approach that javax.swing.text.Position implements and it's justified there because no Swing component has a "history buffer". However, if you use absolute coordinates you'll never have to relocate anything! Simple and effective.
Well almost. What happens when you reach Integer.MAX_VALUE? You wrap and that can confuse everything. What are the chances of this happening? Suppose term can process 4000 lines per second. A runaway process will produce Integer.MAX_VALUE lines in about 4 days. That's too close for comfort, so Term does detect the wrap and only then goes and relocates stuff. This, however, causes a secondary problem with testability since no-one wants to wait 4 days for a single wrap. So what I've done is periodically set Term.modulo to something smaller and tested stuff.
I'm indebted to Alan Kostinsky for this bit of lateral thinking.
Term will convert keystrokes to an output stream and will process characters in an input stream and render them unto the screen. What and how these streams are connected to is up to the client of Term, since it is usually highly platform dependent. For example on unixes the streams may be connected to partially-JNI-based "pty" streams.
This mode works correctly even if there is history and you see a scrollbar, just as it does under XTerm and it's derivatives.
Because of limited history active regions can scroll out of history and
while the coordinate invalidation problem is not addressed by absolute
coordiantes sometimes we don't want stuff to wink out.
Which is why we have ...
To use Term in this mode you can use setText() or appendText() instead of connecting to Terms streams. This mode is called page mode because the most common use of it would be as something akin to a hypertext browser. To that end Term supports nestable ActiveRegions and mapping of coordinates to regions. ActiveTerm puts all of this together in a comprehensive subclass.
This is due to Terms unix heritage where shells (ksh, bash etc) do their own cmdline and history editing, but if you're so inclined the LineDiscipline may be used for experimentation with indigenous cmdline processing.
Nested Class Summary | |
---|---|
protected class |
Term.AccessibleTerm
|
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 | |
---|---|
static int |
DEBUG_INPUT
|
static int |
DEBUG_KEYS
|
static int |
DEBUG_MARGINS
|
static int |
DEBUG_OPS
|
static int |
DEBUG_OUTPUT
|
static int |
DEBUG_WRAP
|
protected int |
firsta
|
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 | |
---|---|
Term()
Constructor |
Method Summary | |
---|---|
void |
addInputListener(TermInputListener l)
Add an input listener to this. |
void |
addListener(TermListener l)
Add a TermListener to this. |
Coord |
advance(Coord c)
Advance the coordinate by one charater and return new coord. |
void |
appendText(String text,
boolean repaint)
Add new text at the current cursor position. |
Coord |
backup(Coord c)
Back up the coordinate by one character and return new Coord. |
int |
charWidth(char c)
Return the cell width of the given character. |
void |
clear()
Clear the visible portion of screen |
void |
clearHistory()
Clear all of the history, including any visible portion of it. |
void |
clearHistoryNoRefresh()
Clear all of the history without repainting the screen. |
void |
clearSelection()
Clear the selection. |
void |
columnLeft(int n)
Scroll the view 'n' columns to the left. |
void |
columnRight(int n)
Scroll the view 'n' columns to the right. |
int |
CoordToPosition(Coord c)
[DO NOT USE] Convert a 2D Coord to a 1D linear position. |
void |
copy()
Transfer selected text into clipboard. |
void |
copyToClipboard()
Transfer selected text into clipboard. |
void |
copyToSelection()
Transfer selected text into selection. |
protected boolean |
debugInput()
Return true if DEBUG_INPUT flag has been set. |
protected boolean |
debugOutput()
Return true if DEBUG_OUTPUT flag has been set. |
Extent |
extentInLogicalLine(Coord begin,
int offset,
int length)
Convert offsets in logical lines into physical coordinates. |
void |
fillSizeInfo(Dimension cells,
Dimension pixels)
|
void |
flush()
Force a repaint. |
AccessibleContext |
getAccessibleContext()
Since Term is a composite widget the main accessible JComponent is not Term but an internal JComponent. |
Color |
getActiveColor()
Get the feedback color of active regions. |
JComponent |
getCanvas()
Deprecated. |
int |
getColumns()
Get the number of character columns in the screen |
int |
getCursorCol()
Get cursor column in buffer coordinates (0-origin) |
Coord |
getCursorCoord()
Get (absolute) cursor coordinates. |
int |
getCursorRow()
Get cursor row in buffer coordinates (0-origin). |
String |
getEmulation()
Returns the termcap string that best describes what this Term emulates. |
Dimension |
getGlyphCellSize()
Get the usable area for drawing glyphs This value changes when the gutter width or the font changes |
Color |
getHighlightColor()
Get the color of the hilite (selection) - for non XOR mode |
Color |
getHighlightXORColor()
Get the color of the hilite (selection) - for XOR mode |
int |
getHistoryBuffSize()
returns curent history size of buffer. |
int |
getHistorySize()
Return the number of lines in history |
org.netbeans.lib.terminalemulator.Interp |
getInterp()
Return the Interpreter assigned to this. |
HashSet |
getKeyStrokeSet()
Get KeyStroke set. |
int |
getRows()
Get the number of character rows in the screen |
String |
getRowText(int row)
|
JComponent |
getScreen()
Returns the actual drawing area so events can be interposed upon, like context menus. |
String |
getSelectedText()
Get contents of current selection. |
Extent |
getSelectionExtent()
Get the extent of the current selection. |
int |
getTabSize()
Get the TAB size. |
WordDelineator |
getWordDelineator()
Get the WordDelineator used by this. |
void |
goTo(Coord coord)
|
boolean |
isAnchored()
Return true if the text is currently anchored. |
boolean |
isAutoCopy()
Deprecated. Now always returns 'true'. |
boolean |
isClickToType()
|
boolean |
isCoordVisible(Coord target)
If the given coordinate is visible within the screen returns true, otherwise returns false. |
boolean |
isCursorVisible()
Find out if cursor is visible. |
boolean |
isHorizontallyScrollable()
|
boolean |
isReadOnly()
Return whether keystrokes are ignored. |
boolean |
isRefreshEnabled()
|
boolean |
isReverseVideo()
Return the value set by setReverseVideo(). |
boolean |
isScrollOnInput()
Return whether Term scrolls to the bottom on keyboard input. |
boolean |
isScrollOnOutput()
Return whether Term scrolls on any output. |
boolean |
isSelectionXOR()
|
boolean |
isSizeRounded()
Returns true if Term will round down resize requests to character cell size. |
boolean |
isTrackCursor()
Return whether Term will scroll to track the cursor as text is added. |
void |
lineDown(int n)
Scroll the view 'n' lines down. |
void |
lineUp(int n)
Scroll the view 'n' lines up. |
Point |
mapToBufRowCol(Point p)
Convert pixel coords to (history) buffer row/column coords (both 0-origin). |
Point |
mapToViewRowCol(Point p)
Convert pixel coords to view (visible area) row/column coords (both o-origin). |
Ops |
ops()
Return the terminal operations implementation. |
void |
pageDown(int n)
Scroll the view 'n' pages down. |
void |
pageLeft(int n)
Scroll the view 'n' pages to the left. |
void |
pageRight(int n)
Scroll the view 'n' pages to the right. |
void |
pageUp(int n)
Scroll the view 'n' pages up. |
void |
paste()
|
void |
pasteFromClipboard()
Transfer contents of clipboard to Terms input stream. |
void |
pasteFromSelection()
Transfer contents of selection to Terms input stream. |
Coord |
PositionToCoord(int position)
[DO NOT USE] Convert a 1D linear position to a 2D Coord. |
protected void |
possibly_repaint(boolean adjust_scrollbar)
|
void |
possiblyNormalize(ActiveRegion region)
Ensure that maximum of the given region is visible. |
void |
possiblyNormalize(Coord target)
Ensure that the given coordinate is visible. |
void |
printStats(String message)
|
void |
pushStream(TermStream stream)
|
void |
putChar(char c)
Send a character to the terminal screen. |
void |
putChars(char[] buf,
int offset,
int count)
Send several characters to the terminal screen. |
RegionManager |
regionManager()
Return the RegionManager associated with this Term |
void |
removeInputListener(TermInputListener l)
|
void |
removeListener(TermListener l)
Remove the given TermListener from this. |
protected void |
repaint(boolean adjust_scrollbar)
Model and or view settings have changed, redraw everything. |
void |
requestFocus()
Override of JComponent. |
boolean |
requestFocusInWindow()
|
void |
reverseVisitLogicalLines(Coord begin,
Coord end,
LogicalLineVisitor llv)
Visit logical lines in reverse from end through begin. |
void |
setActiveColor(Color color)
Set the feedback color of active regions. |
void |
setAnchored(boolean anchored)
Control whether an anchor is set. |
void |
setAttribute(int value)
Set the display attribute for characters printed from now on. |
void |
setAutoCopy(boolean auto_copy)
Deprecated. selections now always get copied to systemSelection if it exists. |
void |
setCharacterAttribute(Coord begin,
Coord end,
int value,
boolean on)
Set or unset the display attribute for characters from 'begin' to 'end' inclusive to 'value' depending on the value of 'on'. |
void |
setClickToType(boolean click_to_type)
Set/unset focus policy. |
void |
setColumns(int cols)
Set the number of character columns in the screen. |
void |
setCursorCoord(Coord coord)
Move the cursor to the given (absolute) coordinates SHOULD be setCursorCoord! |
void |
setCursorVisible(boolean cursor_visible)
Control whether the cursor is visible or not. |
void |
setCustomColor(int number,
Color c)
Register up to 8 new custom colors. |
void |
setDebugFlags(int flags)
|
void |
setEmulation(String emulation)
Set the Interpreter type by name. |
void |
setEnabled(boolean enabled)
Override of JComponent. |
void |
setFont(Font new_font)
Override of JComponent. |
void |
setGlyph(int glyph_id,
int background_id)
|
void |
setGlyphGutterWidth(int pixels)
Set the width of the glyph gutter in pixels |
void |
setGlyphImage(int glyph_number,
Image image)
Associate an Image with a glyph id, or clear it if image is null. |
void |
setHighlightColor(Color color)
Set the color of the hilite (selection) - for non XOR mode |
void |
setHighlightXORColor(Color color)
Set the color of the hilite (selection) - for XOR mode |
void |
setHistorySize(int new_size)
Set how many lines of history will be available. |
void |
setHorizontallyScrollable(boolean horizontally_scrollable)
Controls horizontal scrolling and line wrapping. |
void |
setInputListener(TermInputListener l)
Deprecated. Replaced by addInputListener(TermInputListener) . |
void |
setInterp(org.netbeans.lib.terminalemulator.Interp interp)
Set the emulation interpreter. |
void |
setKeyStrokeSet(HashSet keystroke_set)
|
void |
setListener(TermListener l)
Deprecated. Replaced by addListener(TermListener) . |
void |
setReadOnly(boolean read_only)
Control whether keystrokes are ignored. |
void |
setRefreshEnabled(boolean refresh_enabled)
|
void |
setReverseVideo(boolean reverse_video)
Control whether the default foreground and background colors will be reversed. |
void |
setRowGlyph(int row,
int glyph_id,
int background_id)
|
void |
setRows(int rows)
Set the number of character rows in the screen. |
void |
setRowsColumns(int rows,
int columns)
Simultaneously set the number of character rows and columns. |
void |
setScrollOnInput(boolean scroll_on_input)
Control whether Term scrolls to the bottom on keyboard input. |
void |
setScrollOnOutput(boolean scroll_on_output)
Control whether Term scrolls on any output. |
void |
setSelectionExtent(Extent extent)
Set the extent of the selection. |
void |
setSelectionXOR(boolean selection_xor)
Sets whether the selection highlighting is XOR style or normal Swing style. |
void |
setSizeRounded(boolean size_rounded)
Governs whether Term will round down resize requests to character cell size. |
void |
setTabSize(int tab_size)
Set the TAB size. |
void |
setText(String text)
Clear everything and assign new text. |
void |
setTrackCursor(boolean track_cursor)
Control whether Term will scroll to track the cursor as text is added. |
void |
setWordDelineator(WordDelineator word_delineator)
Set/unset WordDelineator. |
String |
textWithin(Coord begin,
Coord end)
|
Point |
toPixel(Coord target)
Convert row/column coords to pixel coords within the widgets coordinate system. |
protected void |
updateTtySize()
Once the terminal is connected to something, use this function to send all Term Listener notifications. |
void |
visitLogicalLines(Coord begin,
Coord end,
LogicalLineVisitor llv)
Visit logical lines from begin through end. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int firsta
public static final int DEBUG_OPS
public static final int DEBUG_KEYS
public static final int DEBUG_INPUT
public static final int DEBUG_OUTPUT
public static final int DEBUG_WRAP
public static final int DEBUG_MARGINS
Constructor Detail |
---|
public Term()
Method Detail |
---|
public void pushStream(TermStream stream)
public void setDebugFlags(int flags)
protected boolean debugInput()
protected boolean debugOutput()
public void setWordDelineator(WordDelineator word_delineator)
public WordDelineator getWordDelineator()
public void setInputListener(TermInputListener l)
addInputListener(TermInputListener)
.
public void addInputListener(TermInputListener l)
Text entered via the keyboard gets sent via this listener.
public void removeInputListener(TermInputListener l)
public void setListener(TermListener l)
addListener(TermListener)
.
public void addListener(TermListener l)
public void removeListener(TermListener l)
public void setClickToType(boolean click_to_type)
public boolean isClickToType()
public void setReadOnly(boolean read_only)
public boolean isReadOnly()
public void clear()
public void clearHistoryNoRefresh()
This is useful if you want to avoid flicker.
public void clearHistory()
Use clearHistoryNoRefresh()
if you find that clearHistory
causes flickering.
public RegionManager regionManager()
public String textWithin(Coord begin, Coord end)
public String getRowText(int row)
public HashSet getKeyStrokeSet()
Be default Term consumes all keystrokes. Any KeyStroke added to this set will be passed through and not consumed.
Be careful with control characters you need to create the keystroke as follows (note the - 64):
KeyStroke.getKeyStroke(new Character((char)('T'-64)), Event.CTRL_MASK)
public void setKeyStrokeSet(HashSet keystroke_set)
public void visitLogicalLines(Coord begin, Coord end, LogicalLineVisitor llv)
If begin is null, then the start of the buffer is assumed. If end is null, then the end of the buffer is assumed.
public void reverseVisitLogicalLines(Coord begin, Coord end, LogicalLineVisitor llv)
If begin is null, then the start of the buffer is assumed. If end is null, then the end of the buffer is assumed.
public Extent extentInLogicalLine(Coord begin, int offset, int length)
Usually called from within a LogicalLineVisitor.visit(). 'begin' should be the 'begin' Coord passed to visit. 'offset' is an offset into the logical line, the 'text' argument passed to visit().
Note that 'offset' is relative to begin.col!
Following is an example of a line "aaaaaxxxxxxxxxXXXxxxxxxxx" which got wrapped twice. Suppose you're searching for "XXX" and you began your search from the first 'x' on row 2.
row | columns | ----+----------+ 0 |0123456789| 1 | | 2 |aaaaaxxxxx| wrap 3 |xxxxXXXxxx| wrap 4 |xxxxx | 5 | |The visitor will be called with 'begin' pointing at the first 'x', 'end' pointing at the last 'x' and 'text' containing the above line. Let's say you use String.indexOf("XXX") and get an offset of 9. Passing the 'begin' through and the 9 as an offset and 3 as the length will yield an Extent (3,4) - (3,7) which youcan forward to setSelectionExtent();
The implementation of this function is not snappy (it calls Term.advance() in a loop) but the assumption is that his function will not be called in a tight loop.
public void possiblyNormalize(Coord target)
If the given coordinate is visible within the screen nothing happens. Otherwise the screen is scrolled so that the given target ends up approximately mid-sceeen.
public void possiblyNormalize(ActiveRegion region)
If the given region is visible within the screen nothing happens. If the region is bigger than the screen height, first line of the region will be displayed in first line of screen and end of region won't be displayed. If the region is bigger than the half of screen height, last line of the region will be displayed in the last line of the screen. Otherwise the region will start approximately in mid-sceeen
public boolean isCoordVisible(Coord target)
public void setAttribute(int value)
Unrecognized values silently ignored.
public void setCharacterAttribute(Coord begin, Coord end, int value, boolean on)
Will cause a repaint.
public void setGlyph(int glyph_id, int background_id)
public void setRowGlyph(int row, int glyph_id, int background_id)
public int getHistoryBuffSize()
public void printStats(String message)
public void paste()
public void pasteFromSelection()
The pasted content is sent through sendChars.
The paste will silently fail if:
public void pasteFromClipboard()
The pasted content is sent through sendChars.
The paste will silently fail if:
public void copy()
public void copyToClipboard()
public void copyToSelection()
public void setRows(int rows)
See setRowsColumns() for some additional important information.
public int getRows()
public void setColumns(int cols)
See setRowsColumns() for some additional important information.
public int getColumns()
public void setRowsColumns(int rows, int columns)
A Term is a composite widget made of a contained screen (getScreen()) and a scrollbar. It is not a JScrollPane. You're actually setting the screen size here.
Setting the column size also sets the width of the buffer. This doesn't alter the length (column at which lines were wrapped) of past lines, but only new additional lines. For example, if you set columns to 20, print a bunch of lines that wrap, then resize to 80 columns, all the lines that were wrapped to 20 will stay wrapped that way. This is consistent with xterm behaviour.
If this Term is embedded in a component with a layout manager that is set up to accept child resizes gracefully this widget will be resized as expected.
Alternatively if this Term is embedded in a Window (like JFrame) the window will need to be re-pack()ed as it does not accomodate it's childrens size changes. This has to be done by the application using Term. The best way to do this is to add a TermListener() and call pack() on the appropriate window when a resize notification is fired.
public void setSizeRounded(boolean size_rounded)
Sizes are usually set by containers' layout managers. If rounding is enabled Term will attempt to adjust the size to an even multiple of the character cell size.
The layout manager might not neccesarily honor the rounded size.
The situation can be somewhat improved by making sure that the ultimate
container is re-packed as described in setRowsColumns(int, int)
.
public boolean isSizeRounded()
See setSizeRounded(boolean)
for more info.
public void fillSizeInfo(Dimension cells, Dimension pixels)
protected void updateTtySize()
public Point toPixel(Coord target)
public Point mapToViewRowCol(Point p)
In the returned Point, x represents the column, y the row.
public Point mapToBufRowCol(Point p)
In the returned Point, x represents the column, y the row.
public void putChar(char c)
public void putChars(char[] buf, int offset, int count)
public void flush()
Normally a putChar() or putChars() will call repaint, unless ... setRepaintEnabled() has been called with false. This function allows for some flexibility wrt to buffering and flushing:
term.setRefreshEnabled(false); for (cx = 0; cx < buf.length; cx++) { term.putChar(c); if (c % 10 == 0) term.flush(); } term.setRefreshEnabled(true);
protected void possibly_repaint(boolean adjust_scrollbar)
protected void repaint(boolean adjust_scrollbar)
public void setReverseVideo(boolean reverse_video)
Note: This is independent of characters' reverse attribute.
public boolean isReverseVideo()
public void setHighlightColor(Color color)
public Color getHighlightColor()
public void setHighlightXORColor(Color color)
public Color getHighlightXORColor()
public void setActiveColor(Color color)
public Color getActiveColor()
public void setAnchored(boolean anchored)
Setting an anchor will automatically cause the buffer to grow, in excess of what was set by setHistorySize(), to ensure that whatever is displayed and in the current history will still be accessible.
Also, if you're working with Extents, Coords and ActiveRegions, or visiting logical lines, you might want to anchor the text so that your coordinates don't get invalidated by lines going out of the buffer.
Repeated enabling of the anchor will discard all text that doesn't fit in history and start a new anchor.
When anchoring is disabled any text in excess of setHistorySize() is trimmed and the given history size comes into effect again.
public boolean isAnchored()
public JComponent getCanvas()
public JComponent getScreen()
public Ops ops()
public void setEmulation(String emulation)
public String getEmulation()
public void setInterp(org.netbeans.lib.terminalemulator.Interp interp)
It is not advisable to change the emulation after Term has been connected to a process, since it's often impossible to advise the process of the new terminal type.
public org.netbeans.lib.terminalemulator.Interp getInterp()
public void setHistorySize(int new_size)
If an anchor is in effect the history size will only have an effect when the anchor is reset.
public int getHistorySize()
public void setGlyphGutterWidth(int pixels)
public void setGlyphImage(int glyph_number, Image image)
public Dimension getGlyphCellSize()
public void setCustomColor(int number, Color c)
public int getCursorRow()
public int getCursorCol()
public Coord getCursorCoord()
The returned Coord is newly allocated and need not be cloned.
public void goTo(Coord coord)
public void setCursorCoord(Coord coord)
public void setCursorVisible(boolean cursor_visible)
We don't want a visible cursor when we're using Term in non-interactve mode.
public boolean isCursorVisible()
public Coord backup(Coord c)
Travels back over line boundaries
Returns null if 'c' is the first character in the buffer.
public Coord advance(Coord c)
Travels forward over line boundaries.
Returns null if 'c' is the last character in the buffer.
public String getSelectedText()
Returns 'null' if there is no current selection.
public Extent getSelectionExtent()
If there is no selection returns 'null'.
public void setSelectionExtent(Extent extent)
public void clearSelection()
public void setAutoCopy(boolean auto_copy)
This is how xterm and other X-windows selections work.
This property can probably be deprecated. It was neccessary in the pre-1.4.2 days when we didn't have a systemSelection and we wanted to have the option of not cloberring the systemClipboard on text selection.
public boolean isAutoCopy()
public void setRefreshEnabled(boolean refresh_enabled)
public boolean isRefreshEnabled()
public void setSelectionXOR(boolean selection_xor)
public boolean isSelectionXOR()
public void setTabSize(int tab_size)
The cursor is moved to the next column such that
column (0-origin) modulo tab_size == 0The cursor will not go past the last column.
Note that the conventional assumption of what a tab is, is not entirely accurate. ANSI does not define TABs as above but rather as a directive to move to the next "tabstop" which has to have been set previously. In fact on unixes it is the terminal line discipline that expands tabs to spaces in the conventional way. That in, turn explains why TAB information doesn't make it into selections and why copying and pasting Makefile instructions is liable to lead to hard-to-diagnose make rpoblems, which, in turn drove the ANT people to reinvent the world.
public int getTabSize()
public void setScrollOnInput(boolean scroll_on_input)
This is analogous to the xterm -sk/+sk option.
public boolean isScrollOnInput()
public void setScrollOnOutput(boolean scroll_on_output)
When set to false, if the user moves the scrollbar to see some text higher up in history, the view will not change even if more output is produced. But if the cursor is visible, scrolling will happen. This is so that in an interactive session any prompt will be visible etc.
However, the tracking of the cursor is controlled by the 'trackCursor' property which by default is set to 'true'.
This property is analogous to the xterm -si/+si option.
public boolean isScrollOnOutput()
public void setTrackCursor(boolean track_cursor)
If set to true, as output is being generated Term will try to keep the cursor in view.
This property is only relevant when scrollOnOutput is set to false. If scrollOnOutput is true, this property is also implicitly true.
public boolean isTrackCursor()
public void setHorizontallyScrollable(boolean horizontally_scrollable)
When enabled a horizontal scrollbar becomes visible and line-wrapping is disabled.
public boolean isHorizontallyScrollable()
public void setText(String text)
If the size of the text exceeds history early parts of it will get lost, unless an anchor was set using setAnchor().
public void appendText(String text, boolean repaint)
Doesn't repaint the view unless 'repaint' is set to 'true'.
Doesn't do anything if 'text' is 'null'.
public void pageUp(int n)
A page is the height of the view.
public void pageDown(int n)
A page is the height of the view.
public void lineUp(int n)
public void lineDown(int n)
public void pageLeft(int n)
public void pageRight(int n)
public void columnRight(int n)
public void columnLeft(int n)
public int charWidth(char c)
public void setFont(Font new_font)
We absolutely require fixed width fonts, so if the font is changed we create a monospaced version of it with the same style and size.
setFont
in class JComponent
public void requestFocus()
Pass on the request to the screen where all the actual focus management happens.
requestFocus
in class JComponent
public boolean requestFocusInWindow()
requestFocusInWindow
in class JComponent
public void setEnabled(boolean enabled)
Pass on enabledness to sub-components (scrollbars and screen)
setEnabled
in class JComponent
public AccessibleContext getAccessibleContext()
Accessibility for Term is tricky because it doesn't fit into the roles delineated by Swing. The closest role is that of TEXT and that is too bound to how JTextComponent works. To wit ...
The current implementation doesn't cache any of the mappings because that would require a word per line extra storage for the cumulative char count. The times actually we're pretty fast with a 4000 line histroy.
Currently only notifications of ACCESSIBLE_CARET_PROPERTY and ACCESSIBLE_TEXT_PROPERTY are fired and that always in pairs. They are fired on the receipt of any character to be processed.
IMPORTANT: It is assumed that under assistive technology Term will be used primarily as a continuous text output device or a readonly document. Therefore ANSI cursor motion and text editing commands or anything that mutates the text will completely invalidate all of AccessibleTexts properties. (Perhaps an exception SHOULD be made for backspace)
getAccessibleContext
in interface Accessible
getAccessibleContext
in class JComponent
public int CoordToPosition(Coord c)
This function really should be private but I need it to be public for unit-testing purposes.
public Coord PositionToCoord(int position)
This function really should be private but I need it to be public for unit-testing purposes.
|
org.netbeans.lib.terminalemulator 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |