Difference: DpHipeTools (103 vs. 104)

Revision 1042013-06-14 - JavierDiaz

Line: 1 to 1
 
META TOPICPARENT name="WritingTasks"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 222 to 222
 If no specific modifier fits your task parameter, the default modifier will be used. The default modifier only has a dot to drop variables. Others modifiers include an editor at the right of the dot to enter values. You can implement a custom Modifier and register it in the system to be used whenever a parameter of the registered type is used. You can also write your specific Modifier for any of the already registered types. In that case, you can create and assign your modifier (and listeners ....) to your parameter in Task.getCustomModifiers() see Registering a modifier.

Warning, important NOTE:

Deleted:
<
<
Warning, important NOTE:
 The following behaviours and limitations are present in the provided modifiers:
  • Not all modifiers are registered: for example if your parameter is of type String but will represent a file (path) the system will choose just a JStringModifier, so you will have to explicitly associate your parameter (name) to a JFilePathModifier- in Task.getCustomModifiers().
Changed:
<
<
* Also, if you want to tweak a (registered) modifier (using a specific constructor, for example) you will also have to use Task.getCustomModifiers()
>
>
  • Also, if you want to tweak a (registered) modifier (using a specific constructor, for example) or add listeners between them (to update one when another is updated, for example) you will also have to use Task.getCustomModifiers()
 
  • While you can always write SomeTask(param = null) on the command line, using a task dialog you will just get SomeTask(): modifiers use null to signify that they have no value and task GUI command generation interprets this as "not using this parameter".
  • Modifiers have no notion of the optionality of parameters (or default values): if they have a valid value, they will return it. Task command generation for GUIs will not generate a parameter assignment if the value equals the default. See Task Preferences to change this default behaviour.
  • Modifiers will mark as erroneous any variables incompatible with the type (dynamically) and validator, but will neither reject nor remove any variable dropped
Line: 344 to 342
 

Signature components

Deleted:
<
<
TODO: REVIEW
 
In case the default input area based on modifiers does not fit your needs, you can replace it by your own implementation, and register it so that the system opens the task dialog with your custom TaskSignatureComponent. The following sections show you how this is done.
Line: 353 to 350
 
You can create a TaskSignatureComponent by extending JTaskSignatureComponent in the ia.task.gui.dialog package, and providing your own implementation of the makeModifierMap() method.
Added:
>
>
Also if you want to also do your own layout you can extend ==AdbtractTaskSignatureComponent.
  The JTaskSignatureComponent class implements the TaskSignatureComponent interface, which consists of four explicit contracts:
  • Support the setVariableSelection for initial assignment from the Tool Window
Line: 364 to 362
 
  • Deriving from JComponent
  • If registered in the Extension Registry, providing an empty constructor
Added:
>
>
And, as a signature component acts as a container of modifiers, if you directly implement TaskSignatureComponent, you must also implement Disposable (to clean the modifiers when your task GUI is closed):
  • implement dispose() calling dispose on all your Modifiers that implement Disposable.
 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.

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:

Line: 456 to 457
 and the two implicit contracts inherited by the Extension Registry
  • Be JComponent
  • Have an empty constructor
Added:
>
>
And, as a Task Panel acts as a container of modifiers (via a TaskSignatureComponent), if you directly implement , you must also implement Disposable (to clean up the signature when your task GUI is closed and to clean the viewer you are shown in):
    @Override
    public void dispose() {
        if (_component instanceof Disposable) { //_ component is a TaskSignatureComponent
            ((Disposable) _component).dispose();
        }
    }
 
 
This site is powered by the TWiki collaboration platform Powered by Perl