- Timestamp:
- 07/29/11 14:33:36 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swing/DlgSequences.java
r134 r138 18 18 import javax.swing.border.EtchedBorder; 19 19 import javax.swing.JScrollPane; 20 import java.awt.event.WindowAdapter; 21 import java.awt.event.WindowEvent; 20 22 21 23 public class DlgSequences { … … 28 30 */ 29 31 public static void showDialog() { 32 30 33 EventQueue.invokeLater(new Runnable() { 31 34 public void run() { … … 50 53 * Initialize the contents of the frame. 51 54 */ 55 @SuppressWarnings("unchecked") 52 56 private void initialize() { 53 57 frmSequences = new JFrame(); 58 frmSequences.addWindowListener(new WindowAdapter() { 59 @Override 60 public void windowClosed(WindowEvent arg0) { 61 62 synchronized (Console.getInstance()) { 63 Console.getInstance().notify(); 64 } 65 } 66 }); 54 67 final javax.swing.DefaultListModel modelListSequences = new javax.swing.DefaultListModel(); 55 68 final JButton btnSequence = new JButton("Show details"); 56 69 final JButton btnClose = new JButton("Close"); 57 70 JPanel panel = new JPanel(); 58 59 71 60 72 // JFrame: frmSequence *** 61 73 frmSequences.setTitle("Sequences"); … … 65 77 frmSequences.getContentPane().setLayout(null); 66 78 67 68 //!!!69 // is checked by calling "showSequences" -> Needed?70 //!!!71 79 try { 72 containedSequences = (List<List<Event<?>>>) GlobalDataContainer .getInstance().getData("sequences");73 }74 catch(ClassCastException e) {80 containedSequences = (List<List<Event<?>>>) GlobalDataContainer 81 .getInstance().getData("sequences"); 82 } catch (ClassCastException e) { 75 83 Console.println("Not able to cast Data in GlobalDataContainer to List of Sequences"); 76 84 } 77 85 78 86 try { 79 for(int i=0; i<containedSequences.size(); i++) { 80 modelListSequences.addElement("Sequence " + (i+1) + ": " + containedSequences.get(i).size() + " Events"); 87 for (int i = 0; i < containedSequences.size(); i++) { 88 modelListSequences.addElement("Sequence " + (i + 1) + ": " 89 + containedSequences.get(i).size() + " Events"); 81 90 } 82 } 83 catch(NullPointerException e) { 91 } catch (NullPointerException e) { 84 92 Console.println("No sequences found."); 85 93 } 86 87 94 88 95 panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); 89 96 panel.setBounds(10, 11, 244, 218); … … 91 98 panel.setLayout(null); 92 99 // *** 93 94 100 95 101 // JScrollPane: scrollPane 96 102 JScrollPane scrollPane = new JScrollPane(); … … 101 107 // *** 102 108 103 104 105 109 // JList: listSequnces 106 110 listSequences.addListSelectionListener(new ListSelectionListener() { 107 111 public void valueChanged(ListSelectionEvent arg0) { 108 if(listSequences.getSelectedIndex() >= 0) btnSequence.setEnabled(true); 109 else btnSequence.setEnabled(false); 112 if (listSequences.getSelectedIndex() >= 0) 113 btnSequence.setEnabled(true); 114 else 115 btnSequence.setEnabled(false); 110 116 } 111 117 }); 112 118 113 119 JPanel panel_1 = new JPanel(); 114 120 panel_1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); … … 117 123 panel_1.setLayout(null); 118 124 // *** 119 120 125 121 126 // JButton: btnSequence *** 122 127 btnSequence.addMouseListener(new MouseAdapter() { 123 128 public void mouseClicked(MouseEvent arg0) { 124 if(btnSequence.isEnabled()) { 125 DlgSequenceDetails dlgSequences = new DlgSequenceDetails(frmSequences, containedSequences.get(listSequences.getSelectedIndex())); 126 dlgSequences.showDialog(frmSequences, containedSequences.get(listSequences.getSelectedIndex())); 129 if (btnSequence.isEnabled()) { 130 DlgSequenceDetails dlgSequences = new DlgSequenceDetails( 131 frmSequences, containedSequences.get(listSequences 132 .getSelectedIndex())); 133 dlgSequences.showDialog(frmSequences, containedSequences 134 .get(listSequences.getSelectedIndex())); 127 135 frmSequences.setVisible(false); 128 136 } … … 133 141 btnSequence.setEnabled(false); 134 142 // *** 135 136 137 //JButton: btnClose *** 143 144 // JButton: btnClose *** 138 145 btnClose.addMouseListener(new MouseAdapter() { 139 146 public void mouseClicked(MouseEvent arg0) {
Note: See TracChangeset
for help on using the changeset viewer.