<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Kianwee,<br>
Usually the classpath is set when the Java process is started up.<br>
Consult the web for more information about the Java classpath.
Basically, the classpath is a set of directories, jar files and zip
files that Java searches to find Java class files and resources.
I've found that referring to resources using $CLASSPATH is necessary
when models are delivered as Java Web Start applications or as
applets. The problem is somewhat complex, but has to do with jar
urls and caching.<br>
<br>
The xxxxxxCLASSPATHxxxxxxx is a hack and should not appear. If you
send me a model that shows xxxxxxxCLASSPATHxxxxx, I'll take a look.<br>
<br>
Kepler uses kar files that contain Ptolemy models that are xml
files. I'm not that familiar with kar files, but I believe you
could use the jar command to unjar a kar file and then use a file
editor to edit the .xml file.<br>
You can also export a .xml file from Kepler and then edit that using
a file editor and then open the .xml file from within Kepler.<br>
<br>
_Christopher<br>
<br>
On 10/24/11 8:22 PM, kianwee chen wrote:
<blockquote
cite="mid:CAHwgn_z_-=uC8V0oRzRNtQH4Mq==Fy-iQk+zWGB9E_Eqk3j1oA@mail.gmail.com"
type="cite"><span style="background-color: rgb(255, 204, 0);"><span
style="background-color: rgb(255, 255, 255);">Thanks for the
quick reply</span><br>
I often end up using $CLASSPATH, which looks in</span><span
style="background-color: rgb(255, 204, 0);"> the classpath for
the resource.</span><br>
<br>
I type in the $CLASSPATH and this is what is return "
xxxxxxCLASSPATHxxxxxx " is there a way to set the classpath ?<br>
<br>
<span style="background-color: rgb(255, 255, 0);">For a
CompositeActor, you would probably need to edit the MoML by hand
and add a Parameter:</span><br>
<br>
How do you edit the MoML of a composite actor by hand ? I right
click and try all the options but did not get any options that
allow me to edit the MoML <br>
<br>
thanks <br>
ckw<br>
<br>
I typed in the $CLASSPATH and I only get this <br>
<div class="gmail_quote">On Tue, Oct 25, 2011 at 12:46 AM,
Christopher Brooks <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:cxh@eecs.berkeley.edu">cxh@eecs.berkeley.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#FFFFFF" text="#000000"> Hi Kianwee,<br>
My comments are interspersed with your text below.
<div class="im"><br>
<br>
On 10/24/11 8:39 AM, Edward A. Lee wrote:
<blockquote type="cite"> <br>
The documentation for FileParameter says: <br>
<br>
"If this attribute contains a parameter named allowFiles
with value false, then when a file browser is used to
select a file, that file browser will be set to not show
files (only directories will be shown). If this
attribute contains a parameter named allowDirectories
with value true, then the file browser will permit the
user to select directories (the default behavior is that
when a directory is selected, that directory is opened
and its contained files and directories are listed)." <br>
<br>
(I'm not sure about Kepler, but in Ptolemy, just drag in
a FileParameter <br>
from the Utilities menu, right click on it, and select
Documentation.) <br>
<br>
I'm not sure what you mean by "list parameter." Can you
cite a specific <br>
example? <br>
<br>
Edward <br>
<br>
<br>
On 10/24/11 3:22 AM, kianwee chen wrote: <br>
<blockquote type="cite">Hi everyone, I am trying to
create a composite actor and trying to setup <br>
the parameters for the composite actor. Thus I have
some question on <br>
adding parameters in composite actors. <br>
<br>
1.) Directory parameter: <br>
<br>
-I would like to let the users specify a directory on
the composite <br>
actor parameters interface, I know there is a file
parameter but I need <br>
a directory parameter. How can I customise a directory
parameter ? <br>
</blockquote>
</blockquote>
<br>
</div>
See Edward's explanation above.
<div class="im"><br>
<blockquote type="cite">
<blockquote type="cite"> <br>
-I have a problem with relative path too, when I setup
a file parameter <br>
it returns the string of the path relative to my
current kepler file <br>
that is open. Is there a way to get the base file path
? Something like <br>
$CWD, but instead the file path of my currently open
file ? <br>
</blockquote>
</blockquote>
<br>
</div>
The FileParameter documentation says:<br>
<br>
<p>If the model containing
this
<br>
attribute has been saved to a MoML file, then the file name
can
be
<br>
given relative to the directory containing that MoML
file.
<br>
If the model has not been saved to a
file,
<br>
then the classpath is used for identifying relative file
names.</p>
<br>
<br>
<p>Files can be given relative to a
<i>base</i>, where the
baseis
<br>
the URI of the first container above this one that has a
URIAttribute.
<br>
Normally, this URI specifies the file or URL containing the
model
<br>
definition. Thus, files that are referred to here can be
kept in
the
<br>
same directory as the model, or in a related directory, and
can
<br>
moved together with the
model.</p>
<br>
<br>
So, if you type in a relative path, then the file should be
relative to the model.<br>
<br>
There is a Ptolemy test at<br>
ptolemy/actor/lib/io/test/auto/FileReader.xml <br>
that illustrates the various possibilities. If this test is
run in the ptolemy/actor/lib/io/test<br>
directory, then it will work. If the test is run elsewhere,
then the "FileReader Relative to CWD"<br>
actor will fail because that actor uses $CWD, which is
expected to be ptolemy/actor/lib/io/test<br>
in that test.<br>
<br>
In Java, the value of the user.dir property is the " User's
current working directory".<br>
However, when a Java program is opened in a graphical
windowing system by clicking on<br>
a menu choice, then the value of user.dir is not clearly
defined. It should probably be<br>
the same value as the user's home directory, but I've seen
various values.<br>
For a FileParameter, the value of $CWD is set to the value
of the user.dir property,<br>
which is probably not what you want. I often end up using
$CLASSPATH, which looks in<br>
the classpath for the resource. The file chooser does not
have a way to add $CLASSPATH,<br>
you have to type it in manually.
<div class="im"><br>
<br>
<br>
<blockquote type="cite">
<blockquote type="cite"> <br>
2.) List Parameter: <br>
- I have seen some actor have List parameters how do I
customise one for <br>
my composite actor too ? <br>
</blockquote>
</blockquote>
<br>
</div>
For atomic actors, the ptolemy/actor/lib/MathFunction.java
uses the addChoice() method:<br>
<br>
//
Parameters
<br>
function = new StringParameter(this, "function");<br>
function.setExpression("exp");<br>
function.addChoice("exp");<br>
function.addChoice("log");<br>
function.addChoice("modulo");<br>
function.addChoice("sign");<br>
function.addChoice("square");<br>
function.addChoice("sqrt");<br>
_function = _EXP;<br>
<br>
I believe that addChoice() is defined in
ptolemy/gui/Query.java<br>
<br>
For a CompositeActor, you would probably need to edit the
MoML by hand and add a Parameter:<br>
<br>
<property name="function"
class="ptolemy.data.expr.StringParameter" value="square"><br>
<property name="style"
class="ptolemy.actor.gui.style.ChoiceStyle"><br>
<property name="exp"
class="ptolemy.kernel.util.StringAttribute" value="exp"><br>
</property><br>
<property name="log"
class="ptolemy.kernel.util.StringAttribute" value="log"><br>
</property><br>
<property name="modulo"
class="ptolemy.kernel.util.StringAttribute"
value="modulo"><br>
</property><br>
<property name="sign"
class="ptolemy.kernel.util.StringAttribute" value="sign"><br>
</property><br>
<property name="square"
class="ptolemy.kernel.util.StringAttribute"
value="square"><br>
</property><br>
<property name="sqrt"
class="ptolemy.kernel.util.StringAttribute" value="sqrt"><br>
</property><br>
</property><br>
</property><br>
<br>
_Christopher
<div class="im"><br>
<blockquote type="cite">
<blockquote type="cite"> <br>
Thanks alot !! <br>
ckw <br>
<br>
<br>
_______________________________________________ <br>
Kepler-users mailing list <br>
<a moz-do-not-send="true"
href="mailto:Kepler-users@kepler-project.org"
target="_blank">Kepler-users@kepler-project.org</a>
<br>
<a moz-do-not-send="true"
href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users"
target="_blank">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a>
<br>
</blockquote>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
Kepler-users mailing list
<a moz-do-not-send="true" href="mailto:Kepler-users@kepler-project.org" target="_blank">Kepler-users@kepler-project.org</a>
<a moz-do-not-send="true" href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users" target="_blank">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a>
</pre>
</blockquote>
<br>
</div>
<font color="#888888">
<pre cols="72">--
Christopher Brooks, PMP University of California
CHESS Executive Director US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774
ph: <a moz-do-not-send="true" href="tel:510.643.9841" value="+15106439841" target="_blank">510.643.9841</a> (Office: 545Q Cory)
home: (F-Tu) <a moz-do-not-send="true" href="tel:707.665.0131" value="+17076650131" target="_blank">707.665.0131</a> cell: <a moz-do-not-send="true" href="tel:707.332.0670" value="+17073320670" target="_blank">707.332.0670</a> </pre>
</font></div>
</blockquote>
</div>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Christopher Brooks, PMP University of California
CHESS Executive Director US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774
ph: 510.643.9841 (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670 </pre>
</body>
</html>