jACOB 2.7 API Documentation.

de.tif.jacob.screen.event
Class IActionButtonEventHandler

java.lang.Object
  extended by EventHandler
      extended by de.tif.jacob.screen.event.GuiEventHandler
          extended by de.tif.jacob.screen.event.IGroupMemberEventHandler
              extended by de.tif.jacob.screen.event.IActionButtonEventHandler
Direct Known Subclasses:
ISearchActionEventHandler

public abstract class IActionButtonEventHandler
extends IGroupMemberEventHandler

Abstract event handler class for action buttons, i.e search, new, delete and update buttons. Derived implementations of this event handler class have to be used to "hook" application-specific business logic to action buttons.


Field Summary
static java.lang.String RCS_ID
          The internal revision control system id.
static java.lang.String RCS_REV
          The internal revision control system id in short form.
 
Constructor Summary
IActionButtonEventHandler()
           
 
Method Summary
abstract  boolean beforeAction(IClientContext context, IActionEmitter button)
          This event method will be called, if the corresponding button has been pressed.
 void onError(IClientContext context, IGuiElement button, java.lang.Exception reason)
          This event method will be called, if the execution of the action fails by any reason.
abstract  void onSuccess(IClientContext context, IGuiElement button)
          This event method will be called, if the action has been successfully executed.
 
Methods inherited from class de.tif.jacob.screen.event.IGroupMemberEventHandler
onGroupStatusChanged, onHide, onShow
 
Methods inherited from class de.tif.jacob.screen.event.GuiEventHandler
alert, alert, alert
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RCS_ID

public static final transient java.lang.String RCS_ID
The internal revision control system id.

See Also:
Constant Field Values

RCS_REV

public static final transient java.lang.String RCS_REV
The internal revision control system id in short form.

See Also:
Constant Field Values
Constructor Detail

IActionButtonEventHandler

public IActionButtonEventHandler()
Method Detail

beforeAction

public abstract boolean beforeAction(IClientContext context,
                                     IActionEmitter button)
                              throws java.lang.Exception
This event method will be called, if the corresponding button has been pressed. You can prevent the execution of the action, if you return false. Nevertheless, you should inform the user by means of a proper notification, e.g. create and show a message dialog.

Parameters:
context - The current context of the application
button - The action button (the emitter of the event)
Returns:
Return false, if you want to avoid the execution of the action else return true.
Throws:
java.lang.Exception

onSuccess

public abstract void onSuccess(IClientContext context,
                               IGuiElement button)
                        throws java.lang.Exception
This event method will be called, if the action has been successfully executed.

Note for new buttons: You can use this method to initialize or reset GUI input fields which are connected to a data field after a new record action has been performed. Nevertheless, you should do this by modifying the data fields of the selected record instead of modifying the GUI field directly. The later has no effect, since the application server will update the GUI fields according to the values of the respective data fields after this method has been invoked.
Example:

 public void onSuccess(IClientContext context, IGuiElement button) throws Exception
 {
   // clear generated project number which might still be set by previous (template) record
   IDataTableRecord currentRecord = context.getSelectedRecord();
   currentRecord.setValue(currentRecord.getCurrentTransaction(), "projectnumber", null);
 }
 
instead of
 public void onSuccess(IClientContext context, IGuiElement button) throws Exception
 {
   // clear generated project number which might still be set by previous (template) record
   context.getGroup().setInputFieldValue("salesprojectProjectnumber", "");
 }
 

Parameters:
context - The current context of the application
button - The action button (the emitter of the event)
Throws:
java.lang.Exception - If an exception is thrown, onError(IClientContext, IGuiElement, Exception) will be called as well.

onError

public void onError(IClientContext context,
                    IGuiElement button,
                    java.lang.Exception reason)
This event method will be called, if the execution of the action fails by any reason. You should not try to rethrow the reason exception, since this exception is already handled by the jACOB application server. Nevertheless, you could add additional code for error handling, e.g. do some kind of application logging.

Parameters:
context - The current context of the application
button - The action button (the emitter of the event)
reason - The reason why the action has failed

jACOB 2.7 API Documentation.