- Timestamp:
- 09/07/17 16:26:46 (7 years ago)
- Location:
- trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/GuiModelTabComposite.java
r2156 r2168 15 15 16 16 package de.ugoe.cs.autoquest.ui.swt; 17 18 import java.util.Collections; 19 import java.util.LinkedList; 17 20 18 21 import org.eclipse.swt.SWT; … … 112 115 public void updateModelList() { 113 116 guiModelList.removeAll(); 114 for(String key : GlobalDataContainer.getInstance().getAllKeys()) { 115 if( GlobalDataContainer.getInstance().getData(key) instanceof IHierarchicalEventTargetModel ) { 116 guiModelList.add(key); 117 118 java.util.List<String> guiModels = new LinkedList<>(); 119 120 for (String key : GlobalDataContainer.getInstance().getAllKeys()) { 121 if (GlobalDataContainer.getInstance().getData(key) instanceof IHierarchicalEventTargetModel) { 122 guiModels.add(key); 117 123 } 124 } 125 126 Collections.sort(guiModels); 127 128 for (String entry : guiModels) { 129 guiModelList.add(entry); 118 130 } 119 131 } -
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ModelsTabComposite.java
r1146 r2168 15 15 package de.ugoe.cs.autoquest.ui.swt; 16 16 17 import java.util.Collections; 18 import java.util.LinkedList; 19 17 20 import org.eclipse.swt.SWT; 18 21 import org.eclipse.swt.widgets.Composite; … … 289 292 public void updateModelList() { 290 293 modelList.removeAll(); 294 295 java.util.List<String> models = new LinkedList<>(); 296 291 297 for (String key : GlobalDataContainer.getInstance().getAllKeys()) { 292 298 if ((GlobalDataContainer.getInstance().getData(key) instanceof IStochasticProcess) || 293 299 (GlobalDataContainer.getInstance().getData(key) instanceof ITaskModel)) 294 300 { 295 modelList.add(key); 296 } 301 models.add(key); 302 } 303 } 304 305 Collections.sort(models); 306 307 for (String entry : models) { 308 modelList.add(entry); 297 309 } 298 310 } -
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/SequencesTabComposite.java
r927 r2168 16 16 17 17 import org.eclipse.swt.widgets.Composite; 18 19 import java.util.Collections; 20 import java.util.LinkedList; 18 21 19 22 import org.eclipse.swt.SWT; … … 144 147 public void updateSequenceList() { 145 148 sequenceList.removeAll(); 146 for(String key : GlobalDataContainer.getInstance().getAllKeys()) { 147 if( SequenceInstanceOf.isCollectionOfSequences(GlobalDataContainer.getInstance().getData(key)) ) { 148 sequenceList.add(key); 149 150 java.util.List<String> sequences = new LinkedList<>(); 151 152 for (String key : GlobalDataContainer.getInstance().getAllKeys()) { 153 if (SequenceInstanceOf.isCollectionOfSequences(GlobalDataContainer.getInstance().getData(key))) { 154 sequences.add(key); 149 155 } 156 } 157 158 Collections.sort(sequences); 159 160 for (String entry : sequences) { 161 sequenceList.add(entry); 150 162 } 151 163 } -
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ShowGuiModelDialog.java
r2146 r2168 28 28 import org.eclipse.swt.widgets.TreeItem; 29 29 30 import de.ugoe.cs.autoquest.eventcore.HierarchicalEventTargetModel; 30 31 import de.ugoe.cs.autoquest.eventcore.IHierarchicalEventTarget; 31 32 import de.ugoe.cs.autoquest.eventcore.IHierarchicalEventTargetModel; 32 import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel;33 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;34 33 import de.ugoe.cs.util.console.Console; 35 34 … … 91 90 btnCollapseAll.setText("Collapse all"); 92 91 93 if (model instanceof GUIModel) {92 if (model instanceof HierarchicalEventTargetModel) { 94 93 Button btnCondense = new Button(shell, SWT.NONE); 95 94 btnCondense.addSelectionListener(new SelectionAdapter() { 96 95 @Override 97 96 public void widgetSelected(SelectionEvent e) { 98 (( GUIModel) model).condenseModel();97 ((HierarchicalEventTargetModel<?>) model).condenseModel(); 99 98 targetTree.removeAll(); 100 99 buildTargetTree(); … … 189 188 try { 190 189 // try to merge the elements 191 IGUIElement firstElement = (IGUIElement) selectedNodes[0].getData();190 T firstElement = (T) selectedNodes[0].getData(); 192 191 for( int i=1 ; i<selectedNodes.length ; i++ ) { 193 (( GUIModel) model).mergeEventTargets194 (firstElement, ( IGUIElement) selectedNodes[i].getData());192 ((HierarchicalEventTargetModel<T>) model).mergeEventTargets 193 (firstElement, (T) selectedNodes[i].getData()); 195 194 } 196 195 } -
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ShowUsabilityEvaluationResultDialog.java
r2047 r2168 19 19 import java.util.ArrayList; 20 20 import java.util.Collection; 21 import java.util.Collections; 21 22 import java.util.HashMap; 22 23 import java.util.LinkedList; … … 37 38 import org.eclipse.swt.layout.GridData; 38 39 import org.eclipse.swt.layout.GridLayout; 40 import org.eclipse.swt.layout.RowLayout; 41 import org.eclipse.swt.widgets.Button; 42 import org.eclipse.swt.widgets.Composite; 43 import org.eclipse.swt.widgets.Control; 39 44 import org.eclipse.swt.widgets.Dialog; 40 45 import org.eclipse.swt.widgets.Display; 41 46 import org.eclipse.swt.widgets.Event; 47 import org.eclipse.swt.widgets.Group; 48 import org.eclipse.swt.widgets.Label; 42 49 import org.eclipse.swt.widgets.Listener; 43 50 import org.eclipse.swt.widgets.Shell; 51 import org.eclipse.swt.widgets.Text; 44 52 import org.eclipse.swt.widgets.Tree; 45 53 import org.eclipse.swt.widgets.TreeColumn; … … 51 59 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 52 60 import de.ugoe.cs.autoquest.usability.UsabilitySmell; 61 import de.ugoe.cs.autoquest.usability.UsabilitySmell.ManualLabel; 53 62 import de.ugoe.cs.autoquest.usability.UsabilitySmellIntensity; 54 63 import de.ugoe.cs.autoquest.usability.UsabilityEvaluationResult; … … 73 82 private StyledText description; 74 83 75 /** the tree of involved GUI elements of a specific task on the right bottom*/84 /** the tree of involved GUI elements of a specific smell on the right */ 76 85 private Tree involvedTargetsTree; 77 86 78 /** the table containing the parents tasks of a displayed task*/87 /** the table containing the involved tasks of a displayed smell */ 79 88 private Tree involvedTasks; 89 90 /** the radio button group for assessing if a smell is true positive or not */ 91 private Group assessmentRadioButtons; 92 93 /** the list of all different tags given for smells */ 94 private List<String> existingTags = new LinkedList<>(); 95 96 /** the parent of all check boxes for tag representation */ 97 private Composite tagCheckBoxParent; 80 98 81 99 /** the displayed usability evaluation result */ … … 96 114 setText("Usability Evaluation Result " + dataSetName); 97 115 this.usabilityEvalResult = usabilityEvalResult; 116 117 for (UsabilitySmell smell : usabilityEvalResult.getAllSmells()) { 118 for (String tag : smell.getTags()) { 119 if (!existingTags.contains(tag)) { 120 existingTags.add(tag); 121 } 122 } 123 } 124 125 Collections.sort(existingTags); 98 126 } 99 127 … … 168 196 } 169 197 }); 170 198 171 199 SashForm detailsSashForm = new SashForm(mainSashForm, SWT.VERTICAL); 172 200 detailsSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); 173 201 174 description = new StyledText(detailsSashForm, SWT.READ_ONLY | SWT.BORDER | SWT.WRAP); 202 Composite descriptionComposite = new Composite(detailsSashForm, SWT.NONE); 203 descriptionComposite.setLayout(new GridLayout()); 204 205 description = new StyledText(descriptionComposite, SWT.READ_ONLY | SWT.BORDER | SWT.WRAP); 175 206 description.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); 176 207 177 SashForm details BottomSashForm = new SashForm(detailsSashForm, SWT.HORIZONTAL);178 details BottomSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));208 SashForm detailsTreesSashForm = new SashForm(detailsSashForm, SWT.HORIZONTAL); 209 detailsTreesSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); 179 210 180 211 involvedTasks = VisualizationUtils.createTaskDetailsTree 181 (details BottomSashForm, "involved tasks", usabilityEvalResult.getTaskModel());212 (detailsTreesSashForm, "involved tasks", usabilityEvalResult.getTaskModel()); 182 213 183 214 VisualizationUtils.addItemSpecificContextMenu … … 198 229 199 230 involvedTargetsTree = 200 VisualizationUtils.createTargetsTree(details BottomSashForm, "involved GUI elements");231 VisualizationUtils.createTargetsTree(detailsTreesSashForm, "involved GUI elements"); 201 232 202 233 VisualizationUtils.addInvolvedTargetsHighlighting(involvedTasks, involvedTargetsTree); 203 234 204 detailsBottomSashForm.setWeights(new int[] { 1, 1 }); 235 final Composite detailsAssessmentComposite = new Composite(descriptionComposite, SWT.NONE); 236 detailsAssessmentComposite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1)); 237 detailsAssessmentComposite.setLayout(new GridLayout(5, false)); 238 239 assessmentRadioButtons = new Group(detailsAssessmentComposite, SWT.NONE); 240 assessmentRadioButtons.setLayout(new RowLayout(SWT.HORIZONTAL)); 241 242 final Button unassessedRadioButton = new Button(assessmentRadioButtons, SWT.RADIO); 243 unassessedRadioButton.setText("unassessed"); 244 unassessedRadioButton.addSelectionListener(new SelectionAdapter() { 245 @Override 246 public void widgetSelected(SelectionEvent event) { 247 TreeItem[] selectedItems = smellList.getSelection(); 248 if ((selectedItems.length == 1) && 249 (selectedItems[0].getData() instanceof UsabilitySmell)) 250 { 251 UsabilitySmell smell = (UsabilitySmell) selectedItems[0].getData(); 252 if (unassessedRadioButton.getSelection()) { 253 smell.setManualLabel(ManualLabel.UNCHECKED); 254 } 255 } 256 } 257 }); 258 259 final Button falsePositiveRadioButton = new Button(assessmentRadioButtons, SWT.RADIO); 260 falsePositiveRadioButton.setText("false positive"); 261 falsePositiveRadioButton.addSelectionListener(new SelectionAdapter() { 262 @Override 263 public void widgetSelected(SelectionEvent event) { 264 TreeItem[] selectedItems = smellList.getSelection(); 265 if ((selectedItems.length == 1) && 266 (selectedItems[0].getData() instanceof UsabilitySmell)) 267 { 268 UsabilitySmell smell = (UsabilitySmell) selectedItems[0].getData(); 269 if (falsePositiveRadioButton.getSelection()) { 270 smell.setManualLabel(ManualLabel.FALSE_POSITIVE); 271 } 272 } 273 } 274 }); 275 276 final Button truePositiveRadioButton = new Button(assessmentRadioButtons, SWT.RADIO); 277 truePositiveRadioButton.setText("true positive"); 278 truePositiveRadioButton.addSelectionListener(new SelectionAdapter() { 279 @Override 280 public void widgetSelected(SelectionEvent event) { 281 TreeItem[] selectedItems = smellList.getSelection(); 282 if ((selectedItems.length == 1) && 283 (selectedItems[0].getData() instanceof UsabilitySmell)) 284 { 285 UsabilitySmell smell = (UsabilitySmell) selectedItems[0].getData(); 286 if (truePositiveRadioButton.getSelection()) { 287 smell.setManualLabel(ManualLabel.TRUE_POSITIVE); 288 } 289 } 290 } 291 }); 292 293 new Label(detailsAssessmentComposite, SWT.NONE).setText("Tags:"); 294 295 tagCheckBoxParent = new Composite(detailsAssessmentComposite, SWT.NONE); 296 tagCheckBoxParent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); 297 tagCheckBoxParent.setLayout(new RowLayout()); 298 299 recreateTagsSashForm(); 300 301 final Text addTagField = new Text(detailsAssessmentComposite, SWT.BORDER); 302 addTagField.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 303 addTagField.setSize(addTagField.computeSize(100, 50)); 304 305 final Button addTagButton = new Button(detailsAssessmentComposite, SWT.NONE); 306 addTagButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); 307 addTagButton.addSelectionListener(new SelectionAdapter() { 308 @Override 309 public void widgetSelected(SelectionEvent e) { 310 String tagName = addTagField.getText(); 311 if ((tagName != null) && (!"".equals(tagName)) && (!existingTags.contains(tagName))) { 312 existingTags.add(tagName); 313 recreateTagsSashForm(); 314 } 315 } 316 }); 317 addTagButton.setText("add tag"); 318 319 detailsTreesSashForm.setWeights(new int[] { 1, 1 }); 205 320 detailsSashForm.setWeights(new int[] { 1, 3 }); 206 321 mainSashForm.setWeights(new int[] { 1, 3 }); … … 210 325 //descriptionColumn.pack(); 211 326 //smellList.pack(); 327 } 328 329 /** 330 * <p> 331 * TODO: comment 332 * </p> 333 * 334 */ 335 private void recreateTagsSashForm() { 336 for (Control child : tagCheckBoxParent.getChildren()) { 337 child.dispose(); 338 } 339 340 if (existingTags.size() > 0) { 341 TreeItem[] selectedItems = smellList.getSelection(); 342 boolean enabled = (selectedItems.length == 1) && 343 (selectedItems[0].getData() instanceof UsabilitySmell); 344 345 for (String existingTag : existingTags) { 346 Button checkBox = new Button(tagCheckBoxParent, SWT.CHECK); 347 checkBox.setText(existingTag); 348 checkBox.addSelectionListener(new SelectionAdapter() { 349 @Override 350 public void widgetSelected(SelectionEvent event) { 351 Button btn = (Button) event.getSource(); 352 353 TreeItem[] selectedItems = smellList.getSelection(); 354 if ((selectedItems.length == 1) && 355 (selectedItems[0].getData() instanceof UsabilitySmell)) 356 { 357 UsabilitySmell smell = (UsabilitySmell) selectedItems[0].getData(); 358 359 if (btn.getSelection()) { 360 smell.addTag(btn.getText()); 361 } 362 else { 363 smell.removeTag(btn.getText()); 364 } 365 } 366 } 367 }); 368 369 checkBox.setEnabled(enabled); 370 if (enabled) { 371 checkBox.setSelection 372 (((UsabilitySmell) selectedItems[0].getData()).getTags().contains(existingTag)); 373 } 374 } 375 } 376 else { 377 new Label(tagCheckBoxParent, SWT.NONE).setText 378 ("no tags added yet --> add using the text field and the button on the right"); 379 } 380 381 tagCheckBoxParent.layout(); 382 tagCheckBoxParent.redraw(); 212 383 } 213 384 … … 247 418 if (!added) { 248 419 smellList.add(smell); 420 } 421 422 // extract the intial list of tags of the smells 423 for (String tag : smell.getTags()) { 424 if (!existingTags.contains(tag)) { 425 existingTags.add(tag); 426 } 249 427 } 250 428 } … … 432 610 involvedTargetsTree.removeAll(); 433 611 involvedTasks.removeAll(); 612 613 for (Control child : assessmentRadioButtons.getChildren()) { 614 if (child instanceof Button) { 615 child.setEnabled(false); 616 ((Button) child).setSelection(false); 617 } 618 } 619 620 for (Control child : tagCheckBoxParent.getChildren()) { 621 if (child instanceof Button) { 622 child.setEnabled(false); 623 ((Button) child).setSelection(false); 624 } 625 } 434 626 } 435 627 … … 494 686 styleRange.font = new Font(description.getDisplay(), "Courier", 12, SWT.NORMAL); 495 687 description.setStyleRange(styleRange); 688 689 assessmentRadioButtons.getChildren()[0].setEnabled(true); 690 ((Button) assessmentRadioButtons.getChildren()[0]).setSelection 691 (smell.getManualLabel() == ManualLabel.UNCHECKED); 692 693 assessmentRadioButtons.getChildren()[1].setEnabled(true); 694 ((Button) assessmentRadioButtons.getChildren()[1]).setSelection 695 (smell.getManualLabel() == ManualLabel.FALSE_POSITIVE); 696 697 assessmentRadioButtons.getChildren()[2].setEnabled(true); 698 ((Button) assessmentRadioButtons.getChildren()[2]).setSelection 699 (smell.getManualLabel() == ManualLabel.TRUE_POSITIVE); 700 701 for (Control child : tagCheckBoxParent.getChildren()) { 702 if (child instanceof Button) { 703 child.setEnabled(true); 704 ((Button) child).setSelection(smell.getTags().contains(((Button) child).getText())); 705 } 706 } 496 707 497 708 List<ITask> involvedTaskList = getInvolvedTasks(smell); -
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/TaskTreePlotUtils.java
r2128 r2168 168 168 plot.addDomainMarker(marker); 169 169 170 double xLow = 0; 171 double yLow = 0; 172 double xHigh = 100; 173 double yHigh = 100; 174 double maxY = 0; 175 for (int i = 0; i < dataset.getItemCount(0); i++) { 176 double xValue = dataset.getXValue(0, i); 177 double yValue = dataset.getYValue(0, i); 178 179 if ((xLow < xValue) && (xValue < mpMarker)) { 180 xLow = xValue; 181 yLow = yValue; 182 } 183 else if ((xHigh > xValue) && (xValue > mpMarker)) { 184 xHigh = xValue; 185 yHigh = yValue; 186 } 187 188 maxY = Math.max(maxY, yValue); 189 } 190 191 marker = new ValueMarker((yHigh + yLow) / 2); 192 marker.setLabel(new DecimalFormat("#0.0").format((yHigh + yLow) / 2)); 170 double yMP = dataset.getYValue(0, mostProminent.size() - 1); 171 double maxY = dataset.getYValue(0, dataset.getItemCount(0) - 1); 172 173 marker = new ValueMarker(yMP); 174 marker.setLabel(new DecimalFormat("#0.0").format(yMP)); 193 175 marker.setLabelOffset(new RectangleInsets(5, 15, 0, 10)); 194 176 plot.addRangeMarker(marker); -
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/UsabilityTabComposite.java
r1495 r2168 14 14 15 15 package de.ugoe.cs.autoquest.ui.swt; 16 17 import java.util.Collections; 18 import java.util.LinkedList; 16 19 17 20 import org.eclipse.swt.SWT; … … 142 145 public void updateResultList() { 143 146 evaluationResultsList.removeAll(); 147 148 java.util.List<String> results = new LinkedList<>(); 149 144 150 for (String key : GlobalDataContainer.getInstance().getAllKeys()) { 145 151 Object data = GlobalDataContainer.getInstance().getData(key); 146 152 if (data instanceof UsabilityEvaluationResult) { 147 evaluationResultsList.add(key);153 results.add(key); 148 154 } 155 } 156 157 Collections.sort(results); 158 159 for (String entry : results) { 160 evaluationResultsList.add(entry); 149 161 } 150 162 } -
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/VisualizationUtils.java
r2033 r2168 36 36 37 37 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 38 import de.ugoe.cs.autoquest.eventcore. guimodel.IGUIElement;38 import de.ugoe.cs.autoquest.eventcore.IHierarchicalEventTarget; 39 39 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 40 40 import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship; … … 243 243 * 244 244 */ 245 static void addInvolvedTargets(Tree guiElementsTree, List<IEventTarget> targets) {245 static void addInvolvedTargets(Tree eventTargetsTree, List<IEventTarget> targets) { 246 246 for (IEventTarget target : targets) { 247 247 List<IEventTarget> pathToIntegrate = new LinkedList<IEventTarget>(); … … 250 250 pathToIntegrate.add(0, target); 251 251 252 if (target instanceof I GUIElement) {253 target = ((I GUIElement) target).getParent();252 if (target instanceof IHierarchicalEventTarget) { 253 target = ((IHierarchicalEventTarget) target).getParent(); 254 254 } 255 255 else { … … 264 264 265 265 if (parent == null) { 266 children = guiElementsTree.getItems();266 children = eventTargetsTree.getItems(); 267 267 } 268 268 else { … … 282 282 if (childItem == null) { 283 283 if (parent == null) { 284 childItem = new TreeItem( guiElementsTree, SWT.NONE);284 childItem = new TreeItem(eventTargetsTree, SWT.NONE); 285 285 } 286 286 else { … … 297 297 } 298 298 299 expandAll( guiElementsTree, true);300 updateColumnWidths( guiElementsTree);299 expandAll(eventTargetsTree, true); 300 updateColumnWidths(eventTargetsTree); 301 301 } 302 302
Note: See TracChangeset
for help on using the changeset viewer.