DESY ACOP Beans Home

com.cosylab.gui.components.ledder
Class DefaultBitDescriptor

java.lang.Object
  extended by com.cosylab.gui.components.ledder.DefaultBitDescriptor
All Implemented Interfaces:
BitDescriptor

public class DefaultBitDescriptor
extends java.lang.Object
implements BitDescriptor

Default implementation of BitDescriptor.

Author:
Igor Kriznar

Constructor Summary
DefaultBitDescriptor()
          Creates new BitDescriptor with default colors set to GREEN for on and GRAY for off.
 
Method Summary
 void add(java.lang.String label, java.awt.Color colorOn, java.awt.Color colorOff)
          Appends new bit descriptions to the end of the descriptions lists.
 void clear()
          Removes all bit descriptions from the descriptor.
protected  com.cosylab.gui.components.ledder.DefaultBitDescriptor.BitDescription getBitDescription(int i)
           
 java.awt.Color getColorWhenOff(int index)
          Returns the color representing OFF state for bit at specified index or default OFF value if there is no description.
 java.awt.Color getColorWhenOn(int index)
          Returns the default color representing ON state for bit at specified index or default value if color is not defined.
 java.awt.Color getDefaultColorWhenOff()
          Returns the default color representing OFF state for bit used when no specific description is defined.
 java.awt.Color getDefaultColorWhenOn()
          Returns the default color representing ON state for bit used when no specific description is defined.
 java.lang.String getDescription(int index)
          Returns the default description of the bit at the specified index or default string if no description is defined.
 void remove(int index)
          Removes bit description at the specified index from the descriptor.
 void setColorWhenOff(int index, java.awt.Color color)
          Sets new color indicating OFF state for the specified bit.
 void setColorWhenOn(int index, java.awt.Color color)
          Sets new color indicating the ON state for the specified bit index.
 void setDefaultColorWhenOff(java.awt.Color color)
          Sets default color indicating OFF state.
 void setDefaultColorWhenOn(java.awt.Color color)
          Sets default color indicating the ON state.
 void setDescription(int index, java.lang.String description)
          Sets description for the bit at the specified index.
 int size()
          Returns the number of led descriptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBitDescriptor

public DefaultBitDescriptor()
Creates new BitDescriptor with default colors set to GREEN for on and GRAY for off.

Method Detail

size

public int size()
Returns the number of led descriptions.

Returns:
int

getBitDescription

protected com.cosylab.gui.components.ledder.DefaultBitDescriptor.BitDescription getBitDescription(int i)

add

public void add(java.lang.String label,
                java.awt.Color colorOn,
                java.awt.Color colorOff)
Appends new bit descriptions to the end of the descriptions lists.

Parameters:
label - String
colorOn - Color
colorOff - Color

remove

public void remove(int index)
Removes bit description at the specified index from the descriptor. If index is invalid or the model is empty, this method does nothing. Order of the remaining leds will not change.

Parameters:
index - int

clear

public void clear()
Removes all bit descriptions from the descriptor.


getDescription

public java.lang.String getDescription(int index)
Returns the default description of the bit at the specified index or default string if no description is defined.

Specified by:
getDescription in interface BitDescriptor
Parameters:
index - int
Returns:
String Description of led.

setDescription

public void setDescription(int index,
                           java.lang.String description)
Sets description for the bit at the specified index. If the index greater than size, method does nothing.

Parameters:
index - int
description - String

getColorWhenOn

public java.awt.Color getColorWhenOn(int index)
Returns the default color representing ON state for bit at specified index or default value if color is not defined.

Specified by:
getColorWhenOn in interface BitDescriptor
Parameters:
index - int
Returns:
Color Color of bit or default value

getDefaultColorWhenOn

public java.awt.Color getDefaultColorWhenOn()
Returns the default color representing ON state for bit used when no specific description is defined.

Returns:
Color default value

setColorWhenOn

public void setColorWhenOn(int index,
                           java.awt.Color color)
Sets new color indicating the ON state for the specified bit index. If the index is invalid, method does nothing.

Parameters:
index - int
color - Color

setDefaultColorWhenOn

public void setDefaultColorWhenOn(java.awt.Color color)
Sets default color indicating the ON state.

Parameters:
color - Color

getColorWhenOff

public java.awt.Color getColorWhenOff(int index)
Returns the color representing OFF state for bit at specified index or default OFF value if there is no description.

Specified by:
getColorWhenOff in interface BitDescriptor
Parameters:
index - int
Returns:
Color

getDefaultColorWhenOff

public java.awt.Color getDefaultColorWhenOff()
Returns the default color representing OFF state for bit used when no specific description is defined.

Returns:
Color

setColorWhenOff

public void setColorWhenOff(int index,
                            java.awt.Color color)
Sets new color indicating OFF state for the specified bit. If the index is larger or equal to size, method does nothing.

Parameters:
index - int
color - Color

setDefaultColorWhenOff

public void setDefaultColorWhenOff(java.awt.Color color)
Sets default color indicating OFF state.

Parameters:
color - Color


Copyright © 2010. All Rights Reserved.