Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.rse.ui.preferences
Class ListEditor

java.lang.Object
  extended by FieldEditor
      extended by com.ibm.etools.iseries.rse.ui.preferences.ListEditor
Direct Known Subclasses:
DefinesConditionEditor, IFSIncludeDirectoryEditor, StripSequenceNumberFieldEditor

public abstract class ListEditor
extends FieldEditor

An abstract field editor that manages a list of input values. The editor displays a list containing the values, buttons for adding and removing values, and Up and Down buttons to adjust the order of elements in the list.

Subclasses must implement the parseString, createList, and createNewInputObject framework methods.

This is a copy of the JFace ListEditor with the exception that uppercasing has been added, as well as list item limit.


Field Summary
protected  boolean _bUpperCase
           
protected  int _iMaxItems
           
protected  Button addButton
          The Add button.
protected  Composite buttonBox
          The button box containing the Add, Remove, Up, and Down buttons; null if none (before creation or after disposal).
static String Copyright
           
protected  Button downButton
          The Down button.
protected  List list
          The list widget; null if none (before creation or after disposal).
protected  Button removeButton
          The Remove button.
protected  SelectionListener selectionListener
          The selection listener.
protected  Button upButton
          The Up button.
 
Constructor Summary
protected ListEditor()
          Creates a new list field editor
protected ListEditor(String name, String labelText, Composite parent)
          Creates a list field editor.
 
Method Summary
protected  void addPressed()
          Notifies that the Add button has been pressed.
protected  void adjustForNumColumns(int numColumns)
           
protected  void createButtons(Composite buttonBox)
          Creates the Add, Remove, Up, and Down button in the given button box.
protected abstract  String createList(String[] items)
          Combines the given list of items into a single string.
protected  Button createPushButton(Composite parent, String key)
          Helper method to create a push button.
 void createSelectionListener()
          Creates a selection listener.
protected  void doFillIntoGrid(Composite parent, int numColumns)
           
protected  void doLoad()
           
protected  void doLoadDefault()
           
protected  void doStore()
           
protected  void downPressed()
          Notifies that the Down button has been pressed.
 Composite getButtonBoxControl(Composite parent)
          Returns this field editor's button box containing the Add, Remove, Up, and Down button.
 List getListControl(Composite parent)
          Returns this field editor's list control.
protected abstract  String getNewInputObject()
          Creates and returns a new item for the list.
 int getNumberOfControls()
           
protected  SelectionListener getSelectionListener()
          Returns this field editor's selection listener.
protected  Shell getShell()
          Returns this field editor's shell.
protected abstract  String[] parseString(String stringList)
          Splits the given string into a list of strings.
protected  void removePressed()
          Notifies that the Remove button has been pressed.
protected  void selectionChanged()
          Notifies that the list selection has changed.
 void setFocus()
           
protected  void setItemLimit(int iMaxItems)
           
protected  void setUpperCase(boolean bUpperCase)
           
protected  void swap(boolean up)
          Moves the currently selected item up or down.
protected  void upPressed()
          Notifies that the Up button has been pressed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

list

protected List list
The list widget; null if none (before creation or after disposal).


buttonBox

protected Composite buttonBox
The button box containing the Add, Remove, Up, and Down buttons; null if none (before creation or after disposal).


addButton

protected Button addButton
The Add button.


removeButton

protected Button removeButton
The Remove button.


upButton

protected Button upButton
The Up button.


downButton

protected Button downButton
The Down button.


selectionListener

protected SelectionListener selectionListener
The selection listener.


_iMaxItems

protected int _iMaxItems

_bUpperCase

protected boolean _bUpperCase
Constructor Detail

ListEditor

protected ListEditor()
Creates a new list field editor


ListEditor

protected ListEditor(String name,
                     String labelText,
                     Composite parent)
Creates a list field editor.

Parameters:
name - the name of the preference this field editor works on
labelText - the label text of the field editor
parent - the parent of the field editor's control
Method Detail

addPressed

protected void addPressed()
Notifies that the Add button has been pressed.


adjustForNumColumns

protected void adjustForNumColumns(int numColumns)

createButtons

protected void createButtons(Composite buttonBox)
Creates the Add, Remove, Up, and Down button in the given button box.

Parameters:
buttonBox - the box for the buttons

createList

protected abstract String createList(String[] items)
Combines the given list of items into a single string. This method is the converse of parseString.

Subclasses must implement this method.

Parameters:
items - the list of items
Returns:
the combined string
See Also:
parseString(java.lang.String)

createPushButton

protected Button createPushButton(Composite parent,
                                  String key)
Helper method to create a push button.

Parameters:
parent - the parent control
key - the resource name used to supply the button's label text

createSelectionListener

public void createSelectionListener()
Creates a selection listener.


doFillIntoGrid

protected void doFillIntoGrid(Composite parent,
                              int numColumns)

doLoad

protected void doLoad()

doLoadDefault

protected void doLoadDefault()

doStore

protected void doStore()

downPressed

protected void downPressed()
Notifies that the Down button has been pressed.


getButtonBoxControl

public Composite getButtonBoxControl(Composite parent)
Returns this field editor's button box containing the Add, Remove, Up, and Down button.

Parameters:
parent - the parent control
Returns:
the button box

getListControl

public List getListControl(Composite parent)
Returns this field editor's list control.

Parameters:
parent - the parent control
Returns:
the list control

getNewInputObject

protected abstract String getNewInputObject()
Creates and returns a new item for the list.

Subclasses must implement this method.

Returns:
a new item

getNumberOfControls

public int getNumberOfControls()

getSelectionListener

protected SelectionListener getSelectionListener()
Returns this field editor's selection listener. The listener is created if nessessary.

Returns:
the selection listener

getShell

protected Shell getShell()
Returns this field editor's shell.

This method is internal to the framework; subclassers should not call this method.

Returns:
the shell

parseString

protected abstract String[] parseString(String stringList)
Splits the given string into a list of strings. This method is the converse of createList.

Subclasses must implement this method.

Parameters:
stringList - the string
Returns:
an array of String
See Also:
createList(java.lang.String[])

removePressed

protected void removePressed()
Notifies that the Remove button has been pressed.


selectionChanged

protected void selectionChanged()
Notifies that the list selection has changed.


setFocus

public void setFocus()

setItemLimit

protected void setItemLimit(int iMaxItems)

setUpperCase

protected void setUpperCase(boolean bUpperCase)

swap

protected void swap(boolean up)
Moves the currently selected item up or down.

Parameters:
up - true if the item should move up, and false if it should move down

upPressed

protected void upPressed()
Notifies that the Up button has been pressed.


Rational Developer for Power Systems Software
V7.6

Copyright 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.