Changeset 134
- Timestamp:
- 07/27/11 18:32:43 (13 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swing
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swing/DlgInsert.java
r132 r134 4 4 import java.awt.FlowLayout; 5 5 import java.util.List; 6 import de.ugoe.cs.util.console.Console; 6 7 import de.ugoe.cs.eventbench.assertions.AssertEvent; 8 import de.ugoe.cs.eventbench.assertions.FileEqualsReplay; 9 import de.ugoe.cs.eventbench.assertions.TextEqualsReplay; 7 10 import de.ugoe.cs.eventbench.data.Event; 8 import de.ugoe.cs.eventbench.data.GlobalDataContainer;9 11 10 12 import javax.swing.JButton; … … 13 15 import javax.swing.border.EmptyBorder; 14 16 import javax.swing.JComboBox; 15 import javax.swing.ComboBoxModel;16 17 import javax.swing.JLabel; 17 18 import javax.swing.JTextField; … … 21 22 import java.awt.event.MouseAdapter; 22 23 import java.awt.event.MouseEvent; 23 import java.beans.PropertyChangeListener;24 import java.beans.PropertyChangeEvent;25 24 import java.io.File; 26 25 import java.awt.event.ActionListener; 27 26 import java.awt.event.ActionEvent; 28 import java.awt.event.KeyAdapter;29 import java.awt.event.KeyEvent;30 27 import javax.swing.JScrollPane; 31 28 import javax.swing.JList; 32 29 33 30 public class DlgInsert extends JDialog { 31 32 /** 33 * Id for object serialization. 34 */ 35 private static final long serialVersionUID = 1L; 34 36 35 37 private final JPanel contentPanel = new JPanel(); 36 38 private JTextField textFieldExpectedValue; 37 private JTextField textField TestFile;38 private JTextField textField MatchingFile;39 private JTextField textFieldActualFile; 40 private JTextField textFieldExpectedFile; 39 41 40 42 /** 41 43 * Launch the application. 42 44 */ 43 public static void ShowDialog(List<Event<?>> sequences, int selectedIndex, final boolean insertBefore) {45 public static void showDialog(List<Event<?>> sequences, int selectedIndex, final boolean insertBefore) { 44 46 try { 45 47 DlgInsert dialog = new DlgInsert(sequences, selectedIndex, insertBefore); … … 130 132 panelTextEquals.add(scrollPane); 131 133 132 JList listTargets = new JList(modelListTargets);134 final JList listTargets = new JList(modelListTargets); 133 135 scrollPane.setViewportView(listTargets); 134 136 135 137 for(int i=0; i<sequences.size(); i++) { 136 modelListTargets.addElement(sequences.get(i).getTarget());138 if(sequences.get(i).getTarget() != " ") modelListTargets.addElement(sequences.get(i).getTarget()); 137 139 } 140 listTargets.setSelectedIndex(0); 138 141 139 142 … … 143 146 panelFileEquals.setVisible(false); 144 147 145 JLabel lblNewLabel = new JLabel(" Testfile:");146 lblNewLabel.setBounds(10, 11, 46, 14);148 JLabel lblNewLabel = new JLabel("Actual file:"); 149 lblNewLabel.setBounds(10, 11, 89, 14); 147 150 panelFileEquals.add(lblNewLabel); 148 151 149 textField TestFile = new JTextField();150 textField TestFile.setBounds(10, 36, 474, 20);151 panelFileEquals.add(textField TestFile);152 textField TestFile.setColumns(10);152 textFieldActualFile = new JTextField(); 153 textFieldActualFile.setBounds(10, 36, 474, 20); 154 panelFileEquals.add(textFieldActualFile); 155 textFieldActualFile.setColumns(10); 153 156 154 157 JButton btnNewButton = new JButton("Search file"); … … 156 159 public void mouseClicked(MouseEvent arg0) { 157 160 final JFileChooser fc = new JFileChooser(); 158 if(fc.showOpenDialog(contentPanel) == 0) { textField MatchingFile.setText(fc.getSelectedFile().getAbsolutePath()); }161 if(fc.showOpenDialog(contentPanel) == 0) { textFieldExpectedFile.setText(fc.getSelectedFile().getAbsolutePath()); } 159 162 } 160 163 }); … … 162 165 panelFileEquals.add(btnNewButton); 163 166 164 JLabel lblNewLabel_1 = new JLabel(" Matchingfile:");167 JLabel lblNewLabel_1 = new JLabel("Expected file:"); 165 168 lblNewLabel_1.setBounds(10, 84, 89, 14); 166 169 panelFileEquals.add(lblNewLabel_1); 167 170 168 textField MatchingFile = new JTextField();169 textField MatchingFile.setColumns(10);170 textField MatchingFile.setBounds(10, 109, 474, 20);171 panelFileEquals.add(textField MatchingFile);171 textFieldExpectedFile = new JTextField(); 172 textFieldExpectedFile.setColumns(10); 173 textFieldExpectedFile.setBounds(10, 109, 474, 20); 174 panelFileEquals.add(textFieldExpectedFile); 172 175 { 173 176 JPanel buttonPane = new JPanel(); … … 182 185 //FileEquals 183 186 if(panelFileEquals.isVisible()) { 184 if(! new File(textFieldTestFile.getText()).exists()) { 185 if(textFieldTestFile.getText().length() == 0) JOptionPane.showMessageDialog(null, "Please choose a test file.", "No test file chosen", JOptionPane.OK_OPTION); 186 else JOptionPane.showMessageDialog(null, "The test file \"" + textFieldTestFile.getText() + "\" does not exist.", "Test file does not exist", JOptionPane.OK_OPTION); 187 if(textFieldActualFile.getText().length() == 0) JOptionPane.showMessageDialog(null, "Please declare an actual file.", "No actual file declared", JOptionPane.OK_OPTION); 188 else if(! new File(textFieldExpectedFile.getText()).exists()) { 189 if(textFieldExpectedFile.getText().length() == 0) JOptionPane.showMessageDialog(null, "Please choose an expected file.", "No expected file chosen", JOptionPane.OK_OPTION); 190 else JOptionPane.showMessageDialog(null, "The expected file \"" + textFieldActualFile.getText() + "\" does not exist.", "Expected file does not exist", JOptionPane.OK_OPTION); 187 191 return; 188 192 } 189 else if(! new File(textFieldMatchingFile.getText()).exists()) {190 if(textFieldMatchingFile.getText().length() == 0) JOptionPane.showMessageDialog(null, "Please choose a matching file.", "No matching file chosen", JOptionPane.OK_OPTION);191 else JOptionPane.showMessageDialog(null, "The matching file \"" + textFieldTestFile.getText() + "\" does not exist.", "Matching file does not exist", JOptionPane.OK_OPTION);192 return;193 }194 193 else { 195 Event<?> e = new Event("FileEquals"); 194 FileEqualsReplay file = new FileEqualsReplay(); 195 file.setActualFile(textFieldActualFile.getText()); 196 file.setExpectedFile(textFieldExpectedFile.getText()); 197 198 AssertEvent<FileEqualsReplay> e = new AssertEvent<FileEqualsReplay>("FileEquals"); 199 e.addReplayEvent(file); 196 200 e.setTarget(" "); 197 201 if(insertBefore) sequences.add(selectedIndex, e); … … 205 209 return; 206 210 } 211 else if(listTargets.getSelectedIndex() == -1) { 212 JOptionPane.showMessageDialog(null, "Please select a target.", "No target selected", JOptionPane.OK_OPTION); 213 return; 214 } 207 215 else { 208 Event<?> e = new Event("TextEquals"); 216 TextEqualsReplay text = new TextEqualsReplay(); 217 text.setExpectedValue(textFieldExpectedValue.getText()); 218 text.setTarget(modelListTargets.get(listTargets.getSelectedIndex()).toString()); 219 220 AssertEvent<TextEqualsReplay> e = new AssertEvent<TextEqualsReplay>("TextEquals"); 221 e.addReplayEvent(text); 209 222 e.setTarget(" "); 210 223 if(insertBefore) sequences.add(selectedIndex, e); -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swing/DlgSequenceDetails.java
r132 r134 7 7 import java.awt.event.MouseEvent; 8 8 import javax.swing.JList; 9 import java.awt.event.ActionListener;10 import java.awt.event.ActionEvent;11 import java.util.Vector;12 9 import java.util.List; 13 14 import javax.swing.AbstractListModel;15 10 import javax.swing.ListSelectionModel; 16 import javax.swing.border.CompoundBorder;17 import javax.swing.border.LineBorder;18 import java.awt.Color;19 11 import javax.swing.border.SoftBevelBorder; 20 12 import javax.swing.border.BevelBorder; 21 import javax.swing.border.TitledBorder;22 import javax.swing.UIManager;23 13 import javax.swing.event.ListSelectionListener; 24 14 import javax.swing.event.ListSelectionEvent; 25 15 26 import de.ugoe.cs.eventbench.data.GlobalDataContainer;27 import de.ugoe.cs.eventbench.data.IReplayable;28 import de.ugoe.cs.util.console.Console;29 16 import de.ugoe.cs.eventbench.data.Event; 30 import de.ugoe.cs.eventbench.windows.WindowsEvent;31 17 32 18 import javax.swing.JLabel; 33 19 import java.awt.event.WindowAdapter; 34 20 import java.awt.event.WindowEvent; 35 import javax.swing.JScrollBar;36 21 import javax.swing.JScrollPane; 37 22 import javax.swing.JPanel; … … 47 32 * Launch the application, the index of the sequence to work on is stored in sequenceIndex 48 33 */ 49 public void ShowDialog(JFrame parent, final List<Event<?>> events) {34 public void showDialog(JFrame parent, final List<Event<?>> events) { 50 35 frmParent = parent; 51 36 … … 118 103 int selectedIndex = listSequences.getSelectedIndex(); 119 104 DlgInsert dlgInsert = new DlgInsert(events, selectedIndex, true); 120 dlgInsert. ShowDialog(events, selectedIndex, true);105 dlgInsert.showDialog(events, selectedIndex, true); 121 106 122 107 updateLists(events, modelListEvents, modelListTargets); … … 139 124 int selectedIndex = listSequences.getSelectedIndex(); 140 125 DlgInsert dlgInsert = new DlgInsert(events, selectedIndex, false); 141 dlgInsert. ShowDialog(events, selectedIndex, false);126 dlgInsert.showDialog(events, selectedIndex, false); 142 127 143 128 updateLists(events, modelListEvents, modelListTargets); -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swing/DlgSequences.java
r132 r134 4 4 import javax.swing.JFrame; 5 5 import javax.swing.JList; 6 import java.awt.BorderLayout;7 6 import java.util.List; 8 7 9 8 import javax.swing.JButton; 10 import javax.swing.AbstractListModel;11 9 import javax.swing.event.ListSelectionListener; 12 10 import javax.swing.event.ListSelectionEvent; 13 11 import de.ugoe.cs.eventbench.data.Event; 14 12 import de.ugoe.cs.eventbench.data.GlobalDataContainer; 15 import de.ugoe.cs.eventbench.windows.data.WindowsMessage;16 13 import de.ugoe.cs.util.console.Console; 17 14 … … 21 18 import javax.swing.border.EtchedBorder; 22 19 import javax.swing.JScrollPane; 23 import java.awt.event.ComponentAdapter;24 import java.awt.event.ComponentEvent;25 import java.awt.event.WindowAdapter;26 import java.awt.event.WindowEvent;27 20 28 21 public class DlgSequences { … … 34 27 * Launch the application. 35 28 */ 36 public static void ShowDialog() {29 public static void showDialog() { 37 30 EventQueue.invokeLater(new Runnable() { 38 31 public void run() { … … 73 66 74 67 68 //!!! 69 // is checked by calling "showSequences" -> Needed? 70 //!!! 75 71 try { 76 72 containedSequences = (List<List<Event<?>>>) GlobalDataContainer.getInstance().getData("sequences"); … … 128 124 if(btnSequence.isEnabled()) { 129 125 DlgSequenceDetails dlgSequences = new DlgSequenceDetails(frmSequences, containedSequences.get(listSequences.getSelectedIndex())); 130 dlgSequences. ShowDialog(frmSequences, containedSequences.get(listSequences.getSelectedIndex()));126 dlgSequences.showDialog(frmSequences, containedSequences.get(listSequences.getSelectedIndex())); 131 127 frmSequences.setVisible(false); 132 128 }
Note: See TracChangeset
for help on using the changeset viewer.