TelnetD at SF

net.wimpi.telnetd.io.toolkit
Class Selection

java.lang.Object
  extended bynet.wimpi.telnetd.io.toolkit.Component
      extended bynet.wimpi.telnetd.io.toolkit.ActiveComponent
          extended bynet.wimpi.telnetd.io.toolkit.Selection

public class Selection
extends ActiveComponent

Class implementing a selection menu. * * @author Dieter Wimberger * @version 2.0 (13/03/2005)


Field Summary
static int ALIGN_LEFT
           
static int ALIGN_RIGHT
           
 
Fields inherited from class net.wimpi.telnetd.io.toolkit.Component
m_Dim, m_IO, m_Name, m_Position
 
Constructor Summary
Selection(BasicTerminalIO io, java.lang.String name)
          Constructs a Selection instance
 
Method Summary
 void addOption(java.lang.String str)
          Method to add an Option to a Selection instance
 void draw()
          Method that draws the component.
 java.lang.String getOption(int index)
          Accessor method for an option of this selection
 int getSelected()
          Accessor method to retrieve the selected option
 void insertOption(java.lang.String str, int index)
          Method to insert an Option to a Selection instance at a specific * index.
 void removeOption(int index)
          Method to remove an existing Option from a Selection instance
 void removeOption(java.lang.String str)
          Method to remove an existing Option from a Selection instance
 void run()
          Method that will make the selection active, * reading and processing input.
 void setSelected(int index)
          Mutator method to set selected option programatically
 
Methods inherited from class net.wimpi.telnetd.io.toolkit.Component
getDimension, getLocation, getName, setDimension, setLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIGN_LEFT

public static final int ALIGN_LEFT
See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
See Also:
Constant Field Values
Constructor Detail

Selection

public Selection(BasicTerminalIO io,
                 java.lang.String name)
Constructs a Selection instance. * * @param io Object instance implementing the BasicTerminalIO interface. * @param name String representing this instances name.

Method Detail

addOption

public void addOption(java.lang.String str)
Method to add an Option to a Selection instance. * * @param str String representing the option.


insertOption

public void insertOption(java.lang.String str,
                         int index)
Method to insert an Option to a Selection instance at a specific * index. Falls back to add, if index is corrupt. * * @param str String representing the option. * @param index int representing the desired index.


removeOption

public void removeOption(java.lang.String str)
Method to remove an existing Option from a Selection instance. * * @param str String representing the option.


removeOption

public void removeOption(int index)
Method to remove an existing Option from a Selection instance. * Does nothing if the index is corrupt. * * @param index int representing the options index.


getOption

public java.lang.String getOption(int index)
Accessor method for an option of this selection. * Returns null if index is corrupt. * * @param index int representing the options index. * @return Strnig that represents the option.


getSelected

public int getSelected()
Accessor method to retrieve the selected option. * Returns -1 if no option exists. * * @return index int representing index of the the selected option.


setSelected

public void setSelected(int index)
                 throws java.io.IOException
Mutator method to set selected option programatically. * Does nothing if the index is corrupt. * * @param index int representing an options index.

Throws:
java.io.IOException

run

public void run()
         throws java.io.IOException
Method that will make the selection active, * reading and processing input.

Specified by:
run in class ActiveComponent
Throws:
java.io.IOException

draw

public void draw()
          throws java.io.IOException
Method that draws the component.

Specified by:
draw in class Component
Throws:
java.io.IOException

TelnetD at SF

Copyright © 2000-2005 Dieter Wimberger.