Package jmri.implementation
Class JmriSimplePropertyListener
- java.lang.Object
-
- jmri.implementation.JmriSimplePropertyListener
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
- Direct Known Subclasses:
JmriClockPropertyListener
,JmriMemoryPropertyListener
,JmriMultiStatePropertyListener
,JmriTwoStatePropertyListener
public class JmriSimplePropertyListener extends java.lang.Object implements java.beans.PropertyChangeListener
A service base class for monitoring a bound property in one of the JMRI Named beans (Turnout, Sensor, etc).This file is part of JMRI.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- Since:
- 2.5.1
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.ArrayList<Conditional>
_clients
(package private) boolean
_enabled
(package private) NamedBeanHandle<?>
_namedBean
(package private) java.lang.String
_propertyName
(package private) int
_type
(package private) java.lang.String
_varName
(package private) Conditional.Type
_varType
-
Constructor Summary
Constructors Constructor Description JmriSimplePropertyListener(java.lang.String propName, int type, java.lang.String varName, Conditional.Type varType, Conditional client)
JmriSimplePropertyListener(java.lang.String propName, int type, NamedBeanHandle<?> namedBean, Conditional.Type varType, Conditional client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConditional(Conditional client)
void
calculateClient(int idx, java.beans.PropertyChangeEvent evt)
NamedBean
getBean()
java.lang.String
getDevName()
(package private) NamedBeanHandle<?>
getNamedBean()
java.lang.String
getPropertyName()
int
getType()
Conditional.Type
getVarType()
void
propertyChange(java.beans.PropertyChangeEvent evt)
When _enabled is false, Conditional.calculate will compute the state of the conditional, but will not trigger its actions.void
setEnabled(boolean state)
-
-
-
Field Detail
-
_type
int _type
-
_varName
java.lang.String _varName
-
_varType
Conditional.Type _varType
-
_propertyName
java.lang.String _propertyName
-
_clients
java.util.ArrayList<Conditional> _clients
-
_enabled
boolean _enabled
-
_namedBean
NamedBeanHandle<?> _namedBean
-
-
Constructor Detail
-
JmriSimplePropertyListener
JmriSimplePropertyListener(java.lang.String propName, int type, java.lang.String varName, Conditional.Type varType, Conditional client)
-
JmriSimplePropertyListener
JmriSimplePropertyListener(java.lang.String propName, int type, NamedBeanHandle<?> namedBean, Conditional.Type varType, Conditional client)
-
-
Method Detail
-
getNamedBean
NamedBeanHandle<?> getNamedBean()
-
getType
public int getType()
-
getPropertyName
public java.lang.String getPropertyName()
-
getVarType
public Conditional.Type getVarType()
-
getDevName
public java.lang.String getDevName()
-
addConditional
public void addConditional(Conditional client)
-
setEnabled
public void setEnabled(boolean state)
-
calculateClient
public void calculateClient(int idx, java.beans.PropertyChangeEvent evt)
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
When _enabled is false, Conditional.calculate will compute the state of the conditional, but will not trigger its actions. When _enabled is true, Conditional.calculates its state and trigger its actions if its state has changed.- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
-