public SubscriptionState getSubscriptionState () { if ( this.value == null ) { return SubscriptionState.DISCONNECTED; } return this.value.getSubscriptionState (); }
/** * Get the subscription state * * @return the subscription state * @deprecated You should use {@link #getSnapshotValue()} instead to get a * consistent value */ @Deprecated public SubscriptionState getSubscriptionState () { return this.value.getSubscriptionState (); }
/** * Get the subscription state * * @return the subscription state * @deprecated You should use {@link #getSnapshotValue()} instead to get a * consistent value */ @Deprecated public SubscriptionState getSubscriptionState () { return this.value.getSubscriptionState (); }
@Override public void run () { if ( oldValue.getSubscriptionState () != SubscriptionState.CONNECTED ) { listener.notifySubscriptionChange ( SubscriptionState.CONNECTED, null ); } listener.notifyDataChange ( valueChange, attributesChange.isEmpty () ? null : attributesChange, false ); } } );
public Builder ( final DataItemValue sourceValue ) { if ( sourceValue == null ) { this.value = Variant.NULL; this.attributes = new HashMap<String, Variant> (); this.subscriptionState = SubscriptionState.DISCONNECTED; } else { this.value = sourceValue.getValue (); this.attributes = new HashMap<String, Variant> ( sourceValue.getAttributes () ); this.subscriptionState = sourceValue.getSubscriptionState (); this.subscriptionError = sourceValue.getSubscriptionError (); } }
public Builder ( final DataItemValue sourceValue ) { if ( sourceValue == null ) { this.value = Variant.NULL; this.attributes = new HashMap<String, Variant> (); this.subscriptionState = SubscriptionState.DISCONNECTED; } else { this.value = sourceValue.getValue (); this.attributes = new HashMap<String, Variant> ( sourceValue.getAttributes () ); this.subscriptionState = sourceValue.getSubscriptionState (); this.subscriptionError = sourceValue.getSubscriptionError (); } }
@Override public Object getPropertyValue ( final Object id ) { if ( id instanceof Properties ) { switch ( (Properties)id ) { case ITEM_ID: return this.item.getId (); case CONNECTION_URI: return this.item.getConnectionString (); case VALUE: return this.value; case SUBSCRIPTION_STATE: if ( this.value == null ) { return SubscriptionState.DISCONNECTED; } return this.value.getSubscriptionState (); } } return null; }
@Override protected void update () { if ( this.value == null ) { return; } if ( this.value.getSubscriptionError () == null ) { this.stateText.setText ( this.value.getSubscriptionState ().name () ); } else { this.stateText.setText ( String.format ( Messages.OverviewDetailsPart_SubscriptionStateFormat, this.value.getSubscriptionState ().name (), this.value.getSubscriptionError ().getMessage () ) ); } this.warnText.setText ( this.value.isWarning () ? Messages.OverviewDetailsPart_WarningActiveText : Messages.OverviewDetailsPart_WarningInactiveText ); this.alarmText.setText ( this.value.isAlarm () ? Messages.OverviewDetailsPart_AlarmActiveText : Messages.OverviewDetailsPart_AlarmInactiveText ); this.errorText.setText ( this.value.isError () ? Messages.OverviewDetailsPart_ErrorActiveText : Messages.OverviewDetailsPart_ErrorInactiveText ); this.manualText.setText ( this.value.isManual () ? Messages.OverviewDetailsPart_ManualActiveText : Messages.OverviewDetailsPart_ManualInactiveText ); this.blockedText.setText ( this.value.isBlocked () ? Messages.OverviewDetailsPart_BlockedActiveText : Messages.OverviewDetailsPart_BlockedInactiveText ); this.valueText.setText ( this.value.getValue () != null ? this.value.getValue ().toString () : Messages.OverviewDetailsPart_NullText ); final Calendar c = this.value.getTimestamp (); this.timestampText.setText ( c != null ? String.format ( Messages.OverviewDetailsPart_TimeFormat, c ) : Messages.OverviewDetailsPart_NullText ); } }
@Override protected void update () { if ( this.value == null ) { return; } if ( this.value.getSubscriptionError () == null ) { this.stateText.setText ( this.value.getSubscriptionState ().name () ); } else { this.stateText.setText ( String.format ( Messages.OverviewDetailsPart_SubscriptionStateFormat, this.value.getSubscriptionState ().name (), this.value.getSubscriptionError ().getMessage () ) ); } this.warnText.setText ( this.value.isWarning () ? Messages.OverviewDetailsPart_WarningActiveText : Messages.OverviewDetailsPart_WarningInactiveText ); this.alarmText.setText ( this.value.isAlarm () ? Messages.OverviewDetailsPart_AlarmActiveText : Messages.OverviewDetailsPart_AlarmInactiveText ); this.errorText.setText ( this.value.isError () ? Messages.OverviewDetailsPart_ErrorActiveText : Messages.OverviewDetailsPart_ErrorInactiveText ); this.manualText.setText ( this.value.isManual () ? Messages.OverviewDetailsPart_ManualActiveText : Messages.OverviewDetailsPart_ManualInactiveText ); this.blockedText.setText ( this.value.isBlocked () ? Messages.OverviewDetailsPart_BlockedActiveText : Messages.OverviewDetailsPart_BlockedInactiveText ); this.valueText.setText ( this.value.getValue () != null ? this.value.getValue ().toString () : Messages.OverviewDetailsPart_NullText ); final Calendar c = this.value.getTimestamp (); this.timestampText.setText ( c != null ? String.format ( Messages.OverviewDetailsPart_TimeFormat, c ) : Messages.OverviewDetailsPart_NullText ); } }
public static DataItemValueLight valueOf ( final DataItemValue dataItemValue ) { if ( ( dataItemValue == null ) || dataItemValue.equals ( DataItemValue.DISCONNECTED ) ) { return DISCONNECTED; } return new DataItemValueLight ( dataItemValue.getValue (), dataItemValue.getSubscriptionState (), dataItemValue.getTimestamp () == null ? Long.MIN_VALUE : dataItemValue.getTimestamp ().getTimeInMillis (), dataItemValue.isManual (), dataItemValue.isError () ); }
public static DataItemValueLight valueOf ( final DataItemValue dataItemValue ) { if ( ( dataItemValue == null ) || dataItemValue.equals ( DataItemValue.DISCONNECTED ) ) { return DISCONNECTED; } return new DataItemValueLight ( dataItemValue.getValue (), dataItemValue.getSubscriptionState (), dataItemValue.getTimestamp () == null ? Long.MIN_VALUE : dataItemValue.getTimestamp ().getTimeInMillis (), dataItemValue.isManual (), dataItemValue.isError () ); }