Class ChartUIModel

java.lang.Object
com.inductiveautomation.sfc.uimodel.ChartUIModel

public class ChartUIModel extends 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 Details

  • Constructor Details

    • ChartUIModel

      public ChartUIModel()
    • ChartUIModel

      public ChartUIModel(ChartUIModel parentModel)
      Creates a chart UI model that is part of a parallel section
  • Method Details

    • 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 String toXml(StepRegistry registry) throws Exception
      Throws:
      Exception
    • toXml

      public void toXml(XMLStreamWriter writer, StepRegistry registry) throws XMLStreamException
      Outputs this chart UI model to the XML stream. Expects that the <sfc> (or <parallel>) element has already been written.
      Throws:
      XMLStreamException
    • fromXml

      public static ChartUIModel fromXml(InputStream xmlInput, StepRegistry registry) throws XmlParseException
      Parses the input stream as XML which should represent a ChartUIModel
      Throws:
      XmlParseException
    • fromXml

      public static ChartUIModel fromXml(Element sfcElement, StepRegistry registry) throws XmlParseException
      Throws:
      XmlParseException
    • parseDimension

      public static Dimension parseDimension(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 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(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 List<ChartUIElement> findElementsAt(int x, int y)
    • findParallelBegins

      public List<ChartUIElement> findParallelBegins()
      Find the Begin Step elements that start the parallel branches. These elements will not be present in the main elements list within this model, but instead can be accessed through the terminal elements list to be used for serializing and persisting chart instances.
    • 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(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 Dimension getCanvasSize()
    • setCanvasSize

      public void setCanvasSize(Dimension canvasSize)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getSFCElements

      @Deprecated public List<ChartUIElement> getSFCElements()
      Deprecated.
      For serialization. do not call.
    • setSFCElements

      @Deprecated public void setSFCElements(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(PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
    • addPropertyChangeListener

      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(String propertyName, 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 String getOnStartScript()
    • setOnStartScript

      public void setOnStartScript(String onStartScript)
    • getOnStopScript

      public String getOnStopScript()
    • setOnStopScript

      public void setOnStopScript(String onStopScript)
    • getOnCancelScript

      public String getOnCancelScript()
    • setOnCancelScript

      public void setOnCancelScript(String onCancelScript)
    • getOnAbortScript

      public String getOnAbortScript()
    • setOnAbortScript

      public void setOnAbortScript(String onAbortScript)
    • getOnRedundantFailoverScript

      public String getOnRedundantFailoverScript()
    • setOnRedundantFailoverScript

      public void setOnRedundantFailoverScript(String onRedundantFailoverScript)
      Parameters:
      onRedundantFailoverScript - the script that will fire when a gateway becomes the active node in a redundant cluster