All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.eNetwork.beans.HOD.MacroActionCustom

java.lang.Object
   |
   +----com.ibm.eNetwork.beans.HOD.MacroAction
           |
           +----com.ibm.eNetwork.beans.HOD.MacroActionCustom

public class MacroActionCustom
extends MacroAction
This class represents one callout action associated with a MacroScreen object. The callout action gives the developer using the Macro bean the ability to exit to his or her own Java code.

After the Macro bean is instantiated, the developer can call addCustomActionListener. addCustomActionListener takes the callout listener interface object that the developer implements and the MacroActionCustom object's ID. Once addCustomActionListener is called and the Macro bean play method is called, the Macro bean will call the callout listener's callout method with any arguments if it sees a callout line in the macro with the appropriate ID. Note that the arguments are normally coded in the macro file.

For example, the developer codes this in Java (assume the class containing this code snippet implements MacroCalloutListener):

Macro mac = new Macro();
mac.registerCallout("ID1",this);
mac.setMacro(macString); //assume macString is from a macro file (see below)
mac.play();

The macString object is just the string representation of a macro that contains the callout line like this:

custom id="ID1" args="these are the args"

When the Macro bean play method is called, the Macro bean encounters the callout line. It compares the ID and finds a match because it was registered in the Java code. Then, the Macro bean calls the MacroCalloutListener callout method, and the macro play exits to the developer's Java code.

Note: this is and advanced feature that gives developers the ability to fully customize macro actions associated with a screen. Once the Macro exits to the developer's code, it is up to the developer to write reliable code that will not interfere with the Macro bean's normal behavior.

See Also:
Macro, MacroCalloutListener, MacroCalloutEvent

Constructor Index

 o MacroActionCustom()
Constructs an empty instance of a macro callout action.
 o MacroActionCustom(String, String)
Constucts a functional instance of a macro callout action with the given parameters.

Method Index

 o clone()
Classes derived from this action must override this method for the action to be functional in the Macro bean.
 o execute()
Executes the macro callout action.
 o format(int, boolean)
Formats the action object's contents into a readable string.
 o getArgs()
Returns the callout arguments.
 o getID()
Returns the callout identifier.
 o halt()
Halts the macro callout action.
 o setArgs(String)
Sets the callout arguments.
 o setAttributes(Hashtable)
Sets all the basic attributes for the Macro action from the String contents in the given hash table.
 o setID(String)
Sets the callout identifier.

Constructors

 o MacroActionCustom
 public MacroActionCustom()
Constructs an empty instance of a macro callout action.

If you use this constructor you must call all the set methods of this class to properly set up the action.

 o MacroActionCustom
 public MacroActionCustom(String argID,
                          String argsArgs)
Constucts a functional instance of a macro callout action with the given parameters.

Parameters:
argID - callout identifier that is registered with the Macro bean
argArgs - arguments to pass the callout listener

Methods

 o execute
 public void execute()
Executes the macro callout action.

Overrides:
execute in class MacroAction
 o halt
 public void halt()
Halts the macro callout action. If the action is not being executed, then this method just returns.

Overrides:
halt in class MacroAction
 o getID
 public String getID()
Returns the callout identifier.

Returns:
callout identifier that is registered with the Macro bean
 o setID
 public void setID(String argID)
Sets the callout identifier.

Parameters:
argID - callout identifier that is registered with the Macro bean
 o getArgs
 public String getArgs()
Returns the callout arguments.

Returns:
callout identifier that is registered with the Macro bean
 o setArgs
 public void setArgs(String argArgs)
Sets the callout arguments.

Parameters:
argArgs - arguments to pass the callout listener
 o format
 public String format(int argType,
                      boolean formatAll)
Formats the action object's contents into a readable string. Intended for visual feedback, like with the MacroDebugActionEvent class.

Parameters:
type - reserved, currently only XML strings are supported
formatAll - if true, optional parameters will be formatted also
Returns:
formatted string that reflects the contents of the action
Overrides:
format in class MacroAction
 o setAttributes
 public MacroParseEvent setAttributes(Hashtable ht) throws MacroException
Sets all the basic attributes for the Macro action from the String contents in the given hash table.

Parameters:
ht - hash table that contains string values of each attribute. Numeric and boolean values are converted from strings.
Overrides:
setAttributes in class MacroAction
 o clone
 public Object clone()
Classes derived from this action must override this method for the action to be functional in the Macro bean. This method is called by the Macro bean to clone an action.

Overrides:
clone in class MacroAction

All Packages  Class Hierarchy  This Package  Previous  Next  Index