[kepler-dev] [kepler-users] saving workflow in eps format

Chad Berkley berkley at nceas.ucsb.edu
Tue Mar 9 12:04:11 PST 2010


Hi Ufuk,

I got this to work with the following steps.

1) Edit uiMenuMappings to include:

<pair>
       <name>File->Export PDF</name>
       <value>ptolemy.vergil.basic.itextpdf.ExportPDFAction</value>
</pair>

2) edit build-area/settings/ptolemy-excludes to remove the bottom line

ptolemy/vergil/basic/itextpdf/**

3) download the itext jar file from
http://sourceforge.net/projects/itext/files/iText/iText5.0.1/iText-5.0.1.jar/download

4) put the jar file in kepler/ptolemy/lib/.

5) change gui/src/org/kepler/gui/MenuMapper in the getActionFor() method
to create the constructor like so (I've checked these changes into the
trunk so you don't have to make this change, but I thought I'd point it
out anyway):

// create a constructor
Constructor constructor;
try
{
   constructor = classDefinition.getConstructor(args);
}
catch(java.lang.NoSuchMethodException nsme)
{
   args = new Class[] {ptolemy.vergil.basic.BasicGraphFrame.class};
   constructor = classDefinition.getConstructor(args);
}


The problem is that this action is added after the ptolemy subsystems
have already started so our MenuMapper class does not see the ptolemy
menu item that is added.  To compound this problem, ExportPDFAction was 
written specifically for BasicGraphFrame instead of for a TableauFrame 
which is more generic, hence step 5.

Let me know if this doesn't work for you.

chad



Ufuk Utku Turuncoglu wrote:
> Hi Chad,
> 
> I add the following line into uiMenuMappings_en_US.xml after File->Print 
> menu definition,
> 
> <pair>
> <name>File->Export (PDF)</name>
> <value>File->ptolemy.vergil.basic.itextpdf.ExportPDFAction</value>
> </pair>
> 
> and then i run the following commands to build kepler
> 
> ant clean-all
> ant run
> 
> but i could not see the Export (PDF) in File menu. I am using Mac OS 
> 10.6, so it loads some Mac menu specific modules. May be it causes the 
> problem. What do you suggest?
> 
> Thanks for your help,
> Best,
> 
> --ufuk
> 
> On 3/3/10 9:53 PM, Chad Berkley wrote:
>> Hi Ufuk,
>>
>> The instructions for adding a menu item for Ptolemy will not work in 
>> Kepler.  Kepler has a menu system built on top of the Ptolemy menu 
>> system.  To add menu items to Kepler, you will need to edit the 
>> gui/resources/configurations/uiMenuMappings_en_US.xml.  This file 
>> defines the mappings between the Ptolemy menu items and the Kepler 
>> menu items.  If you enable the menu item in ptolemy, you then need to 
>> map it to a kepler menu item in this file.
>>
>> You can also map an action directly to a menu item (if it does not 
>> exist in ptolemy) which allows you to create new menu items that do 
>> not already exist in ptolemy.  There are many examples of both of 
>> these methods in the config file I mentioned above.  Let me know if 
>> you have any questions.
>>
>> thanks,
>> chad
>>
>>
>> u.utku.turuncoglu at be.itu.edu.tr wrote:
>>> Hi,
>>>
>>> Okay. I solve the problem. My custom suite caused the problem. I think
>>> that i have to update it, so it is not compatible with this Kepler
>>> version. I have also another question. What is the correct place to put
>>> itextpdf jar file to enable export PDF menu. I uncomment the lines in 
>>> ptII/ptolemy/vergil/basic/BasicGraphFrame.java and rebuild the source 
>>> but
>>> there is no export PDF option in menu.
>>>
>>> Thanks,
>>>
>>> --ufuk
>>>
>>>> Hi Ufuk,
>>>>
>>>> Can you go over exactly what commands you typed in which caused these
>>>> compilation errors?
>>>>
>>>> Also, can you try to do an "ant update" in case on of your modules did
>>>> not download properly?
>>>>
>>>> Thanks!
>>>>
>>>> -David
>>>>
>>>>
>>>> On Mar 2, 2010, at 2:50 AM, Ufuk Utku Turuncoglu wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Thanks for the detailed information. I will try to use itextpdf
>>>>> solution but the Kepler version that i used is little bit older. So,
>>>>> there is no such kind of code in BasicGraphFrame.java. To enable it,
>>>>> i try to get latest developer version but when i compile it using
>>>>> ant run command, i am getting following error messages,
>>>>>
>>>>> [compile] /Volumes/dali/progs/kepler/provenance/src/org/kepler/
>>>>> module/provenance/Initialize.java:39: package org.kepler.tagging
>>>>> does not exist
>>>>>  [compile] import org.kepler.tagging.Tagging;
>>>>>  [compile]                          ^
>>>>>  [compile] /Volumes/dali/progs/kepler/provenance/src/org/kepler/
>>>>> provenance/ProvenanceRecorder.java:62: package org.kepler.tagging
>>>>> does not exist
>>>>>  [compile] import org.kepler.tagging.TagEvent;
>>>>>  [compile]                          ^
>>>>>  [compile] /Volumes/dali/progs/kepler/provenance/src/org/kepler/
>>>>> provenance/ProvenanceRecorder.java:63: package org.kepler.tagging
>>>>> does not exist
>>>>>  [compile] import org.kepler.tagging.TagEventListener;
>>>>>  [compile]                          ^
>>>>>  [compile] /Volumes/dali/progs/kepler/provenance/src/org/kepler/
>>>>> provenance/ProvenanceRecorder.java:126: cannot find symbol
>>>>>  [compile] symbol: class TagEventListener
>>>>>  [compile]     TagEventListener
>>>>>
>>>>> related with tagging suite. I also installed tagging suite using
>>>>> "ant change-to -Dsuite=tagging" command but the error is same. Have
>>>>> you ever faced this kind of error?
>>>>>
>>>>> PS: I also add information about java and ant version (Mac OS 10.6)
>>>>> and may be it helps you.
>>>>>
>>>>> java version "1.6.0_17"
>>>>> Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
>>>>> Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
>>>>>
>>>>> Apache Ant version 1.7.1 compiled on September 22 2009
>>>>>
>>>>> Best regards,
>>>>>
>>>>> --ufuk
>>>>>
>>>>> On 3/1/10 11:05 PM, Christopher Brooks wrote:
>>>>>> Hi,
>>>>>> If you have Adobe Acrobat installed, the you can print to PDF as
>>>>>> you would print to a regular printer.  Adobe Acrobat costs money
>>>>>> though.
>>>>>>
>>>>>> The Ptolemy vergil script has a hacked in option "-printPDF"
>>>>>> which will print a model to the first printer that has the string
>>>>>> "PDF"
>>>>>> in its name.  For example, if you have Adobe Acrobat installed,
>>>>>>
>>>>>> $PTII/bin/vergil -printPDF $PTII/ptolemy/domains/sdf/demo/Butterfly/
>>>>>> Butterfly.xml
>>>>>>
>>>>>> will create a file called "Java Printing.pdf" on the Desktop.
>>>>>> It looks like there is a problem with the background not being set
>>>>>> to white though.
>>>>>>
>>>>>>
>>>>>>
>>>>>> We have prototype code that uses the AGPL'd itextPDF library from
>>>>>> http://itextpdf.com/
>>>>>>
>>>>>> This code can be enabled in Vergil by editing ptII/ptolemy/vergil/
>>>>>> basic/BasicGraphFrame.java
>>>>>> and uncommenting a section of code and recompiling
>>>>>>
>>>>>>        // Uncomment the next block to have Export PDF *ALWAYS*
>>>>>> enabled.
>>>>>>        // We don't want it always enabled because ptiny, the
>>>>>> applets and
>>>>>>        // Web Start should not included this AGPL'd piece of software
>>>>>>
>>>>>> //         if (_exportPDFAction == null) {
>>>>>> //             //String exportPDFActionClassName =
>>>>>> exportPDFActionClassNameParameter.stringValue();
>>>>>> //             String exportPDFActionClassName =
>>>>>> "ptolemy.vergil.basic.itextpdf.ExportPDFAction";
>>>>>> //             try {
>>>>>> //                 Class exportPDFActionClass = Class
>>>>>> //                 .forName(exportPDFActionClassName);
>>>>>> //                 Constructor exportPDFActionConstructor =
>>>>>> exportPDFActionClass.getDeclaredConstructor(BasicGraphFrame.class);
>>>>>> //                 _exportPDFAction = (AbstractAction)
>>>>>> exportPDFActionConstructor.newInstance(this);
>>>>>> //             } catch (Throwable throwable) {
>>>>>> //                 new InternalErrorException(null, throwable,
>>>>>> "Failed to construct export PDF class \""
>>>>>> //                         + exportPDFActionClassName
>>>>>> //                         + "\", which was read from the
>>>>>> configuration.");
>>>>>> //             }
>>>>>> //         }
>>>>>>        // End of block to uncomment.
>>>>>>
>>>>>>
>>>>>> This should add an Export PDF menu choice to Vergil's File menu.
>>>>>> This menu choice will not be available in Kepler unless you add it.
>>>>>>
>>>>>> This code is prototype code, so you are on your own.
>>>>>>
>>>>>> The reason it is not folded in is because it uses GPL'd software.
>>>>>> Edward and I are looking at various possibilities.
>>>>>>
>>>>>> _Christopher
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 3/1/10 12:52 PM, u.utku.turuncoglu at be.itu.edu.tr wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Is it possible to save created workflow in eps or pdf format? Now,
>>>>>>> i am
>>>>>>> using simple screen shots but the quality of them are worse than i
>>>>>>> expected (especially for the publications). Any suggestion can be
>>>>>>> helpful.
>>>>>>>
>>>>>>> Best regards,
>>>>>>>
>>>>>>> --ufuk
>>>>>>>
>>>>>>>
>>>>>
>>>>> -- 
>>>>> This message has been scanned for viruses and
>>>>> dangerous content by MailScanner, and is
>>>>> believed to be clean.
>>>>>
>>>>> _______________________________________________
>>>>> Kepler-users mailing list
>>>>> Kepler-users at kepler-project.org
>>>>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>>>
>>>> -- 
>>>> This message has been scanned for viruses and
>>>> dangerous content by MailScanner, and is
>>>> believed to be clean.
>>>>
>>>
>>>
>>>
>>
> 
> 



More information about the Kepler-dev mailing list