|
|
|
The Model-Driven System Builder
|
|
JeeWiz Architect's Guide
|
|
|
|
Contents >
15. 'Screen' Reference
|
|
|
15.4 EventHandler Object
| Superclass | forward |
| Subclassed By |
|
| Description | This event-handler defines how to handle an event from the containing page.
Events are triggered by controls like buttons.
In J2EE, where multiple events are handled on one page, an assumption is made that all events use the same request parameter (e.g. 'action=...') to signal which event handler to action.
This is called the event-request-parameter and defaults to 'action'.
The standard scripts map the name defined here to 'eventName' - the name of the event as submitted by the form - in component.properties.
This means that scripts should use $eventName to check for the event, rather than $name.
In appropriate UI platforms (e.g. J2EE/Struts, but *not* .NET) an event-handler can be designated as the default handler and will always be actioned if no other events are appropriate.
If no default event-handler is set, the last event is used-as a catch-all.
This also means that there is no need to set a default handler on a single-event page - it will be done for you.
Event handling should only be necessary where there is server-side action to be taken; links (anchors) can be handled directly in the HTML.
The constraints defined on an event-handler are only active if this event handler action is performed.
The code to execute can be either
- auto-generated code. This can come from
- code generated from an included script in 'action-script'. This will be inserted to do the body of the logic.
For example, the standard search page generates logic to check all the fields in a page and create a SQL statement.
This also calls the session/method handler.
- a method to call on a session object. This is generated if the action-style is not specified and there is a session/method pair specifid.
This will be accessed via a local delegate (for now).
The session will be effectively stateless (the delegate will be instantiated using a null constructor).
The single parameter will be the value-object from the view.
- embedded text (CDATA...) within the action XML element
- both of the above: the method is called and then the embedded text is done.
The page forwards to the success-forward-page/action if this succeeds.
Any further logic is done by setting the 'forward' variable in the template; this must be done in embedded text.
Some forms have multiple success outcomes from a single event. For example, searches can result in a single row or multiple rows being returned.
There is one predefined property - alternative-forward - that can be used to handle an alternative success outcome.
If there is more that one alternative forward, then other means of selection should be used.
TBD: think about adding base/implementation split in generated classes to allow embedded text to be called as an override method.
|
Contained Lists |
| 1 |
|
| |
| 2 |
| Name | rolesAllowed |
| Type | String |
| Inherited from | panel |
|
| |
| 3 |
| Name | rolesBlocked |
| Type | String |
| Inherited from | panel |
|
| |
| 4 |
| Name | constraint |
| Type | constraint |
| GenerateAllList | false |
|
|
Inherited properties |
|
15.4.1 Property 'businessMethod'
|
| Description | The name of the business method to call. This method can either be on a session object (if the 'bean' property is specified) or on the current page.
|
| Type | String |
15.4.2 Property 'bean'
|
| Description | The session class, on which the business-method is held. This must be specified if the method to call for this event is on a session object. If so, then there also must be a data-view for the data behind the page; the generated code automatically links the page's data-view information to the session's business method's parameters.
|
| Type | String |
15.4.3 Property 'jar'
|
| Description | The name of the jar, ejb-jar or .NET assembly the session object is in.
This is only relevant if the method name is specified.
It is only required if there are more than one session objects with a business-method with one parameter of the correct name.
|
| Type | String |
15.4.4 Property 'actionScript'
|
| Description | The action-script is a way of linking up a page to a business method.
The normal code just calls the business-method using input data-view's value object as the input.
The action-script must be in the page directory (i.e. jeewiz/resources/screen/control/page or your override of this).
A '.inc' extension will be added automatically.
If there are knock-on changes to the page (other events that need handling, for example), it may be more convenient to use the page's rendering-script property and render the whole page.
Some page renderings (for example, the standard search pages) ignore the action-script.
|
| Type | String |
15.4.5 Property 'alternativeForwardPage'
|
| Description | Defines the page to go to in a for an alternative success (e.g. multiple rows returned from a search).
This must be the name of a page in the current application.
|
| Type | String |
| Delegates | true |
15.4.6 Property 'alternativeForwardRequestString'
|
| Description | Defines the additional request action to execute in an alternative forward.
Default is just to display the page.
If this value is specified, it results in the default event for the forwarded page being set to this value.
|
| Type | String |
15.4.7 Property 'htmlInsert'
|
| Description | Adds extra text to be placed inside an html rendering
|
| Type | String |
15.4.8 Property 'isDefaultEvent'
|
| Overrides | forward.isDefaultEvent |
| Description | This marks an event handler as the default to use.
This is an alternative to setting the 'name' of the event null.
After initialisation, this will automatically be set for an event if there is only one event.
Therefore in a single-event page there is no need to set this flag.
|
| Type | boolean |
| Default | false |
15.4.9 Property 'showControl'
|
| Description | Normally an event has an associated control that is put on the page.
However, some events are triggered by other means.
In this case, the processing of the event still needs to be done, but the control should not be shown on the page.
To stop the control being shown, set this flag to false.
|
| Type | boolean |
| Default | true |
15.4.10 Property 'loopEnd'
|
15.4.11 Property 'goingToDvName'
|
| Description | If an event takes us from a page backed by one dataview to a page backed by another, depending on the event
it might be necessary to process, perhaps in the action class or the code behind, something that requires
knowing which dataview we are going to. This property may store this information for later retreival in
those cases.
|
| Type | String |
15.4.12 Property 'failureForwardPage'
|
| Description | Defines the default page to go to in a failure situation (e.g. constraint failure).
This must be the name of a page in the current application.
|
| Type | String |
| Delegates | true |
15.4.13 Property 'failureForwardRequestString'
|
| Description | Defines the additional request action to execute in a failure situation.
Default is just to display the page.
If this value is specified, it results in the default event for the forwarded page being set to this value.
|
| Type | String |
| Delegates | true |
15.4.14 Property 'userNameBase'
|
| Description | This is the user-visible name for this object (currently it is used on business objects, business-methods and data-views.
In the standard rendering, this is further embellished in component.properties to create the userName, which the user will actually see.
For example, say the name of a session object is AccountTransaction.
Then the default for the user-name-base will be 'Account Transaction'.
This will be embellished in component.properties to give the userName 'Account Transactions'.
Either the userNameBase or the userName can then be used in scripts.
|
| Type | String |
15.4.15 Property 'text'
|
| Description | The 'text' is the code insert for the body of the method - the text between the '{' and '}' brackets.
If the method has a return value, you should write the return statement too.
|
| Type | String |
15.4.16 Property 'presentationStyle'
|
| Description | This is hint to the renderer to set a 'class' type style for the children components of this component - The rendering will probably
(but not necessarily) be done using cascading style sheets, where this will translate into the css class attribute.
|
| Type | String |
15.4.17 Property 'border'
|
| Description | This is a hint for the renderer to indicate the style of the border for this component.
|
| Type | String |
15.4.18 Property 'margin'
|
| Description | This is a hint for the render to indicate the margin required for this object (and, optionally, the spacing
inbetween child components). The margin value can be a comma separated value using the convention of the first
value = Top, second = Right, third = Bottom, fourth = Left, fifth = Spacing between child components.
Specifiying the fifth element is a convenience to allow spacing between
for example
2,3,4,5,2 would mean a margin of 2 on the Top, 3 on the Right, 4 on the Bottom, 5 on the left and 2 inbetween child components.
2,3,4,5 would mean a margin of 2 on the Top, 3 on the Right, 4 on the Bottom and 5 on the left.
- would mean a margin of 4 on all borders.
4,0,0,0 would mean a margin of 4 on the Top, 0 on all other edges.
|
| Type | String |
15.4.19 Property 'padding'
|
| Description | This is a hint for the render to indicate the padding required for this object. The margin value can be a comma separated value
using the convention of the first value = Top, second = Right, third = Bottom, fourth = Left.
for example
2,3,4,5 would mean a padding of 2 on the Top, 3 on the Right, 4 on the Bottom and 5 on the left.
- would mean a pagging of 4 on all borders.
4,0,0,0 would mean a padding of 4 on the Top, 0 on all the other edges
|
| Type | String |
15.4.20 Property 'color'
|
| Description | This is hint to the renderer to inidicate the color to use on this component.
|
| Type | String |
15.4.21 Property 'backgroundColor'
|
| Description | This is a hint for the renderer to indicate the background color.
|
| Type | String |
15.4.22 Property 'extraStyle'
|
| Description | This is mechanism for the modeller to add any additional rendering (look) details into the component.
How this is added will depend on the rendering itself, but for example in the JSF rendering this will be appended to
the 'inlineStyle' attribute (which itself uses css style notation) of the JSF components.
|
| Type | String |
15.4.23 Property 'height'
|
| Description | This is a hint for the render to indicate the height required for this object.
|
| Type | String |
Copyright (c) 2001-2008 New Technology/enterprise Ltd.
| |