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/ToolButton"
Dev.jmini.fr (Talk | contribs) m (Scout/Concepts/Tool moved to Scout/Concepts/ToolButton: Match the Java Name) |
(Luna update (Tool button in forms)) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ScoutPage|cat= | + | {{ScoutPage|cat=Component Model}} |
− | + | Special type of {{ScoutLink|Concepts|Action|Action}} that is usually rendered as an element in a tool bar. | |
− | * implements: {{ScoutJavadoc| | + | * implements: {{ScoutJavadoc|IToolButton|I}} |
− | * extends: {{ScoutJavadoc| | + | * extends: {{ScoutJavadoc|AbstractToolButton|C}} |
− | == | + | == Tool Button in the Desktop == |
− | {{ | + | Defined as inner class of the {{ScoutLink|Concepts|Desktop|scout Desktop}}, Tool Buttons are used to proposed actions in a tool bar of the main windows of an {{ScoutLink|Concepts|Outline based application}}. |
+ | ==== FormToolButton ==== | ||
+ | The form tools buttons are used to open form. Usually these forms are displayed on the right part of the main windows. They can contain some fields to perform searches, or quick access to global functions (bookmarks, task list, action list...) | ||
− | + | * implements: {{ScoutJavadoc|IFormToolButton<T>|I}} | |
− | {{ | + | * extends: {{ScoutJavadoc|AbstractFormToolButton<T>|C}} |
+ | The generic parameter <T> needs to extend {{ScoutLink|Concepts|Form}}. | ||
+ | |||
+ | |||
+ | === Screenshot === | ||
+ | On the screenshot, you see the ToolButtons (in green) and the FormToolButtons (in red). | ||
+ | |||
+ | Swing Nimbus look and feel: | ||
+ | |||
+ | [[Image:Scout ToolButtons Nimbus.png]] | ||
+ | |||
+ | |||
+ | Same example with the {{ScoutLink|Concepts|Rayo|Swing Rayo}} look and feel: | ||
+ | |||
+ | [[Image:Scout ToolButtons Rayo.png]] | ||
+ | |||
+ | For the moment the normal ToolButtons are not rendered with the Rayo look and feel. | ||
+ | |||
+ | |||
+ | === SDK Support === | ||
+ | The Scout SDK provides support for these buttons: A folder is located under the Desktop node: | ||
+ | |||
+ | [[Image:ScoutSdk New Tool item.png]] | ||
+ | |||
+ | === Example === | ||
+ | ToolButton: | ||
+ | <source lang="java"> | ||
+ | @Order(10.0) | ||
+ | public class DrawLineTool extends AbstractToolButton { | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredIconId() { | ||
+ | return Icons.DrawLine; | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredText() { | ||
+ | return TEXTS.get("DrawLine"); | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredTooltipText() { | ||
+ | return TEXTS.get("DrawLineTooltip"); | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected void execAction() throws ProcessingException { | ||
+ | MessageBox.showOkMessage(TEXTS.get("DrawLineTitle"), TEXTS.get("DrawLineInfo"), null); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | FormToolButton: | ||
+ | <source lang="java"> | ||
+ | @Order(40.0) | ||
+ | public class GroupFormTool extends AbstractFormToolButton<GroupForm> { | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredIconId() { | ||
+ | return Icons.Group; | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredText() { | ||
+ | return TEXTS.get("Group"); | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected void execAction() throws ProcessingException { | ||
+ | GroupForm form = new GroupForm(); | ||
+ | decorateForm(form); | ||
+ | form.startDisplay(); | ||
+ | setForm(form); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | == Tool Button in the Forms == | ||
+ | Since the Luna version, it is possible to define Tool Buttons in forms (as inner class of form). | ||
+ | |||
+ | The position of the toolbar is controlled with the property {{ScoutProp|ToobarLocation}} on {{ScoutLink|Concepts|Form}}. | ||
+ | |||
+ | |||
+ | === Screenshot === | ||
+ | The toolbuttons can be rendered on the form header (default): | ||
+ | |||
+ | [[File:Scout_Form_Toolbar_FormHeader.png]] | ||
+ | |||
+ | Or as view part buttons (Swt only): | ||
+ | |||
+ | [[File:Scout_Form_Toolbar_ViewPart.png]] | ||
+ | |||
+ | |||
+ | === Example === | ||
+ | <source lang="java"> | ||
+ | @FormData(value = MyFormData.class, sdkCommand = FormData.SdkCommand.CREATE) | ||
+ | public class MyForm extends AbstractForm { | ||
+ | |||
+ | //... other form content ... | ||
+ | |||
+ | @Order(10.0) | ||
+ | public class BookmarkToolButton extends AbstractToolButton { | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredIconId() { | ||
+ | return Icons.Bookmark; | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected String getConfiguredTooltipText() { | ||
+ | return TEXTS.get("AddToBookmark"); | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | protected void execAction() throws ProcessingException { | ||
+ | //mark bookmark action | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
== Properties == | == Properties == | ||
Line 28: | Line 149: | ||
== See Also == | == See Also == | ||
* {{ScoutLink|Concepts|Client Plug-In|Client Plug-In}} | * {{ScoutLink|Concepts|Client Plug-In|Client Plug-In}} | ||
+ | * {{ScoutLink|Concepts|ViewButton}} |
Revision as of 06:50, 23 July 2014
The Scout documentation has been moved to https://eclipsescout.github.io/.
Special type of The Scout documentation has been moved to https://eclipsescout.github.io/. that is usually rendered as an element in a tool bar.
- implements: The Scout documentation has been moved to https://eclipsescout.github.io/.
- extends: The Scout documentation has been moved to https://eclipsescout.github.io/.
Contents
Tool Button in the Desktop
Defined as inner class of the The Scout documentation has been moved to https://eclipsescout.github.io/., Tool Buttons are used to proposed actions in a tool bar of the main windows of an The Scout documentation has been moved to https://eclipsescout.github.io/..
FormToolButton
The form tools buttons are used to open form. Usually these forms are displayed on the right part of the main windows. They can contain some fields to perform searches, or quick access to global functions (bookmarks, task list, action list...)
- implements: The Scout documentation has been moved to https://eclipsescout.github.io/.
- extends: The Scout documentation has been moved to https://eclipsescout.github.io/.
The generic parameter <T> needs to extend The Scout documentation has been moved to https://eclipsescout.github.io/..
Screenshot
On the screenshot, you see the ToolButtons (in green) and the FormToolButtons (in red).
Swing Nimbus look and feel:
Same example with the The Scout documentation has been moved to https://eclipsescout.github.io/. look and feel:
For the moment the normal ToolButtons are not rendered with the Rayo look and feel.
SDK Support
The Scout SDK provides support for these buttons: A folder is located under the Desktop node:
Example
ToolButton:
@Order(10.0) public class DrawLineTool extends AbstractToolButton { @Override protected String getConfiguredIconId() { return Icons.DrawLine; } @Override protected String getConfiguredText() { return TEXTS.get("DrawLine"); } @Override protected String getConfiguredTooltipText() { return TEXTS.get("DrawLineTooltip"); } @Override protected void execAction() throws ProcessingException { MessageBox.showOkMessage(TEXTS.get("DrawLineTitle"), TEXTS.get("DrawLineInfo"), null); } }
FormToolButton:
@Order(40.0) public class GroupFormTool extends AbstractFormToolButton<GroupForm> { @Override protected String getConfiguredIconId() { return Icons.Group; } @Override protected String getConfiguredText() { return TEXTS.get("Group"); } @Override protected void execAction() throws ProcessingException { GroupForm form = new GroupForm(); decorateForm(form); form.startDisplay(); setForm(form); } }
Tool Button in the Forms
Since the Luna version, it is possible to define Tool Buttons in forms (as inner class of form).
The position of the toolbar is controlled with the property The Scout documentation has been moved to https://eclipsescout.github.io/. on The Scout documentation has been moved to https://eclipsescout.github.io/..
Screenshot
The toolbuttons can be rendered on the form header (default):
Or as view part buttons (Swt only):
Example
@FormData(value = MyFormData.class, sdkCommand = FormData.SdkCommand.CREATE) public class MyForm extends AbstractForm { //... other form content ... @Order(10.0) public class BookmarkToolButton extends AbstractToolButton { @Override protected String getConfiguredIconId() { return Icons.Bookmark; } @Override protected String getConfiguredTooltipText() { return TEXTS.get("AddToBookmark"); } @Override protected void execAction() throws ProcessingException { //mark bookmark action } } }
Properties
Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.
Events
Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.
See Also
- The Scout documentation has been moved to https://eclipsescout.github.io/.
- The Scout documentation has been moved to https://eclipsescout.github.io/.