SORTIE Java Interface  1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
sortie.datavisualizer.Legend Class Reference

This is an internal frame which displays a color legend for species-based charts. More...

Inheritance diagram for sortie.datavisualizer.Legend:
sortie.datavisualizer.DetailedOutputLegend

Public Member Functions

 Legend (DataFileManager oManager, String sTitle, String[] p_sSpeciesNames) throws ModelException
 Constructor. More...
 
Color getSpeciesColor (int iIndex) throws ModelException
 Gets the color associated with a particular species. More...
 
Color getSpeciesColor (String sName) throws ModelException
 Gets the color associated with a particular species. More...
 
boolean getIsSpeciesSelected (int iIndex) throws ModelException
 Get whether or not a species' checkbox indicates that it is selected. More...
 
int getNumberOfSpecies ()
 Gets the total number of species for this legend. More...
 
void actionPerformed (ActionEvent e)
 Triggered when a checkbox is toggled on or off. More...
 
String getSpeciesCodeName (int i) throws ModelException
 Gets the internal code species name for a given species index. More...
 
String getSpeciesDisplayName (int i) throws ModelException
 Gets the species display name for a given species index. More...
 
void chooseColor (ActionEvent e)
 Displays the color chooser when the user clicks the color chooser button, and extracts the chosen color. More...
 

Protected Member Functions

void createColorList ()
 Creates the GUI and lays out all the components. More...
 

Protected Attributes

String [] mp_sSpeciesNames
 The names of each of the species. More...
 
String [] mp_sDisplayNames
 The names that will be displayed. More...
 
Color [] mp_oSpeciesColors
 The color for each species. More...
 
JButton [] mp_jSpeciesColorDisplays
 The color display for each species. More...
 
JCheckBox [] mp_jSpeciesChecks
 Checkboxes indicating whether or not a species should be visible. More...
 
DataFileManager m_oManager
 Parent data file manager. More...
 

Private Member Functions

void createGUI () throws Exception
 Creates the GUI and lays out all the components. More...
 

Detailed Description

This is an internal frame which displays a color legend for species-based charts.

When the user clicks on a color, they get a color chooser that lets them change a species's color.

When species names come in, they may have underscores substituted for spaces. Thus, a separate set of display names is used that will have the underscores removed. The species names with underscores is what all other objects will expect when they ask the legend for help parsing a detailed output file.

Copyright: Copyright (c) Charles D. Canham 2003

Company: Cary Institute of Ecosystem Studies

Author
Lora E. Murphy
Version
1.0


Edit history:
---------------—
April 28, 2004: Submitted in beta version (LEM)
February 4, 2008: Updated to conform to Java 6 compliance (LEM)
December 20, 2010: Added scroll bar to species list and cleaned up code a bit (LEM)

Constructor & Destructor Documentation

◆ Legend()

sortie.datavisualizer.Legend.Legend ( DataFileManager  oManager,
String  sTitle,
String []  p_sSpeciesNames 
) throws ModelException

Constructor.

This will create the legend window and assign default colors to all the species.

Parameters
oManagerThe parent DataFileManager object.
sTitleWindow title
p_sSpeciesNamesThe list of species to display in the legend.
Exceptions
ModelExceptionif the list of species has 0 items, or wrapping another type of exception.

Member Function Documentation

◆ actionPerformed()

void sortie.datavisualizer.Legend.actionPerformed ( ActionEvent  e)

Triggered when a checkbox is toggled on or off.

All open charts are redrawn.

Parameters
eActionEvent. Ignored.

◆ chooseColor()

void sortie.datavisualizer.Legend.chooseColor ( ActionEvent  e)

Displays the color chooser when the user clicks the color chooser button, and extracts the chosen color.

Parameters
eActionEvent

◆ createColorList()

void sortie.datavisualizer.Legend.createColorList ( )
protected

Creates the GUI and lays out all the components.

Exceptions
java.lang.ExceptionIf anything goes wrong. This picks a default color for each of our species.

◆ createGUI()

void sortie.datavisualizer.Legend.createGUI ( ) throws Exception
private

Creates the GUI and lays out all the components.

Exceptions
ExceptionIf anything goes wrong.

◆ getIsSpeciesSelected()

boolean sortie.datavisualizer.Legend.getIsSpeciesSelected ( int  iIndex) throws ModelException

Get whether or not a species' checkbox indicates that it is selected.

Parameters
iIndexSpecies index number.
Returns
Whether or not the species is selected and should be shown in graphs.
Exceptions
ModelExceptionif the species index is not valid.

◆ getNumberOfSpecies()

int sortie.datavisualizer.Legend.getNumberOfSpecies ( )

Gets the total number of species for this legend.

Returns
Number of species.

◆ getSpeciesCodeName()

String sortie.datavisualizer.Legend.getSpeciesCodeName ( int  i) throws ModelException

Gets the internal code species name for a given species index.

Parameters
iSpecies index number.
Returns
Species name.
Exceptions
ModelExceptionIf the species index is not valid.

◆ getSpeciesColor() [1/2]

Color sortie.datavisualizer.Legend.getSpeciesColor ( int  iIndex) throws ModelException

Gets the color associated with a particular species.

Parameters
iIndexSpecies index number.
Returns
This species' color.
Exceptions
ModelExceptionif the species index is not valid.

◆ getSpeciesColor() [2/2]

Color sortie.datavisualizer.Legend.getSpeciesColor ( String  sName) throws ModelException

Gets the color associated with a particular species.

Parameters
sNameSpecies' name.
Returns
This species' color.
Exceptions
ModelExceptionModelException if the species name is not valid.

◆ getSpeciesDisplayName()

String sortie.datavisualizer.Legend.getSpeciesDisplayName ( int  i) throws ModelException

Gets the species display name for a given species index.

Parameters
iSpecies index number.
Returns
Species name.
Exceptions
ModelExceptionIf the species index is not valid.

Member Data Documentation

◆ m_oManager

DataFileManager sortie.datavisualizer.Legend.m_oManager
protected

Parent data file manager.

◆ mp_jSpeciesChecks

JCheckBox [] sortie.datavisualizer.Legend.mp_jSpeciesChecks
protected

Checkboxes indicating whether or not a species should be visible.

◆ mp_jSpeciesColorDisplays

JButton [] sortie.datavisualizer.Legend.mp_jSpeciesColorDisplays
protected

The color display for each species.

◆ mp_oSpeciesColors

Color [] sortie.datavisualizer.Legend.mp_oSpeciesColors
protected

The color for each species.

◆ mp_sDisplayNames

String [] sortie.datavisualizer.Legend.mp_sDisplayNames
protected

The names that will be displayed.

◆ mp_sSpeciesNames

String [] sortie.datavisualizer.Legend.mp_sSpeciesNames
protected

The names of each of the species.


The documentation for this class was generated from the following file: