de.mud.jta.plugin

Class ButtonBar

Implemented Interfaces:
ActionListener, FilterPlugin, ListSelectionListener, VisualPlugin

public class ButtonBar
extends Plugin
implements FilterPlugin, VisualPlugin, ActionListener, ListSelectionListener

Implementation of a programmable button bar to be used as a plugin in the Java(tm) Telnet Applet/Application. The button bar is configured using a input file that contains the setup for the button bar.

A typical setup file may look like:

 #
 # Example for writing a button bar config file.
 #
 # The syntaxt for defining buttons, input fields and breaks is as follows:
 #
 # - defining a button:
 # A button is defined by giving the keyword 'button' followed by the text
 # of the button and the command that should be sent when pressing the
 # button. If the command contains whitespace characters, enclode it in
 # quote (") characters!
 #
 button		Connect		"\$connect(\@host@,\@port@)"
 #
 # - defining a label:
 # A labvel is defined by giving the keyword 'label' followed by the text
 # of the label. If the label contains whitespace characters, enclode it in
 # quote (") characters!
 #
 label 		"Hello User"
 #
 # - defining an input field:
 # An input field is defined just like the button above, but it has one more
 # parameter, the size of the input field. So you define it, by giving the
 # keyword 'input' followed by the name of the input field (for reference)
 # followed by the size of the input field and optionally a third parameter
 # which is the initial text to be displayed in that field.
 #
 input		host	20	"tanis"
 stretch
 input		port	4	"23"
 #
 # Now after the button and two input fields we define another button which
 # will be shown last in the row. Order is significant for the order in
 # which the buttons and fields appear.
 #
 button		Disconnect	"\\$disconnect()" break
 #
 # To implement an input line that is cleared and sends text use this:
 # The following line send the text in the input field "send" and appends
 # a newline.
 input		send	20	"\\@send@\n"	"ls"
 #
 # - Defining a choice
 # A choice is defined just like the button above, but it has multiple
 # text/command pairs. If the text or command contain whitespace characters,
 # enclose them in quote (") characters. The text and command data may be
 # spread over several lines for better readability. Make the first command
 # empty because it is initially selected, and choosing it will have no
 # effect until some other item has been chosen.
 #choice       "- choose -"   ""
 #             "Text 1"       "Command 1"
 #             "Text 2"       "Command 2"
 #             "Text 3"       "Command 3"
 # etc...
 
Other possible keywords are break which does introduce a new line so that buttons and input fields defined next will appear in a new line below and stretch to make the just defined button or input field stretched as far as possible on the line. That last keyword is useful to fill the space.
Version:
$Id: ButtonBar.java 499 2005-09-29 08:24:54Z leo $
Author:
Matthias L. Jugel, Marcus Mei???ner

Field Summary

protected JPanel
panel
the panel that contains the buttons and input fields

Fields inherited from class de.mud.jta.Plugin

bus, id

Constructor Summary

ButtonBar(PluginBus bus, String id)
Initialize the button bar and register plugin listeners

Method Summary

void
actionPerformed(ActionEvent evt)
FilterPlugin
getFilterSource()
JMenu
getPluginMenu()
Get the menu entry for this component.
JComponent
getPluginVisual()
Get the visible components from the plugin.
int
read(byte[] b)
void
setFilterSource(FilterPlugin source)
void
valueChanged(ListSelectionEvent evt)
void
write(byte[] b)

Methods inherited from class de.mud.jta.Plugin

error, getId

Field Details

panel

protected JPanel panel
the panel that contains the buttons and input fields

Constructor Details

ButtonBar

public ButtonBar(PluginBus bus,
                 String id)
Initialize the button bar and register plugin listeners

Method Details

actionPerformed

public void actionPerformed(ActionEvent evt)

getFilterSource

public FilterPlugin getFilterSource()
Specified by:
getFilterSource in interface FilterPlugin

getPluginMenu

public JMenu getPluginMenu()
Get the menu entry for this component.
Specified by:
getPluginMenu in interface VisualPlugin
Returns:
a menu that can be used to change the plugin state

getPluginVisual

public JComponent getPluginVisual()
Get the visible components from the plugin.
Specified by:
getPluginVisual in interface VisualPlugin
Returns:
a component that represents the plugin

read

public int read(byte[] b)
            throws IOException
Specified by:
read in interface FilterPlugin

setFilterSource

public void setFilterSource(FilterPlugin source)
Specified by:
setFilterSource in interface FilterPlugin

valueChanged

public void valueChanged(ListSelectionEvent evt)

write

public void write(byte[] b)
            throws IOException
Specified by:
write in interface FilterPlugin