TWiki
>
WebXEO Web
>
XeoPrimer
>
XeoPrimerJavaAPI
>
XeoPrimerJavaAPIBridgeHandler
(revision 5) (raw view)
Edit
Attach
Tags:
tag this topic
create new tag
,
view all tags
-- Main.PedroRio - 30 Dec 2010 ---+ BridgeHandler - Handler for a collection attribute The <em>bridgeHandler </em>class is a handler for collection attributes. It allows to iterate through the collection, add new elements to the collection, remove elements and re-order the elements inside the collection ( __elements in XEO's collections are ordered__). Bellow is the list of methods that allow interaction with a collection attribute ---+++ Definition Methods in these category allow to query the Object Model definition for the given collection attribute | *Method name* | *Description* | *Parameters* | *Return type* | *Notes* | | getName | Retrieves the name of the collection attribute (as declared in the Object Model) | - | String | | | getDefAttribute | Retrieves the handler for the Object Model definition of the collection attribute | - | boDefAttribute | | ___ ---+++ Iteration Iteration methods allow to iterate through elements of the collection as well as interacting with the content of the collection. As explained before, the collection attribute contains an ordered list of elements and can be iterated from the first to the last element (collection attributes are not paged, like _boObjectList_ instances). | *Method name* | *Description* | *Parameters* | *Return type* | *Notes* | | beforeFirst | Resets the iterator to the beginning of the collection (before the first position of the collection, so that a call to next() will return the first element) | - | void | Issuing a beforeFirst() command on the iterator allows to issue a next() command afterwards and retrieve the first element | | first | Positions the iterator in the first position of the collection | - | void | | | last | Positions the iterator in the last position of the collection | - | void | | | next | Advances the iterator to the next position of the collection | - | boolean | If no more elements are available in the iterator this method returns false | | getObject | Retrieves the <em>boObject </em>instance in the current position of the iterator | - | boObject | Throws runtime exception1 | | isEmpty | Checks whether the collection is empty or not | - | boolean | | | truncate | Removes all elements from the collection (final size is zero) | - | void | | | moveTo | Moves the iterator the desired position (passed as parameter) | int line | boolean | Returns whether or not the iterator was moved to the desired position | | moveRowTo | Moves the current element to a specified position | int position | void | This method will trigger the [[XeoPrimerConcepts#attEvents][onBeforeChangeOrder and onAfterChangeOrder]] events in any collection attribute that defines them. | | addNewObject | Creates a new boObject instance adds it to the bridge and returns a reference to it. | String objectName | boObject | | | getEboContext | Retrieves an EboContext instance | - | EboContext | | | getParent | Retrieves the boObject instance which own the collection attribute | - | boObject | | <strong> ___ </strong> ---+++ Behavior Collection attributes, like non-collection attributes, have associated behavior which can be invoked/queried through the API. The following methods are available: | *Method name* | *Description* | *Parameters* | *Return type* | *Notes* | | required | Whether the attribute is required or not (executes user code if it's defined) | - | boolean | | | disableWhen | Whether the attribute is disabled or not (executes user code if it's defined) | - | boolean | | | | | | | | valid()- __Não funciona__ hiddenWhen() - __Não funciona__ defaultValue() - __Não funciona__ formula() - __Não funciona__ <strong> ___ </strong> ---+++ Sample Code : Iterating through a collection attribute and updating the objects ___ <verbatim> boObject obj = ... //loadObject; //Retrieve the bridge bridgeHandler collectionHandler = obj.getBridge("collectionAttributeName"); //Reset the handler collectionHandler.beforeFirst(); //Iterate through all elements while (collectionHandler.next()){ try { //Retrieve the current object boObject current = collectionHandler.getObject(); //Change a value and update current.getAttribute("foo").setValueString("bar"); current.update(); } catch (boRuntimeException e) { //Deal with the exception } }</verbatim> ___
Edit
|
Attach
|
P
rint version
|
H
istory
:
r8
<
r7
<
r6
<
r5
<
r4
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r5 - 2011-03-14
-
PedroRio
WebXEO
XEO Primer
-
Instalation
-
Introduction
-
Concepts
-
Architecture
-
XEO Library
-
Deploy to EAR
-
PreferenceStore
XEO - Core
-
XEO Model Reference
-
Security
-
Java API
-
BOL
-
XEOQL (BOQL)
-
Administrating
-
Background Tasks
-
boConfig.xml
-
Web.xml
-
Known Issues
-
XEO Flags
XEO - XWC
- Web Components
- Java Samples
- Custom Components
- Component Plugins
- Internationalization
- Viewer Events
- Value Change Listeners
- XUIServlet
- XeoLocalization
- XvwTemplates
Create New Topic
WebXEO Web
No permission to view
TWiki.WebTopBar
No permission to view
TWiki.WebBottomBar