@@ -82,16 +82,7 @@ public class Main extends JFrame {
8282 private static final Color DEFAULT_BG_COLOR = Color .BLACK ;
8383 private static final Color Vertex_COLOR = Color .WHITE ;
8484 private static int DELAY = 2048 ;
85- private JSlider friendDurThreshold ;
86- private JSlider friendNumMeetThreshold ;
87- private JSlider classmateDurThreshold ;
88- private JSlider classmateNumMeetThreshold ;
89- private JSlider fsDurThreshold ;
90- private JSlider fsNumMeetThreshold ;
91- private JSlider strangerDurThreshold ;
92- private JSlider strangerNumMeetThreshold ;
93- private JSlider studyGDurThreshold ;
94- private JSlider studyGNumMeetThreshold ;
85+ // Slider/checkbox state is now accessed through categoryRows[] — see initializeCategoryPanel()
9586 private String month ;
9687 private String date ;
9788 private String timeStamp ;
@@ -130,11 +121,11 @@ private void syncRenderers() {
130121 */
131122 private ThresholdConfig currentThresholds () {
132123 return new ThresholdConfig .Builder ()
133- .friend (friendDurThreshold . getValue (), friendNumMeetThreshold .getValue ())
134- .familiarStranger (fsDurThreshold . getValue (), fsNumMeetThreshold .getValue ())
135- .classmate (classmateDurThreshold . getValue (), classmateNumMeetThreshold .getValue ())
136- .stranger (strangerDurThreshold . getValue (), strangerNumMeetThreshold .getValue ())
137- .studyGroup (studyGDurThreshold . getValue (), studyGNumMeetThreshold .getValue ())
124+ .friend (categoryRows [ 0 ]. durationSlider . getValue (), categoryRows [ 0 ]. meetingSlider .getValue ())
125+ .familiarStranger (categoryRows [ 2 ]. durationSlider . getValue (), categoryRows [ 2 ]. meetingSlider .getValue ())
126+ .classmate (categoryRows [ 1 ]. durationSlider . getValue (), categoryRows [ 1 ]. meetingSlider .getValue ())
127+ .stranger (categoryRows [ 3 ]. durationSlider . getValue (), categoryRows [ 3 ]. meetingSlider .getValue ())
128+ .studyGroup (categoryRows [ 4 ]. durationSlider . getValue (), categoryRows [ 4 ]. meetingSlider .getValue ())
138129 .build ();
139130 }
140131 private List <Edge > friendEdges = new ArrayList <>();
@@ -150,31 +141,9 @@ private ThresholdConfig currentThresholds() {
150141 private JSlider timeline ;
151142 private JPanel contentPanel ;
152143 private JPanel toolPanel ;
153- private JCheckBox showFriend ;
154- private JCheckBox showClassmate ;
155- private JCheckBox showFS ;
156- private JCheckBox showStranger ;
157- private JCheckBox showStudy ;
158144 private Timer timer ;
159- private JButton playButton ;
160- private JButton stopButton ;
161- private JButton pauseButton ;
162- private JButton frShowParam ;
163- private JButton fsShowParam ;
164- private JButton cShowParam ;
165- private JButton sShowParam ;
166- private JButton sgShowParam ;
167145 private Box [] categoryPanel ;
168- private JPanel frHpanel ;
169- private JPanel fsHpanel ;
170- private JPanel cHpanel ;
171- private JPanel sHpanel ;
172- private JPanel sgHpanel ;
173146 private int NUM_EDGES_IMP_GRAPH = 20 ;
174- private JButton prevButton ;
175- private JButton nextButton ;
176- private JButton slowButton ;
177- private JButton fastButton ;
178147 private Collection <String > OldVertices ;
179148 private int prevTimeline ;
180149 private JPanel legendPanel ;
@@ -263,11 +232,11 @@ private boolean isEdgeTypeVisible(String typeCode) {
263232 EdgeType type = EdgeType .fromCode (typeCode );
264233 if (type == null ) return true ; // unknown types are visible by default
265234 switch (type ) {
266- case FRIEND : return showFriend .isSelected ();
267- case CLASSMATE : return showClassmate .isSelected ();
268- case FAMILIAR : return showFS .isSelected ();
269- case STRANGER : return showStranger .isSelected ();
270- case STUDY_GROUP : return showStudy .isSelected ();
235+ case FRIEND : return categoryRows [ 0 ]. checkbox .isSelected ();
236+ case CLASSMATE : return categoryRows [ 1 ]. checkbox .isSelected ();
237+ case FAMILIAR : return categoryRows [ 2 ]. checkbox .isSelected ();
238+ case STRANGER : return categoryRows [ 3 ]. checkbox .isSelected ();
239+ case STUDY_GROUP : return categoryRows [ 4 ]. checkbox .isSelected ();
271240 default : return true ;
272241 }
273242 }
@@ -863,20 +832,20 @@ public final void initializeTimeLine() {
863832
864833
865834
866- playButton = createTimelineButton ("images/play.png" , "Play" , e -> {
835+ JButton playButton = createTimelineButton ("images/play.png" , "Play" , e -> {
867836 LOGGER .fine ("Play pressed" );
868837 timer .start ();
869838 });
870- pauseButton = createTimelineButton ("images/pause.png" , "Pause" , e -> {
839+ JButton pauseButton = createTimelineButton ("images/pause.png" , "Pause" , e -> {
871840 LOGGER .fine ("Pause pressed" );
872841 timer .stop ();
873842 });
874- stopButton = createTimelineButton ("images/stop.png" , "Stop" , e -> {
843+ JButton stopButton = createTimelineButton ("images/stop.png" , "Stop" , e -> {
875844 LOGGER .fine ("Stop pressed" );
876845 timeline .setValue (1 );
877846 timer .stop ();
878847 });
879- prevButton = createTimelineButton ("images/prev.png" , "Previous important graph" , e -> {
848+ JButton prevButton = createTimelineButton ("images/prev.png" , "Previous important graph" , e -> {
880849 try {
881850 LOGGER .fine ("Prev pressed" );
882851 nextOrPrevGraph ("prev" );
@@ -885,7 +854,7 @@ public final void initializeTimeLine() {
885854 LOGGER .log (Level .SEVERE , null , ex );
886855 }
887856 });
888- nextButton = createTimelineButton ("images/next.png" , "Next important graph" , e -> {
857+ JButton nextButton = createTimelineButton ("images/next.png" , "Next important graph" , e -> {
889858 try {
890859 LOGGER .fine ("Next pressed" );
891860 nextOrPrevGraph ("next" );
@@ -894,12 +863,12 @@ public final void initializeTimeLine() {
894863 LOGGER .log (Level .SEVERE , null , ex );
895864 }
896865 });
897- slowButton = createTimelineButton ("images/slow.png" , "Slow down" , e -> {
866+ JButton slowButton = createTimelineButton ("images/slow.png" , "Slow down" , e -> {
898867 DELAY = DELAY * 2 ;
899868 timer .setDelay (DELAY );
900869 LOGGER .fine ("Slow pressed, delay=" + timer .getDelay ());
901870 });
902- fastButton = createTimelineButton ("images/fast.png" , "Speed up" , e -> {
871+ JButton fastButton = createTimelineButton ("images/fast.png" , "Speed up" , e -> {
903872 DELAY = DELAY / 2 ;
904873 timer .setDelay (DELAY );
905874 LOGGER .fine ("Fast pressed, delay=" + timer .getDelay ());
@@ -1028,38 +997,6 @@ public final void initializeCategoryPanel() {
1028997 "STRANGERS (Location : public,pathways)" , 25 );
1029998 categoryRows [4 ] = createCategoryRow (EdgeType .STUDY_GROUP , studyGEdges ,
1030999 "STUDY GROUPS (Location : public)" , 50 );
1031-
1032- // Alias the sliders/checkboxes/panels to existing fields so that the
1033- // rest of Main.java (addGraph, generateFile calls, etc.) still compiles.
1034- showFriend = categoryRows [0 ].checkbox ;
1035- friendDurThreshold = categoryRows [0 ].durationSlider ;
1036- friendNumMeetThreshold = categoryRows [0 ].meetingSlider ;
1037- frShowParam = categoryRows [0 ].settingsButton ;
1038- frHpanel = categoryRows [0 ].headerPanel ;
1039-
1040- showClassmate = categoryRows [1 ].checkbox ;
1041- classmateDurThreshold = categoryRows [1 ].durationSlider ;
1042- classmateNumMeetThreshold = categoryRows [1 ].meetingSlider ;
1043- cShowParam = categoryRows [1 ].settingsButton ;
1044- cHpanel = categoryRows [1 ].headerPanel ;
1045-
1046- showFS = categoryRows [2 ].checkbox ;
1047- fsDurThreshold = categoryRows [2 ].durationSlider ;
1048- fsNumMeetThreshold = categoryRows [2 ].meetingSlider ;
1049- fsShowParam = categoryRows [2 ].settingsButton ;
1050- fsHpanel = categoryRows [2 ].headerPanel ;
1051-
1052- showStranger = categoryRows [3 ].checkbox ;
1053- strangerDurThreshold = categoryRows [3 ].durationSlider ;
1054- strangerNumMeetThreshold = categoryRows [3 ].meetingSlider ;
1055- sShowParam = categoryRows [3 ].settingsButton ;
1056- sHpanel = categoryRows [3 ].headerPanel ;
1057-
1058- showStudy = categoryRows [4 ].checkbox ;
1059- studyGDurThreshold = categoryRows [4 ].durationSlider ;
1060- studyGNumMeetThreshold = categoryRows [4 ].meetingSlider ;
1061- sgShowParam = categoryRows [4 ].settingsButton ;
1062- sgHpanel = categoryRows [4 ].headerPanel ;
10631000 }
10641001
10651002 /**
0 commit comments