Difference: DpHipeTools (54 vs. 55)

Revision 552010-06-17 - JavierDiaz

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

Adding Tools to HIPE

Line: 213 to 213
  }
Deleted:
<
<
Warning, important NOTE:
Using TaskParameter.setModifier() for customizing modifiers is deprecated.
This mechanism is unsafe, even dangerous, because it implies executing GUI code at task creation, which is done in a non-GUI thread.
In consequence, this method is planned to be removed.
 
Line: 242 to 238
 
  • 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)
Changed:
<
<
  • Clear and check user inputs (used by the default buttons)
>
>
  • Clear and check user inputs implementations (used by the default buttons)
 and the two implicit contracts inherited by the Extension Registry
  • Be JComponent
  • Have an empty constructor
Added:
>
>
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.
 An easy way of implementing TaskSignatureComponent is by extending ia.task.gui.dialog.JTaskSignatureComponent and providing your own implementation for the makeModifierMap() method.

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:

Line: 273 to 271
  Warning, important NOTE:
You no longer need a signature component to choose your own modifiers for your task (and link them with events ...): Task has a new function
public Map<String, Modifier> getCustomModifiers()
where you can do just that, see above "Register a Modifier".
Deleted:
<
<
Conventions for labels for input parameters: (see DM). The static function
 public static JLabel getDecoratedLabel(TaskParameter tp, boolean isPrimeInput, String altName) 
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)
 
Deleted:
<
<
If some other function needs to be made public so that tasks can follow the default style, they will be added above.
 

Register a Task Signature Component
Line: 315 to 309
 
  • Notify request of executions to the framework by
    • Allow for setting the Site Event handler for notifying request of execution (the setSiteEventHandler method)
    • 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.
Added:
>
>
  • 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() {
        return runbutton.getAction();
    }

    public Action getResetAction() {
        return resetButton.getAction();
    }
 and the two implicit contracts inherited by the Extension Registry
  • Be JComponent
  • Have an empty constructor
Deleted:
<
<
Warning, important NOTE: A Task panel will need in the future to provide the actions that invoke "Accept" and "Clear", so that they can be invoked from some other part of the interface (or somebody may remove the Buttons from his panel). Currently we try to invoke the actions via the Toolbar.
  The Rotate Panel example (herschel.ia.task.example.RotatePanel):
rotate_panel.jpg
Line: 348 to 350
 

Task compliance

  • Write user documentation (jtags)! That will be automatically picked up whenever a user asks the system for help on your task.
Changed:
<
<
  • The name of the task should be a legal variable name in the global name-space. For example your instance of MyTask should report itself as e.g.: "myTask" and not "This is my task".
>
>
  • The name of the task should be a legal variable name in the global name-space. For example your instance of DoXTask should report itself as e.g.: "doX" and not as "This is my task" or "DoXTask".
 
  • If your prime parameter is not the first parameter in your task, specify the prime parameter using the setPrimeInput method in the signature
Added:
>
>
  • Your main output parameter will be the first (input)output parameter in your task, this will be the parameter value that is returned automatically upon execution of your task (ret value comes from first output in ret = t(x,y,z)).
 
  • Write a parameter validator for your prime parameter if your task should be listed not only on prime data type but on prime data contents as well.

Recommendations for simple tasks and limitations

 
This site is powered by the TWiki collaboration platform Powered by Perl