Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Scout/Concepts/LookupCall"
Dev.jmini.fr (Talk | contribs) |
Dev.jmini.fr (Talk | contribs) |
||
Line 7: | Line 7: | ||
== Description == | == Description == | ||
− | LookupCalls can be used in smart fields, tree boxes and other Scout widgets. They compute the Smart association: to a key a {{ScoutLink|Concepts|LookupRow|lookup row}} is associated. This | + | LookupCalls can be used in smart fields, tree boxes and other Scout widgets. They compute the Smart association: to a key a {{ScoutLink|Concepts|LookupRow|lookup row}}is associated. This enable to provide more than a text to the key (The lookupRow also contains an Icon, Colors, a TooltipText...) |
− | This | + | This schema explains the role of a LookupCall in a SmartField: |
[[Image:Schema LookupCall.png]] | [[Image:Schema LookupCall.png]] | ||
Line 21: | Line 21: | ||
* <code>getDataByRec()</code>: This can only be used for hierarchical lookup calls. It retrieves all available sub-tree lookup rows for a given parent. | * <code>getDataByRec()</code>: This can only be used for hierarchical lookup calls. It retrieves all available sub-tree lookup rows for a given parent. | ||
− | + | {{note|TODO|parameters are present to compute the set of rows: Object key, ... Master}} | |
+ | == Type of lookup calls == | ||
===With a Lookup Service=== | ===With a Lookup Service=== | ||
Delegation to the {{ScoutLink|Concepts|Lookup Service|Lookup Service}} on server side. | Delegation to the {{ScoutLink|Concepts|Lookup Service|Lookup Service}} on server side. | ||
Line 43: | Line 44: | ||
* {{ScoutProp|MasterRequired}}: Defines whether a master value must be set in order to query for multiple lookup rows | * {{ScoutProp|MasterRequired}}: Defines whether a master value must be set in order to query for multiple lookup rows | ||
− | == Code == | + | == Code example == |
− | {{note|TODO|Code example: | + | === Using a LookupCall in a SmartField === |
+ | {{note|TODO|Code example: getConfigured method and mention of execPrepareLookup(call)}} | ||
+ | |||
+ | === Accessing a LookupRow directly === | ||
+ | It is possible to access a LookupRow direclty. In this example the input is a key (<code>thisKey</code>) and the method <code>getDataByKey()</code> is used. | ||
+ | Before accessing the text, we ensure that a LookupRow has been retrived. | ||
+ | |||
+ | <source lang="java"> | ||
+ | //Execute the LookupCall (using DataByKey) | ||
+ | LookupCall call = new MyLookupCall(); | ||
+ | call.setKey(thisKey); | ||
+ | LookupRow[] rows=call.getDataByKey(); | ||
+ | |||
+ | //Get the text (with a null check) | ||
+ | String text = null; | ||
+ | if(rows != null && rows.length > 0) { | ||
+ | text = rows[0].getText(); | ||
+ | } | ||
+ | </source> | ||
== See Also == | == See Also == | ||
* {{ScoutLink|Concepts|LookupRow|Lookup Row}} | * {{ScoutLink|Concepts|LookupRow|Lookup Row}} | ||
* {{ScoutLink|Concepts|Lookup Service|Lookup Service}} | * {{ScoutLink|Concepts|Lookup Service|Lookup Service}} | ||
− | * {{ScoutLink|Concepts| | + | * {{ScoutLink|Concepts|LocalLookupCall|Local Lookup Calls}} |
* {{ScoutLink|Concepts|Shared Plug-In|Shared Plug-In}} | * {{ScoutLink|Concepts|Shared Plug-In|Shared Plug-In}} |
Revision as of 13:18, 30 December 2010
The Scout documentation has been moved to https://eclipsescout.github.io/.
Lookup calls are used by The Scout documentation has been moved to https://eclipsescout.github.io/. and The Scout documentation has been moved to https://eclipsescout.github.io/. to look up single or multiple The Scout documentation has been moved to https://eclipsescout.github.io/..
- Class: The Scout documentation has been moved to https://eclipsescout.github.io/.
Contents
Description
LookupCalls can be used in smart fields, tree boxes and other Scout widgets. They compute the Smart association: to a key a The Scout documentation has been moved to https://eclipsescout.github.io/.is associated. This enable to provide more than a text to the key (The lookupRow also contains an Icon, Colors, a TooltipText...)
This schema explains the role of a LookupCall in a SmartField:
Input
Lookup calls provide different method to compute the set of The Scout documentation has been moved to https://eclipsescout.github.io/. :
-
getDataByKey()
Retrieve a single lookup row for a specific key value. Used by SmartFields and SmatColumns to get the display text for a given value. -
getDataByText()
: Retrieve multiple lookup rows which match a certain String. Used by SmartFields when the user start to enter some text in the Field. -
getDataByAll()
: Retrieves all available lookup rows. Used by SmartFields when the user clic on the browse icon. -
getDataByRec()
: This can only be used for hierarchical lookup calls. It retrieves all available sub-tree lookup rows for a given parent.
Type of lookup calls
With a Lookup Service
Delegation to the The Scout documentation has been moved to https://eclipsescout.github.io/. on server side.
They are not necessarily restricted to a fix number of records. Instead they should be favoured if the set of records is rather large.
Directy
Principe of the The Scout documentation has been moved to https://eclipsescout.github.io/.
An example of this approach is when a SmartField or a SmartColumn is configured to be use with a The Scout documentation has been moved to https://eclipsescout.github.io/.. A The Scout documentation has been moved to https://eclipsescout.github.io/. is instantiated for the CodeType. It creates the LookupRows corresponding to the The Scout documentation has been moved to https://eclipsescout.github.io/. in the CodeType.
Overview
Properties
Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.
- The Scout documentation has been moved to https://eclipsescout.github.io/.: Defines which service is used to retrieve lookup rows
- The Scout documentation has been moved to https://eclipsescout.github.io/.: Defines whether a master value must be set in order to query for multiple lookup rows
Code example
Using a LookupCall in a SmartField
Accessing a LookupRow directly
It is possible to access a LookupRow direclty. In this example the input is a key (thisKey
) and the method getDataByKey()
is used.
Before accessing the text, we ensure that a LookupRow has been retrived.
//Execute the LookupCall (using DataByKey) LookupCall call = new MyLookupCall(); call.setKey(thisKey); LookupRow[] rows=call.getDataByKey(); //Get the text (with a null check) String text = null; if(rows != null && rows.length > 0) { text = rows[0].getText(); }
See Also
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.