crowdmodel.gui
Class UserPanelInitializer

java.lang.Object
  extended by crowdmodel.gui.UserPanelInitializer
All Implemented Interfaces:
repast.simphony.scenario.ModelInitializer

public class UserPanelInitializer
extends java.lang.Object
implements repast.simphony.scenario.ModelInitializer

The custom made user interface tab: user panel is defined/designed here. Everything needs to be defined here, the components, layout, ActionListeners, update of the GUI components and simuation parameters etc. The only thing that Repast does for you is provide a method that gets/sets the simulation parameters

Author:
Nanda Wijermans

Field Summary
static java.lang.String CBidentity
           
static java.lang.String CBsafety
           
static java.lang.String CBsocial
           
static java.lang.String CBsubsistence
           
private static java.lang.String ComboIDDist
           
private static java.lang.String ComboSafeDist
           
private static java.lang.String ComboSocDist
           
private static java.lang.String ComboSubsDist
           
(package private)  java.awt.event.ActionListener d_actionListener
           
(package private)  javax.swing.event.ChangeListener d_changeListener
           
(package private)  javax.swing.JSlider d_custoIDprefSlider
           
(package private)  javax.swing.JSlider d_custoSafePrefSlider
           
(package private)  javax.swing.JSlider d_custoSocPrefSlider
           
(package private)  javax.swing.JSlider d_custoSubsPrefSlider
           
(package private)  javax.swing.JCheckBox d_idCheckb
           
(package private)  javax.swing.JComboBox d_identityPrefCombb
           
(package private)  javax.swing.JSlider d_initIdentity
           
(package private)  javax.swing.JSlider d_initSafety
           
(package private)  javax.swing.JSlider d_initSocial
           
(package private)  java.awt.event.ItemListener d_itemListener
           
(package private)  javax.swing.JCheckBox d_safeCheckb
           
(package private)  javax.swing.JComboBox d_safetyPrefCombb
           
(package private)  javax.swing.JCheckBox d_socCheckb
           
(package private)  javax.swing.JComboBox d_socialPrefCombb
           
(package private)  javax.swing.JCheckBox d_subsCheckb
           
(package private)  javax.swing.JComboBox d_subsistencePrefCombb
           
private static java.lang.String SLcustoID
           
private static java.lang.String SLcustoSafe
           
private static java.lang.String SLcustoSoc
           
private static java.lang.String SLcustoSubs
           
private static java.lang.String SLinitID
           
private static java.lang.String SLinitSafe
           
private static java.lang.String SLinitSoc
           
 
Constructor Summary
UserPanelInitializer()
           
 
Method Summary
 void createListeners()
          Creates the listeners for the GUI-elements.
 void initialize(repast.simphony.scenario.Scenario scen, repast.simphony.engine.environment.RunEnvironmentBuilder builder)
          Takes care of the creation of my custom made panel while initialising the GUI
private  javax.swing.JPanel makeMyPanel()
          Defines a custom made panel in which one can design the user-editable parameters The GUI allows for setting the settings for the goals 1) indicate whether the goal should be turned on 2) the initial satisfaction level of the goal 3) the preference level of a goal (following a distribution or a customised number)
 void myGUIelements()
          Defines all the GUI elements that are used displayed in the User Panel.
 void setDist(java.lang.String name, java.lang.String dist)
          This function retrieves information from the Combo-boxes as soon as a selection is changed in the Graphical User Interface (GUI).
 void setGoalUsage(java.lang.String name, java.lang.Boolean selected)
          Sets the values coming from the checkboxes in the Graphical User Interface (GUI) updates these values in the GUIparams.java which is used by the simulation to update and set the simulation parameter.
 void setSliderInfo(java.lang.String name, double val)
          Sets the values coming from the sliders in the Graphical User Interface (GUI) updates these values in the GUIparams.java which is used by the simulation to update and set the simulation parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CBidentity

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

CBsocial

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

CBsafety

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

CBsubsistence

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

SLinitID

private static final java.lang.String SLinitID
See Also:
Constant Field Values

SLcustoID

private static final java.lang.String SLcustoID
See Also:
Constant Field Values

SLinitSoc

private static final java.lang.String SLinitSoc
See Also:
Constant Field Values

SLcustoSoc

private static final java.lang.String SLcustoSoc
See Also:
Constant Field Values

SLinitSafe

private static final java.lang.String SLinitSafe
See Also:
Constant Field Values

SLcustoSafe

private static final java.lang.String SLcustoSafe
See Also:
Constant Field Values

SLcustoSubs

private static final java.lang.String SLcustoSubs
See Also:
Constant Field Values

ComboIDDist

private static final java.lang.String ComboIDDist
See Also:
Constant Field Values

ComboSocDist

private static final java.lang.String ComboSocDist
See Also:
Constant Field Values

ComboSafeDist

private static final java.lang.String ComboSafeDist
See Also:
Constant Field Values

ComboSubsDist

private static final java.lang.String ComboSubsDist
See Also:
Constant Field Values

d_idCheckb

javax.swing.JCheckBox d_idCheckb

d_socCheckb

javax.swing.JCheckBox d_socCheckb

d_safeCheckb

javax.swing.JCheckBox d_safeCheckb

d_subsCheckb

javax.swing.JCheckBox d_subsCheckb

d_identityPrefCombb

javax.swing.JComboBox d_identityPrefCombb

d_socialPrefCombb

javax.swing.JComboBox d_socialPrefCombb

d_safetyPrefCombb

javax.swing.JComboBox d_safetyPrefCombb

d_subsistencePrefCombb

javax.swing.JComboBox d_subsistencePrefCombb

d_initIdentity

javax.swing.JSlider d_initIdentity

d_custoIDprefSlider

javax.swing.JSlider d_custoIDprefSlider

d_initSocial

javax.swing.JSlider d_initSocial

d_custoSocPrefSlider

javax.swing.JSlider d_custoSocPrefSlider

d_initSafety

javax.swing.JSlider d_initSafety

d_custoSafePrefSlider

javax.swing.JSlider d_custoSafePrefSlider

d_custoSubsPrefSlider

javax.swing.JSlider d_custoSubsPrefSlider

d_actionListener

java.awt.event.ActionListener d_actionListener

d_changeListener

javax.swing.event.ChangeListener d_changeListener

d_itemListener

java.awt.event.ItemListener d_itemListener
Constructor Detail

UserPanelInitializer

public UserPanelInitializer()
Method Detail

initialize

public void initialize(repast.simphony.scenario.Scenario scen,
                       repast.simphony.engine.environment.RunEnvironmentBuilder builder)
Takes care of the creation of my custom made panel while initialising the GUI

Specified by:
initialize in interface repast.simphony.scenario.ModelInitializer

makeMyPanel

private javax.swing.JPanel makeMyPanel()
Defines a custom made panel in which one can design the user-editable parameters The GUI allows for setting the settings for the goals 1) indicate whether the goal should be turned on 2) the initial satisfaction level of the goal 3) the preference level of a goal (following a distribution or a customised number)


myGUIelements

public void myGUIelements()
Defines all the GUI elements that are used displayed in the User Panel.


setGoalUsage

public void setGoalUsage(java.lang.String name,
                         java.lang.Boolean selected)
Sets the values coming from the checkboxes in the Graphical User Interface (GUI) updates these values in the GUIparams.java which is used by the simulation to update and set the simulation parameter. This represent the connection between the GUI and the simulation. The checkboxes in the GUI represent the participation of the role of the possible goals in the agents. They can be switched on and off here.

Parameters:
name -
selected -

setSliderInfo

public void setSliderInfo(java.lang.String name,
                          double val)
Sets the values coming from the sliders in the Graphical User Interface (GUI) updates these values in the GUIparams.java which is used by the simulation to update and set the simulation parameter. This represent the connection between the GUI and the simulation The sliders here allow for setting the initial or current satisfaction level of the goals as well as the preferred level of satisfaction of the goals

Parameters:
name -
val -

setDist

public void setDist(java.lang.String name,
                    java.lang.String dist)
This function retrieves information from the Combo-boxes as soon as a selection is changed in the Graphical User Interface (GUI). These values are stored in the GUIparams.java which is used by the simulation to update and set the simulation parameters. This represent the connection between the GUI and the simulation More specifically, the combo-boxes allow for indicating the distribution of the preferred goal-level of the agents. This allows for a heterogeneous set of agents as this preference is an unique attribute of an agent.

Parameters:
name -
dist -

createListeners

public void createListeners()
Creates the listeners for the GUI-elements. Listeners are functions that notice changes a user can apply by (de)selecting, sliding etc. So it allows for the changes/settings inflicted by the user to have effect in the simulation