Difference: DpHipeTools (68 vs. 69)

Revision 692011-05-31 - JaimeSaiz

Line: 1 to 1
 
META TOPICPARENT name="WritingTasks"

Adding Tools to HIPE

Line: 238 to 238
  Conventions for labels for input parameters: to construct the labels of your parameters you can use the static function of class JTaskSignatureComponent
 public static JLabel getDecoratedLabel(TaskParameter tp, boolean isPrimeInput, String altName) 
it provides a decorated label (including tooltip) that follows the standard style. For the function to work properly your task parameters should be fully configured (for example, the parameter description will be the tooltip of the label) if present.
Changed:
<
<
For example, if you want to use a custom Signature Component that just wants to use ia.gui.apps.modifier.JFilePathModifier for a parameter aimed for a file name, you could do it like this:
>
>
For example, if you want to use a custom Signature Component that just wants to use JFilePathModifier for a parameter aimed for a file name, you could do it like this:
 
public class MySignatureComponent extends JTaskSignatureComponent {

Line: 298 to 298
 
  • Assign the Task to display ( the setTask)
  • Notify request of executions to the framework by
    • Allow for setting the Site Event handler for notifying request of execution (the setSiteEventHandler method)
Changed:
<
<
    • Notify the execution requests calling the trigger method of ia.gui.kernel.SiteEventHandler passing a ia.gui.kernel.event.CommandExecutionRequestEvent.
      You can create this event through the ia.task.gui.dialog.TaskCommandExecutionEventFactory.
>
>
    • Notify the execution requests calling the trigger method of herschel.ia.gui.kernel.SiteEventHandler passing a herschel.ia.gui.kernel.event.CommandExecutionRequestEvent.
      You can create this event through the herschel.ia.task.gui.dialog.TaskCommandExecutionEventFactory.
 
  • Return the javax.swing.Actions for running the task and resetting (clear) the signature (the actions that are invoked when pressing "Accept" and "Clear" buttons, if present), to allow to execute them from the toolbar of HIPE. The simplest implementation would be to create and assign those actions to your buttons in your setTask(TaskApi) method and then to return them from the buttons when asked:
    public Action getRunAction() {

Line: 342 to 342
 If you have an existing task and want to make it available in HIPE, you just need to follow the steps described in the above section.

Now, a task has its limitations. It is somewhat an atomic operation for which you provide some inputs and expect some result.

Changed:
<
<
Therefore, it is not expected for acting interactively with a user, and it is not meant for holding internal status either, that a user can modify during its execution.
>
>
Therefore, it is not expected for acting interactively with a user, and it is not meant for holding internal state either, that a user can modify during its execution.
  If you need more flexibility, you can write your own implementation of the Tool interface.
Besides, you would most probably need a viewer associated to your tool, for letting the user interact with it.
Line: 370 to 370
  List<? extends Parameter> inputs, Category... categories)
Changed:
<
<
You provide the variable types you are interested in within the prime input: just return a ia.gui.kernel.ToolParameter initiated with the proper class of data you want to handle:
>
>
You provide the variable types you are interested in within the prime input: just return a herschel.ia.gui.kernel.ToolParameter initiated with the proper class of data you want to handle:
 
new ToolParameter("data", MyTargetDataType.class)

Line: 380 to 380
 More conditions for checking whether the tool can react on a particular variable can be added by providing a ParameterValidator to the prime input.

The actual job to be done can be delegated to a third object (the "tool object"), or just be executed by the tool class itself.

Changed:
<
<
This latter case is the default, otherwise, you need to call setToolObject(Object toolObject) in your constructor.
>
>
This latter case is the default; otherwise, you need to call setToolObject(Object toolObject) in your constructor.
  Moreover, you may return the categories you think the tool is meaningful for, by providing the proper ones in the super call.
Line: 395 to 395
 

Tool Viewer

Changed:
<
<
Every tool has an associated viewer, which must implement ia.gui.kernel.parts.EditorComponent (by extending ia.gui.kernel.parts.AbstractEditorComponent or one of its subclasses).
>
>
Every tool has an associated viewer, which must implement EditorComponent (by extending AbstractEditorComponent or one of its subclasses).
 

Tool Registry

Once you have your tool and the corresponding viewer, you need to register them like this:
 
This site is powered by the TWiki collaboration platform Powered by Perl