Skip to main content
Jump to: navigation, search

Scout/Concepts/ToolButton

< Scout‎ | Concepts(Redirected from Scout/Concepts/Tool)


Scout
Wiki Home
Website
DownloadGit
Community
ForumsBlogTwitterG+
Bugzilla
Bugzilla


Special type of Action that is usually rendered as an element in a tool bar.

  • implements: I obj.pngIToolButton
  • extends: C obj.pngAbstractToolButton

Tool Button in the Desktop

Defined as inner class of the scout Desktop, Tool Buttons are used to proposed actions in a tool bar of the main windows of an 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: I obj.pngIFormToolButton<T>
  • extends: C obj.pngAbstractFormToolButton<T>

The generic parameter <T> needs to extend Form.


Screenshot

On the screenshot, you see the ToolButtons (in green) and the FormToolButtons (in red).

Swing Nimbus look and feel:

Scout ToolButtons Nimbus.png


Same example with the Swing Rayo look and feel:

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:

ScoutSdk New Tool item.png

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 ToobarLocation on Form.


Screenshot

The toolbuttons can be rendered on the form header (default):

Scout Form Toolbar FormHeader.png

Or as view part buttons (Swt only):

Scout Form Toolbar ViewPart.png


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 getConfiguredXxxxxx() methods.

Note.png
TODO
Add a description of important properties. The idea is not to recreate the JavaDoc of the getConfiguredXxxxxx() methods but to provide explanations, best practice, example... Group the properties by domain.


Events

Defined with execXxxxxx() methods.

Note.png
TODO
Add a description of important events. The idea is not to recreate the JavaDoc of the execXxxxxx() methods but to provide explanations, best practice, example... Group the events by domain.


See Also

Back to the top