cage.generator
Class SizeOptionsMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by java.util.TreeMap
          extended by cage.generator.SizeOptionsMap
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, java.util.Map, java.util.SortedMap, javax.swing.event.ChangeListener

public class SizeOptionsMap
extends java.util.TreeMap
implements javax.swing.event.ChangeListener, java.awt.event.ActionListener

See Also:
Serialized Form

Constructor Summary
SizeOptionsMap(javax.swing.JPanel optionsPanel, java.awt.Component sizesComponent, javax.swing.BoundedRangeModel sizesModel, javax.swing.JToggleButton includedButton)
          Creates a new SizeOptionsMap that allows a user to add certain allowed sizes (face sizes or vertex degrees).
SizeOptionsMap(javax.swing.JPanel optionsPanel, java.awt.Component sizesComponent, javax.swing.BoundedRangeModel sizesModel, javax.swing.JToggleButton includedButton, boolean dual, boolean limitable)
          Creates a new SizeOptionsMap that allows a user to add certain allowed face sizes or vertex degree (in case dual is true).
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addChangeListener(javax.swing.event.ChangeListener l)
          Add a ChangeListener to this object.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Remove a ChangeListener from this object.
 void setSizeIncluded(int size, boolean included)
           
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, put, putAll, remove, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

SizeOptionsMap

public SizeOptionsMap(javax.swing.JPanel optionsPanel,
                      java.awt.Component sizesComponent,
                      javax.swing.BoundedRangeModel sizesModel,
                      javax.swing.JToggleButton includedButton)
Creates a new SizeOptionsMap that allows a user to add certain allowed sizes (face sizes or vertex degrees). The panel optionsPanel is used to add controls to which allow the user to easily remove an allowed size or limit the number of those faces/vertices. For this to work correctly it is assumed that this panel has a GridBagLayout. The constructor explicitly sets this layout and you should not alter this at a later point. The component facesComponent is the component that is used for selecting the face size and will usually be a JSlider or a JSpinner. A reference to this component is only used to give it the focus. The facesModel is used to determine the face size that needs to be added or removed when includedButton is pressed.

Parameters:
optionsPanel - The panel on which the options for the allowed gons are shown
sizesComponent - The component that is used for the selection of the sizes (usually a slider)
sizesModel - The model that shows which size needs to be added or removed.
includedButton - The button used to add or remove sizes.

SizeOptionsMap

public SizeOptionsMap(javax.swing.JPanel optionsPanel,
                      java.awt.Component sizesComponent,
                      javax.swing.BoundedRangeModel sizesModel,
                      javax.swing.JToggleButton includedButton,
                      boolean dual,
                      boolean limitable)
Creates a new SizeOptionsMap that allows a user to add certain allowed face sizes or vertex degree (in case dual is true). The panel optionsPanel is used to add controls to which allow the user to easily remove an allowed face size (respectively vertex degree) or limit the number of those faces (respectively vertices) if limitable is true. For this to work correctly it is assumed that this panel has a GridBagLayout. The constructor explicitly sets this layout and you should not alter this at a later point. The component facesComponent is the component that is used for selecting the face size (respectively vertex degree )and will usually be a JSlider or a JSpinner. A reference to this component is only used to give it the focus. The facesModel is used to determine the face size (respectively vertex degree) that needs to be added or removed when includedButton is pressed.

Parameters:
optionsPanel - The panel on which the options for the allowed gons are shown
sizesComponent - The component that is used for the selection of the sizes (usually a slider)
sizesModel - The model that shows which size needs to be added or removed.
includedButton - The button used to add or remove sizes.
dual - If true this object is used for vertex degrees.
limitable - If true the user can limit the number of faces (resp. vertices) with a certain size (resp. degree).
Method Detail

setSizeIncluded

public void setSizeIncluded(int size,
                            boolean included)

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Add a ChangeListener to this object.

Parameters:
l - The ChangeListener to add.

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Remove a ChangeListener from this object.

Parameters:
l - The ChangeListener to remove.