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 java.lang.Object implements PropertyAdapter, Adapter.ValueHolder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractPropertyAdapter.EdtUpdateValue
-
Nested classes/interfaces inherited from interface com.inductiveautomation.factorypmi.application.binding.Adapter
Adapter.ValueHolder
-
Nested classes/interfaces inherited from interface com.inductiveautomation.factorypmi.application.binding.PropertyAdapter
PropertyAdapter.PAType
-
-
Field Summary
Fields Modifier and Type Field Description protected VisionClientContext
appContext
protected boolean
isTargetPropertyDynamic
protected LoggerEx
log
protected boolean
overlayOptOut
Overlay opt out notifies the adapter that this binding's quality shouldn't affect the overlay systemprotected java.awt.Component
target
protected java.lang.String
targetPropertyName
protected QualifiedValue
value
protected java.lang.Class
valueClass
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPropertyAdapter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
canUpdate()
checks to make sure we don't try to assign null to a primitivevoid
connect(VisionClientContext appContext)
Calls connect() on all interaction descriptorsvoid
disconnect()
Calls disconnect() on all interaction descriptorsQualifiedValue
getQValue()
java.awt.Component
getTarget()
The target component is the component that this adapter serves.protected java.lang.String
getTargetDesc()
java.lang.String
getTargetFullPath()
Returns the full path to the target componentjava.lang.String
getTargetPropertyName()
java.lang.Class
getValueClass()
protected void
handleError(java.lang.Exception ex, QualityCode quality)
protected void
handleNullToPrimitive()
protected LoggerEx
initLogger()
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.static boolean
isDataUsed(QualifiedValue qv, java.lang.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.boolean
isOverlayOptOut()
boolean
isTargetPropertyDynamic()
boolean
isValid()
Returns true if the target isn't null and the target has a parent.protected boolean
isValueClassPrimitive()
void
setOverlayOptOut(boolean overlayOptOut)
void
setQValue(QualifiedValue qualifiedValue)
Sets this adapter's value.void
setSetterMethodName(java.lang.String string)
Deprecated.void
setTarget(java.awt.Component component)
void
setTargetPropertyDynamic(boolean b)
void
setTargetPropertyName(java.lang.String string)
void
setValue(java.lang.Object value)
Deprecated.Use setQValue() instead.void
setValueClass(java.lang.Class class1)
void
shutdown()
Notifies the adapter that it is becoming inactive, and should cease any polling/threaded activities.void
startup()
Notifies the adapter that it is becoming active, and should start any polling/threaded activities.java.lang.String
toString()
protected void
updateQuality(QualityCode quality)
protected void
updateTarget()
Sets the target property to the value.protected void
updateValue(QualifiedValue qv)
Sets the property adapter value to the given QualifiedValue, and updates the data quality, then calls updateTarget().protected boolean
useQuality()
Called to determine whether or not to push qualities to the target.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.factorypmi.application.binding.Adapter
getInteractions
-
Methods inherited from interface com.inductiveautomation.factorypmi.application.binding.PropertyAdapter
getReferenceType
-
-
-
-
Field Detail
-
target
protected java.awt.Component target
-
targetPropertyName
protected java.lang.String targetPropertyName
-
value
protected QualifiedValue value
-
valueClass
protected java.lang.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
-
-
Method Detail
-
isDataUsed
public static boolean isDataUsed(QualifiedValue qv, java.lang.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.
-
shutdown
public void shutdown()
Description copied from interface:Adapter
Notifies the adapter that it is becoming inactive, and should cease any polling/threaded activities.
-
disconnect
public void disconnect()
Calls disconnect() on all interaction descriptors- Specified by:
disconnect
in interfaceAdapter
-
connect
public void connect(VisionClientContext appContext)
Calls connect() on all interaction descriptors
-
getTargetDesc
protected java.lang.String getTargetDesc()
-
isValid
public boolean isValid()
Returns true if the target isn't null and the target has a parent.
-
getTargetFullPath
public java.lang.String getTargetFullPath()
Returns the full path to the target component
-
getTarget
public java.awt.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.
-
setTarget
public void setTarget(java.awt.Component component)
-
getTargetPropertyName
public java.lang.String getTargetPropertyName()
- Specified by:
getTargetPropertyName
in interfacePropertyAdapter
-
setTargetPropertyName
public void setTargetPropertyName(java.lang.String string)
- Specified by:
setTargetPropertyName
in interfacePropertyAdapter
-
setSetterMethodName
@Deprecated public void setSetterMethodName(java.lang.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 interfaceAdapter.ValueHolder
-
setValue
@Deprecated public void setValue(java.lang.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 interfaceAdapter.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.
-
canUpdate
protected boolean canUpdate()
checks to make sure we don't try to assign null to a primitive
-
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(java.lang.Exception ex, QualityCode quality)
-
isValueClassPrimitive
protected boolean isValueClassPrimitive()
-
getValueClass
public java.lang.Class getValueClass()
-
setValueClass
public void setValueClass(java.lang.Class class1)
-
isTargetPropertyDynamic
public boolean isTargetPropertyDynamic()
-
setTargetPropertyDynamic
public void setTargetPropertyDynamic(boolean b)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isOverlayOptOut
public boolean isOverlayOptOut()
-
setOverlayOptOut
public void setOverlayOptOut(boolean overlayOptOut)
-
-