cancel
Showing results for 
Search instead for 
Did you mean: 

The difference of actions,method and event handler!

Former Member
0 Kudos

hello,

In Web Dynpro development, you can create event method and event handler in component controller.You can create actions, method and event handler as well in a view controller.I just confused with the difference of the usage of event,method,

actions and event handler in Web Dynpro.Would you please help me?Just give you your opoins.Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

<b>Hi Daniel

I hope You will get something from the Below Descriptions

<u>Events</u>

The editor can trigger events when administrators perform actions within the editor, such as clicking a button. The following types of events can be triggered:

<i>Generic Events:</i> Events triggered when an administrator clicks a button in the generic toolbar at the top of the editor. These events are triggered and captured automatically by the editor framework.

You cannot change the buttons displayed in the generic events toolbar, but you can create a custom events handler for overriding or extending the standard event handling.

<i>Custom Events:</i> Events, either client or server side, that you trigger and capture.

The component controller allows you to create events.

Events are used to communicate between controllers and enable one controller to trigger event handlers in a different controller.

Cross-component communication can be implemented using the interface controller’s events. Events that were created in the component controller are visible within the component only.

<u>Event Handler</u>

For the Generated Event, a corresponding event handler ie..What should be done upon trogering that event. The Defining of the Actions is done in Event Handler.

Event handlers allow the separation of static and dynamic code in a page. The layout processing deals with the static data, while the event handlers deal with the dynamic data.

<u>Actions</u>

The Web Dynpro event model is based on an event abstraction known as action to cause client-side event information to be transported to the server. Actions are the connection between an event fired by a UI element and the corresponding event handling code implemented as an action event handler in a Web Dynpro view controller. Web Dynpro distinguishes two different types of actions, called validating actions and non-validating actions.

Based on a small Web Dynpro sample application, this article describes the technical background of the Web Dynpro event model and lists some golden rules for working with validating and non-validating actions.

<u>Methods</u>

Methods describe how an object behaves. You implement them using functions defined within classes. They are operations that change the attributes of a class or interface. There are instance- and static methods. Instance methods refer to a certain class instance, whereas static methods are common to all the class instances. Static methods can only address static attributes.

The special methods include constructors and class constructors. Constructors (class constructors) need not be created explicitly if they are not to be implemented.

Regards

Chandran S</b>

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

i will tell with an small example, to add two numbers using action,method,eventhandler...

  • Action means it will fire some event

  • Method is used to do some operation lik adding numbers,multplying etc.,

  • Event is used to fire from component controller to view

  • Event handler is used to catch the event from component controller.

*create an three attribute(eg. num1,num2,num3) in component controller,then context map to view.

*insert inputfield and data bind that attribute

*insert 1 button and create action then write the following code,

{

wdThis.wdGetEventController().getadd();

}

1) Action will be fired from UI element(Button) from view,then it will goes to component controller method.we hav to create an method in component controller(eg. getadd)

2)We have to create an event(eg. addnum) in component controller with 1 parameter (eg.value1).

3)In method we will write somecoding to add numbers in the method getadd() lik,

getADD()

{

int res=wdcontext.currentcontextelement.num1+wdcontext.currentcontextelement.num2;

wdThis.wdFireEventAddnum(res); // firing event to view

}

4)now in view have to create an eventhandler(eg. display add) to catch that event

display add()

{

wdcontext.currentcontext.setnum3(value1); // addition value will be added to input

} field

former_member186016
Active Contributor
0 Kudos

See this thread also:

Regards,

Ashwani Kr Sharma

former_member186016
Active Contributor
0 Kudos

Actions are trigerred by specific step(action) on the UI.

Method are concrete implementation in java which has to executed when the action has occured.

Event are some activity on the UI and event handlers are attached to the event to handle them by giving some concrete implementation. In event handler you get event as parameter so that you can read and handle the event.

Regards,

Ashwani Kr Sharma