de.mud.jta.plugin
public class ButtonBar extends Plugin implements FilterPlugin, VisualPlugin, java.awt.event.ActionListener, javax.swing.event.ListSelectionListener
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.
Modifier and Type | Field and Description |
---|---|
protected javax.swing.JPanel |
panel
the panel that contains the buttons and input fields
|
Constructor and Description |
---|
ButtonBar(PluginBus bus,
java.lang.String id)
Initialize the button bar and register plugin listeners
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt) |
FilterPlugin |
getFilterSource() |
javax.swing.JMenu |
getPluginMenu()
Get the menu entry for this component.
|
javax.swing.JComponent |
getPluginVisual()
Get the visible components from the plugin.
|
int |
read(byte[] b)
Read a block of data from the back end.
|
void |
setFilterSource(FilterPlugin source)
Set the source plugin where we get our data from and where the data
sink (write) is.
|
void |
valueChanged(javax.swing.event.ListSelectionEvent evt) |
void |
write(byte[] b)
Write a block of data to the back end.
|
protected javax.swing.JPanel panel
public ButtonBar(PluginBus bus, java.lang.String id)
public void valueChanged(javax.swing.event.ListSelectionEvent evt)
valueChanged
in interface javax.swing.event.ListSelectionListener
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
public javax.swing.JComponent getPluginVisual()
VisualPlugin
getPluginVisual
in interface VisualPlugin
public javax.swing.JMenu getPluginMenu()
VisualPlugin
getPluginMenu
in interface VisualPlugin
public void setFilterSource(FilterPlugin source)
FilterPlugin
setFilterSource
in interface FilterPlugin
source
- the data sourcepublic FilterPlugin getFilterSource()
getFilterSource
in interface FilterPlugin
public int read(byte[] b) throws java.io.IOException
FilterPlugin
read
in interface FilterPlugin
b
- the buffer to read the data intojava.io.IOException
public void write(byte[] b) throws java.io.IOException
FilterPlugin
write
in interface FilterPlugin
b
- the buffer to be sentjava.io.IOException