Class ChartUIModel
- java.lang.Object
-
- com.inductiveautomation.sfc.uimodel.ChartUIModel
-
public class ChartUIModel extends java.lang.Object
This is the root of the object hierarchy which is serialized into the project resource, it represents the chart as it is displayed in the UI.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
RESOURCE_NAME
static ResourceType
RESOURCE_TYPE
static java.util.UUID
ROOT_FOLDER
static int
SCOPE
-
Constructor Summary
Constructors Constructor Description ChartUIModel()
ChartUIModel(ChartUIModel parentModel)
Creates a chart UI model that is part of a parallel section
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addChartElement(ChartUIElement element)
void
addChartUIModelListener(ChartUIModelListener listener)
void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
void
addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
static ChartUIModel
createNew()
Creates a new chart with a begin step at x=5, y=1com.google.common.base.Optional<ChartUIElement>
find(int x, int y)
com.google.common.base.Optional<ChartUIElement>
find(int x, int y, ElementType type)
com.google.common.base.Optional<ChartUIElement>
find(java.util.UUID id)
java.util.List<ChartUIElement>
findElementsAt(int x, int y)
java.util.List<ChartUIElement>
findParallelBegins()
Find the elements that start the parallel branches.protected void
fireElementAdded(ChartUIElement element)
protected void
fireElementRemoved(ChartUIElement element)
protected void
fireStructureChanged()
static ChartUIModel
fromXml(java.io.InputStream xmlInput, StepRegistry registry)
Parses the input stream as XML which should represent a ChartUIModelstatic ChartUIModel
fromXml(org.w3c.dom.Element sfcElement, StepRegistry registry)
java.awt.Dimension
getCanvasSize()
java.lang.Iterable<ChartUIElement>
getChartElements()
Return an iterable view of all chart elements.static LinkDirection
getConnectivity(ChartUIElement element, Edge direction)
LinkDirection
getConnectivityAt(int x, int y, Edge direction)
Tests whether the element at the given location is connectable on the given edge, and if so, what direction the connection should beChartExecutionMode
getExecutionMode()
java.lang.String
getOnAbortScript()
java.lang.String
getOnCancelScript()
java.lang.String
getOnRedundantFailoverScript()
java.lang.String
getOnStartScript()
java.lang.String
getOnStopScript()
com.google.common.base.Optional<ChartUIModel>
getParentModel()
ChartUIModel
getParentModelSerializer()
Deprecated.java.util.List<ChartUIElement>
getSFCElements()
Deprecated.float
getZoom()
Returns the zoom amount.int
hashCode()
boolean
isHotEditable()
boolean
isParallelSectionModel()
boolean
isPersistState()
boolean
isRedundantSync()
static java.awt.Dimension
parseDimension(java.lang.String attributeValue)
void
removeChartElement(java.util.UUID id)
void
removeChartUIModelListener(ChartUIModelListener listener)
void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
void
removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
void
setCanvasSize(java.awt.Dimension canvasSize)
void
setExecutionMode(ChartExecutionMode executionMode)
void
setHotEditable(boolean hotEditable)
void
setOnAbortScript(java.lang.String onAbortScript)
void
setOnCancelScript(java.lang.String onCancelScript)
void
setOnRedundantFailoverScript(java.lang.String onRedundantFailoverScript)
void
setOnStartScript(java.lang.String onStartScript)
void
setOnStopScript(java.lang.String onStopScript)
void
setParentModelSerializer(ChartUIModel parentModel)
Deprecated.void
setPersistState(boolean persistState)
void
setRedundantSync(boolean redundantSync)
void
setSFCElements(java.util.List<ChartUIElement> elements)
Deprecated.void
setZoom(float zoom)
java.lang.String
toXml(StepRegistry registry)
void
toXml(javax.xml.stream.XMLStreamWriter writer, StepRegistry registry)
Outputs this chart UI model to the XML stream.
-
-
-
Field Detail
-
RESOURCE_TYPE
public static final ResourceType RESOURCE_TYPE
-
RESOURCE_NAME
public static final java.lang.String RESOURCE_NAME
- See Also:
- Constant Field Values
-
SCOPE
public static final int SCOPE
- See Also:
- Constant Field Values
-
ROOT_FOLDER
public static final java.util.UUID ROOT_FOLDER
-
-
Constructor Detail
-
ChartUIModel
public ChartUIModel()
-
ChartUIModel
public ChartUIModel(ChartUIModel parentModel)
Creates a chart UI model that is part of a parallel section
-
-
Method Detail
-
createNew
public static ChartUIModel createNew()
Creates a new chart with a begin step at x=5, y=1
-
toXml
public java.lang.String toXml(StepRegistry registry) throws java.lang.Exception
- Throws:
java.lang.Exception
-
toXml
public void toXml(javax.xml.stream.XMLStreamWriter writer, StepRegistry registry) throws javax.xml.stream.XMLStreamException
Outputs this chart UI model to the XML stream. Expects that the <sfc> (or <parallel>) element has already been written.- Throws:
javax.xml.stream.XMLStreamException
-
fromXml
public static ChartUIModel fromXml(java.io.InputStream xmlInput, StepRegistry registry) throws XmlParseException
Parses the input stream as XML which should represent a ChartUIModel- Throws:
XmlParseException
-
fromXml
public static ChartUIModel fromXml(org.w3c.dom.Element sfcElement, StepRegistry registry) throws XmlParseException
- Throws:
XmlParseException
-
parseDimension
public static java.awt.Dimension parseDimension(java.lang.String attributeValue)
-
fireStructureChanged
protected void fireStructureChanged()
-
fireElementAdded
protected void fireElementAdded(ChartUIElement element)
-
fireElementRemoved
protected void fireElementRemoved(ChartUIElement element)
-
isParallelSectionModel
public boolean isParallelSectionModel()
-
getParentModel
public com.google.common.base.Optional<ChartUIModel> getParentModel()
-
getParentModelSerializer
@Deprecated public ChartUIModel getParentModelSerializer()
Deprecated.Do not call - for serialization
-
setParentModelSerializer
@Deprecated public void setParentModelSerializer(ChartUIModel parentModel)
Deprecated.Do not call - for serialization
-
getChartElements
public java.lang.Iterable<ChartUIElement> getChartElements()
Return an iterable view of all chart elements. Note that the iterator generated will be unmodifiable. Also, note that this iterator will be fail-fast, and will throw a ConcurrentModificationException if the model is altered while iterating.
-
find
public com.google.common.base.Optional<ChartUIElement> find(java.util.UUID id)
-
find
public com.google.common.base.Optional<ChartUIElement> find(int x, int y)
-
find
public com.google.common.base.Optional<ChartUIElement> find(int x, int y, ElementType type)
-
findElementsAt
public java.util.List<ChartUIElement> findElementsAt(int x, int y)
-
findParallelBegins
public java.util.List<ChartUIElement> findParallelBegins()
Find the elements that start the parallel branches. Note that these elements will be Begin Steps, although they won't actually be present in the list of elements present in this model. And their ID will change with every call to this function.
-
getConnectivityAt
public LinkDirection getConnectivityAt(int x, int y, Edge direction)
Tests whether the element at the given location is connectable on the given edge, and if so, what direction the connection should be
-
getConnectivity
public static LinkDirection getConnectivity(ChartUIElement element, Edge direction)
-
addChartElement
public void addChartElement(ChartUIElement element)
-
removeChartElement
public void removeChartElement(java.util.UUID id)
-
getZoom
public float getZoom()
Returns the zoom amount. Standard resolution is 1.0f, zoomed in double is 2.0f, etc.
-
setZoom
public void setZoom(float zoom)
-
getCanvasSize
public java.awt.Dimension getCanvasSize()
-
setCanvasSize
public void setCanvasSize(java.awt.Dimension canvasSize)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getSFCElements
@Deprecated public java.util.List<ChartUIElement> getSFCElements()
Deprecated.For serialization. do not call.
-
setSFCElements
@Deprecated public void setSFCElements(java.util.List<ChartUIElement> elements)
Deprecated.For serialization. do not call.
-
addChartUIModelListener
public void addChartUIModelListener(ChartUIModelListener listener)
-
removeChartUIModelListener
public void removeChartUIModelListener(ChartUIModelListener listener)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
getExecutionMode
public ChartExecutionMode getExecutionMode()
-
setExecutionMode
public void setExecutionMode(ChartExecutionMode executionMode)
-
isHotEditable
public boolean isHotEditable()
-
setHotEditable
public void setHotEditable(boolean hotEditable)
-
isPersistState
public boolean isPersistState()
-
setPersistState
public void setPersistState(boolean persistState)
-
isRedundantSync
public boolean isRedundantSync()
-
setRedundantSync
public void setRedundantSync(boolean redundantSync)
- Parameters:
redundantSync
- Set to True to allow a chart's data model to be synchronized between a redundant master and backup during chart state changes and during step transitions.
-
getOnStartScript
public java.lang.String getOnStartScript()
-
setOnStartScript
public void setOnStartScript(java.lang.String onStartScript)
-
getOnStopScript
public java.lang.String getOnStopScript()
-
setOnStopScript
public void setOnStopScript(java.lang.String onStopScript)
-
getOnCancelScript
public java.lang.String getOnCancelScript()
-
setOnCancelScript
public void setOnCancelScript(java.lang.String onCancelScript)
-
getOnAbortScript
public java.lang.String getOnAbortScript()
-
setOnAbortScript
public void setOnAbortScript(java.lang.String onAbortScript)
-
getOnRedundantFailoverScript
public java.lang.String getOnRedundantFailoverScript()
-
setOnRedundantFailoverScript
public void setOnRedundantFailoverScript(java.lang.String onRedundantFailoverScript)
- Parameters:
onRedundantFailoverScript
- the script that will fire when a gateway becomes the active node in a redundant cluster
-
-