Difference: DpHipeTools (53 vs. 54)

Revision 542010-06-10 - DavideRizzo

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

Adding Tools to HIPE

Line: 7 to 7
 

Task, tools and variables

Line: 17 to 19
 
<-- summary -->
Tools are processing units that operate on specific data elements.
From the Java point of view, a tool is an implementation of the Tool interface.
Changed:
<
<
The well-known Tasks are examples of tools within HIPE. In this case, TaskTool is used under the hoods.
>
>
The well-known Tasks are examples of tools within HIPE. In this case, TaskTool is used under the hood.
  If a data element is selected, a list of tools that can operate on that data should appear. Double clicking on the tool will open an associated view (for non-task tools) or a dialog for settings parameters (for task tools).
Line: 25 to 27
  This section explains:
  • how you can create a Tool and register it for being available for dedicated data
Changed:
<
<
  • how you can make HIPE aware of an existing Task,
>
>
  • how you can make HIPE aware of an existing Task,
 
  • how your task can react better on an active data element,
  • the default task dialog and how you implement and contribute a dedicated input dialog for your task,
  • how you can implement and contribute a specific parameter editor
Line: 77 to 79
  }
Changed:
<
<
Naming conventions for task when to be registered in Hipe should follow this example assuming that the task will perform the functionality named "reduce" :
>
>
Naming conventions for task when to be registered in HIPE should follow this example assuming that the task will perform the functionality named "reduce" :
 
     Name of the Class              : ReduceTask
     Name of the Task (getName())   : reduce

Line: 91 to 93
 
The mechanism above makes you task to become a tool within the system and it appears whenever a variable of type SpecificProduct (i.e. the type of the value of the Parameter) is selected.
Changed:
<
<
Sometimes this may not be enough, e.g. in certain situations your task will only run on a SpecificProduct if it contains certain contents. A typical situation would be when a SPIRE reduction operates on a ObservationContext: such a task should not be listed whenever a HIFI observation is selected...
>
>
Sometimes this may not be enough, e.g. in certain situations your task will only run on a SpecificProduct if it contains certain contents. A typical situation would be when a SPIRE reduction operates on an ObservationContext: such a task should not be listed whenever a HIFI observation is selected...
  You can write a ParameterValidator to do just that:

Line: 108 to 110
  In other words, rather than writing this logic within the pre-amble or execution block of your task, we recommend you to move that logic into the parameter validation. This way we achieve two things:
  • make the logic appear where it should be and therefore keeping the execution block of your task concentrated to the algorithm, and
Changed:
<
<
  • make your task appear as a tool within HIPE that can be ran against specific data.
>
>
  • make your task appear as a tool within HIPE that can be ran against specific data.
 

Task Dialogs

Line: 130 to 132
 Warning, important A new default dialog layout has been implemented following the request of the DPUG: It puts two parameters per line: lines are filled left to right, and then top to bottom. If you only have 1 input (or output) it will fill the whole line. Modifiers implementors should take care that the preferred size of their modifier is smaller (about 20 chars max).
Changed:
<
<
Provided modifiers have been updated but some modifiers are too wide for this layout (ex. AngleModifier, can have 3 texts and 1 combo in a line, see rotate later).
>
>
Provided modifiers have been updated but some modifiers are too wide for this layout (for instance, AngleModifier can have three texts and one combo in a line, see rotate later).
 The default dialog for the crop task, with all sections opened:
crop_new.png
Line: 144 to 145
 

Parameter Modifiers

Changed:
<
<
The system provides a default dialog displaying an input area for setting the values of the parameter based on a composition of Modifiers.
>
>
The system provides a default dialog displaying an input area for setting the values of the parameter based on a composition of Modifier objects.
  The input area for the crop task:
crop_input_new.png
Changed:
<
<
The composition of Modifiers is created based on the types of the values of the Task Parameters of the Task Signature.
>
>
The composition of Modifier objects is created based on the types of the values of the Task Parameters of the Task Signature.
  The Modifier for the row1 Parameter of the crop task:
crop_modifier_new.png
Line: 172 to 173
 
Implement a Modifier
Changed:
<
<
The Modifier interface consists of two explicit contracts:
>
>
The ia.gui.apps.Modifier interface consists of two explicit contracts:
 
  • Support the drag and drop features (the set/getVariableSelection)
  • Support the inspection for Object (the set/getObject)
and two implicit contracts:
Line: 237 to 238
 
Implement a Task Signature Component

Changed:
<
<
The TaskSignatureComponent interface consists of four explicit contracts
>
>
The ia.task.gui.dialog.TaskSignatureComponent interface consists of four explicit contracts:
 
  • Support the setVariableSelection for initial assignment from the Tool Window
  • Assign the Signature to display (setSignature)
  • Return a map of parameters and assigned values (in Map<TaskParameter, VariableSelection> getParameters)
Line: 246 to 247
 
  • Be JComponent
  • Have an empty constructor
Changed:
<
<
An easy way of implementing TaskSignatureComponent is by extending JTaskSignatureComponent and providing your own implementation for the makeModifierMap() method.
>
>
An easy way of implementing TaskSignatureComponent is by extending ia.task.gui.dialog.JTaskSignatureComponent and providing your own implementation for the makeModifierMap() method.
 
Changed:
<
<
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:
>
>
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:
 
public class MySignatureComponent extends JTaskSignatureComponent {

Line: 311 to 309
 
Implement a Task Panel

Changed:
<
<
The TaskPanel interface consists of three explicit contracts
>
>
The ia.task.gui.dialog.TaskPanel interface consists of three explicit contracts:
 
  • Support the setVariableSelection for initial assignment from the Tool Window
  • 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.
 and the two implicit contracts inherited by the Extension Registry
  • Be JComponent
  • Have an empty constructor
Line: 397 to 395
  List<? extends Parameter> inputs, Category... categories)
Changed:
<
<
You provide the variable types you are interested in within the prime input: just return a 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 ia.gui.kernel.ToolParameter initiated with the proper class of data you want to handle:
 
new ToolParameter("data", MyTargetDataType.class)

Line: 422 to 420
 

Tool Viewer

Changed:
<
<
Every tool has an associated viewer, which must implement EditorComponent (by extending AbstractEditorComponent or one of its subclasses).
>
>
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).
 

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