etomica.graphics
Class DeviceTernarySelector

java.lang.Object
  extended by etomica.graphics.Device
      extended by etomica.graphics.DeviceTernarySelector
All Implemented Interfaces:
GraphicalElement, Dimensioned

public class DeviceTernarySelector
extends Device

Selector for fractions in a ternary system. Presents a triangle that can be clicked upon to select (for example) the three mole fractions of a ternary mixture.


Nested Class Summary
static interface DeviceTernarySelector.Listener
           
protected static class DeviceTernarySelector.MyEventManager
           
 
Nested classes/interfaces inherited from class etomica.graphics.Device
Device.ActionSet
 
Field Summary
 
Fields inherited from class etomica.graphics.Device
controller, unit
 
Constructor Summary
DeviceTernarySelector()
           
DeviceTernarySelector(String[] labels)
          Creates a new devices using the given labels for the diagram.
 
Method Summary
 void addListener(DeviceTernarySelector.Listener listener)
           
static EtomicaInfo getEtomicaInfo()
           
 String[] getLabels()
          Accessor method for the labels.
 int getPrecision()
          Accessor method for the precision of the mole fractions.
 int getSideLength()
          Accessor method for the length of each side of the triangle, in pixels.
 String[] getSymbols()
          Accessor method for the symbols.
 Component graphic(Object obj)
          Graphical display given by this device.
 boolean isShowValues()
          Accessor method for flag indicating if values are shown in accompanying text boxes.
 void removeListener(DeviceTernarySelector.Listener listener)
           
 void setLabels(String[] newLabels)
          Labels used to indicate the three component fractions.
 void setPrecision(int n)
          Mutatator method for the precision of the mole fractions.
 void setShowValues(boolean b)
          Mutator method for flag indicating whether a set of boxes is displayed with labels and fraction values as text.
 void setSideLength(int L)
          Mutator method for the length of each side of the triangle, in pixels.
 void setSymbols(String[] newSymbols)
          Symbols used to label each vertex of the triangle.
 
Methods inherited from class etomica.graphics.Device
doAction, getController, getDimension, getPostAction, getPreAction, getUnit, graphic, setController, setPostAction, setPreAction, setUnit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeviceTernarySelector

public DeviceTernarySelector()

DeviceTernarySelector

public DeviceTernarySelector(String[] labels)
Creates a new devices using the given labels for the diagram. The given string array must be of dimension 3.

Method Detail

getEtomicaInfo

public static EtomicaInfo getEtomicaInfo()

addListener

public void addListener(DeviceTernarySelector.Listener listener)

removeListener

public void removeListener(DeviceTernarySelector.Listener listener)

setPrecision

public void setPrecision(int n)
Mutatator method for the precision of the mole fractions. Precision is the number of significant figures to which the values are rounded. Minimum is 1, maximum is 10. Default is 2.


getPrecision

public int getPrecision()
Accessor method for the precision of the mole fractions.


setShowValues

public void setShowValues(boolean b)
Mutator method for flag indicating whether a set of boxes is displayed with labels and fraction values as text.


isShowValues

public boolean isShowValues()
Accessor method for flag indicating if values are shown in accompanying text boxes.


setSideLength

public void setSideLength(int L)
Mutator method for the length of each side of the triangle, in pixels. Default value is 200.


getSideLength

public int getSideLength()
Accessor method for the length of each side of the triangle, in pixels. Default value is 200.


setLabels

public void setLabels(String[] newLabels)
Labels used to indicate the three component fractions. These strings are used to label the numeric displays of the fractions, if the device is set to show them. They are also used to label each vertex of the triangle, if the symbols are not set explicitly. Default values of the labels are "A", "B", and "C"


getLabels

public String[] getLabels()
Accessor method for the labels.


setSymbols

public void setSymbols(String[] newSymbols)
Symbols used to label each vertex of the triangle. By default the symbols are the same as the labels, and will change any time the labels are changed, unless having once been set explicitly using this method.


getSymbols

public String[] getSymbols()
Accessor method for the symbols.


graphic

public Component graphic(Object obj)
Graphical display given by this device.

Specified by:
graphic in interface GraphicalElement
Specified by:
graphic in class Device
Parameters:
obj - An object that might be used to specify the graphic that the GraphicalElement is to return. In most cases the GraphicalElement ignores this parameter, and it can be set to null.
Returns:
A Component that can be used in the GUI of a graphical simulation
See Also:
Device, Display