Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.rse.util.clprompter
Class CLPrompter

java.lang.Object
  extended by com.ibm.etools.iseries.rse.util.clprompter.CLPrompter

public class CLPrompter
extends Object

This object displays a prompter for a given command string similar to the prompting done by the AS/400 command line. The command string may be a command name, a full command string, or a partial command name such as crt*. Any errors encountered during prompting will be handled by the CLPrompter. The prompter requires the AS/400 system to be at release V4R4 or later.

Usage:

          AS400 system = new AS400("system1");
          CLPrompter cp = new CLPrompter(frame, system, "savlib");
 
if(cp.showDialog() == CLPrompter.OK) { result = cp.getCommandString(); // get command string }

Since:
v5r1m0

Nested Class Summary
protected  class CLPrompter.RunnableConfigure
           
 
Field Summary
static int CANCEL
          The user dismissed the dialog by pressing the Cancel button.
static String Copyright
           
static int DATE_DAY_MONTH_YEAR
          Constant specifying the date format is day, month, and year.
static int DATE_JULIAN
          Constant specifying the date format is Julian.
static int DATE_MONTH_DAY_YEAR
          Constant specifying the date format is month, day, and year.
static int DATE_NONE
          Constant specifying a date format was not used by the command.
static int DATE_YEAR_MONTH_DAY
          Constant specifying the date format is year, month, and day.
static int EDIT_MODE
          Indicates that the prompter should use edit mode: Label and Comment fields are displayed Variables are allowed Expressions are allowed
static int ERROR
          The dialog was dismissed due to an error during prompting.
static int EXECUTE_MODE
          Indicates that the prompter should use execute mode: Label and Comment fields are NOT displayed Variables are NOT allowed Expressions are NOT allowed
protected static int NESTED_EDIT_MODE
          Indicates that the prompter should use edit mode: Label and Comment fields are NOT displayed Variables are allowed Expressions are allowed
static int NON_EXECUTE_MODE
          Indicates that the prompter should use edit mode: Label and Comment fields are NOT displayed Variables are allowed Expressions are NOT allowed
static int OK
          The user dismissed the dialog by pressing the OK button.
static int PTF_REQUIRED
          The host system requires a PTF for the prompter to function.
 
Constructor Summary
CLPrompter()
          Constructs a CLPrompter object.
CLPrompter(Shell parentShell, IBMiConnection system, String commandString)
          Constructs a CLPrompter object.
CLPrompter(Shell parentShell, IBMiConnection system, String commandString, boolean usePromptPrograms, boolean promptInteractiveCommands)
          Constructs a CLPrompter object.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a listener to be notified when the value of any bound property changes.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a listener to be notified when the value of any constrained property changes.
 String getCommandString()
          Returns the prompted command string.
 IBMiConnection getConnection()
          Returns the connection used by this dialog.
 int getDateFormat()
          Returns the date format used during prompting.
 SystemMessage getHelp()
          Show the help window for the command without prompting.
 String getHelpURL()
          Retrieves the URL for the help XML file
 Shell getParent()
          Returns the parent Frame for the CLPrompter dialog.
 boolean getPromptInteractiveCommands()
          Gets whether the CLPrompter should prompt interactive commands in addition to batch commands.
 boolean getUsePromptPrograms()
          Returns if the prompter should call the prompt override and change exit programs.
 boolean isBatch()
          Returns if the command prompted could be executed in batch.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a property change listener.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes a vetoable change listener.
 void setCCSID(int ccsid)
           
 void setCommandString(String commandString)
          Sets the command string to be prompted.
 void setConnection(IBMiConnection connection)
          Sets the iSeries connection used to retrieve the command definition.
 void setMode(int mode)
          Sets the mode that the editor should use.
 void setParent(Shell parent)
          Sets the parent shell for the CLPrompter dialog.
 void setPromptInteractiveCommands(boolean prompt)
          Sets whether the prompter should prompt interactive commands in addition to batch commands.
 void setUsePromptPrograms(boolean usePromptPrograms)
          Sets whether the prompter should call the prompt override and change exit programs for the command.
 int showDialog()
          Shows the dialog and returns how it was dismissed.
 SystemMessage showHelp()
          Show the help window for the command without prompting.
 SystemMessage testSyntax()
           
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

OK

public static final int OK
The user dismissed the dialog by pressing the OK button.

See Also:
Constant Field Values

CANCEL

public static final int CANCEL
The user dismissed the dialog by pressing the Cancel button.

See Also:
Constant Field Values

ERROR

public static final int ERROR
The dialog was dismissed due to an error during prompting.

See Also:
Constant Field Values

PTF_REQUIRED

public static final int PTF_REQUIRED
The host system requires a PTF for the prompter to function. Only applies to V4R4 and V4R5 systems.

See Also:
Constant Field Values

DATE_NONE

public static final int DATE_NONE
Constant specifying a date format was not used by the command.

See Also:
Constant Field Values

DATE_DAY_MONTH_YEAR

public static final int DATE_DAY_MONTH_YEAR
Constant specifying the date format is day, month, and year.

See Also:
Constant Field Values

DATE_JULIAN

public static final int DATE_JULIAN
Constant specifying the date format is Julian.

See Also:
Constant Field Values

DATE_MONTH_DAY_YEAR

public static final int DATE_MONTH_DAY_YEAR
Constant specifying the date format is month, day, and year.

See Also:
Constant Field Values

DATE_YEAR_MONTH_DAY

public static final int DATE_YEAR_MONTH_DAY
Constant specifying the date format is year, month, and day.

See Also:
Constant Field Values

EDIT_MODE

public static final int EDIT_MODE
Indicates that the prompter should use edit mode: Label and Comment fields are displayed Variables are allowed Expressions are allowed

Since:
6.0
See Also:
Constant Field Values

EXECUTE_MODE

public static final int EXECUTE_MODE
Indicates that the prompter should use execute mode: Label and Comment fields are NOT displayed Variables are NOT allowed Expressions are NOT allowed

Since:
6.0
See Also:
Constant Field Values

NON_EXECUTE_MODE

public static final int NON_EXECUTE_MODE
Indicates that the prompter should use edit mode: Label and Comment fields are NOT displayed Variables are allowed Expressions are NOT allowed

Since:
6.0
See Also:
Constant Field Values

NESTED_EDIT_MODE

protected static final int NESTED_EDIT_MODE
Indicates that the prompter should use edit mode: Label and Comment fields are NOT displayed Variables are allowed Expressions are allowed

Since:
6.0
See Also:
Constant Field Values
Constructor Detail

CLPrompter

public CLPrompter()
           throws SystemMessageException
Constructs a CLPrompter object.
The dialog will be modal upon the parent.

Throws:
SystemMessageException
Since:
v5r1m0

CLPrompter

public CLPrompter(Shell parentShell,
                  IBMiConnection system,
                  String commandString)
           throws SystemMessageException
Constructs a CLPrompter object.
The dialog will be modal upon the parent.

Parameters:
parent - The parent Frame that displays the dialog.
system - The ISeriesConnection used to retrieve the command definition.
commandString - The command string to be prompted.
Throws:
SystemMessageException
Since:
v5r1m0

CLPrompter

public CLPrompter(Shell parentShell,
                  IBMiConnection system,
                  String commandString,
                  boolean usePromptPrograms,
                  boolean promptInteractiveCommands)
           throws SystemMessageException
Constructs a CLPrompter object.
The dialog will be modal upon the parent.

Parameters:
parent - The parent Frame that displays the dialog.
system - The AS/400 system used to retrieve the command definition.
commandString - The command string to be prompted.
usePromptPrograms - If the prompt override and change exit programs should be called for the command.
promptInteractiveCommands - If the prompter should prompt interactive commands.
Throws:
SystemMessageException
Since:
v5r1m0
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to be notified when the value of any bound property changes.

Since:
v5r1m0

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a listener to be notified when the value of any constrained property changes.

Since:
v5r1m0

getCommandString

public String getCommandString()
Returns the prompted command string.
The string is a valid command string if the user pressed OK to dismiss the dialog. Otherwise, it is the starting command string.

Returns:
A command string.
Since:
v5r1m0

getDateFormat

public int getDateFormat()
Returns the date format used during prompting. This date format is retrieved from the job used to prompt the command.

Returns:
DATE_NONE if the command did not use date fields or the command has yet to be prompted.
Since:
v5r1m0

getParent

public Shell getParent()
Returns the parent Frame for the CLPrompter dialog.

Returns:
The parent Frame for the CLPrompter dialog.
Since:
v5r1m0

getPromptInteractiveCommands

public boolean getPromptInteractiveCommands()
Gets whether the CLPrompter should prompt interactive commands in addition to batch commands.
If the prompter is set to not prompt interactive commands, an error will be displayed to the user if they try to prompt interactive commands.
By default, the prompter will prompt both batch and interactive commands.

Returns:
True if the prompter should prompt interactive commands, false otherwise.
Since:
v5r1m0
See Also:
setPromptInteractiveCommands(boolean)

getConnection

public IBMiConnection getConnection()
Returns the connection used by this dialog. Port of getSystem

Returns:
The object that represents the system.
Since:
v5.1

getUsePromptPrograms

public boolean getUsePromptPrograms()
Returns if the prompter should call the prompt override and change exit programs.
A prompt override program is called to fill input fields with existing values on the AS/400 instead of *SAME. This value should be false if the command is not being retrieved from the same system it will be executed on. By default, CLPrompter will call the prompt override and change exit programs for a command.

Returns:
true if the prompter will use the prompt override and change exit programs, false otherwise.
Since:
v5r1m0
See Also:
setUsePromptPrograms(boolean)

isBatch

public boolean isBatch()
Returns if the command prompted could be executed in batch.

Returns:
true if the command could be executed in batch, false otherwise.
Since:
v5r1m0

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.

Since:
v5r1m0

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable change listener.

Since:
v5r1m0

setCommandString

public void setCommandString(String commandString)
Sets the command string to be prompted.

Parameters:
command - The command string to be prompted.
Since:
v5r1m0

setParent

public void setParent(Shell parent)
Sets the parent shell for the CLPrompter dialog.

Parameters:
parent - The parent shell for the CLPrompter dialog.
Since:
v5r1m0

setPromptInteractiveCommands

public void setPromptInteractiveCommands(boolean prompt)
                                  throws PropertyVetoException
Sets whether the prompter should prompt interactive commands in addition to batch commands.
If the prompter is set to not prompt interactive commands, an error will be displayed to the user if they try to prompt interactive commands.
By default, the prompter will prompt both batch and interactive commands.

Parameters:
prompt - Specifies if the prompter should also prompt interactive commands.
Throws:
PropertyVetoException
Since:
v5r1m0
See Also:
getPromptInteractiveCommands()

setConnection

public void setConnection(IBMiConnection connection)
Sets the iSeries connection used to retrieve the command definition. port of setSystem

Parameters:
connection - The connection to use to retrieve the command definition.
Since:
5.1

setUsePromptPrograms

public void setUsePromptPrograms(boolean usePromptPrograms)
                          throws PropertyVetoException
Sets whether the prompter should call the prompt override and change exit programs for the command.
A prompt override program is called to fill input fields with existing values on the AS/400 instead of *SAME. This value should be false if the command is not being retrieved from the same system it is being executed on. By default, the prompter will call the prompt override and change exit programs for a command.

Parameters:
usePromptPrograms - true to allow the prompt override and change exit programs to be called for the command, false otherwise.
Throws:
PropertyVetoException
Since:
v5r1m0
See Also:
getUsePromptPrograms()

showDialog

public int showDialog()
Shows the dialog and returns how it was dismissed.

Returns:
OK if the user dismissed the dialog by pressing the ok button.
Since:
v5r1m0
See Also:
OK, CANCEL, ERROR, PTF_REQUIRED

showHelp

public SystemMessage showHelp()
Show the help window for the command without prompting.

Returns:
OK if the help was displayed.
Since:
v5r1m0f
See Also:
OK, ERROR, PTF_REQUIRED

getHelpURL

public String getHelpURL()
                  throws SystemMessageException
Retrieves the URL for the help XML file

Returns:
The URL for the help file
Throws:
SystemMessageException
Since:
6.0.1

getHelp

public SystemMessage getHelp()
Show the help window for the command without prompting.

Returns:
ERROR if an internal or server error prevented displaying the help.
Since:
v5r1m0f
See Also:
OK, ERROR, PTF_REQUIRED

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object
Returns:
The class name and starting command string.
Since:
v5r1m0

testSyntax

public SystemMessage testSyntax()

setCCSID

public void setCCSID(int ccsid)

setMode

public void setMode(int mode)
Sets the mode that the editor should use. If not set, EXECUTE_MODE is used.

Parameters:
mode - One of the following: EDIT_MODE, EXECUTE_MODE, NON_EXECUTE_MODE
Since:
6.0

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.