Alan,

Sorry, I probably didn't state my problem clearly.

If I add the default value stuff in executeAsynch, then the users won't be able 
to see the default values right?
is there a way to add default values in configurePorts() where the ports are 
made?

Thanks
jane 
________________________________________
From: Alan R Williams [[email protected]]
Sent: Wednesday, October 20, 2010 10:07 AM
To: [email protected]
Subject: Re: [Taverna-hackers] Writings new Nodes in Taverna

On 20/10/2010 17:17, Jane Ren wrote:
> Hi Alan,

Hello,

> I meant how to set the default value when I write code for the input port?

The executeAsynch method for your activity is called with a
Map<String, T2Reference> which gives the values sent to the input ports
of the activity.  Assuming your activity has a map of defaultValues, you
need to do something like:

private Map<String, Object> defaultValues = new HashMap();

...

public void executeAsynch(final Map<String, T2Reference> data,
                           final AsynchronousCallback callback) {

   callback.requestRun(new Runnable() {
     public void run() {

       ...
      Map<String,Object> actualInputs =
        new HashMap<String,Object>(defaultValues);

      for (String key: data.keySet()) {
        Object value = referenceService.renderIdentifier(data.get(key) ...);
        actualInputs.put(key, value);
      }
      ....
     }
  }
}


I'd expect that the default values are part of the configuration, so the
configure method will need to populate the defaultValues map.

> Thanks
> jane

Alan

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
taverna-hackers mailing list
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/about/contact-us/
Developers Guide: http://www.taverna.org.uk/developers/

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
taverna-hackers mailing list
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/about/contact-us/
Developers Guide: http://www.taverna.org.uk/developers/

Reply via email to