- Timestamp:
- 08/17/12 11:38:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/InsertFileEquals.java
r548 r570 1 1 2 package de.ugoe.cs.quest.ui.swt; 2 3 … … 20 21 21 22 public class InsertFileEquals extends AbstractInsertEventComposite { 22 23 23 private Text actualText; 24 private Text expectedText; 24 25 25 public InsertFileEquals(Composite parent, int style) { 26 this(parent, style, null); 27 } 28 29 /** 30 * Create the composite. 31 * @param parent 32 * @param style 33 */ 34 public InsertFileEquals(Composite parent, int style, SortedSet<String> targets) { 35 super(parent, style, targets); 36 setLayout(new GridLayout(3, false)); 37 38 39 Label lblExpectedFile = new Label(this, SWT.NONE); 40 lblExpectedFile.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 41 lblExpectedFile.setText("Expected file:"); 42 43 expectedText = new Text(this, SWT.BORDER); 44 expectedText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 45 46 Button btnSearch = new Button(this, SWT.NONE); 47 btnSearch.addSelectionListener(new SelectionAdapter() { 48 @Override 49 public void widgetSelected(SelectionEvent e) { 50 FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); 51 String filename = fileDialog.open(); 52 if( filename!= null ) { 53 expectedText.setText(filename); 54 } 55 } 56 }); 57 btnSearch.setText("Search..."); 58 59 Label lblActualFile = new Label(this, SWT.NONE); 60 61 lblActualFile.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 62 lblActualFile.setText("Actual file:"); 63 64 actualText = new Text(this, SWT.BORDER); 65 actualText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 66 new Label(this, SWT.NONE); 26 public InsertFileEquals(Composite parent, int style) { 27 this(parent, style, null); 28 } 67 29 68 } 30 /** 31 * Create the composite. 32 * 33 * @param parent 34 * @param style 35 */ 36 public InsertFileEquals(Composite parent, int style, SortedSet<String> targets) { 37 super(parent, style, targets); 38 setLayout(new GridLayout(3, false)); 69 39 70 @Override 71 protected void checkSubclass() { 72 // Disable the check that prevents subclassing of SWT components 73 } 40 Label lblExpectedFile = new Label(this, SWT.NONE); 41 lblExpectedFile.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 42 lblExpectedFile.setText("Expected file:"); 74 43 75 @Override 76 public Event getEvent() { 77 FileEqualsReplay replay = new FileEqualsReplay(expectedText.getText(), actualText.getText()); 78 Event event = new Event(new FileEqualsAssertEvent()); 79 event.addReplayable(replay); 80 return event; 81 } 44 expectedText = new Text(this, SWT.BORDER); 45 expectedText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 46 47 Button btnSearch = new Button(this, SWT.NONE); 48 btnSearch.addSelectionListener(new SelectionAdapter() { 49 @Override 50 public void widgetSelected(SelectionEvent e) { 51 FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); 52 String filename = fileDialog.open(); 53 if (filename != null) { 54 expectedText.setText(filename); 55 } 56 } 57 }); 58 btnSearch.setText("Search..."); 59 60 Label lblActualFile = new Label(this, SWT.NONE); 61 62 lblActualFile.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 63 lblActualFile.setText("Actual file:"); 64 65 actualText = new Text(this, SWT.BORDER); 66 actualText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 67 new Label(this, SWT.NONE); 68 69 } 70 71 @Override 72 protected void checkSubclass() { 73 // Disable the check that prevents subclassing of SWT components 74 } 75 76 @Override 77 public Event getEvent() { 78 FileEqualsReplay replay = 79 new FileEqualsReplay(expectedText.getText(), actualText.getText()); 80 Event event = new Event(new FileEqualsAssertEvent()); 81 event.addReplayable(replay); 82 return event; 83 } 82 84 83 85 }
Note: See TracChangeset
for help on using the changeset viewer.