org.gnu.gnomevte

Class Terminal

public class Terminal extends Widget

Deprecated: This class is part of the java-gnome 2.x family of libraries, which, due to their inefficiency and complexity, are no longer being maintained and have been abandoned by the java-gnome project. This class may have an equivalent in java-gnome 4.0; have a look for org.gnome.vte.Terminal.

VteTerminal widget bindings implementation.
Constructor Summary
protected Terminal(Handle handle)
Used in the bindings development.
Terminal()
Creates a new Termina widget.
Terminal(String command, String[] args, String workingDir)
Creates a new Terminal widget and executes command inside it.
Method Summary
voidaddListener(TerminalListener listener)
Registers a TerminalListener to handle generic terminal events.
voidaddListener(CommitListener listener)
Registers a TerminalCommitListener to handle terminal commit events.
voidaddListener(CharacterSizeChangedListener listener)
Registers a TerminalCharacterSizeChangedListener to handle terminal character size change events.
voidaddListener(MoveWindowListener listener)
Registers a TerminalMoveWindowListener to handle terminal move window events.
voidaddListener(ResizeWindowListener listener)
Registers a TerminalResizeWindowListener to handle terminal resize window events.
voidaddListener(TextScrolledListener listener)
Registers a TerminalTextScrolledListener to handle terminal text scroll events.
voidcopyClipboard()
Copy currently selected text to the clipboard.
voidcopyPrimary()
voidfeed(String data)
Send data to the terminal to display to handle in some way.
voidfeedChild(String data)
Send data to the terminal's forked command to handle in some way.
protected voidfireTerminalCharacterSizeChangedEvent(CharacterSizeChangedEvent event)
This method invokes all the TerminalCharacterSizeChangedListener that are registered with this instance of a Terminal.
protected voidfireTerminalCommitEvent(CommitEvent event)
This method invokes all the TerminalCommitListeners that are registered with this instance of a Terminal.
protected voidfireTerminalEvent(TerminalEvent event)
This method invokes all the TerminalListeners that are registered with this instance of a Terminal.
protected voidfireTerminalMoveWindowEvent(MoveWindowEvent event)
This method invokes all the TerminalMoveWindowListener that are registered with this instance of a Terminal.
protected voidfireTerminalResizeWindowEvent(ResizeWindowEvent event)
This method invokes all the TerminalResizeWindowListeners that are registered with this instance of a Terminal.
protected voidfireTerminalTextScrolledEvent(TextScrolledEvent event)
This method invokes all the TerminalTextScrolledListeners that are registered with this instance of a Terminal.
intforkCommand(String command, String[] args, String directory, boolean lastlog, boolean utmp, boolean wtmp)
Forks the command and show it inside the widget.
AdjustmentgetAdjustment()
Get the Adjustment which is the "model" object for Terminal.
booleangetAllowBold()
Checks whether or not the terminal will attempt to draw bold text by repainting text with a one-pixel offset.
StringgetEmulation()
Queries the terminal for its current emulation, as last set by a call to setEmulation().
StringgetEncoding()
Determines the name of the encoding in which the terminal expects data to be encoded.
FontDescriptiongetFont()
Queries the terminal for information about the fonts which will be used to draw text in the terminal.
StringgetStatusLine()
Some terminal emulations specify a status line which is separate from the main display area, and define a means for applications to move the cursor to the status line and back.
booleanhasSelection()
Checks if the terminal currently contains selected text.
booleanisBellAudible()
Get the terminal's audible bell state.
booleanisBellVisible()
Get the terminal's audible bell state.
voidpasteClipboard()
Paste clipboard text from the clipboard to the terminal.
voidpastePrimary()
voidremoveListener(TerminalListener listener)
Removes the given TerminalListener.
voidremoveListener(CommitListener listener)
Removes the given TerminalCommitListener.
voidremoveListener(CharacterSizeChangedListener listener)
Removes the given TerminalCharacterSizeChangedListener.
voidremoveListener(MoveWindowListener listener)
Removes the given TerminalMoveWindowListener.
voidremoveListener(ResizeWindowListener listener)
Removes the given TerminalResizeWindowListener.
voidremoveListener(TextScrolledListener listener)
Removes the given TerminalTextScrolledListener.
voidreset(boolean full, boolean clearHistory)
Resets as much of the terminal's internal state as possible, discarding any unprocessed input data, resetting character attributes, cursor state, national character set state, status line, terminal modes (insert/delete), selection state, and encoding.
voidsetAllowBold(boolean allowBold)
Controls whether or not the terminal will attempt to draw bold text by repainting text with a different offset.
voidsetAudibleBell(boolean audible)
Set the terminal's audible bell.
voidsetBackgroudColor(Color color)
voidsetBackgroudImage(String file)
voidsetBackgroundColor(Color color)
Sets the background color for text which does not have a specific background color assigned.
voidsetBackgroundImage(String file)
Set the file as the background image of the terminal.
voidsetBackgroundImage(Pixbuf image)
Sets the background image for the widget.
voidsetBackgroundSaturation(int saturation)
Sets the terminal's background saturation level.
voidsetBackgroundTransparent(boolean transparent)
Sets the terminal backgroud transparent or not.
voidsetColorBold(Color color)
Sets the color used to draw bold text in the default foreground color.
voidsetColorDim(Color color)
Sets the color used to draw dim text in the default foreground color.
voidsetColors(Color fgcolor, Color bgcolor, Color palett, int size)
The terminal widget uses a 28-color model comprised of the default foreground and background colors, the bold foreground color, the dim foreground color, an eight color palette, and bold versions of the eight color palette, and a dim version of the the eight color palette. size must be either 0, 8, 16, or 24.
voidsetCursorBlinks(boolean blinks)
Set whether or not the cursor blinks.
voidsetDefaultColors()
Restores the default colors.
voidsetEmulation(String emulation)
Sets what type of terminal the widget attempts to emulate by scanning for control sequences defined in the system's termcap file.
voidsetEncoding(String codeset)
Changes the encoding the terminal will expect data from the child to be encoded with.
voidsetFont(FontDescription font)
Sets the font used for rendering all text displayed by the terminal.
voidsetForegroundColor(Color color)
Sets the foreground color used to draw normal text
voidsetPty(int pty_master)
Associate a pty file descriptor with the terminal
voidsetScrollbackLines(int lines)
Set the number of scrollback lines.
voidsetScrollOnKeystroke(boolean scrollOnKeystroke)
If true, scrolls the widget down when pressing following the keyboard press.
voidsetScrollOnOutput(boolean scrollOnOutput)
If true, scrolls the widget down following the output.
voidsetSize(int columns, int rows)
Set the terminal's size.
voidsetVisibleBell(boolean visible)
Set the terminal's visible bell state.
static TerminalterminalAndShell()
Creates an new Terminal widget and launches a shell inside it.

Constructor Detail

Terminal

protected Terminal(Handle handle)
Used in the bindings development. You should not use this constructor Use Terminal () or Terminal (command, args, workingDir) instead.

Terminal

public Terminal()
Creates a new Termina widget. This constructor launchs a shell inside de widget.

Terminal

public Terminal(String command, String[] args, String workingDir)
Creates a new Terminal widget and executes command inside it.

Parameters: command Command launched inside the terminal. args arguments passed to the command. workingDir working directory passed to the process.

Method Detail

addListener

public void addListener(TerminalListener listener)
Registers a TerminalListener to handle generic terminal events.

Parameters: listener the listener to register.

addListener

public void addListener(CommitListener listener)
Registers a TerminalCommitListener to handle terminal commit events.

Parameters: listener the listener to register.

addListener

public void addListener(CharacterSizeChangedListener listener)
Registers a TerminalCharacterSizeChangedListener to handle terminal character size change events.

Parameters: listener the listener to register.

addListener

public void addListener(MoveWindowListener listener)
Registers a TerminalMoveWindowListener to handle terminal move window events.

Parameters: listener the listener to register.

addListener

public void addListener(ResizeWindowListener listener)
Registers a TerminalResizeWindowListener to handle terminal resize window events.

Parameters: listener the listener to register.

addListener

public void addListener(TextScrolledListener listener)
Registers a TerminalTextScrolledListener to handle terminal text scroll events.

Parameters: listener the listener to register.

copyClipboard

public void copyClipboard()
Copy currently selected text to the clipboard.

copyPrimary

public void copyPrimary()

feed

public void feed(String data)
Send data to the terminal to display to handle in some way. If data is null, it will be ignored.

Parameters: data Sent to the terminal.

feedChild

public void feedChild(String data)
Send data to the terminal's forked command to handle in some way. If data is null, it will be ignored.

Parameters: data Sent to the terminal.

fireTerminalCharacterSizeChangedEvent

protected void fireTerminalCharacterSizeChangedEvent(CharacterSizeChangedEvent event)
This method invokes all the TerminalCharacterSizeChangedListener that are registered with this instance of a Terminal.

Parameters: event the event to fire.

fireTerminalCommitEvent

protected void fireTerminalCommitEvent(CommitEvent event)
This method invokes all the TerminalCommitListeners that are registered with this instance of a Terminal.

Parameters: event the event to fire.

fireTerminalEvent

protected void fireTerminalEvent(TerminalEvent event)
This method invokes all the TerminalListeners that are registered with this instance of a Terminal.

Parameters: event the event to fire.

fireTerminalMoveWindowEvent

protected void fireTerminalMoveWindowEvent(MoveWindowEvent event)
This method invokes all the TerminalMoveWindowListener that are registered with this instance of a Terminal.

Parameters: event the event to fire.

fireTerminalResizeWindowEvent

protected void fireTerminalResizeWindowEvent(ResizeWindowEvent event)
This method invokes all the TerminalResizeWindowListeners that are registered with this instance of a Terminal.

Parameters: event the event to fire.

fireTerminalTextScrolledEvent

protected void fireTerminalTextScrolledEvent(TextScrolledEvent event)
This method invokes all the TerminalTextScrolledListeners that are registered with this instance of a Terminal.

Parameters: event the event to fire.

forkCommand

public int forkCommand(String command, String[] args, String directory, boolean lastlog, boolean utmp, boolean wtmp)
Forks the command and show it inside the widget.

Parameters: command program to launch in a new process. args The argument list available to the executed program. directory working directory available to the executed program. FIXME: investigate the meaning of laslog, utmp, wtmp.

Returns: Integer representing the process id.

getAdjustment

public Adjustment getAdjustment()

Deprecated: Superceeded by java-gnome 4.0; this method may or may not exist in the new bindings but if it does, it will likely have a different name or signature in order that the presented API is a more algorithmic mapping of the underlying native libraries.

Get the Adjustment which is the "model" object for Terminal.

Returns: The adjustment model

getAllowBold

public boolean getAllowBold()
Checks whether or not the terminal will attempt to draw bold text by repainting text with a one-pixel offset.

Returns: boolean

getEmulation

public String getEmulation()
Queries the terminal for its current emulation, as last set by a call to setEmulation().

Returns: String

getEncoding

public String getEncoding()
Determines the name of the encoding in which the terminal expects data to be encoded.

Returns: String

getFont

public FontDescription getFont()
Queries the terminal for information about the fonts which will be used to draw text in the terminal.

Returns: FontDescription

getStatusLine

public String getStatusLine()
Some terminal emulations specify a status line which is separate from the main display area, and define a means for applications to move the cursor to the status line and back.

Returns: the current contents of the terminal's status line. For terminals like "xterm", this will usually be the empty string.

hasSelection

public boolean hasSelection()
Checks if the terminal currently contains selected text. Note that this is different from determining if the terminal is the owner of any GtkClipboard items.

Returns: true if the terminal has a selection.

isBellAudible

public boolean isBellAudible()
Get the terminal's audible bell state.

Returns: The audible bell state.

isBellVisible

public boolean isBellVisible()
Get the terminal's audible bell state.

Returns: The visual bell state

pasteClipboard

public void pasteClipboard()
Paste clipboard text from the clipboard to the terminal.

pastePrimary

public void pastePrimary()

removeListener

public void removeListener(TerminalListener listener)
Removes the given TerminalListener.

Parameters: listener the listener to remove.

removeListener

public void removeListener(CommitListener listener)
Removes the given TerminalCommitListener.

Parameters: listener the listener to remove.

removeListener

public void removeListener(CharacterSizeChangedListener listener)
Removes the given TerminalCharacterSizeChangedListener.

Parameters: listener the listener to remove.

removeListener

public void removeListener(MoveWindowListener listener)
Removes the given TerminalMoveWindowListener.

Parameters: listener the listener to remove.

removeListener

public void removeListener(ResizeWindowListener listener)
Removes the given TerminalResizeWindowListener.

Parameters: listener the listener to remove.

removeListener

public void removeListener(TextScrolledListener listener)
Removes the given TerminalTextScrolledListener.

Parameters: listener the listener to remove.

reset

public void reset(boolean full, boolean clearHistory)
Resets as much of the terminal's internal state as possible, discarding any unprocessed input data, resetting character attributes, cursor state, national character set state, status line, terminal modes (insert/delete), selection state, and encoding.

Parameters: full true to reset tabstops clearHistory true to empty the terminal's scrollback buffer

setAllowBold

public void setAllowBold(boolean allowBold)
Controls whether or not the terminal will attempt to draw bold text by repainting text with a different offset.

Parameters: allowBold

setAudibleBell

public void setAudibleBell(boolean audible)
Set the terminal's audible bell.

Parameters: audible If true, the terminal emits a Bip to attract users attention.

setBackgroudColor

public void setBackgroudColor(Color color)

setBackgroudImage

public void setBackgroudImage(String file)

setBackgroundColor

public void setBackgroundColor(Color color)
Sets the background color for text which does not have a specific background color assigned. Only has effect when no background image is set and when the terminal is not transparent.

Parameters: color

setBackgroundImage

public void setBackgroundImage(String file)
Set the file as the background image of the terminal.

Parameters: file File to set as background.

Throws: FileNotFoundException if the image doesn't exist.

setBackgroundImage

public void setBackgroundImage(Pixbuf image)
Sets the background image for the widget. Text which would otherwise be drawn using the default background color will instead be drawn over the specified image. If necessary, the image will be tiled to cover the widget's entire visible area.

Parameters: image

setBackgroundSaturation

public void setBackgroundSaturation(int saturation)
Sets the terminal's background saturation level.

Parameters: saturation The saturation level.

setBackgroundTransparent

public void setBackgroundTransparent(boolean transparent)
Sets the terminal backgroud transparent or not.

Parameters: transparent Transparent if true.

setColorBold

public void setColorBold(Color color)
Sets the color used to draw bold text in the default foreground color.

Parameters: color

setColorDim

public void setColorDim(Color color)
Sets the color used to draw dim text in the default foreground color.

Parameters: color

setColors

public void setColors(Color fgcolor, Color bgcolor, Color palett, int size)
The terminal widget uses a 28-color model comprised of the default foreground and background colors, the bold foreground color, the dim foreground color, an eight color palette, and bold versions of the eight color palette, and a dim version of the the eight color palette. size must be either 0, 8, 16, or 24. If foreground is null and size is greater than 0, the new foreground color is taken from palette[7]. If background is null and size is greater than 0, the new background color is taken from palette[0]. If size is 8 or 16, the third (dim) and possibly second (bold) 8-color palette is extrapolated from the new background color and the items in palette.

Parameters: fgcolor bgcolor palett size

setCursorBlinks

public void setCursorBlinks(boolean blinks)
Set whether or not the cursor blinks.

Parameters: blinks If true, blinks.

setDefaultColors

public void setDefaultColors()
Restores the default colors.

setEmulation

public void setEmulation(String emulation)
Sets what type of terminal the widget attempts to emulate by scanning for control sequences defined in the system's termcap file. Unless you are interested in this feature, always use "xterm".

Parameters: emulation

setEncoding

public void setEncoding(String codeset)
Changes the encoding the terminal will expect data from the child to be encoded with. For certain terminal types, applications executing in the terminal can change the encoding. The default encoding is defined by the application's locale settings.

Parameters: codeset

setFont

public void setFont(FontDescription font)
Sets the font used for rendering all text displayed by the terminal. The terminal will immediately attempt to load the desired font, retrieve its metrics, and attempts to resize itself to keep the same number of rows and columns.

setForegroundColor

public void setForegroundColor(Color color)
Sets the foreground color used to draw normal text

Parameters: color

setPty

public void setPty(int pty_master)
Associate a pty file descriptor with the terminal

Parameters: pty_master pty fd

setScrollbackLines

public void setScrollbackLines(int lines)
Set the number of scrollback lines.

Parameters: lines The number of lines to save in the buffer.

setScrollOnKeystroke

public void setScrollOnKeystroke(boolean scrollOnKeystroke)
If true, scrolls the widget down when pressing following the keyboard press.

Parameters: scrollOnKeystroke If true, scroll.

setScrollOnOutput

public void setScrollOnOutput(boolean scrollOnOutput)
If true, scrolls the widget down following the output.

Parameters: scrollOnOutput If true, scroll.

setSize

public void setSize(int columns, int rows)
Set the terminal's size.

Parameters: columns The terminal's width. rows The terminal's height.

setVisibleBell

public void setVisibleBell(boolean visible)
Set the terminal's visible bell state.

Parameters: visible If true, the terminal blinks to attract users attention.

terminalAndShell

public static Terminal terminalAndShell()
Creates an new Terminal widget and launches a shell inside it.

Returns: The widget with a shell in it.