public class IlvDecorationRenderer extends IlvFilterSDMRenderer
IlvDecorationRenderer
is a filtering
renderer that adds various IlvGraphic
s in the manager.
The added objects are defined through a given style sheet (or
through the style sheet of the IlvSDMEngine
).
To add graphic object, simply define names in this renderer (see
setDecorationNames()
) and it will try to load and add
IlvGraphic
s corresponding to the names. The following
example creates two filled rectangles and place them in the shape
of an L with the corner at (0,0)
:
SDM { Decoration : true; } Decoration { decorationNames : 'testV,testH'; } // decorations #testH { class : 'ilog.views.interactor.IlvMakeFilledRectangleInteractor'; IlvRect : '10,20,100,2'; x : 0; y : 0; layer : 3; anchor : TopLeft; foreground : pink; } #testV { class : 'ilog.views.interactor.IlvMakeFilledRectangleInteractor'; IlvRect : '10,50,2,100'; x : 0; y : 0; anchor : BottomRight; layer : 3; }The renderer also has three properties used to fix the background color, the background pattern of the view, and to load an arbitrary .ivl file.
Since Perforce JViews version 8.0, this class can also load SVG and DXF files.
_renderer
PSEUDOCLASS_PREFIX
Constructor and Description |
---|
IlvDecorationRenderer()
Creates a new decoration renderer with a
null
filtered renderer. |
IlvDecorationRenderer(IlvSDMRenderer renderer)
Creates a new decoration renderer for a specified
filtered renderer.
|
Modifier and Type | Method and Description |
---|---|
Color |
getBackground()
Gets the background color.
|
URL |
getBackgroundFile()
Gets the background file.
|
URL |
getBackgroundPatternLocation()
Returns the location of the background pattern of the view.
|
int |
getDebugMask()
Returns the debug level of the current configuration style sheet.
|
String |
getDecorationContext()
Gets the decoration context.
|
String[] |
getDecorationNames()
Gets the names of the decoration objects.
|
String[] |
getStyleSheets()
Returns the current configuration style sheet.
|
String |
getStyleSheets(int index)
Returns the configuration style sheet found at location
index in the array. |
boolean |
isFitToContent()
Returns the value of the "fit-to-content" flag.
|
void |
prepareRendering(IlvSDMEngine engine)
Prepares the renderer for rendering objects in the specified SDM engine.
|
void |
removeAll(IlvSDMEngine engine)
Restores the original background color and pattern of the view.
|
void |
renderingDone(IlvSDMEngine engine)
Creates and adds the decoration object.
|
void |
setBackground(Color color)
Sets the view background color.
|
void |
setBackgroundFile(URL ivlFile)
Sets a URL that points to a Perforce JViews formatted file (.ivl).
|
void |
setBackgroundPatternLocation(URL url)
Changes the background pattern of the view.
|
void |
setDebugMask(int v)
Sets the CSS debug flag while parsing the configuration style sheet.
|
void |
setDecorationContext(String context)
Sets the decoration context (that is, an additional CSS class to
match for all the decoration rules).
|
void |
setDecorationNames(String[] names)
Sets the names of the decoration objects.
|
void |
setFitToContent(boolean fitToContent)
Specifies whether a "fit-to-content" will be performed
after the background file has been loaded.
|
void |
setStyleSheets(int index,
String v)
Sets the configuration style sheet found at location
index
in the array. |
void |
setStyleSheets(String[] v)
Sets the configuration style sheets.
|
addLinkGraphic, addNodeGraphic, computeBBox, createLinkGraphic, createNodeGraphic, customize, getEncapsulatedGraphic, getFilteredRenderer, getGraphicProperty, getLinkConnectionRectangle, linkGraphicAdded, moveResizeNodeGraphic, nodeGraphicAdded, nodeGraphicBBoxChanged, processServerAction, propertiesChanged, removeLinkGraphic, removeNodeGraphic, setFilteredRenderer, updateObjectProperties
addViewListeners, callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getAuxiliaryBeans, getEngine, getLinkConnectionRectangle, getLocation, getParameter, needsViewListeners, propertyChanged, removeViewListeners, setAlias, setEngine, setLayerName, setParameter
public IlvDecorationRenderer(IlvSDMRenderer renderer)
renderer
- The filtered renderer.public IlvDecorationRenderer()
null
filtered renderer.public void setDecorationNames(String[] names)
names
- The names of the decoration objects.public String[] getDecorationNames()
public void setDecorationContext(String context)
context
- The decoration context.public String getDecorationContext()
public void setBackgroundFile(URL ivlFile) throws IOException, IlvReadFileException
IlvSDMEngine.loadData()
is invoked.
Since Perforce JViews version 8.0, this class can also load SVG and DXF files.
ivlFile
- The new background .ivl URL.IOException
- An IO error occurs.IlvReadFileException
- This exception occurs when
the grapher cannot read the file either because the file
is not a Perforce JViews file, or because the format is not correct
or some graphic classes cannot be found.IlvManager.read(java.net.URL)
public URL getBackgroundFile()
public boolean isFitToContent()
setFitToContent(boolean)
public void setFitToContent(boolean fitToContent)
setBackgroundFile(URL)
.
The default value is true
.
fitToContent
- If true
, a "fit-to-content"
will be performed after the background file has been loaded,
otherwise the view's transformer will be left unchanged.isFitToContent()
public void setBackground(Color color)
color
- The new background color.IlvManagerView.setBackground(java.awt.Color)
public Color getBackground()
public void setBackgroundPatternLocation(URL url)
url
- The URL of the image, or null
to remove the pattern.getBackgroundPatternLocation()
,
IlvManagerView.setBackgroundPatternLocation(java.net.URL)
public URL getBackgroundPatternLocation()
null
if the view
has no background pattern.public void setStyleSheets(String[] v)
v
- The array of style sheets (URL, filename, or string).setDebugMask(int)
,
getStyleSheets(int)
public void setStyleSheets(int index, String v)
index
in the array. If no style sheet is provided, the decoration
renderer will fetch the style sheet of the SDM engine.index
- The index of the style sheet in the array.v
- The style sheet (URL, filename, or string).setDebugMask(int)
,
getStyleSheets(int)
public String getStyleSheets(int index)
index
in the array.index
- The index of the style sheet in the array.setStyleSheets(java.lang.String[])
public String[] getStyleSheets()
setStyleSheets(java.lang.String[])
public void setDebugMask(int v)
setStyleSheets()
to debug
problems during configuration. The default value will report bad
class names.v
- The debug mask, as defined in IlvStyleSheetRenderer
.IlvStyleSheetRenderer.setDebugMask(int)
,
setStyleSheets(java.lang.String[])
,
getDebugMask()
public int getDebugMask()
setDebugMask(int)
public void prepareRendering(IlvSDMEngine engine)
prepareRendering
in class IlvFilterSDMRenderer
engine
- The SDM engine.public void removeAll(IlvSDMEngine engine)
removeAll
in class IlvFilterSDMRenderer
engine
- The SDM engine.public void renderingDone(IlvSDMEngine engine)
renderingDone
in class IlvFilterSDMRenderer
engine
- The SDM engine.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.