Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.rse.ui.widgets
Class QSYSBasePrompt

java.lang.Object
  extended by Composite
      extended by com.ibm.etools.iseries.rse.ui.widgets.QSYSBasePrompt
Direct Known Subclasses:
QSYSAspDevPrompt, QSYSAUTLPrompt, QSYSLibraryPrompt, QSYSObjectPrompt, QSYSProgramObjectPrompt

public abstract class QSYSBasePrompt
extends Composite

This is a base class for a re-usable composite widget for prompting the user for a remote object name. The composite is layed as follows:


   pppppppp: ______________________v  Browse...
 

Child classes specify the prompt label and tooltip, the combo contents and the browse-button action.


Field Summary
protected  IIBMiSelectAction browseAction
           
protected  Button browseButton
           
static String copyright
           
protected  IHost defaultConnection
           
protected  boolean enableBrowse
           
protected  int gridColumns
           
protected  boolean ignoreChanges
           
protected  boolean onlyConnection
           
protected  SystemHistoryCombo promptCombo
           
protected  Label promptLabel
           
protected  ResourceBundle rb
           
protected  boolean showNewConnection
           
protected  boolean testing
           
 
Constructor Summary
QSYSBasePrompt(Composite parent, int style, String historyKey, IHost defaultConnection, String label, String tooltip, String browseLabel, String browseTooltip)
          Constructor when the default connection is already known
QSYSBasePrompt(Composite parent, int style, String historyKey, String label, String tooltip, String browseLabel, String browseTooltip)
          Constructor when the default connection is not yet known
 
Method Summary
 void addBrowseButtonSelectionListener(SelectionListener listener)
          Register a listener interested in when the browse button is selected
 void addModifyListener(ModifyListener listener)
          Register a listener interested in entry field modify events
protected  void addOurButtonSelectionListener()
           
 void addSelectionChangedListener(ISelectionChangedListener listener)
          Register a listener interested in an item is selected in the combo box
 void addSelectionListener(SelectionListener listener)
          Register a listener interested in an item is selected in the combo box
static Combo createCombo(Composite parent, boolean readonly)
          Creates a new combobox instance and sets the default layout data.
static SystemHistoryCombo createHistoryCombo(Composite parent, String key, boolean readonly)
          Creates a new historical combobox instance and sets the default layout data.
protected static Button createPushButton(Composite group, ResourceBundle bundle, String key)
           
protected static Button createPushButton(Composite group, String label)
           
protected abstract  IIBMiSelectAction getBrowseAction(Shell shell, IHost defaultConnection, boolean onlyConnection)
          Overridable method.
 Button getBrowseButton()
          Return the Browse...
 SystemHistoryCombo getCombo()
          Return the combo box widget
 int getGridColumns()
          Return the number of grid data columns within this composite.
 String[] getItems()
          Get the items in the combo field
 Label getPromptLabel()
          Get the prompt Label object
 ISelection getSelection()
           
 String getText()
          Get the user entered or selected name.
 void lineUpWith(IBMiConnectionCombo otherWidget)
          If a composite widget like this is used more than once on the same page, it is nice to line up the columns.
 void lineUpWith(QSYSBasePrompt otherWidget)
          If a composite widget like this is used more than once on the same page, it is nice to line up the columns.
protected  Composite prepareComposite(int numColumns)
          Prepares this composite control and sets the default layout data.
 void removeBrowseButtonSelectionListener(SelectionListener listener)
          Remove a previously set browse button selection listener.
 void removeModifyListener(ModifyListener listener)
          Remove a previously set entry field listener.
 void removeSelectionChangedListener(ISelectionChangedListener listener)
          Remove a previously set combo box selection listener.
 void removeSelectionListener(SelectionListener listener)
          Remove a previously set combo box selection listener.
 void setBrowseButtonFocus()
          Set the focus to the browse button
 void setBrowseButtonLabel(String label)
          Set the tooltip text for the browse button
 void setBrowseButtonToolTipText(String tip)
          Set the tooltip text for the browse button
 void setButtonWidthHint(Control otherWidget)
          Set button width hint, based on the width of another widget
 void setButtonWidthHint(int widthHint)
          Set button width hint
 void setDefaultConnection(IHost defaultConnection)
          Set the default connection to preselect when Browse is pressed.
 void setEnabled(boolean enabled)
          Disable/Enable all the child controls.
 boolean setFocus()
          Set the focus to the combo field
 void setHost(IHost onlyConnection)
          Set the system connection to use when Browse is pressed.
Unlike setDefaultConnection, this has the result of not allowing the user to select or create any other connection.
 void setIgnoreChanges(boolean ignoreChanges)
          Turn on or off ignore changes mode.
 void setItems(String[] items)
          Set the items in the combo field
 void setPromptLabel(String label)
          Set the prompt label
 void setSelection(ISelection selection)
           
 void setShowNewConnectionPrompt(boolean showNewConnection)
          Sets whether a "New Connection..." special connection is shown in the tree when Browse is pressed.
 void setText(String name)
          Set the name displayed in the combo box
 void setToolTipText(String tip)
          Set the tooltip text for the combo field
 void setWidthHint(int widthHint)
          Set the width hint for this whole composite Default is computed from children by the layout.
 boolean showBrowseButton()
          Return whether or not we are to show the browse button
 void showBrowseButton(boolean show)
          Enable or disable the showing of the Browse button.
 void updateHistory()
          Update the history with current entry field setting.
 void updateHistory(boolean refresh)
          Update the history with current entry field setting and refresh the ui to reflect it.
 
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

promptLabel

protected Label promptLabel

promptCombo

protected SystemHistoryCombo promptCombo

browseButton

protected Button browseButton

gridColumns

protected int gridColumns

defaultConnection

protected IHost defaultConnection

browseAction

protected IIBMiSelectAction browseAction

rb

protected ResourceBundle rb

onlyConnection

protected boolean onlyConnection

enableBrowse

protected boolean enableBrowse

testing

protected boolean testing

ignoreChanges

protected boolean ignoreChanges

showNewConnection

protected boolean showNewConnection
Constructor Detail

QSYSBasePrompt

public QSYSBasePrompt(Composite parent,
                      int style,
                      String historyKey,
                      String label,
                      String tooltip,
                      String browseLabel,
                      String browseTooltip)
Constructor when the default connection is not yet known

Parameters:
parent - Parent composite
style - The SWT style flags for overall composite widget. Typically just pass SWT.NULL
historyKey - The key to use to save and restore historical values for the combo widget
rb - The resourcebundle from which to get the label and tooltip
rbLabelKey - The label key root for the resource bundle strings. We will append "label" and "tooltip" to get the prompt text and tooltip text for the combo field.
rbBrowseKey - The browse button key root for the resource bundle strings. We will append "label" and "tooltip" to get the button text and tooltip text.

QSYSBasePrompt

public QSYSBasePrompt(Composite parent,
                      int style,
                      String historyKey,
                      IHost defaultConnection,
                      String label,
                      String tooltip,
                      String browseLabel,
                      String browseTooltip)
Constructor when the default connection is already known

Parameters:
parent - Parent composite
style - The SWT style flags for overall composite widget. Typically just pass SWT.NULL
historyKey - The key to use to save and restore historical values for the combo widget
defaultConnection - The system connection to preselect when Browse is pressed.
rb - The resourcebundle from which to get the label and tooltip
rbLabelKey - The label key root for the resource bundle strings. We will append "label" and "tooltip" to get the prompt text and tooltip text for the combo field.
rbBrowseKey - The browse button key root for the resource bundle strings. We will append "label" and "tooltip" to get the button text and tooltip text.
Method Detail

lineUpWith

public void lineUpWith(QSYSBasePrompt otherWidget)
If a composite widget like this is used more than once on the same page, it is nice to line up the columns. This method will do that, given the first composite widget. The trick to this though is that we need to know the size of other composite, which is not known until after the controls are all layed out. So only call this after all controls have been added to your dialog/wizard content area.


lineUpWith

public void lineUpWith(IBMiConnectionCombo otherWidget)
If a composite widget like this is used more than once on the same page, it is nice to line up the columns. This method will do that, given the first composite widget. The trick to this though is that we need to know the size of other composite, which is not known until after the controls are all layed out. So only call this after all controls have been added to your dialog/wizard content area.


setDefaultConnection

public void setDefaultConnection(IHost defaultConnection)
Set the default connection to preselect when Browse is pressed. Unlike #setSystemConnection(SystemConnection), this method assumes the user is allowed to choose from multiple connections, and we are merely defaulting the selection to this one.

See Also:
#setSystemConnection(SystemConnection)

setBrowseButtonLabel

public void setBrowseButtonLabel(String label)
Set the tooltip text for the browse button


setHost

public void setHost(IHost onlyConnection)
Set the system connection to use when Browse is pressed.
Unlike setDefaultConnection, this has the result of not allowing the user to select or create any other connection. If you call this, you probably also want to call setShowNewConnectionPrompt(boolean).
If you do call setShowNewConnectionPrompt(boolean) with false, then this method has the effect of either enabling or disabling the Browser button, depending if the connection is not-null or null, respectively. This is because if they cannot create a connection, and no connection is given, then there is no point in browsing. Note the button is enabled until you call this, so you probably will need to do a priming call with null, to disable it initially if the user selects their connection from another widget. It also means you want to do that priming call after calling setShowNewConnectionPrompt(boolean) with false.

See Also:
#setDefaultConnection(SystemConnection), setShowNewConnectionPrompt(boolean)

showBrowseButton

public void showBrowseButton(boolean show)
Enable or disable the showing of the Browse button. Enabled by default

See Also:
setShowNewConnectionPrompt(boolean)

showBrowseButton

public boolean showBrowseButton()
Return whether or not we are to show the browse button


setShowNewConnectionPrompt

public void setShowNewConnectionPrompt(boolean showNewConnection)
Sets whether a "New Connection..." special connection is shown in the tree when Browse is pressed.

Parameters:
showNewConnection - - true to allow users to create a new connection while browsing, false o/w
See Also:
showBrowseButton(boolean)

setIgnoreChanges

public void setIgnoreChanges(boolean ignoreChanges)
Turn on or off ignore changes mode. When on, the validators are not invoked, nor events fired. Typically turned on during initialization.


getBrowseAction

protected abstract IIBMiSelectAction getBrowseAction(Shell shell,
                                                     IHost defaultConnection,
                                                     boolean onlyConnection)
Overridable method. Returns action to be called when Browse... pressed.


setText

public void setText(String name)
Set the name displayed in the combo box


getText

public String getText()
Get the user entered or selected name.


getCombo

public SystemHistoryCombo getCombo()
Return the combo box widget


setWidthHint

public void setWidthHint(int widthHint)
Set the width hint for this whole composite Default is computed from children by the layout. Do not set this lightly, as it may cause problems with translated flavors.


setButtonWidthHint

public void setButtonWidthHint(int widthHint)
Set button width hint


setButtonWidthHint

public void setButtonWidthHint(Control otherWidget)
Set button width hint, based on the width of another widget


getGridColumns

public int getGridColumns()
Return the number of grid data columns within this composite. Will vary depending if there is a New button or not.


getBrowseButton

public Button getBrowseButton()
Return the Browse... button widget


setItems

public void setItems(String[] items)
Set the items in the combo field


getItems

public String[] getItems()
Get the items in the combo field


setEnabled

public void setEnabled(boolean enabled)
Disable/Enable all the child controls.


setPromptLabel

public void setPromptLabel(String label)
Set the prompt label


getPromptLabel

public Label getPromptLabel()
Get the prompt Label object


setToolTipText

public void setToolTipText(String tip)
Set the tooltip text for the combo field


setBrowseButtonToolTipText

public void setBrowseButtonToolTipText(String tip)
Set the tooltip text for the browse button


setFocus

public boolean setFocus()
Set the focus to the combo field


setBrowseButtonFocus

public void setBrowseButtonFocus()
Set the focus to the browse button


addSelectionListener

public void addSelectionListener(SelectionListener listener)
Register a listener interested in an item is selected in the combo box

See Also:
removeSelectionListener(SelectionListener)

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
Remove a previously set combo box selection listener.

See Also:
addSelectionListener(SelectionListener)

addBrowseButtonSelectionListener

public void addBrowseButtonSelectionListener(SelectionListener listener)
Register a listener interested in when the browse button is selected

See Also:
#removeNewButtonSelectionListener(SelectionListener)

removeBrowseButtonSelectionListener

public void removeBrowseButtonSelectionListener(SelectionListener listener)
Remove a previously set browse button selection listener.

See Also:
#addNewButtonSelectionListener(SelectionListener)

addModifyListener

public void addModifyListener(ModifyListener listener)
Register a listener interested in entry field modify events

See Also:
removeModifyListener(ModifyListener)

removeModifyListener

public void removeModifyListener(ModifyListener listener)
Remove a previously set entry field listener.

See Also:
addModifyListener(ModifyListener)

updateHistory

public void updateHistory()
Update the history with current entry field setting.

This is called automatically for you when setText is called. However, for non-readonly versions, you should still call this yourself when OK is successfully pressed on the dialog box.


updateHistory

public void updateHistory(boolean refresh)
Update the history with current entry field setting and refresh the ui to reflect it.

This is called automatically for you when setText is called. However, for non-readonly versions, you should still call this yourself when OK is successfully pressed on the dialog box.


prepareComposite

protected Composite prepareComposite(int numColumns)
Prepares this composite control and sets the default layout data.

Parameters:
Number - of columns the new group will contain.

createCombo

public static Combo createCombo(Composite parent,
                                boolean readonly)
Creates a new combobox instance and sets the default layout data.

Does NOT set the widthHint as that causes problems. Instead the combo will consume what space is available within this composite.

Parameters:
parent - composite to put the button into.

createHistoryCombo

public static SystemHistoryCombo createHistoryCombo(Composite parent,
                                                    String key,
                                                    boolean readonly)
Creates a new historical combobox instance and sets the default layout data.

Does NOT set the widthHint as that causes problems. Instead the combo will consume what space is available within this composite.

Parameters:
parent - composite to put the button into.

createPushButton

protected static Button createPushButton(Composite group,
                                         String label)

createPushButton

protected static Button createPushButton(Composite group,
                                         ResourceBundle bundle,
                                         String key)

addOurButtonSelectionListener

protected void addOurButtonSelectionListener()

addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener listener)
Register a listener interested in an item is selected in the combo box

See Also:
#removeSelectionChangedListener(SelectionChangedListener)

removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener listener)
Remove a previously set combo box selection listener.

See Also:
#addSelectionChangedListener(SelectionChangedListener)

getSelection

public ISelection getSelection()

setSelection

public void setSelection(ISelection selection)

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.