[jboss-user] [jBPM] - Re: CustormWorkItemEditor + ObjectDataType("MyDomainClass"): Always getting String instead of MyDomainClass in WorkItem
sebb
do-not-reply at jboss.com
Tue Jan 31 06:30:17 EST 2012
sebb [https://community.jboss.org/people/sebb] created the discussion
"Re: CustormWorkItemEditor + ObjectDataType("MyDomainClass"): Always getting String instead of MyDomainClass in WorkItem"
To view the discussion, visit: https://community.jboss.org/message/649625#649625
--------------------------------------------------------------
Hi Demian,
I use my ServiceTask with my CustomWorkItemEditor to pass the parameters to the node (reduced to one parameter for this code example):
> public class MyDialog extends EditBeanDialog implements WorkEditor{
>
> Text myText;
>
> public MyDialog(Shell parentShell) {
> super (parentShell, "title");
> setBlockOnOpen(true);
> }
>
> protected Control createDialogArea(Composite parent) {
> Composite composite = (Composite) super.createDialogArea(parent);
> GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);
>
> Work work = (Work) getValue();
>
> Label label = new Label(composite, SWT.NONE);
> label.setText("labelOne:");
> GridDataFactory.fillDefaults().applyTo(label);
>
> myText = new Text(composite, SWT.NONE);
>
> //get current value from node
> MyDomainClass mdc = (MyDomainClass) work.getParameter("myParameter");
> if(mdc != null){
> Value value = mdc.getValue();
> myText.setText(value == null ? "" : value.toString());
> } else {
> myText.setText("");
> }
> GridDataFactory.fillDefaults().applyTo(myText);
> }
>
> protected Object updateValue(Object value) {
> Work work = new WorkImpl();
> work.setName(((Work) value).getName());
>
> MyDomainClass mdc = new MyDomainClass();
> mdc.setValue(myText.getText());
> work.setParameter("myParameter", mdc);
> work.setParameterDefinitions(((Work) value).getParameterDefinitions());
> return work;
> }
>
> public Work getWork() {
> return (Work) getValue();
> }
>
> public void setWork(Work work) {
> setValue(work);
> }
>
> public void setWorkDefinition(WorkDefinition workDefinition) {
> }
>
> public boolean show() {
> int result = open();
> return result == OK;
> }
>
WorkItemDefinition (reduced to one parameter for this code example):
> [
> [
> "name" : "MyServiceTask",
> "parameters" : [
> "myParameter" : new ObjectDataType("my.package.MyDomainClass"),
> ],
> "displayName" : "do fancy stuff",
> "customEditor" : "my.package.MyDialog"
> ],
>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/649625#649625]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120131/4d7036d8/attachment.html
More information about the jboss-user
mailing list