Search:
|
Browse by category:
|
| | | |
|
Question
How do you set relative path for an icon parameter in Symbol Editor?
Answer
You can specify the icon with relative path using the following CSS rule:
node {
class : "ilog.views.sdm.graphic.IlvSDMCompositeNode" ; ;
...
children[1] : "@+Icon";
}
#Icon {
class : "ilog.views.graphic.IlvIcon" ;
imageLocation : "url(data/icons/info.gif)" ;
...
}
The icon location in this case is interpreted relative to the location of the CSS file.
You can also specify;
#Icon {
class : "ilog.views.graphic.IlvIcon" ;
imageLocation : "file:data/icons/info.gif" ;
...
}
In this case, the icon location is interpreted relative to the location where the program starts, not relative to the location of the CSS file.
In the Symbol Editor, when you are at the icon imageLocation, you can either enter an URL or a CSS expression. Entering "url(...)
" in the imageLocation field is not allow because it is not a valid URL syntax and url(...)
is not a CSS function.
There are two ways to specify the relative path for an icon in Symbol Editor:
- Specific location relative to the location where the program starts:
node {
class : "ilog.views.sdm.graphic.IlvSDMCompositeNode" ;
...
children[1] : "@+Icon";
}
#Icon {
class : "ilog.views.graphic.IlvIcon" ;
imageLocation : "@iconUrl" ;
...
}
where iconUrl
is a parameter with value "jar:file:nasapalette.jar!/ilog/views/palettes/newpalette/icon/info.gif"
2. Define a CSS function to accept the parameter as String or URL.
In the attached sample, you will find implementation of a CSS function (named url) that combines a base URL with a second part, which can either be a String or a relative URL. With this CSS function, you can specify the icon imageLocation as url(styleSheetURL(), @iconUrl)
where iconUrl
parameter is of type URL.
Since the URL customizer does not accept invalid URLs such as ../resources/icon.gif
, this new CSS function will accept URL with the following syntax:
URL with protocol is file
and the path starts with the keywork relative
will be consider as relative URL.
- Relative URL as
file:relative/../resources/icon.gif
will allow you to access the icon in the same jar file. - Absolute URL. Any URL that does not contain the
file
protocol or does not start withrelative/
will be considered as an absolute URL.
The samplepalette.jar in the attached sample contains a symbol with two icons: the icon on the left has a fixed image while the icon on the right can be set with the symbol parameter.
Attached files | |
sample-icon.zip (9 kb)
|
Also listed in | |
Visualizations -> JViews -> Diagrammer |
Prev | Next | |
Modify the keyboard shortcuts in Dashboard Editor | Dashboard Editor Search Path for Palettes |