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/Code"
Dev.jmini.fr (Talk | contribs) (New page: {{ScoutPage|cat=Concepts}} <TODO: 1 phrase describing the concept> * implements: {{ScoutJavadoc|<TODO:NameOfTheInterface>|I}} * extends: {{ScoutJavadoc|<TODO:NameOfTheAbstractClass>|C}} ...) |
Dev.jmini.fr (Talk | contribs) (First version) |
||
Line 1: | Line 1: | ||
{{ScoutPage|cat=Concepts}} | {{ScoutPage|cat=Concepts}} | ||
− | + | A code is an element of a {{ScoutLink|Concepts|CodeType|CodeType}}. It group together some properties. | |
− | * implements: {{ScoutJavadoc|< | + | * implements: {{ScoutJavadoc|ICode<T>|I}} |
− | * extends: {{ScoutJavadoc|< | + | * extends: {{ScoutJavadoc|AbstractCode<T>|C}} |
== Description == | == Description == | ||
− | |||
+ | Needs to override the <code>getId()</code> | ||
− | + | For each code following properties can be set: | |
− | + | ||
− | + | Texts: | |
− | + | * {{ScoutProp|Text}} using {{ScoutLink|Concepts|Texts|Texts}} | |
+ | * {{ScoutProp|TooltipText}} using {{ScoutLink|Concepts|Texts|Texts}} | ||
− | |||
+ | State of the code: | ||
+ | * {{ScoutProp|Active}} | ||
+ | * {{ScoutProp|Enabled}} | ||
+ | {{note|TODO|Difference Active/Enabled}} | ||
− | |||
− | |||
− | {{ | + | Styling: |
+ | * {{ScoutProp|IconId}} using {{ScoutLink|Concepts|Icons|Icons}} | ||
+ | * {{ScoutProp|Font}} | ||
+ | * {{ScoutProp|Foreground Color}} | ||
+ | * {{ScoutProp|Background Color}} | ||
+ | |||
+ | Other properties: | ||
+ | * {{ScoutProp|ExtKey}} | ||
+ | * {{ScoutProp|Value}} | ||
+ | |||
+ | ==Example - Good Practice== | ||
+ | A good practice is to define an ID as static member like in this example: | ||
+ | <source lang="java"> | ||
+ | @Order(10.0) | ||
+ | public class RedCode extends AbstractCode<String>{ | ||
+ | private static final long serialVersionUID=1L; | ||
+ | private final String ID = "FF0000"; | ||
+ | |||
+ | @Override | ||
+ | public String getId() { | ||
+ | return ID; | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | public String getConfiguredText() { | ||
+ | return Texts.get("Red"); | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredIconId(){ | ||
+ | return Icons.RedIcon; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </source> | ||
+ | |||
+ | It is recommanded to use this member if you want to compare the ID of an <code>ICode</code>. | ||
+ | <source lang="java"> | ||
+ | private void displayValue(ICode c) { | ||
+ | if(CompareUtility.equals(c.getId(), ColorCodeType.RedCode.ID)) { | ||
+ | // the code c is RedCode | ||
+ | // add some business logic here ... | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
== See Also == | == See Also == | ||
* {{ScoutLink|Concepts|CodeType|CodeType}} | * {{ScoutLink|Concepts|CodeType|CodeType}} | ||
* {{ScoutLink|Concepts|Shared Plug-In|Shared Plug-In}} | * {{ScoutLink|Concepts|Shared Plug-In|Shared Plug-In}} |
Revision as of 16:12, 9 November 2010
The Scout documentation has been moved to https://eclipsescout.github.io/.
A code is an element of a The Scout documentation has been moved to https://eclipsescout.github.io/.. It group together some properties.
- implements: The Scout documentation has been moved to https://eclipsescout.github.io/.
- extends: The Scout documentation has been moved to https://eclipsescout.github.io/.
Description
Needs to override the getId()
For each code following properties can be set:
Texts:
- The Scout documentation has been moved to https://eclipsescout.github.io/. using The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/. using The Scout documentation has been moved to https://eclipsescout.github.io/.
State of the code:
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.
Styling:
- The Scout documentation has been moved to https://eclipsescout.github.io/. using 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/.
Other properties:
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.
Example - Good Practice
A good practice is to define an ID as static member like in this example:
@Order(10.0) public class RedCode extends AbstractCode<String>{ private static final long serialVersionUID=1L; private final String ID = "FF0000"; @Override public String getId() { return ID; } @Override public String getConfiguredText() { return Texts.get("Red"); } @Override protected String getConfiguredIconId(){ return Icons.RedIcon; } }
It is recommanded to use this member if you want to compare the ID of an ICode
.
private void displayValue(ICode c) { if(CompareUtility.equals(c.getId(), ColorCodeType.RedCode.ID)) { // the code c is RedCode // add some business logic here ... } }
See Also
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.