[kepler-users] remove parameter ???

turuncu at be.itu.edu.tr turuncu at be.itu.edu.tr
Tue Jan 20 13:27:30 PST 2009


Ok, i do that setting parameter container simply to null.

params[i].setContainer(null);

but in other method i failed. What is the actual value of _target? I try
to set _target as params[i]
like,

params[i].addChangeListener(this);

but i am getting type mismatch warning. I also search other source codes
to find the answer but i could not.

Thanks for your help,

--ufuk

> Try setting the container of the parameter to null.
> This usually does it.
> You may need to create a MoMLChangeRequest, especially
> if you want have the Undo facility handle the change or
> if the UI does not recognize the change.
>
> The way I sometimes track these down is to look at how
> the UI handles something similar.  In this case, the
> edit parameters dialog has the code.  The title
> of the window in Ptolemy is "Edit parameters for"
> and then the actor name.  The name of the window in Kepler
> might be different. . .  I then search the code base
> for the string "Edit parameters for", which leads me
> to ptII/ptolemy/actor/gui/EditParametersDialog.java
>
> Searching EditParametersDialog.java for "Remove" finds
> a code block that queues up a change request:
>
>              // If the OK button was pressed, then queue a mutation
>              // to delete the parameter.
>              String deleteName = query.getStringValue("delete");
>
>              if (dialog.buttonPressed().equals("OK") &&
> !deleteName.equals("")) {
>                  String moml = "<deleteProperty name=\"" + deleteName +
> "\"/>";
>                  _target.addChangeListener(this);
>
>                  MoMLChangeRequest request = new MoMLChangeRequest(this,
>                          _target, moml);
>                  request.setUndoable(true);
>                  _target.requestChange(request);
>              }
>
>
> _Christopher
>
> turuncu at be.itu.edu.tr wrote:
>> Hi,
>>
>> I just wonder that is it possible to remove parameter from actor using
>> java code? How can i do this? I can create parameter field using
>> following
>> code (simplified version),
>>
>> StringParameter[] params = new StringParameter[10];
>> for (int i=0; i<10; i++) {
>> params[i] = new StringParameter(this, "params"+i);
>> params[i].setDisplayName(i);
>> params[i].setExpression(i);
>> }
>>
>> and i want to remove some of them when an other parameter is changed
>> (attribute change method).
>>
>> Any suggestion will be helpful.
>> Best,
>>
>> --ufuk
>>
>>
>
> --
> Christopher Brooks (cxh at eecs berkeley edu) University of California
> CHESS Executive Director                      US Mail: 337 Cory Hall
> Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
> ph: 510.643.9841 fax:510.642.2718	      (Office: 545Q Cory)
> home: (F-Tu) 707.665.0131 (W-F) 510.655.5480
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Kepler-users mailing list