1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package p3j.gui.dialogs;
17
18 import java.awt.BorderLayout;
19 import java.awt.Dimension;
20 import java.awt.Frame;
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23 import java.util.ArrayList;
24 import java.util.List;
25
26 import javax.swing.BoxLayout;
27 import javax.swing.DefaultComboBoxModel;
28 import javax.swing.DefaultListModel;
29 import javax.swing.JButton;
30 import javax.swing.JComboBox;
31 import javax.swing.JDialog;
32 import javax.swing.JLabel;
33 import javax.swing.JList;
34 import javax.swing.JPanel;
35 import javax.swing.JScrollPane;
36 import javax.swing.JTextArea;
37 import javax.swing.JTextField;
38 import javax.swing.event.ListSelectionEvent;
39 import javax.swing.event.ListSelectionListener;
40
41 import p3j.gui.P3J;
42 import p3j.gui.misc.ParameterListCellRenderer;
43 import p3j.misc.Misc;
44 import p3j.misc.gui.GUI;
45 import p3j.misc.math.Matrix;
46 import p3j.pppm.ProjectionModel;
47 import p3j.pppm.parameters.ParameterAssignment;
48 import p3j.pppm.parameters.ParameterInstance;
49 import p3j.pppm.sets.Set;
50 import p3j.pppm.sets.SetType;
51
52
53
54
55
56
57
58
59
60
61
62
63
64 @Deprecated
65 public class EditSetsDialog extends JDialog {
66
67
68 private static final long serialVersionUID = -5975274418446080442L;
69
70
71 private static final int AVAILABLE_SET_PANEL_HEIGHT = 350;
72
73
74 private static final int AVAILABLE_SETS_PANEL_WIDTH = 200;
75
76
77 private static final int EXISTING_MATRIX_PANEL_HEIGHT = 350;
78
79
80 private static final int EXISTING_MATRIX_PANEL_WIDTH = 200;
81
82
83 private static final int AVAILABLE_PARAMS_PANEL_HEIGHT = 350;
84
85
86 private static final int AVAILABLE_PARAMS_PANEL_WIDTH = 400;
87
88
89 public static final int DIALOG_WIDTH = 1200;
90
91
92 public static final int DIALOG_HEIGHT = 640;
93
94
95 private final ProjectionModel projection;
96
97
98 private SetType currentSetType;
99
100
101 private Set currentSet;
102
103
104 private ParameterInstance currentParameter;
105
106
107 private ParameterAssignment currentParameterAssignment;
108
109
110
111
112 private JPanel contentPanel;
113
114
115 private JPanel setEditingPanel;
116
117
118 private JPanel editSetPanel;
119
120
121 private JPanel chooseTypeCreateSetPanel;
122
123
124 private JPanel setContentEditingPanel;
125
126
127 private JPanel editMatrixPanel;
128
129
130 private JPanel showExistingMatricesPanel;
131
132
133 private JPanel showAvailableParametersPanel;
134
135
136 private JPanel showAvailableSetsPanel;
137
138
139
140
141 private JList matricesList = new JList(new DefaultListModel());
142 {
143 matricesList.addListSelectionListener(new ListSelectionListener() {
144 @Override
145 public void valueChanged(ListSelectionEvent e) {
146 currentParameterAssignment = (ParameterAssignment) matricesList
147 .getSelectedValue();
148 updateMatrixFields();
149 }
150 });
151 }
152
153
154 private final ParameterListCellRenderer paramListRenderer = new ParameterListCellRenderer(
155 this);
156
157
158 private final JList parametersList = new JList(new DefaultListModel());
159 {
160 parametersList.setCellRenderer(paramListRenderer);
161 parametersList.addListSelectionListener(new ListSelectionListener() {
162 @Override
163 public void valueChanged(ListSelectionEvent e) {
164 currentParameter = (ParameterInstance) parametersList
165 .getSelectedValue();
166 refreshAssignments(0);
167 }
168 });
169 }
170
171
172 private final JList setsList = new JList(new DefaultListModel());
173 {
174 setsList.addListSelectionListener(new ListSelectionListener() {
175 @Override
176 public void valueChanged(ListSelectionEvent e) {
177 currentSet = (Set) setsList.getSelectedValue();
178 updateSetFields();
179 refreshAssignments(0);
180 }
181 });
182 }
183
184
185
186
187 private final JTextField currentSetName = new JTextField(15);
188
189
190 private final JTextField currentSetProb = new JTextField(3);
191
192
193 private final JTextField newSetName = new JTextField(15);
194
195
196 private final JTextArea currentSetDesc = new JTextArea(5, 30);
197
198
199 private final JComboBox availableSetTypes = new JComboBox();
200 {
201 availableSetTypes.addActionListener(new ActionListener() {
202 @Override
203 public void actionPerformed(ActionEvent e) {
204 currentSetType = (SetType) availableSetTypes.getSelectedItem();
205 refreshSetType(0, 0);
206 }
207 });
208 }
209
210
211 private final JTextField currentMatrixName = new JTextField(15);
212
213
214 private final JTextField currentMatrixProb = new JTextField(3);
215
216
217 private final JTextArea currentMatrixDesc = new JTextArea(7, 15);
218
219
220
221
222
223 private final JComboBox availableSetsCombo = new JComboBox();
224
225
226 private final JComboBox availableParametersCombo = new JComboBox();
227
228
229
230
231 private final JButton changeCurrentSetButton = new JButton("Change");
232 {
233 changeCurrentSetButton.addActionListener(new ActionListener() {
234 @Override
235 public void actionPerformed(ActionEvent e) {
236 storeSetFields();
237 }
238 });
239 }
240
241
242 private final JButton deleteCurrentSetButton = new JButton("Delete");
243 {
244 deleteCurrentSetButton.addActionListener(new ActionListener() {
245 @Override
246 public void actionPerformed(ActionEvent e) {
247 deleteCurrentSet();
248 }
249 });
250 }
251
252
253 private final JButton createNewSetButton = new JButton("Add");
254 {
255 createNewSetButton.addActionListener(new ActionListener() {
256 @Override
257 public void actionPerformed(ActionEvent e) {
258 currentSetType.createSet(newSetName.getText(),
259 "Edit set description here.", 0);
260 refreshSetType(currentSetType.getNumOfSets() - 1, -1);
261 }
262 });
263 }
264
265
266 private final JButton editCurrentMatrixButton = new JButton("Edit values");
267 {
268 editCurrentMatrixButton.addActionListener(new ActionListener() {
269 @Override
270 public void actionPerformed(ActionEvent e) {
271 editCurrentMatrix();
272 }
273 });
274 }
275
276
277 private final JButton deleteCurrentMatrixButton = new JButton("Delete");
278 {
279 deleteCurrentMatrixButton.addActionListener(new ActionListener() {
280 @Override
281 public void actionPerformed(ActionEvent e) {
282 deleteCurrentMatrix();
283 }
284 });
285 }
286
287
288
289
290
291 private final JButton changeCurrentMatrixButton = new JButton("Save");
292 {
293 changeCurrentMatrixButton.addActionListener(new ActionListener() {
294 @Override
295 public void actionPerformed(ActionEvent e) {
296 storeMatrixFields();
297 }
298 });
299 }
300
301
302 private final JButton newMatrixButton = new JButton("New");
303 {
304 newMatrixButton.addActionListener(new ActionListener() {
305 @Override
306 public void actionPerformed(ActionEvent e) {
307 createNewMatrix();
308 }
309 });
310 }
311
312
313 private final JButton copyMatrixButton = new JButton("Copy");
314 {
315 copyMatrixButton.addActionListener(new ActionListener() {
316 @Override
317 public void actionPerformed(ActionEvent e) {
318 copyMatrix();
319 }
320 });
321 }
322
323
324
325
326
327
328
329
330
331 public EditSetsDialog(Frame owner, ProjectionModel proj) {
332 super(owner);
333
334 this.projection = proj;
335
336 availableSetTypes.setModel(new DefaultComboBoxModel(projection
337 .getUserDefinedTypes().toArray()));
338
339 initialize();
340 resetUI();
341 }
342
343
344
345
346 protected void copyMatrix() {
347
348 Set targetSet = (Set) availableSetsCombo.getSelectedItem();
349 int setIndex = availableSetsCombo.getSelectedIndex();
350 ParameterInstance targetParameter = (ParameterInstance) availableParametersCombo
351 .getSelectedItem();
352 int parameterIndex = availableParametersCombo.getSelectedIndex();
353
354 if (targetSet == null || targetParameter == null) {
355 return;
356 }
357
358 ParameterAssignment paramAssign = new ParameterAssignment(targetParameter);
359
360 paramAssign.setName(currentMatrixName.getText());
361 paramAssign.setDescription(currentMatrixDesc.getText());
362 paramAssign.setProbability(Misc.parseToDoubleProb(currentMatrixProb
363 .getText()));
364 paramAssign
365 .setMatrix(currentParameterAssignment != null ? currentParameterAssignment
366 .getMatrix().copy() : new Matrix(currentParameter
367 .createEmptyValue()));
368
369 targetSet.addParameterAssignment(paramAssign);
370
371 this.currentSet = targetSet;
372 this.currentParameter = targetParameter;
373
374 refreshSets(false, setIndex);
375 refreshParameters(true, parameterIndex);
376 }
377
378
379
380
381 public final void resetUI() {
382 if (projection.getNumOfSetTypes() > 0) {
383 availableSetTypes.setSelectedIndex(0);
384 currentSetType = (SetType) availableSetTypes.getSelectedItem();
385 refreshSetType(0, 0);
386 }
387 }
388
389
390
391
392 private void initialize() {
393 this.setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
394 this.setContentPane(getContentPanel());
395 this.setTitle("Edit Sets");
396 }
397
398
399
400 @Override
401 public void setVisible(boolean visible) {
402 availableSetTypes.setModel(new DefaultComboBoxModel(projection
403 .getUserDefinedTypes().toArray()));
404 super.setVisible(visible);
405 }
406
407
408
409
410
411
412
413
414
415 final void refreshSetType(int setIndex, int matrixIndex) {
416 if (currentSetType == null) {
417 return;
418 }
419 refreshSets(false, setIndex);
420 refreshParameters(false, -1);
421 refreshAssignments(matrixIndex);
422 }
423
424
425
426
427
428
429
430
431
432 final void refreshSets(boolean refreshAll, int setIndex) {
433
434 List<Set> sets = currentSetType.getSets();
435 availableSetsCombo.setModel(new DefaultComboBoxModel(sets.toArray()));
436
437 GUI.replaceListContents((DefaultListModel) setsList.getModel(), sets);
438
439 Set selectedSet = sets.size() > setIndex ? sets.get(setIndex) : null;
440 currentSet = selectedSet;
441
442 if (selectedSet != null) {
443 setsList.setSelectedIndex(setIndex);
444 } else if (sets.size() > 0) {
445 setsList.setSelectedIndex(0);
446 currentSet = sets.get(0);
447 }
448
449 updateSetFields();
450
451 if (refreshAll) {
452 refreshAssignments(0);
453 }
454 }
455
456
457
458
459
460
461
462
463
464 final void refreshParameters(boolean refreshAll, int selIndex) {
465
466 int selectedIndex = selIndex < 0 ? parametersList.getSelectedIndex()
467 : selIndex;
468
469 List<ParameterInstance> parameters = currentSetType.getDefinedParameters();
470 availableParametersCombo.setModel(new DefaultComboBoxModel(parameters
471 .toArray()));
472
473 GUI.replaceListContents((DefaultListModel) parametersList.getModel(),
474 parameters);
475
476 ParameterInstance selectedParameter = parameters.size() > selectedIndex
477 && selectedIndex >= 0 ? parameters.get(selectedIndex) : null;
478
479 currentParameter = selectedParameter;
480
481 if (selectedParameter != null) {
482 parametersList.setSelectedIndex(selectedIndex);
483 } else if (parameters.size() > 0) {
484 parametersList.setSelectedIndex(0);
485 currentParameter = parameters.get(0);
486 }
487
488 if (refreshAll) {
489 refreshAssignments(0);
490 }
491 }
492
493
494
495
496
497
498
499 final void refreshAssignments(int matIndex) {
500
501 int matrixIndex = Math.max(0, matIndex);
502
503 List<ParameterAssignment> matrices = null;
504
505 if (currentSet != null && currentParameter != null) {
506 matrices = new ArrayList<ParameterAssignment>(currentSet
507 .getParameterAssignments(currentParameter).getAssignments());
508 }
509
510 GUI.replaceListContents((DefaultListModel) matricesList.getModel(),
511 matrices);
512
513 if (matrices != null) {
514 ParameterAssignment selectedMatrix = matrices.size() > matrixIndex ? matrices
515 .get(matrixIndex) : null;
516
517 if (selectedMatrix != null) {
518 matricesList.setSelectedIndex(matrixIndex);
519 currentParameterAssignment = matrices.get(matrixIndex);
520 } else if (matrices.size() > 0) {
521 matricesList.setSelectedIndex(0);
522 currentParameterAssignment = matrices.get(0);
523 }
524 }
525
526 updateMatrixFields();
527
528 }
529
530
531
532
533
534
535 final void updateSetFields() {
536 currentSetName.setText(currentSet == null ? "" : currentSet.getName());
537 currentSetProb.setText(currentSet == null ? "" : Double.toString(currentSet
538 .getProbability()));
539 currentSetDesc.setText(currentSet == null ? "" : currentSet
540 .getDescription());
541 }
542
543
544
545
546
547 final void updateMatrixFields() {
548 currentMatrixName.setText(currentParameterAssignment == null ? ""
549 : currentParameterAssignment.getName());
550 currentMatrixProb.setText(currentParameterAssignment == null ? "" : Double
551 .toString(currentParameterAssignment.getProbability()));
552 currentMatrixDesc.setText(currentParameterAssignment == null ? ""
553 : currentParameterAssignment.getDescription());
554 }
555
556
557
558
559 void storeSetFields() {
560
561 if (currentSet == null) {
562 return;
563 }
564
565 currentSet.setName(currentSetName.getText());
566 currentSet.setDescription(currentSetDesc.getText());
567 currentSet.setProbability(Double.parseDouble(currentSetProb.getText()));
568
569 setsList.repaint();
570 }
571
572
573
574
575 void storeMatrixFields() {
576 if (currentParameterAssignment == null) {
577 return;
578 }
579 currentParameterAssignment.setName(currentMatrixName.getText());
580 currentParameterAssignment.setDescription(currentMatrixDesc.getText());
581 currentParameterAssignment.setProbability(Misc
582 .parseToDoubleProb(currentMatrixProb.getText()));
583
584 matricesList.repaint();
585 }
586
587
588
589
590 void deleteCurrentSet() {
591
592 if (currentSet == null) {
593 return;
594 }
595
596 currentSetType.removeSet(currentSet);
597 refreshSetType(setsList.getSelectedIndex() - 1,
598 matricesList.getSelectedIndex());
599 }
600
601
602
603
604 void deleteCurrentMatrix() {
605
606 if (currentSet == null || currentParameterAssignment == null) {
607 return;
608 }
609
610 int selectedIndex = matricesList.getSelectedIndex();
611 currentSet.removeParameterAssignment(currentParameterAssignment);
612 refreshAssignments(selectedIndex - 1);
613
614 }
615
616
617
618
619 void createNewMatrix() {
620
621 if (currentSet == null || currentParameter == null) {
622 return;
623 }
624
625 ParameterAssignment paramAssign = new ParameterAssignment(currentParameter);
626
627 paramAssign.setName(currentMatrixName.getText());
628 paramAssign.setDescription(currentMatrixDesc.getText());
629 paramAssign.setProbability(Misc.parseToDoubleProb(currentMatrixProb
630 .getText()));
631 paramAssign
632 .setMatrix(currentParameterAssignment != null ? currentParameterAssignment
633 .getMatrix().copy() : new Matrix(currentParameter
634 .createEmptyValue()));
635
636 currentSet.addParameterAssignment(paramAssign);
637
638 refreshAssignments(currentSet.getNumberOfAssignments(currentParameter) - 1);
639 }
640
641
642
643
644 void editCurrentMatrix() {
645 if (currentParameterAssignment == null) {
646 return;
647 }
648 EditMatrixDialog editMatrixDialog = new EditMatrixDialog(P3J.getInstance(),
649 currentParameterAssignment);
650 editMatrixDialog.setVisible(true);
651 }
652
653
654
655
656
657
658
659
660 private JPanel getContentPanel() {
661 if (contentPanel == null) {
662 contentPanel = new JPanel(GUI.getStdBorderLayout());
663 contentPanel.add(getSetEditingPanel(), BorderLayout.NORTH);
664 contentPanel.add(getSetContentEditingPanel(), BorderLayout.CENTER);
665 contentPanel.add(getCopyMatrixPanel(), BorderLayout.SOUTH);
666 }
667 return contentPanel;
668 }
669
670
671
672
673
674
675 private JPanel getSetEditingPanel() {
676 if (setEditingPanel == null) {
677 setEditingPanel = new JPanel(GUI.getStdBorderLayout());
678 setEditingPanel.add(getChooseTypeAndCreateSetsPanel(), BorderLayout.WEST);
679 setEditingPanel.add(getEditSetPanel(), BorderLayout.CENTER);
680 }
681 return setEditingPanel;
682 }
683
684
685
686
687
688
689 private JPanel getSetContentEditingPanel() {
690
691 if (setContentEditingPanel == null) {
692 setContentEditingPanel = new JPanel();
693 setContentEditingPanel.add(getShowAvailableSetsPanel());
694 setContentEditingPanel.add(getShowAvailableParametersPanel());
695 setContentEditingPanel.add(getShowExistingMatricesPanel());
696 setContentEditingPanel.add(getEditMatrixPanel());
697 }
698
699 return setContentEditingPanel;
700 }
701
702
703
704
705
706
707 private JPanel getEditMatrixPanel() {
708
709 if (editMatrixPanel == null) {
710 editMatrixPanel = new JPanel(GUI.getStdBorderLayout());
711 editMatrixPanel.add(new JLabel("Edit matrix:"), BorderLayout.NORTH);
712
713 JPanel editMatrixInnerPanel = new JPanel(GUI.getStdBorderLayout());
714 editMatrixPanel.add(editMatrixInnerPanel, BorderLayout.CENTER);
715
716
717 JPanel editNameProbPanel = new JPanel(GUI.getStdBorderLayout());
718 editMatrixInnerPanel.add(editNameProbPanel, BorderLayout.NORTH);
719
720 JPanel editNamePanel = new JPanel();
721 editNameProbPanel.add(editNamePanel, BorderLayout.NORTH);
722 editNamePanel.add(new JLabel(Misc.GUI_LABEL_NAME));
723 editNamePanel.add(currentMatrixName);
724 editNamePanel.add(editCurrentMatrixButton);
725
726 JPanel editProbPanel = new JPanel();
727 editNameProbPanel.add(editProbPanel, BorderLayout.SOUTH);
728 editProbPanel.add(new JLabel(Misc.GUI_LABEL_PROBABILITY));
729 editProbPanel.add(currentMatrixProb);
730
731
732 JPanel editDescriptionPanel = new JPanel(GUI.getStdBorderLayout());
733 editMatrixInnerPanel.add(editDescriptionPanel, BorderLayout.CENTER);
734 editDescriptionPanel.add(new JLabel("Description:"), BorderLayout.NORTH);
735 editDescriptionPanel.add(currentMatrixDesc, BorderLayout.CENTER);
736
737 JPanel buttonPanel = new JPanel();
738 editDescriptionPanel.add(buttonPanel, BorderLayout.SOUTH);
739 buttonPanel.add(deleteCurrentMatrixButton);
740 buttonPanel.add(changeCurrentMatrixButton);
741 buttonPanel.add(newMatrixButton);
742 }
743
744 return editMatrixPanel;
745 }
746
747
748
749
750
751
752 private JPanel getCopyMatrixPanel() {
753 JPanel returnPanel = new JPanel(GUI.getStdBorderLayout());
754 returnPanel.add(new JPanel(), BorderLayout.CENTER);
755
756 JPanel copyMatrixPanel = new JPanel(GUI.getStdBorderLayout());
757 copyMatrixPanel.add(new JLabel("Copy matrix to:"), BorderLayout.NORTH);
758 JPanel comboBoxPanel = new JPanel();
759 copyMatrixPanel.add(comboBoxPanel, BorderLayout.CENTER);
760 comboBoxPanel.setLayout(new BoxLayout(comboBoxPanel, BoxLayout.Y_AXIS));
761 comboBoxPanel.add(availableSetsCombo);
762 comboBoxPanel.add(availableParametersCombo);
763 copyMatrixPanel.add(copyMatrixButton, BorderLayout.EAST);
764
765 returnPanel.add(copyMatrixPanel, BorderLayout.EAST);
766 return returnPanel;
767 }
768
769
770
771
772
773
774 private JPanel getShowExistingMatricesPanel() {
775
776 if (showExistingMatricesPanel == null) {
777 showExistingMatricesPanel = new JPanel(GUI.getStdBorderLayout());
778
779 showExistingMatricesPanel.add(new JLabel("Matrices in Set: "),
780 BorderLayout.NORTH);
781
782 JScrollPane matricesScrollPane = new JScrollPane();
783 matricesScrollPane.setPreferredSize(new Dimension(
784 EXISTING_MATRIX_PANEL_WIDTH, EXISTING_MATRIX_PANEL_HEIGHT));
785 matricesScrollPane.getViewport().add(matricesList);
786 showExistingMatricesPanel.add(matricesScrollPane, BorderLayout.CENTER);
787
788 }
789
790 return showExistingMatricesPanel;
791 }
792
793
794
795
796
797
798 private JPanel getShowAvailableParametersPanel() {
799 if (showAvailableParametersPanel == null) {
800 showAvailableParametersPanel = new JPanel(GUI.getStdBorderLayout());
801
802 showAvailableParametersPanel.add(new JLabel("Parameters of Set: "),
803 BorderLayout.NORTH);
804
805 JScrollPane parametersScrollPane = new JScrollPane();
806 parametersScrollPane.setPreferredSize(new Dimension(
807 AVAILABLE_PARAMS_PANEL_WIDTH, AVAILABLE_PARAMS_PANEL_HEIGHT));
808 parametersScrollPane.getViewport().add(parametersList);
809 showAvailableParametersPanel.add(parametersScrollPane,
810 BorderLayout.CENTER);
811 }
812 return showAvailableParametersPanel;
813 }
814
815
816
817
818
819
820 private JPanel getShowAvailableSetsPanel() {
821
822 if (showAvailableSetsPanel == null) {
823 showAvailableSetsPanel = new JPanel(GUI.getStdBorderLayout());
824
825 showAvailableSetsPanel.add(new JLabel("Parameters of Set: "),
826 BorderLayout.NORTH);
827
828 JScrollPane setsScrollPane = new JScrollPane();
829 setsScrollPane.setPreferredSize(new Dimension(AVAILABLE_SETS_PANEL_WIDTH,
830 AVAILABLE_SET_PANEL_HEIGHT));
831 setsScrollPane.getViewport().add(setsList);
832 showAvailableSetsPanel.add(setsScrollPane, BorderLayout.CENTER);
833 }
834
835 return showAvailableSetsPanel;
836 }
837
838
839
840
841
842
843 final JPanel getChooseTypeAndCreateSetsPanel() {
844
845 if (chooseTypeCreateSetPanel == null) {
846
847 chooseTypeCreateSetPanel = new JPanel(GUI.getStdBorderLayout());
848
849 JPanel chooseSetType = new JPanel();
850 chooseTypeCreateSetPanel.add(chooseSetType, BorderLayout.NORTH);
851 chooseSetType.add(new JLabel("Choose Settype:"));
852 chooseSetType.add(availableSetTypes);
853
854 JPanel createNewSet = new JPanel();
855 chooseTypeCreateSetPanel.add(createNewSet, BorderLayout.SOUTH);
856 createNewSet.add(new JLabel("Create new set:"));
857 createNewSet.add(newSetName);
858 createNewSet.add(createNewSetButton);
859
860 }
861
862 return chooseTypeCreateSetPanel;
863 }
864
865
866
867
868
869
870 final JPanel getEditSetPanel() {
871 if (editSetPanel == null) {
872 editSetPanel = new JPanel(GUI.getStdBorderLayout());
873
874 JPanel nameProbPanel = new JPanel();
875 nameProbPanel.setLayout(new BoxLayout(nameProbPanel, BoxLayout.Y_AXIS));
876 editSetPanel.add(nameProbPanel, BorderLayout.WEST);
877 JPanel editCurrentSetNamePanel = new JPanel();
878 editCurrentSetNamePanel.add(new JLabel(Misc.GUI_LABEL_NAME));
879 editCurrentSetNamePanel.add(currentSetName);
880 JPanel editCurrentSetProbPanel = new JPanel();
881 editCurrentSetProbPanel.add(new JLabel(Misc.GUI_LABEL_PROBABILITY));
882 editCurrentSetProbPanel.add(currentSetProb);
883 nameProbPanel.add(editCurrentSetNamePanel);
884 nameProbPanel.add(editCurrentSetProbPanel);
885
886 JPanel descPanel = new JPanel();
887 descPanel.setLayout(new BoxLayout(descPanel, BoxLayout.Y_AXIS));
888 editSetPanel.add(descPanel, BorderLayout.CENTER);
889 descPanel.add(new JLabel("Description:"));
890 descPanel.add(currentSetDesc);
891
892 JPanel buttonPanel = new JPanel();
893 editSetPanel.add(buttonPanel, BorderLayout.SOUTH);
894 buttonPanel.add(changeCurrentSetButton);
895 buttonPanel.add(deleteCurrentSetButton);
896 }
897 return editSetPanel;
898 }
899
900
901
902
903
904
905 public Set getCurrentSet() {
906 return currentSet;
907 }
908
909 }