public abstract static class IlvGraphLayoutRenderer.ParameterSetter extends Object
IlvGraphLayoutRenderer
.
This is an expert class; you do not usually need to use it, since most graph layout parameters are handled automatically.
A parameter setter implements the setting of a parameter
used by a graph layout algorithm for a given object. For
example, the following setter calls the method
IlvGraphLayout.setFixed(java.lang.Object, boolean)
of the graph layout algorithm to specify that a given
object must not be moved by the layout:
class LayoutFixedSetter extends ParameterSetter { LayoutFixedSetter(String name) { super(name, new Class[] { IlvGraphic.class, Boolean.class }, IlvGraphLayout.class); } public void set(Object layout, Object[] params) throws Exception { Object graphic = params[0]; boolean fixed = ((Boolean)params[1]).booleanValue(); ((IlvGraphLayout)layout).setFixed(graphic, fixed); } }
Constructor and Description |
---|
ParameterSetter(String name,
Class<?>[] parameterTypes,
Class<?> layoutClass)
Creates a new parameter setter.
|
Modifier and Type | Method and Description |
---|---|
void |
afterSet(Object layout,
Object graphic)
This method is called after the call to the
set(java.lang.Object, java.lang.Object[]) method. |
void |
beforeSet(Object layout,
Object graphic)
This method is called before the call to the
set(java.lang.Object, java.lang.Object[]) method. |
Class<?> |
getLayoutClass()
Returns the subclass of
IlvGraphLayout
that this parameter can be applied to. |
String |
getName()
Returns the name of the parameter.
|
Class<?>[] |
getParameterTypes()
Returns the types of the setter's parameters.
|
IlvGraphLayoutRenderer |
getRenderer()
Returns the graph layout renderer.
|
abstract void |
set(Object layout,
Object[] params)
You must subclass
ParameterSetter and
override this method to actually set the parameter. |
void |
setRenderer(IlvGraphLayoutRenderer renderer)
Sets the graph layout renderer.
|
public ParameterSetter(String name, Class<?>[] parameterTypes, Class<?> layoutClass)
name
- The name of the parameter, as it will
appear in the style sheet.parameterTypes
- The types of the parameters
expected by the setter. Usually, the first type in the
array will be IlvGraphic.class
, and
the array will contain one additional parameter.layoutClass
- The subclass of IlvGraphLayout
that this parameter can be applied to.public String getName()
public Class<?>[] getParameterTypes()
public Class<?> getLayoutClass()
IlvGraphLayout
that this parameter can be applied to.public IlvGraphLayoutRenderer getRenderer()
public void setRenderer(IlvGraphLayoutRenderer renderer)
public void beforeSet(Object layout, Object graphic)
set(java.lang.Object, java.lang.Object[])
method.
If there are several calls separated by semi-colons,
as explained in IlvGraphLayoutRenderer
, this method is called
once before the multiple calls to set(java.lang.Object, java.lang.Object[])
.
The default implementation does nothing.layout
- The IlvGraphLayout
object.graphic
- The graphic object for which the parameter is set.public abstract void set(Object layout, Object[] params) throws Exception
ParameterSetter
and
override this method to actually set the parameter.layout
- The graph layout object.params
- The parameters of the setter. The parameters
have already been converted to the types specified by
getParameterTypes()
.Exception
public void afterSet(Object layout, Object graphic)
set(java.lang.Object, java.lang.Object[])
method.
If there are several calls separated by semi-colons,
as explained in IlvGraphLayoutRenderer
, this method is called
once after the multiple calls to set(java.lang.Object, java.lang.Object[])
.
The default implementation does nothing.layout
- The IlvGraphLayout
object.graphic
- The graphic object for which the parameter is set.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.