[kepler-dev] Changing icons for composite actors
Laura L. Downey
ldowney at lternet.edu
Mon Jun 18 12:58:44 PDT 2007
For reference, the two config files that talk about assigning icons by class
or LSID are:
kepler\configs\ptolemy\configs\kepler\uiSVGIconMappingsByClass.properties
kepler\configs\ptolemy\configs\kepler\uiSVGIconMappingsByLSID.properties
And here is a snippet from the LSID config file that maybe gives you some
info that could be useful since it explains how the code works:
############################################################################
####
#
# '$RCSfile: uiSVGIconMappingsByLSID.properties,v $'
#
# '$Author: madin $'
# '$Date: 2006/05/22 20:03:36 $'
# '$Revision: 1.20 $'
#
# This ResourceBundle contains mappings between actor or director LSIDs and
the
# base filenames of the corresponding actor/director icons. The base
filename is
# then added to the appropriate path, and the appropriate file extension is
# added(see svgIconDefaults.properties), in order to retrieve either the
svg
# icon, a variation on the svg icon (ie same icon, different state), or a
raster
# thumbnail icon for use in the actor library tree.
#
# As an example, if you wish to add the mapping stating that the actor with
the
# LSID:
#
# urn:lsid:kepler-project.org:actor:240:1
#
# uses the svg icon "browser.svg" on the canvas, and the raster icon
# "browser-sm.gif" in the actor library, then the mapping is:
#
# urn\:lsid\:kepler-project.org\:actor\:240\:1=browser
#
# No spaces, no quotes, nothing else besides what you see here (unless the
# filename has dashes or underscores in it, which are fine).
#
# NOTES:
# *** IMPORTANT!!!
# The following characters MUST be escaped with a backslash:
# : <whitespace> # ! \ =
# (except where ":", "=" or " " are used as a delimeter between the key
and
# its corresponding value). This means that any COLON characters in the
LSID
# *MUST* be escaped with a backslash, thus \:
# for example: WRONG - urn:lsid:localhost:director:1:1=myIcon
# CORRECT - urn\:lsid\:localhost\:director\:1\:1=myIcon
# ***
# * The code first tries to match an actor to an icon by looking at its
unique
# LSID, and looking for a match in this file. If a match is not found, the
# classname of the actor is sought in the file
# "svgIconMappingsByClass.properties", and a match is attempted. If no
match
# is found there, the default "catch-all" icon is used, as defined in
# svgIconDefaults.properties
# * All actor SVG icons must be in the same directory, and must have the
same
# file extension (currently ".svg"; see "HOW IT WORKS" below)
# * All thumbnail raster icons must be in the same directory, and must have
the
# same file extension (currently "-sm.gif"; see "HOW IT WORKS", below)
# * For any given pair of corresponding svg and raster icons, the base-part
of
# the name must match. For example, the browser icons must be called
# "browser.svg" and "browser-sm.gif (base-name is "browser"); the R
composite
# actor icons must be called "r-c.svg" and "r-c-sm.gif" (base-name is
"r-c")
# etc. (see "HOW IT WORKS", below).
# * There must *always* be an SVG/raster pair of icons with the same base
name;
# i.e. for every SVG there must be a corresponding raster, and vice-versa
#
#
# HOW IT WORKS:
#
# The code looks in the file:
# kepler/configs/ptolemy/configs/kepler/svgIconDefaults.properties
# for the following:
#
# 1) it takes the root name above ("browser"), and adds the path before it
(see
# the svgIconDefaults for the property called "RASTER_THUMBNAIL_BASE_PATH").
It
# then adds the file extension on the end (see the svgIconDefaults for the
# property called "RASTER_THUMBNAIL_EXT"). At the time of writing, the path
is
# "/actorthumbs/" and the extension is "-sm.gif", so the raster icon is at:
#
# /actorthumbs/browser-sm.gif
#
# 2) The code repeats the above for the SVG icon that is used by the actor
in
# workflows. The path is called "SVG_ICON_BASE_PATH", and the extension is
# called "SVG_BASE_ICON_EXT". At the time of writing, the path and extension
# were "/svg/" and ".svg", respectively,
# resulting in a full icon location of:
#
# /svg/browser.svg
#
# These paths start with a "/" because they are loaded using
# class.getResourceAsStream(), and the "/" tells this method to look for the
# file relative to the runtime classpath - see javadoc for
getResourceAsStream()
#
############################################################################
####
Laura L. Downey
Senior Usability Engineer
LTER Network Office
Department of Biology, MSC03 2020
1 University of New Mexico
Albuquerque, NM 87131-0001
505.277.3157 office
505.610.9657 mobile
505.277-2541 fax
ldowney at lternet.edu
-----Original Message-----
From: kepler-dev-bounces at ecoinformatics.org
[mailto:kepler-dev-bounces at ecoinformatics.org] On Behalf Of Norbert
Podhorszki
Sent: Monday, June 18, 2007 11:47 AM
To: Chad Berkley
Cc: Kepler-Dev
Subject: Re: [kepler-dev] Changing icons for composite actors
Hi Chad,
I may have not described my question fully. I know how to define icons for
Kepler actors that either have lsids (saved in kar) or are java
classes. The composite actors in the CPES workflows are neither "actors
saved in kar" nor classes. They are simply ad-hoc subworkflows. That is,
they have no lsids either.
For example, in the workflow there are unique (not too complex) composites
to hide some specific, control related operations. They have the default
green box representation of the TypedCompositeActor. I would like to
show them as control actors (there is such an existing icon).
However, if this requires to save them as kars and
define/register/cvs-commit them, I may quickly decide it is not worth to
do it.
I can see in the Tree view of the workflow, that each component has an
_svgIcon and _iconDescription parameters, obviously created and filled by
Kepler when loading the moml file. Is there any way to influence this
process to insert that icon name what I want, not the one which is
assigned to TypedCompositeActor? Through a special _... parameter inserted
by hand in the moml for example :-) ?
Thanks
Norbert
On Mon, 18 Jun 2007, Chad Berkley wrote:
> Yes, I think you can. You can actually assign the icon by LSID. See the
> file configs/ptolemy/configs/kepler/uiSVGIconMappingsByLSID.properties
>
> You can also assign them by class:
> configs/ptolemy/configs/kepler/uiSVGIconMappingsByClass.properties
>
> Note the config file format is something like this:
> urn\:lsid\:kepler-project.org\:actor\:417\:1=data_process-c
> where the icon name (on the right side of the '=' sign is a filename from
the
> kepler/lib/images/svg directory with the ".svg" removed.
>
> chad
_______________________________________________
Kepler-dev mailing list
Kepler-dev at ecoinformatics.org
http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
More information about the Kepler-dev
mailing list