public abstract class ProxyProperty
extends java.lang.Object
Before a property can be used, its AbstractParaViewProxy
must be set
by calling #setProxy(AbstractParaViewProxy)
.
This class helps deal with the structures in the ParaView web client's proxies. In general, a file, view, or representation proxy adheres to the format below:
JsonArray
- Contains some useful metadata,
including:
JsonArray
of doubles - The timesteps in the file.
JsonArray
- Contains metadata about properties, which
can be used to construct a UI for changing said properties. For example, each
element may include:
{ list-1, list-n, checkbox, textfield }
.
list-1
or list-n
,
this is an array of the allowed values.JsonArray
- Contains the current value(s) for
the properties. This is indexed exactly the same as the "ui" array. Each
element may include the following properties:
list-n
, this is
an array of the selected values. Otherwise, it is the current value.Modifier and Type | Class and Description |
---|---|
static class |
ProxyProperty.PropertyType
This enumeration is used to determine how certain properties should be
treated.
|
Modifier and Type | Field and Description |
---|---|
int |
index
The index of the property in its parent proxy's "ui" and "properties"
JsonArrays.
|
java.lang.String |
name
The name of the property.
|
Constructor and Description |
---|
ProxyProperty(java.lang.String name,
int index)
The default constructor.
|
ProxyProperty(java.lang.String name,
int index,
ProxyProperty.PropertyType type)
The full constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.lang.String> |
getAllowedValues()
Gets the allowed values for the property.
|
java.lang.String |
getValue()
Gets the current value for the property.
|
java.util.List<java.lang.String> |
getValues()
Gets the currently selected values for the property.
|
boolean |
setConnection(IVizConnection<IParaViewWebClient> connection)
Sets the connection used for this property.
|
boolean |
setValue(java.lang.String value)
Sets the value to the specified value.
|
boolean |
setValues(java.util.List<java.lang.String> values)
Sets the selected values for the property.
|
boolean |
valueAllowed(java.lang.String value)
Determines whether the specified value is allowed.
|
public final java.lang.String name
public final int index
public ProxyProperty(java.lang.String name, int index)
name
- The name of the property. This corresponds to the "name" value
in the corresponding array element in the "ui" array.index
- The index of the property in its parent proxy's "ui" and
"properties" JsonArrays.public ProxyProperty(java.lang.String name, int index, ProxyProperty.PropertyType type)
name
- The name of the property. This corresponds to the "name" value
in the corresponding array element in the "ui" array.index
- The index of the property in its parent proxy's "ui" and
"properties" JsonArrays.type
- The type of property. This dictates the format of the "values"
and "value" JsonElements in its "ui" and "properties" entries,
respectively.public java.util.Set<java.lang.String> getAllowedValues()
public java.lang.String getValue()
null
if the
property is unset or has the type
ProxyProperty.PropertyType.DISCRETE_MULTI
.public java.util.List<java.lang.String> getValues()
ProxyProperty.PropertyType.DISCRETE_MULTI
, or an empty
collection otherwise.public boolean setConnection(IVizConnection<IParaViewWebClient> connection)
getProxyId()
.connection
- The new connection. If null
or not connected, the
property's data will be cleared.public boolean setValue(java.lang.String value)
If the property type is ProxyProperty.PropertyType.DISCRETE_MULTI
, then the
selected values will be changed to the provided value.
value
- The new value of the property.public boolean setValues(java.util.List<java.lang.String> values) throws java.lang.NullPointerException, java.lang.UnsupportedOperationException
Note: This method only applies to properties of the type
ProxyProperty.PropertyType.DISCRETE_MULTI
.
values
- The new selected values. May be an empty list.java.lang.NullPointerException
java.lang.UnsupportedOperationException
public boolean valueAllowed(java.lang.String value)
value
- The value to test.