org.samcrow
Class DisplayOptions

java.lang.Object
  extended by org.samcrow.DisplayOptions
All Implemented Interfaces:
java.awt.event.ItemListener, java.util.EventListener

public class DisplayOptions
extends java.lang.Object
implements java.awt.event.ItemListener

Manages the display options for the map

Author:
Sam Crow

Nested Class Summary
static interface DisplayOptions.DisplayChangeListener
          Interface for a class that wants to be notified when the display state changes
 class DisplayOptions.DisplayState
          Contains the state of display of various components.
Waypoints: nodes that are waypoints, not destinations. Destinations: nodes that are destinations. Destination labels: labels for destinations. Links: links between nodes. Link speeds: labels indicating the speeds of links
 
Field Summary
private  boolean[] defaultState
           
private  javax.swing.JCheckBox displayDestinationLabelsBox
           
private  javax.swing.JCheckBox displayDestinationsBox
           
private  javax.swing.JLabel displayLabel
           
private  javax.swing.JCheckBox displayLinksBox
           
private  javax.swing.JCheckBox displayLinkSpeedsBox
           
private  javax.swing.JCheckBox displayWaypointsBox
           
private  DisplayOptions.DisplayChangeListener listener
           
private  DisplayOptions.DisplayState state
           
static java.lang.String STATE_CHANGE_ACTION
           
 
Constructor Summary
DisplayOptions(org.lekan.graphics.GraphicsProgram program, java.lang.String borderPosition)
          Initialize the set of options.
 
Method Summary
 void addDisplayChangeListener(DisplayOptions.DisplayChangeListener l)
          Add a DisplayChangeListener to be notified when the display state changes.
It is not necessary to call this method if the GraphicsProgram passed into the constructor implements DisplayChangeListener, because it will already have been made the listener.
This class only supports one DisplayChangeListener.
 void itemStateChanged(java.awt.event.ItemEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_CHANGE_ACTION

public static final java.lang.String STATE_CHANGE_ACTION
See Also:
Constant Field Values

displayLabel

private javax.swing.JLabel displayLabel

displayWaypointsBox

private javax.swing.JCheckBox displayWaypointsBox

displayDestinationsBox

private javax.swing.JCheckBox displayDestinationsBox

displayDestinationLabelsBox

private javax.swing.JCheckBox displayDestinationLabelsBox

displayLinksBox

private javax.swing.JCheckBox displayLinksBox

displayLinkSpeedsBox

private javax.swing.JCheckBox displayLinkSpeedsBox

defaultState

private boolean[] defaultState

state

private DisplayOptions.DisplayState state

listener

private DisplayOptions.DisplayChangeListener listener
Constructor Detail

DisplayOptions

public DisplayOptions(org.lekan.graphics.GraphicsProgram program,
                      java.lang.String borderPosition)
Initialize the set of options. This will add the user interface elements and set them to their default states.
If program implements DisplayChangeListener, it will automatically be added as a listener

Parameters:
program - the GraphicsProgram to add the elements to
borderPosition - NORTH, SOUTH, EAST, or WEST panel to add the elements to
Method Detail

addDisplayChangeListener

public void addDisplayChangeListener(DisplayOptions.DisplayChangeListener l)
Add a DisplayChangeListener to be notified when the display state changes.
It is not necessary to call this method if the GraphicsProgram passed into the constructor implements DisplayChangeListener, because it will already have been made the listener.
This class only supports one DisplayChangeListener. Adding one will replace the old one.

Parameters:
l - the listener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener