Class ChartUIModel
- java.lang.Object
-
- com.inductiveautomation.sfc.uimodel.ChartUIModel
-
public class ChartUIModel extends java.lang.ObjectThis 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.StringRESOURCE_NAMEstatic ResourceTypeRESOURCE_TYPEstatic intSCOPE
-
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 voidaddChartElement(ChartUIElement element)voidaddChartUIModelListener(ChartUIModelListener listener)voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)static ChartUIModelcreateNew()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 voidfireElementAdded(ChartUIElement element)protected voidfireElementRemoved(ChartUIElement element)protected voidfireStructureChanged()static ChartUIModelfromXml(java.io.InputStream xmlInput, StepRegistry registry)Parses the input stream as XML which should represent a ChartUIModelstatic ChartUIModelfromXml(org.w3c.dom.Element sfcElement, StepRegistry registry)java.awt.DimensiongetCanvasSize()java.lang.Iterable<ChartUIElement>getChartElements()Return an iterable view of all chart elements.static LinkDirectiongetConnectivity(ChartUIElement element, Edge direction)LinkDirectiongetConnectivityAt(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 beChartExecutionModegetExecutionMode()java.lang.StringgetOnAbortScript()java.lang.StringgetOnCancelScript()java.lang.StringgetOnRedundantFailoverScript()java.lang.StringgetOnStartScript()java.lang.StringgetOnStopScript()com.google.common.base.Optional<ChartUIModel>getParentModel()ChartUIModelgetParentModelSerializer()Deprecated.ResourcePathgetResourcePath()java.util.List<ChartUIElement>getSFCElements()Deprecated.floatgetZoom()Returns the zoom amount.inthashCode()booleanisHotEditable()booleanisParallelSectionModel()booleanisPersistState()booleanisRedundantSync()static java.awt.DimensionparseDimension(java.lang.String attributeValue)voidremoveChartElement(java.util.UUID id)voidremoveChartUIModelListener(ChartUIModelListener listener)voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)voidsetCanvasSize(java.awt.Dimension canvasSize)voidsetExecutionMode(ChartExecutionMode executionMode)voidsetHotEditable(boolean hotEditable)voidsetOnAbortScript(java.lang.String onAbortScript)voidsetOnCancelScript(java.lang.String onCancelScript)voidsetOnRedundantFailoverScript(java.lang.String onRedundantFailoverScript)voidsetOnStartScript(java.lang.String onStartScript)voidsetOnStopScript(java.lang.String onStopScript)voidsetParentModelSerializer(ChartUIModel parentModel)Deprecated.voidsetPersistState(boolean persistState)voidsetRedundantSync(boolean redundantSync)voidsetResourcePath(ResourcePath resourcePath)voidsetSFCElements(java.util.List<ChartUIElement> elements)Deprecated.voidsetZoom(float zoom)java.lang.StringtoXml(StepRegistry registry)voidtoXml(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
-
-
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
-
setResourcePath
public void setResourcePath(ResourcePath resourcePath)
-
getResourcePath
@Nullable public ResourcePath getResourcePath()
-
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.XMLStreamExceptionOutputs 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:
hashCodein 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
-
-