Class AbstractPropertyAdapter

java.lang.Object
com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter
All Implemented Interfaces:
Adapter, Adapter.ValueHolder, PropertyAdapter
Direct Known Subclasses:
AbstractQueryAdapter, AbstractTagAdapter, CellUpdateAdapter, ExpressionPropertyAdapter, SimpleBoundColorAdapter, SimpleBoundPropertyAdapter

public abstract class AbstractPropertyAdapter extends Object implements PropertyAdapter, Adapter.ValueHolder
  • Field Details

    • target

      protected Component target
    • targetPropertyName

      protected String targetPropertyName
    • value

      protected QualifiedValue value
    • valueClass

      protected Class valueClass
    • isTargetPropertyDynamic

      protected boolean isTargetPropertyDynamic
    • overlayOptOut

      protected boolean overlayOptOut
      Overlay opt out notifies the adapter that this binding's quality shouldn't affect the overlay system
    • appContext

      protected VisionClientContext appContext
    • log

      protected LoggerEx log
  • Constructor Details

    • AbstractPropertyAdapter

      protected AbstractPropertyAdapter()
  • Method Details

    • isDataUsed

      public static boolean isDataUsed(QualifiedValue qv, Class<?> targetType)
      Returns whether or not the data portion of the qualified value should be used, or whether only the quality portion should be used instead.
    • isDataUsed

      protected boolean isDataUsed(QualifiedValue qv)
      Returns whether or not the data portion of the qualified value should be used, or whether only the quality portion should be used instead.
    • initLogger

      protected LoggerEx initLogger()
    • startup

      public void startup()
      Description copied from interface: Adapter
      Notifies the adapter that it is becoming active, and should start any polling/threaded activities.
      Specified by:
      startup in interface Adapter
    • shutdown

      public void shutdown()
      Description copied from interface: Adapter
      Notifies the adapter that it is becoming inactive, and should cease any polling/threaded activities.
      Specified by:
      shutdown in interface Adapter
    • disconnect

      public void disconnect()
      Calls disconnect() on all interaction descriptors
      Specified by:
      disconnect in interface Adapter
    • connect

      public void connect(VisionClientContext appContext)
      Calls connect() on all interaction descriptors
      Specified by:
      connect in interface Adapter
    • getTargetDesc

      protected String getTargetDesc()
    • isValid

      public boolean isValid()
      Returns true if the target isn't null and the target has a parent.
      Specified by:
      isValid in interface Adapter
    • getTargetFullPath

      public String getTargetFullPath()
      Returns the full path to the target component
    • getTarget

      public Component getTarget()
      Description copied from interface: Adapter
      The target component is the component that this adapter serves. This means it is the target of a property adapter or the source of events for an action adapter.
      Specified by:
      getTarget in interface Adapter
    • setTarget

      public void setTarget(Component component)
      Specified by:
      setTarget in interface Adapter
    • getTargetPropertyName

      public String getTargetPropertyName()
      Specified by:
      getTargetPropertyName in interface PropertyAdapter
    • setTargetPropertyName

      public void setTargetPropertyName(String string)
      Specified by:
      setTargetPropertyName in interface PropertyAdapter
    • setSetterMethodName

      @Deprecated public void setSetterMethodName(String string)
      Deprecated.
      This is no longer used, but is here for serialization. The setter is now looked up dynamically based on the target property name.
    • getQValue

      public QualifiedValue getQValue()
      Specified by:
      getQValue in interface Adapter.ValueHolder
    • setValue

      @Deprecated public void setValue(Object value)
      Deprecated.
      Use setQValue() instead. Kept for serialization.
    • setQValue

      public void setQValue(QualifiedValue qualifiedValue)
      Sets this adapter's value. Doesn't push the value to the target or update the quality if the target is a quality monitor. For that, use updateValue()
      Specified by:
      setQValue in interface Adapter.ValueHolder
    • updateQuality

      protected void updateQuality(QualityCode quality)
    • useQuality

      protected boolean useQuality()
      Called to determine whether or not to push qualities to the target. Default implementation is:

       return !isOverlayOptOut() && target instanceof QualityMonitor;
       

      If overridden, make sure that you AND-in super().

    • updateValue

      protected void updateValue(QualifiedValue qv)
      Sets the property adapter value to the given QualifiedValue, and updates the data quality, then calls updateTarget().

      This function is Non-EDT safe. It will re-call itself on the EDT if not called on EDT.

    • updateTarget

      protected void updateTarget()
      Sets the target property to the value. If a problem occurs, the problem is displayed, not thrown. Note that updateValue() is probably a better bet, as it updates both value and quality.
    • handleNullToPrimitive

      protected void handleNullToPrimitive()
    • handleError

      protected void handleError(Exception ex, QualityCode quality)
    • isValueClassPrimitive

      protected boolean isValueClassPrimitive()
    • getValueClass

      public Class getValueClass()
    • setValueClass

      public void setValueClass(Class class1)
    • isTargetPropertyDynamic

      public boolean isTargetPropertyDynamic()
    • setTargetPropertyDynamic

      public void setTargetPropertyDynamic(boolean b)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isOverlayOptOut

      public boolean isOverlayOptOut()
    • setOverlayOptOut

      public void setOverlayOptOut(boolean overlayOptOut)