|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cosylab.gui.components.ledder.BitmaskField
public class BitmaskField
This is generic class providing access to the BitDescriptor
. In
most cases this implementation should provide all neccessary access to the
model. This class is designed for convenient access and minimal overhead.
Field Summary | |
---|---|
static int |
IGNORE_MASK
DOCUMENT ME! |
Constructor Summary | |
---|---|
BitmaskField()
Default constructor for BitmaskField. |
|
BitmaskField(BitDescriptor ledModel)
Constructor for BitmaskField that also initialized the values to the specified model. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds property change listener. |
protected BitDescriptor |
createDefaultModel()
Creates default model. |
protected void |
firePropertyChange(java.lang.String property,
long old,
long now)
Convenience method that fires property change event with long parameters. |
protected void |
flushBitCount()
Resets the cache for the getBitCount() method. |
int |
getBitCount()
Returns number of bits defined by mask. |
BitDescriptor |
getBitDescriptor()
Returns current model used to represent the bit values. |
long |
getBits()
Returns the bit pattern currently set. |
java.awt.Color[] |
getColorsWhenOff()
Returns array of colors to be used for rendering the individual led's OFF state. |
java.awt.Color[] |
getColorsWhenOn()
Returns array of colors to be used for rendering the individual led's ON state. |
long |
getCompactValue()
Returns bit pattern by ignoring all zeros in the mask. |
java.lang.String[] |
getDescriptions()
Returns array containing descriptions for the leds. |
long |
getMask()
Returns the mask. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes property change listener. |
void |
setBitDescriptor(BitDescriptor newModel)
Sets the model to represent bit values. |
void |
setBits(long value)
Sets the new bit pattern. |
void |
setMask(long value)
Sets the mask to use. |
java.awt.Color[] |
toColor()
Returns array of colors corresponding to current state of bit pattern. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int IGNORE_MASK
Constructor Detail |
---|
public BitmaskField()
public BitmaskField(BitDescriptor ledModel)
ledModel
- BitDescriptor Initial model to use.Method Detail |
---|
protected BitDescriptor createDefaultModel()
public BitDescriptor getBitDescriptor()
public void setBitDescriptor(BitDescriptor newModel)
createDefaultModel()
method. Also, setting the same
instance of the model multiple times will not cause any change to
occur. If the new model is null, a new instance of model will be
created using createDefaultModel()
method.
newModel
- BitDescriptorpublic int getBitCount()
If the mask is defined as 0010110111, getBitCount returns 6.
Always returns non-negative integer.
This method may be used to discover the number of leds to display. If the mask is not defined, the return value will be the number of leds in the model. Value of leds is cached to avoid calculation each time the method is called and will be changed whenever the model changes.
protected final void flushBitCount()
getBitCount()
method. This should
be called whenever the number of leds changes.
public void setBits(long value)
value
- long New bit pattern.public long getBits()
public void setMask(long value)
value
- long New mask.public long getMask()
public java.lang.String[] getDescriptions()
public java.awt.Color[] getColorsWhenOn()
public java.awt.Color[] getColorsWhenOff()
public java.awt.Color[] toColor()
public long getCompactValue()
Example:
mask = XX10101 bits = XX10010 getCompactValue() = XXXXX100
protected void firePropertyChange(java.lang.String property, long old, long now)
Long
objects
the event is only fired if any listeners have been registered.
property
- Stringold
- longnow
- longpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- PropertyChangeListenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- PropertyChangeListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |