[1094] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
| 2 | // |
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 4 | // you may not use this file except in compliance with the License. |
---|
| 5 | // You may obtain a copy of the License at |
---|
| 6 | // |
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 8 | // |
---|
| 9 | // Unless required by applicable law or agreed to in writing, software |
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 12 | // See the License for the specific language governing permissions and |
---|
| 13 | // limitations under the License. |
---|
| 14 | |
---|
| 15 | package de.ugoe.cs.autoquest.ui.swt; |
---|
| 16 | |
---|
[2033] | 17 | import java.awt.Frame; |
---|
[1424] | 18 | import java.awt.GraphicsDevice; |
---|
| 19 | import java.awt.GraphicsEnvironment; |
---|
[2033] | 20 | import java.lang.reflect.Method; |
---|
[1153] | 21 | import java.util.Collection; |
---|
[1262] | 22 | import java.util.Collections; |
---|
| 23 | import java.util.Comparator; |
---|
| 24 | import java.util.LinkedList; |
---|
[1146] | 25 | import java.util.List; |
---|
| 26 | |
---|
[1094] | 27 | import org.eclipse.swt.SWT; |
---|
[2033] | 28 | import org.eclipse.swt.awt.SWT_AWT; |
---|
[1146] | 29 | import org.eclipse.swt.custom.SashForm; |
---|
[2033] | 30 | import org.eclipse.swt.custom.StackLayout; |
---|
[1094] | 31 | import org.eclipse.swt.events.SelectionAdapter; |
---|
| 32 | import org.eclipse.swt.events.SelectionEvent; |
---|
[1424] | 33 | import org.eclipse.swt.events.ShellAdapter; |
---|
| 34 | import org.eclipse.swt.events.ShellEvent; |
---|
| 35 | import org.eclipse.swt.events.ShellListener; |
---|
[2033] | 36 | import org.eclipse.swt.graphics.Color; |
---|
[1094] | 37 | import org.eclipse.swt.layout.GridData; |
---|
| 38 | import org.eclipse.swt.layout.GridLayout; |
---|
| 39 | import org.eclipse.swt.widgets.Button; |
---|
[1424] | 40 | import org.eclipse.swt.widgets.Composite; |
---|
[2033] | 41 | import org.eclipse.swt.widgets.Control; |
---|
[1094] | 42 | import org.eclipse.swt.widgets.Dialog; |
---|
| 43 | import org.eclipse.swt.widgets.Display; |
---|
[1153] | 44 | import org.eclipse.swt.widgets.Event; |
---|
[2033] | 45 | import org.eclipse.swt.widgets.FileDialog; |
---|
[1424] | 46 | import org.eclipse.swt.widgets.Label; |
---|
[1153] | 47 | import org.eclipse.swt.widgets.Listener; |
---|
[2033] | 48 | import org.eclipse.swt.widgets.Menu; |
---|
| 49 | import org.eclipse.swt.widgets.MenuItem; |
---|
[1094] | 50 | import org.eclipse.swt.widgets.Shell; |
---|
[1424] | 51 | import org.eclipse.swt.widgets.TabFolder; |
---|
| 52 | import org.eclipse.swt.widgets.TabItem; |
---|
[1094] | 53 | import org.eclipse.swt.widgets.Tree; |
---|
[1424] | 54 | import org.eclipse.swt.widgets.TreeColumn; |
---|
[1094] | 55 | import org.eclipse.swt.widgets.TreeItem; |
---|
[2033] | 56 | import org.jfree.chart.ChartPanel; |
---|
| 57 | import org.jfree.chart.JFreeChart; |
---|
[1094] | 58 | |
---|
[1424] | 59 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; |
---|
[1146] | 60 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship; |
---|
[1424] | 61 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; |
---|
[1294] | 62 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; |
---|
[1424] | 63 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; |
---|
[1294] | 64 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; |
---|
[1424] | 65 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; |
---|
[1146] | 66 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship; |
---|
| 67 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
| 68 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; |
---|
| 69 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; |
---|
| 70 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; |
---|
| 71 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; |
---|
[1636] | 72 | import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric; |
---|
[2033] | 73 | import de.ugoe.cs.util.console.Console; |
---|
[1094] | 74 | |
---|
| 75 | /** |
---|
| 76 | * <p> |
---|
[1275] | 77 | * a dialog to inspect the tasks and task instances of a task model |
---|
[1094] | 78 | * </p> |
---|
| 79 | * |
---|
| 80 | * @author Patrick Harms |
---|
| 81 | */ |
---|
| 82 | public class ShowTaskTreeDialog extends Dialog { |
---|
| 83 | |
---|
[1275] | 84 | /** the main shell */ |
---|
[1424] | 85 | private Shell shell; |
---|
[1094] | 86 | |
---|
[1424] | 87 | /** the listener for the main shell to prevent disposing required */ |
---|
| 88 | private ShellListener shellListener; |
---|
| 89 | |
---|
[2033] | 90 | /** the tab folder containing the instance tree, the model tree, and the visualizations list */ |
---|
[1424] | 91 | private TabFolder tabFolder; |
---|
| 92 | |
---|
[1275] | 93 | /** the tree of task instances on the left */ |
---|
[1146] | 94 | private Tree instanceTree; |
---|
| 95 | |
---|
[1424] | 96 | /** the tree of tasks on the left */ |
---|
[1146] | 97 | private Tree modelTree; |
---|
[1424] | 98 | |
---|
[2033] | 99 | /** the tree of possible visualizations on the left */ |
---|
| 100 | private Tree modelVisualizationTree; |
---|
| 101 | |
---|
| 102 | /** the right hand composite containing either task details or a visualization */ |
---|
| 103 | private Composite rightHandComposite; |
---|
| 104 | |
---|
| 105 | /** the stack layout displaying either the task details or a visualization */ |
---|
| 106 | private StackLayout rightHandLayout; |
---|
| 107 | |
---|
| 108 | /** the task details composite containing the task details tree, the execution variants, etc.*/ |
---|
| 109 | private Composite detailsComposite; |
---|
| 110 | |
---|
[1424] | 111 | /** the tree of a specific task on the right */ |
---|
| 112 | private Tree taskDetailsTree; |
---|
[1094] | 113 | |
---|
[1424] | 114 | /** the tree of execution variants of a specific task on the right */ |
---|
| 115 | private Tree executionVariantsTree; |
---|
| 116 | |
---|
| 117 | /** the tree of involved GUI elements of a specific task on the right bottom */ |
---|
[1495] | 118 | private Tree involvedTargetsTree; |
---|
[1424] | 119 | |
---|
| 120 | /** the table containing the parents tasks of a displayed task */ |
---|
| 121 | private Tree parentTasks; |
---|
[2033] | 122 | |
---|
| 123 | /** the visualization composite on the right hand side toggled with the details composite */ |
---|
| 124 | private Composite visualizationsComposite; |
---|
[1424] | 125 | |
---|
[1275] | 126 | /** the displayed task model */ |
---|
[1424] | 127 | private ITaskModel taskModel; |
---|
| 128 | |
---|
[2033] | 129 | /** a boolean indicating if the CTTE export of a task is possible */ |
---|
| 130 | private boolean taskExportAvailable = false; |
---|
| 131 | |
---|
[1424] | 132 | /** default expansion listener */ |
---|
| 133 | private Listener defaultExpansionListener = new Listener() { |
---|
| 134 | public void handleEvent(final Event event) { |
---|
| 135 | ensureChildren((TreeItem) event.item); |
---|
| 136 | ((TreeItem) event.item).setExpanded(true); |
---|
| 137 | } |
---|
| 138 | }; |
---|
[1094] | 139 | |
---|
| 140 | /** |
---|
[1275] | 141 | * creates the dialog |
---|
[1094] | 142 | */ |
---|
[1146] | 143 | public ShowTaskTreeDialog(Shell parent, int style, ITaskModel taskModel, String taskTreeName) { |
---|
[1094] | 144 | super(parent, style); |
---|
[1146] | 145 | setText("Task Model " + taskTreeName); |
---|
| 146 | this.taskModel = taskModel; |
---|
[1094] | 147 | } |
---|
| 148 | |
---|
| 149 | /** |
---|
[1275] | 150 | * displays the dialog |
---|
[1424] | 151 | * @param task |
---|
[1094] | 152 | */ |
---|
| 153 | public void open() { |
---|
[2033] | 154 | // check, if export to CTTE is possible |
---|
| 155 | try { |
---|
| 156 | Class<?> exportClass = this.getClass().getClassLoader().loadClass |
---|
| 157 | ("de.ugoe.cs.autoquest.plugin.exports.tasktree.CTTExportUtils"); |
---|
| 158 | |
---|
| 159 | if (exportClass != null) { |
---|
| 160 | taskExportAvailable = true; |
---|
| 161 | } |
---|
| 162 | } |
---|
| 163 | catch (ClassNotFoundException e) { |
---|
| 164 | // ignore. No export available |
---|
| 165 | } |
---|
| 166 | |
---|
[1424] | 167 | open(null); |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | /** |
---|
| 171 | * displays the dialog with a specific task opened |
---|
| 172 | * @param task |
---|
| 173 | */ |
---|
| 174 | public void open(ITask task) { |
---|
| 175 | if (shell == null) { |
---|
| 176 | createContents(); |
---|
| 177 | shell.open(); |
---|
| 178 | shell.layout(); |
---|
| 179 | |
---|
| 180 | VisualizationUtils.updateColumnWidths(taskDetailsTree); |
---|
| 181 | } |
---|
| 182 | else { |
---|
| 183 | shell.setVisible(true); |
---|
| 184 | } |
---|
| 185 | |
---|
| 186 | if (task != null) { |
---|
| 187 | shellListener = new ShellAdapter() { |
---|
| 188 | @Override |
---|
| 189 | public void shellClosed(ShellEvent e) { |
---|
| 190 | e.doit = false; |
---|
| 191 | shell.setVisible(false); |
---|
| 192 | } |
---|
| 193 | }; |
---|
| 194 | |
---|
| 195 | shell.addShellListener(shellListener); |
---|
| 196 | } |
---|
| 197 | |
---|
| 198 | if (task != null) { |
---|
| 199 | navigateTo(task); |
---|
| 200 | } |
---|
| 201 | |
---|
[1094] | 202 | Display display = getParent().getDisplay(); |
---|
[1424] | 203 | while (!shell.isDisposed() && shell.isVisible()) { |
---|
[1094] | 204 | if (!display.readAndDispatch()) { |
---|
| 205 | display.sleep(); |
---|
| 206 | } |
---|
| 207 | } |
---|
[1424] | 208 | |
---|
| 209 | if (task == null) { |
---|
| 210 | dispose(); |
---|
| 211 | } |
---|
[1094] | 212 | } |
---|
| 213 | |
---|
| 214 | /** |
---|
[1424] | 215 | * disposes the dialog if it is not used anymore |
---|
| 216 | */ |
---|
| 217 | public void dispose() { |
---|
| 218 | if ((shell != null) && (!shell.isDisposed())) { |
---|
| 219 | if (shellListener != null) { |
---|
| 220 | shell.removeShellListener(shellListener); |
---|
| 221 | } |
---|
| 222 | |
---|
| 223 | shell.dispose(); |
---|
| 224 | } |
---|
| 225 | } |
---|
| 226 | |
---|
| 227 | /** |
---|
[1275] | 228 | * creates the two views, one on the task instances on the left, on on the task models on the |
---|
| 229 | * right. Also adds a selection adapter to the task instances so that for a selected task |
---|
| 230 | * instance always the respective model is presented. |
---|
[1094] | 231 | */ |
---|
| 232 | private void createContents() { |
---|
[1424] | 233 | shell = new Shell(getParent(), SWT.SHELL_TRIM | SWT.BORDER); |
---|
| 234 | |
---|
| 235 | GraphicsDevice gd = |
---|
| 236 | GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
---|
| 237 | |
---|
| 238 | shell.setSize(gd.getDisplayMode().getWidth(), gd.getDisplayMode().getHeight()); |
---|
[1094] | 239 | shell.setText(getText()); |
---|
| 240 | |
---|
| 241 | shell.setLayout(new GridLayout(4, false)); |
---|
[1146] | 242 | |
---|
[1424] | 243 | SashForm mainSashForm = new SashForm(shell, SWT.HORIZONTAL); |
---|
| 244 | mainSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1)); |
---|
[1146] | 245 | |
---|
[2033] | 246 | createLeftHandSideTabs(mainSashForm); |
---|
| 247 | createRightHandSideView(mainSashForm); |
---|
[1424] | 248 | |
---|
| 249 | mainSashForm.setWeights(new int[] { 1, 3 }); |
---|
| 250 | |
---|
| 251 | Button btnExpandAll = new Button(shell, SWT.NONE); |
---|
| 252 | btnExpandAll.addSelectionListener(new SelectionAdapter() { |
---|
| 253 | @Override |
---|
| 254 | public void widgetSelected(SelectionEvent e) { |
---|
| 255 | if (tabFolder.getSelectionIndex() == 0) { |
---|
| 256 | VisualizationUtils.expandAll(instanceTree, true); |
---|
| 257 | } |
---|
| 258 | else { |
---|
| 259 | VisualizationUtils.expandAll(modelTree, true); |
---|
| 260 | } |
---|
| 261 | } |
---|
| 262 | }); |
---|
| 263 | btnExpandAll.setText("Expand all"); |
---|
| 264 | |
---|
| 265 | Button btnCollapseAll = new Button(shell, SWT.NONE); |
---|
| 266 | btnCollapseAll.addSelectionListener(new SelectionAdapter() { |
---|
| 267 | @Override |
---|
| 268 | public void widgetSelected(SelectionEvent e) { |
---|
| 269 | if (tabFolder.getSelectionIndex() == 0) { |
---|
| 270 | VisualizationUtils.expandAll(instanceTree, false); |
---|
| 271 | } |
---|
| 272 | else { |
---|
| 273 | VisualizationUtils.expandAll(modelTree, false); |
---|
| 274 | } |
---|
| 275 | } |
---|
| 276 | }); |
---|
| 277 | btnCollapseAll.setText("Collapse all"); |
---|
| 278 | |
---|
| 279 | new Label(shell, SWT.NONE); |
---|
| 280 | new Label(shell, SWT.NONE); |
---|
| 281 | } |
---|
| 282 | |
---|
| 283 | /** |
---|
| 284 | * |
---|
| 285 | */ |
---|
[2033] | 286 | private void createLeftHandSideTabs(final SashForm mainSashForm) { |
---|
[1424] | 287 | tabFolder = new TabFolder(mainSashForm, SWT.NONE); |
---|
| 288 | tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
---|
| 289 | tabFolder.addSelectionListener(new SelectionAdapter() { |
---|
| 290 | @Override |
---|
| 291 | public void widgetSelected(SelectionEvent e) { |
---|
[2033] | 292 | if (tabFolder.getSelectionIndex() == 0) { |
---|
| 293 | // task instances tab selected |
---|
| 294 | rightHandLayout.topControl = detailsComposite; |
---|
| 295 | } |
---|
| 296 | else if (tabFolder.getSelectionIndex() == 1) { |
---|
| 297 | // task model tab selected |
---|
| 298 | rightHandLayout.topControl = detailsComposite; |
---|
| 299 | VisualizationUtils.updateColumnWidths(modelTree); |
---|
| 300 | } |
---|
| 301 | else { |
---|
| 302 | rightHandLayout.topControl = visualizationsComposite; |
---|
| 303 | } |
---|
| 304 | |
---|
| 305 | rightHandComposite.layout(); |
---|
| 306 | rightHandComposite.redraw(); |
---|
| 307 | rightHandComposite.update(); |
---|
[1424] | 308 | } |
---|
| 309 | }); |
---|
| 310 | |
---|
| 311 | TabItem instanceTreeTab = new TabItem(tabFolder, SWT.NONE); |
---|
| 312 | instanceTreeTab.setText("Task Instances"); |
---|
| 313 | |
---|
| 314 | instanceTree = new Tree(tabFolder, SWT.BORDER | SWT.SINGLE | SWT.VIRTUAL); |
---|
[1146] | 315 | instanceTree.addSelectionListener(new SelectionAdapter() { |
---|
| 316 | @Override |
---|
| 317 | public void widgetSelected(SelectionEvent e) { |
---|
| 318 | TreeItem[] selectedItems = instanceTree.getSelection(); |
---|
[1424] | 319 | if ((selectedItems.length == 1) && |
---|
| 320 | (selectedItems[0].getData() instanceof ITaskInstance)) |
---|
| 321 | { |
---|
| 322 | displayTaskDetails(((ITaskInstance) selectedItems[0].getData()).getTask()); |
---|
[1146] | 323 | } |
---|
[1424] | 324 | else { |
---|
| 325 | clearTaskDetails(); |
---|
| 326 | } |
---|
[1146] | 327 | } |
---|
| 328 | }); |
---|
[1094] | 329 | |
---|
[1424] | 330 | VisualizationUtils.addItemSpecificContextMenu |
---|
| 331 | (instanceTree, ITaskInstance.class, "show in task list", new SelectionAdapter() |
---|
| 332 | { |
---|
| 333 | @Override |
---|
| 334 | public void widgetSelected(SelectionEvent e) { |
---|
| 335 | navigateTo(((ITaskInstance) instanceTree.getSelection()[0].getData()).getTask()); |
---|
| 336 | } |
---|
| 337 | }); |
---|
[2033] | 338 | |
---|
| 339 | if (taskExportAvailable) { |
---|
| 340 | VisualizationUtils.addItemSpecificContextMenu |
---|
| 341 | (instanceTree, ITask.class, "export to ConcurTaskTree", new SelectionAdapter() |
---|
| 342 | { |
---|
| 343 | @Override |
---|
| 344 | public void widgetSelected(SelectionEvent e) { |
---|
| 345 | export((ITask) taskDetailsTree.getSelection()[0].getData()); |
---|
| 346 | } |
---|
| 347 | }); |
---|
| 348 | } |
---|
[1424] | 349 | |
---|
[1146] | 350 | buildInstanceTree(); |
---|
[1424] | 351 | instanceTreeTab.setControl(instanceTree); |
---|
[1094] | 352 | |
---|
[1424] | 353 | TabItem modelTreeTab = new TabItem(tabFolder, SWT.NONE); |
---|
| 354 | modelTreeTab.setText("Tasks"); |
---|
| 355 | |
---|
| 356 | modelTree = |
---|
| 357 | VisualizationUtils.createTaskDetailsTree(tabFolder, "tasks in model", taskModel); |
---|
| 358 | |
---|
| 359 | // show task details if requested |
---|
| 360 | modelTree.addSelectionListener(new SelectionAdapter() { |
---|
| 361 | @Override |
---|
| 362 | public void widgetSelected(SelectionEvent e) { |
---|
| 363 | TreeItem[] selectedItems = modelTree.getSelection(); |
---|
| 364 | if ((selectedItems.length == 1) && (selectedItems[0].getData() instanceof ITask)) { |
---|
| 365 | displayTaskDetails((ITask) selectedItems[0].getData()); |
---|
| 366 | } |
---|
| 367 | else { |
---|
| 368 | clearTaskDetails(); |
---|
| 369 | } |
---|
| 370 | } |
---|
| 371 | }); |
---|
| 372 | |
---|
[1153] | 373 | buildModelTree(taskModel); |
---|
[1424] | 374 | |
---|
| 375 | modelTreeTab.setControl(modelTree); |
---|
[2033] | 376 | |
---|
| 377 | TabItem modelVisualizationTab = new TabItem(tabFolder, SWT.NONE); |
---|
| 378 | modelVisualizationTab.setText("Visualizations"); |
---|
| 379 | |
---|
| 380 | modelVisualizationTree = new Tree(tabFolder, SWT.BORDER | SWT.SINGLE | SWT.VIRTUAL); |
---|
| 381 | |
---|
| 382 | TreeItem item1 = new TreeItem(modelVisualizationTree, SWT.NULL); |
---|
| 383 | item1.setText(TaskTreePlotUtils.TASK_COUNT__EVENT_COVERAGE_PLOT); |
---|
| 384 | |
---|
| 385 | item1 = new TreeItem(modelVisualizationTree, SWT.NULL); |
---|
| 386 | item1.setText(TaskTreePlotUtils.ORDERED_TASK_COUNT_PLOT); |
---|
| 387 | |
---|
| 388 | item1 = new TreeItem(modelVisualizationTree, SWT.NULL); |
---|
| 389 | item1.setText(TaskTreePlotUtils.CUMULATIVE_TASK_COVERAGE_PLOT); |
---|
| 390 | |
---|
| 391 | Menu menu = modelVisualizationTree.getMenu(); |
---|
| 392 | |
---|
| 393 | if (menu == null) { |
---|
| 394 | menu = new Menu(modelVisualizationTree); |
---|
| 395 | modelVisualizationTree.setMenu(menu); |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | // show visualization if requested |
---|
| 399 | modelVisualizationTree.addSelectionListener(new SelectionAdapter() { |
---|
| 400 | @Override |
---|
| 401 | public void widgetSelected(SelectionEvent e) { |
---|
| 402 | clearVisualization(); |
---|
| 403 | TreeItem[] selectedItems = modelVisualizationTree.getSelection(); |
---|
| 404 | if (selectedItems.length == 1) { |
---|
| 405 | showVisualization(selectedItems[0].getText()); |
---|
| 406 | } |
---|
| 407 | } |
---|
| 408 | }); |
---|
| 409 | |
---|
| 410 | modelVisualizationTab.setControl(modelVisualizationTree); |
---|
| 411 | |
---|
| 412 | // add a context menu for PDF export |
---|
| 413 | final Menu finalMenu = menu; |
---|
| 414 | MenuItem newItem = new MenuItem(finalMenu, SWT.NONE); |
---|
| 415 | newItem.setText("save as PDF"); |
---|
| 416 | newItem.addSelectionListener(new SelectionAdapter() { |
---|
| 417 | @Override |
---|
| 418 | public void widgetSelected(SelectionEvent e) { |
---|
| 419 | try { |
---|
| 420 | FileDialog dialog = new FileDialog(shell, SWT.SAVE); |
---|
| 421 | dialog.setFilterExtensions(new String [] {"*.pdf"}); |
---|
| 422 | TaskTreePlotUtils.saveChartToPDF |
---|
| 423 | ((JFreeChart) modelVisualizationTree.getSelection()[0].getData(), |
---|
| 424 | dialog.open(), 500, 500); |
---|
| 425 | } |
---|
| 426 | catch (Exception e1) { |
---|
| 427 | // TODO Auto-generated catch block |
---|
| 428 | e1.printStackTrace(); |
---|
| 429 | } |
---|
| 430 | } |
---|
| 431 | }); |
---|
[1424] | 432 | } |
---|
[2033] | 433 | |
---|
[1424] | 434 | /** |
---|
| 435 | * |
---|
| 436 | */ |
---|
[2033] | 437 | private void createRightHandSideView(SashForm mainSashForm) { |
---|
| 438 | rightHandComposite = new Composite(mainSashForm, SWT.NO_BACKGROUND); |
---|
| 439 | rightHandLayout = new StackLayout(); |
---|
| 440 | rightHandComposite.setLayout(rightHandLayout); |
---|
| 441 | |
---|
| 442 | detailsComposite = new Composite(rightHandComposite, SWT.NO_BACKGROUND); |
---|
[1424] | 443 | detailsComposite.setLayout(new GridLayout(1, false)); |
---|
| 444 | detailsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
---|
| 445 | |
---|
| 446 | new Label(detailsComposite, SWT.NONE).setText("Task Details:"); |
---|
| 447 | |
---|
| 448 | SashForm detailsSashForm = new SashForm(detailsComposite, SWT.VERTICAL); |
---|
| 449 | detailsSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
---|
| 450 | |
---|
| 451 | SashForm detailsTopSashForm = new SashForm(detailsSashForm, SWT.HORIZONTAL); |
---|
| 452 | detailsTopSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
---|
| 453 | |
---|
| 454 | taskDetailsTree = |
---|
| 455 | VisualizationUtils.createTaskDetailsTree(detailsTopSashForm, "task details", taskModel); |
---|
| 456 | |
---|
| 457 | VisualizationUtils.addExpansionListener(taskDetailsTree, defaultExpansionListener); |
---|
| 458 | |
---|
[2033] | 459 | VisualizationUtils.addItemSpecificContextMenu |
---|
| 460 | (taskDetailsTree, ITask.class, "show in task list", new SelectionAdapter() |
---|
[1424] | 461 | { |
---|
[1094] | 462 | @Override |
---|
| 463 | public void widgetSelected(SelectionEvent e) { |
---|
[1424] | 464 | navigateTo((ITask) taskDetailsTree.getSelection()[0].getData()); |
---|
[1094] | 465 | } |
---|
| 466 | }); |
---|
[1424] | 467 | |
---|
[2033] | 468 | if (taskExportAvailable) { |
---|
| 469 | VisualizationUtils.addItemSpecificContextMenu |
---|
| 470 | (taskDetailsTree, ITask.class, "export to ConcurTaskTree", new SelectionAdapter() |
---|
| 471 | { |
---|
| 472 | @Override |
---|
| 473 | public void widgetSelected(SelectionEvent e) { |
---|
| 474 | export((ITask) taskDetailsTree.getSelection()[0].getData()); |
---|
| 475 | } |
---|
| 476 | }); |
---|
| 477 | } |
---|
| 478 | |
---|
[1424] | 479 | executionVariantsTree = new Tree(detailsTopSashForm, SWT.BORDER | SWT.SINGLE | SWT.WRAP); |
---|
| 480 | executionVariantsTree.setHeaderVisible(true); |
---|
| 481 | |
---|
| 482 | TreeColumn taskColumn = new TreeColumn(executionVariantsTree, SWT.NONE); |
---|
| 483 | taskColumn.setText("instance variants"); |
---|
| 484 | taskColumn.setAlignment(SWT.LEFT); |
---|
[1094] | 485 | |
---|
[1424] | 486 | // load the correct children on expansion |
---|
| 487 | VisualizationUtils.addExpansionListener(executionVariantsTree, defaultExpansionListener); |
---|
| 488 | |
---|
| 489 | detailsTopSashForm.setWeights(new int[] { 3, 2 }); |
---|
| 490 | |
---|
| 491 | SashForm detailsBottomSashForm = new SashForm(detailsSashForm, SWT.HORIZONTAL); |
---|
| 492 | detailsBottomSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
---|
| 493 | |
---|
| 494 | parentTasks = VisualizationUtils.createTaskDetailsTree |
---|
| 495 | (detailsBottomSashForm, "parent tasks", taskModel); |
---|
| 496 | |
---|
[2033] | 497 | VisualizationUtils.addItemSpecificContextMenu |
---|
| 498 | (parentTasks, ITask.class, "show in task list", new SelectionAdapter() |
---|
[1424] | 499 | { |
---|
[1094] | 500 | @Override |
---|
| 501 | public void widgetSelected(SelectionEvent e) { |
---|
[1424] | 502 | navigateTo((ITask) parentTasks.getSelection()[0].getData()); |
---|
[1094] | 503 | } |
---|
| 504 | }); |
---|
| 505 | |
---|
[2033] | 506 | if (taskExportAvailable) { |
---|
| 507 | VisualizationUtils.addItemSpecificContextMenu |
---|
| 508 | (parentTasks, ITask.class, "export to ConcurTaskTree", new SelectionAdapter() |
---|
| 509 | { |
---|
| 510 | @Override |
---|
| 511 | public void widgetSelected(SelectionEvent e) { |
---|
| 512 | export((ITask) taskDetailsTree.getSelection()[0].getData()); |
---|
| 513 | } |
---|
| 514 | }); |
---|
| 515 | } |
---|
| 516 | |
---|
[1495] | 517 | involvedTargetsTree = |
---|
| 518 | VisualizationUtils.createTargetsTree(detailsBottomSashForm, "involved GUI elements"); |
---|
[1424] | 519 | |
---|
[2033] | 520 | visualizationsComposite = new Composite(rightHandComposite, SWT.NO_BACKGROUND); |
---|
| 521 | visualizationsComposite.setLayout(new GridLayout(1, false)); |
---|
| 522 | visualizationsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
---|
| 523 | |
---|
| 524 | new Label(visualizationsComposite, SWT.NONE).setText("Visualization:"); |
---|
| 525 | |
---|
| 526 | rightHandLayout.topControl = detailsComposite; |
---|
| 527 | |
---|
[1424] | 528 | detailsBottomSashForm.setWeights(new int[] { 2, 3 }); |
---|
| 529 | detailsSashForm.setWeights(new int[] { 1, 1 }); |
---|
[1094] | 530 | } |
---|
| 531 | |
---|
| 532 | /** |
---|
[1275] | 533 | * convenience method for creating the display of the instances |
---|
[1094] | 534 | */ |
---|
[1146] | 535 | private void buildInstanceTree() { |
---|
| 536 | List<IUserSession> sessions = taskModel.getUserSessions(); |
---|
[1424] | 537 | |
---|
| 538 | // load the correct children on expansion |
---|
| 539 | VisualizationUtils.addExpansionListener(instanceTree, defaultExpansionListener); |
---|
| 540 | |
---|
[1146] | 541 | TreeItem root = new TreeItem(instanceTree, SWT.NULL); |
---|
| 542 | root.setText(sessions.size() + " sessions"); |
---|
[1153] | 543 | root.setData(taskModel); |
---|
[1146] | 544 | |
---|
| 545 | for (IUserSession session : sessions) { |
---|
| 546 | buildInstanceTree(root, session); |
---|
| 547 | } |
---|
[1424] | 548 | |
---|
| 549 | root.setExpanded(true); |
---|
[1094] | 550 | } |
---|
| 551 | |
---|
| 552 | /** |
---|
[1275] | 553 | * convenience method for creating the display of the instances |
---|
[1094] | 554 | */ |
---|
[1294] | 555 | private void buildInstanceTree(TreeItem currentParent, IUserSession session) { |
---|
[1424] | 556 | TreeItem item = new TreeItem(currentParent, SWT.NULL); |
---|
| 557 | item.setText(session.toString()); |
---|
| 558 | item.setData(session); |
---|
[1146] | 559 | |
---|
[1424] | 560 | // simulate a child |
---|
| 561 | new TreeItem(item, SWT.NULL); |
---|
[1146] | 562 | } |
---|
| 563 | |
---|
| 564 | /** |
---|
[1275] | 565 | * convenience method for creating the display of the task model |
---|
[1146] | 566 | */ |
---|
[1153] | 567 | private void buildModelTree(ITaskModel taskModel) { |
---|
[1424] | 568 | Collection<ITask> allTasks = taskModel.getTasks(); |
---|
[1153] | 569 | |
---|
[1424] | 570 | List<ITask> sequences = new LinkedList<ITask>(); |
---|
| 571 | List<ITask> iterations = new LinkedList<ITask>(); |
---|
| 572 | List<ITask> selections = new LinkedList<ITask>(); |
---|
| 573 | List<ITask> optionals = new LinkedList<ITask>(); |
---|
| 574 | List<ITask> others = new LinkedList<ITask>(); |
---|
[1153] | 575 | |
---|
| 576 | TreeItem root = new TreeItem(modelTree, SWT.NULL); |
---|
[1424] | 577 | root.setText(allTasks.size() + " tasks in model"); |
---|
[1153] | 578 | root.setData(taskModel); |
---|
| 579 | |
---|
[1424] | 580 | createSortedTaskLists(allTasks, sequences, iterations, selections, optionals, others); |
---|
[1153] | 581 | |
---|
[1424] | 582 | //allTasks = createSortedTaskList(allTasks); |
---|
[1153] | 583 | |
---|
[1424] | 584 | createModelTreeItemFor(sequences, sequences.size() + " Sequences", root); |
---|
| 585 | createModelTreeItemFor(iterations, iterations.size() + " Iterations", root); |
---|
| 586 | createModelTreeItemFor(selections, selections.size() + " Selections", root); |
---|
| 587 | createModelTreeItemFor(optionals, optionals.size() + " Optionals", root); |
---|
| 588 | createModelTreeItemFor(others, others.size() + " other Tasks", root); |
---|
| 589 | |
---|
[1153] | 590 | root.setExpanded(true); |
---|
| 591 | } |
---|
| 592 | |
---|
| 593 | /** |
---|
[1424] | 594 | * |
---|
[1153] | 595 | */ |
---|
[1424] | 596 | private void createSortedTaskLists(Collection<ITask> allTasks, |
---|
| 597 | List<ITask> sequences, |
---|
| 598 | List<ITask> iterations, |
---|
| 599 | List<ITask> selections, |
---|
| 600 | List<ITask> optionals, |
---|
| 601 | List<ITask> others) |
---|
| 602 | { |
---|
| 603 | List<ITask> toAdd; |
---|
[1153] | 604 | |
---|
[1424] | 605 | for (ITask task : allTasks) { |
---|
| 606 | if (task instanceof ISequence) { |
---|
| 607 | toAdd = sequences; |
---|
| 608 | } |
---|
| 609 | else if (task instanceof IIteration) { |
---|
| 610 | toAdd = iterations; |
---|
| 611 | } |
---|
| 612 | else if (task instanceof ISelection) { |
---|
| 613 | toAdd = selections; |
---|
| 614 | } |
---|
| 615 | else if (task instanceof IOptional) { |
---|
| 616 | toAdd = optionals; |
---|
| 617 | } |
---|
| 618 | else { |
---|
| 619 | toAdd = others; |
---|
| 620 | } |
---|
| 621 | |
---|
[1636] | 622 | int taskValue = taskModel.getTaskInfo(task).getMeasureValue(TaskMetric.EVENT_COVERAGE); |
---|
[1424] | 623 | int start = 0; |
---|
| 624 | int end = toAdd.size(); |
---|
| 625 | int center = 0; |
---|
[1636] | 626 | int centerValue; |
---|
[1424] | 627 | |
---|
| 628 | while (start != end) { |
---|
| 629 | center = start + ((end - start) / 2); |
---|
| 630 | |
---|
| 631 | if ((center != start) || (center != end)) { |
---|
[1636] | 632 | //centerValue = toAdd.get(center).getInstances().size(); |
---|
| 633 | centerValue = taskModel.getTaskInfo(toAdd.get(center)).getMeasureValue |
---|
| 634 | (TaskMetric.EVENT_COVERAGE); |
---|
[1424] | 635 | |
---|
[1636] | 636 | if (centerValue > taskValue) { |
---|
[1424] | 637 | start = Math.max(center, start + 1); |
---|
| 638 | } |
---|
[1636] | 639 | else if (centerValue < taskValue) { |
---|
[1424] | 640 | end = Math.min(center, end - 1); |
---|
| 641 | } |
---|
| 642 | else { |
---|
| 643 | // add the event directly where the center is, as the count of the center |
---|
| 644 | // and the new task are equal |
---|
| 645 | end = center; |
---|
| 646 | start = end; |
---|
| 647 | break; |
---|
| 648 | } |
---|
| 649 | } |
---|
| 650 | else { |
---|
| 651 | // add the event to the position denoted by the add index |
---|
| 652 | break; |
---|
| 653 | } |
---|
| 654 | } |
---|
| 655 | |
---|
| 656 | toAdd.add(start, task); |
---|
| 657 | } |
---|
[1146] | 658 | } |
---|
| 659 | |
---|
| 660 | /** |
---|
[1424] | 661 | * |
---|
[1146] | 662 | */ |
---|
[1424] | 663 | private void clearTaskDetails() { |
---|
| 664 | taskDetailsTree.removeAll(); |
---|
| 665 | executionVariantsTree.removeAll(); |
---|
[1495] | 666 | involvedTargetsTree.removeAll(); |
---|
[1424] | 667 | parentTasks.removeAll(); |
---|
| 668 | } |
---|
| 669 | |
---|
| 670 | /** |
---|
| 671 | * |
---|
| 672 | */ |
---|
| 673 | private void displayTaskDetails(ITask task) { |
---|
| 674 | clearTaskDetails(); |
---|
[1146] | 675 | |
---|
[1424] | 676 | VisualizationUtils.createTreeItemFor(task, taskDetailsTree, taskModel, true); |
---|
| 677 | VisualizationUtils.expandAll(taskDetailsTree, true); |
---|
[1153] | 678 | |
---|
[1424] | 679 | // do it twice. Otherwise, it doesn't work |
---|
| 680 | VisualizationUtils.updateColumnWidths(taskDetailsTree); |
---|
[1262] | 681 | |
---|
[1424] | 682 | Collection<Collection<ITaskInstance>> executionVariants = task.getExecutionVariants(); |
---|
| 683 | List<Collection<ITaskInstance>> sortedExecutionVariants = |
---|
| 684 | new LinkedList<Collection<ITaskInstance>>(executionVariants); |
---|
| 685 | |
---|
| 686 | Collections.sort(sortedExecutionVariants, new Comparator<Collection<ITaskInstance>>() { |
---|
[1262] | 687 | @Override |
---|
[1424] | 688 | public int compare(Collection<ITaskInstance> list1, Collection<ITaskInstance> list2) { |
---|
| 689 | return list2.size() - list1.size(); |
---|
[1262] | 690 | } |
---|
| 691 | }); |
---|
| 692 | |
---|
[1424] | 693 | int counter = 1; |
---|
| 694 | for (Collection<ITaskInstance> variant : sortedExecutionVariants) { |
---|
| 695 | TreeItem item = new TreeItem(executionVariantsTree, SWT.NULL); |
---|
| 696 | if (variant.size() > 1) { |
---|
| 697 | item.setText("variant " + counter++ + " (executed " + variant.size() + " times)"); |
---|
| 698 | } |
---|
| 699 | else { |
---|
| 700 | item.setText("variant " + counter++ + " (executed once)"); |
---|
| 701 | } |
---|
| 702 | item.setData(variant); |
---|
| 703 | |
---|
| 704 | createTreeItemFor(variant.iterator().next(), item); |
---|
| 705 | } |
---|
| 706 | |
---|
| 707 | VisualizationUtils.expandAll(executionVariantsTree, true); |
---|
| 708 | VisualizationUtils.updateColumnWidths(executionVariantsTree); |
---|
| 709 | |
---|
| 710 | addParentTasks(task); |
---|
| 711 | VisualizationUtils.updateColumnWidths(parentTasks); |
---|
| 712 | |
---|
[1495] | 713 | VisualizationUtils.addInvolvedTargets(involvedTargetsTree, task); |
---|
[1153] | 714 | } |
---|
| 715 | |
---|
| 716 | /** |
---|
[1424] | 717 | * |
---|
[1153] | 718 | */ |
---|
[1424] | 719 | private void addParentTasks(ITask task) { |
---|
| 720 | for (ITask candidate : taskModel.getTasks()) { |
---|
| 721 | if (((candidate instanceof IStructuringTemporalRelationship) && |
---|
| 722 | (((IStructuringTemporalRelationship) candidate).getChildren().contains(task))) || |
---|
| 723 | ((candidate instanceof IMarkingTemporalRelationship) && |
---|
| 724 | (((IMarkingTemporalRelationship) candidate).getMarkedTask().equals(task)))) |
---|
| 725 | { |
---|
| 726 | VisualizationUtils.createTreeItemFor(candidate, parentTasks, taskModel, false); |
---|
[1094] | 727 | } |
---|
| 728 | } |
---|
| 729 | } |
---|
| 730 | |
---|
| 731 | /** |
---|
[1424] | 732 | * |
---|
[1094] | 733 | */ |
---|
[1424] | 734 | private void navigateTo(ITask task) { |
---|
| 735 | tabFolder.setSelection(1); |
---|
[1153] | 736 | |
---|
[1424] | 737 | OUTER: |
---|
| 738 | for (TreeItem sublist : modelTree.getItem(0).getItems()) { |
---|
| 739 | for (TreeItem taskItem : sublist.getItems()) { |
---|
| 740 | if (task.equals(taskItem.getData())) { |
---|
| 741 | modelTree.setSelection(taskItem); |
---|
| 742 | sublist.setExpanded(true); |
---|
| 743 | VisualizationUtils.updateColumnWidths(modelTree); |
---|
| 744 | break OUTER; |
---|
| 745 | } |
---|
[1153] | 746 | } |
---|
| 747 | } |
---|
[1424] | 748 | |
---|
| 749 | displayTaskDetails(task); |
---|
[1094] | 750 | } |
---|
[2033] | 751 | |
---|
| 752 | /** |
---|
| 753 | * |
---|
| 754 | */ |
---|
| 755 | private void export(ITask task) { |
---|
| 756 | try { |
---|
| 757 | Class<?> exportClass = this.getClass().getClassLoader().loadClass |
---|
| 758 | ("de.ugoe.cs.autoquest.plugin.exports.tasktree.CTTExportUtils"); |
---|
| 759 | |
---|
| 760 | Method method = exportClass.getDeclaredMethod("exportToCTT", ITask.class, String.class); |
---|
| 761 | |
---|
| 762 | method.invoke(null, task, task.getId() + "_ctte.xml"); |
---|
| 763 | } |
---|
| 764 | catch (Exception e) { |
---|
| 765 | Console.logException(e); |
---|
| 766 | } |
---|
| 767 | } |
---|
[1094] | 768 | |
---|
[1153] | 769 | /** |
---|
[1275] | 770 | * ensures, that the children of a specific node are loaded |
---|
[1153] | 771 | */ |
---|
| 772 | private void ensureChildren(TreeItem parent) { |
---|
[1424] | 773 | TreeItem[] items = parent.getItems(); |
---|
| 774 | if ((items == null) || (items.length == 0) || (items[0].getData() == null)) { |
---|
| 775 | if (items != null) { |
---|
| 776 | for (int i = 0; i < items.length; i++) { |
---|
| 777 | items[i].dispose(); |
---|
[1153] | 778 | } |
---|
[1424] | 779 | } |
---|
[1153] | 780 | |
---|
[1424] | 781 | if (parent.getData() instanceof ITask) { |
---|
[1153] | 782 | ITask task = (ITask) parent.getData(); |
---|
| 783 | |
---|
| 784 | if (task instanceof IStructuringTemporalRelationship) { |
---|
| 785 | for (ITask subTask : ((IStructuringTemporalRelationship) task).getChildren()) { |
---|
[1424] | 786 | VisualizationUtils.createTreeItemFor(subTask, parent, taskModel, true); |
---|
[1153] | 787 | } |
---|
| 788 | } |
---|
| 789 | else if (task instanceof IMarkingTemporalRelationship) { |
---|
[1424] | 790 | VisualizationUtils.createTreeItemFor |
---|
| 791 | (((IMarkingTemporalRelationship) task).getMarkedTask(), parent, |
---|
| 792 | taskModel, true); |
---|
[1153] | 793 | } |
---|
| 794 | } |
---|
[1424] | 795 | else if (parent.getData() instanceof List<?>) { |
---|
| 796 | @SuppressWarnings("unchecked") |
---|
| 797 | List<ITask> tasks = (List<ITask>) parent.getData(); |
---|
| 798 | for (ITask task : tasks) { |
---|
| 799 | VisualizationUtils.createTreeItemFor(task, parent, taskModel, false); |
---|
| 800 | } |
---|
| 801 | } |
---|
| 802 | else if (parent.getData() instanceof ITaskInstanceList) { |
---|
| 803 | for (ITaskInstance subInstance : (ITaskInstanceList) parent.getData()) { |
---|
| 804 | createTreeItemFor(subInstance, parent); |
---|
| 805 | } |
---|
| 806 | } |
---|
| 807 | else if (parent.getData() instanceof ITaskInstance) { |
---|
| 808 | ITaskInstance instance = (ITaskInstance) parent.getData(); |
---|
| 809 | |
---|
| 810 | if (instance instanceof ISelectionInstance) { |
---|
| 811 | if (((ISelectionInstance) instance).getChild() != null) { |
---|
| 812 | createTreeItemFor(((ISelectionInstance) instance).getChild(), parent); |
---|
| 813 | } |
---|
| 814 | } |
---|
| 815 | else if (instance instanceof IOptionalInstance) { |
---|
| 816 | if (((IOptionalInstance) instance).getChild() != null) { |
---|
| 817 | createTreeItemFor(((IOptionalInstance) instance).getChild(), parent); |
---|
| 818 | } |
---|
| 819 | } |
---|
| 820 | } |
---|
[1153] | 821 | } |
---|
| 822 | } |
---|
| 823 | |
---|
| 824 | /** |
---|
[1424] | 825 | * |
---|
| 826 | */ |
---|
| 827 | private void createModelTreeItemFor(List<ITask> taskList, String name, TreeItem parent) { |
---|
| 828 | TreeItem item = new TreeItem(parent, SWT.NULL); |
---|
| 829 | item.setText(name); |
---|
| 830 | item.setData(taskList); |
---|
| 831 | |
---|
| 832 | // simulate a child |
---|
| 833 | if (taskList.size() > 0) { |
---|
| 834 | for (ITask task : taskList) { |
---|
| 835 | VisualizationUtils.createTreeItemFor(task, item, taskModel, false); |
---|
| 836 | } |
---|
| 837 | } |
---|
| 838 | } |
---|
| 839 | |
---|
| 840 | /** |
---|
[1275] | 841 | * convenience method to create a tree item for a task |
---|
[1153] | 842 | */ |
---|
[1424] | 843 | private void createTreeItemFor(ITaskInstance taskInstance, |
---|
| 844 | TreeItem parent) |
---|
| 845 | { |
---|
[1153] | 846 | TreeItem item = new TreeItem(parent, SWT.NULL); |
---|
[1424] | 847 | item.setText(taskInstance.toString()); |
---|
| 848 | item.setData(taskInstance); |
---|
[1153] | 849 | |
---|
| 850 | // simulate a child |
---|
[1424] | 851 | if ((taskInstance instanceof ITaskInstanceList) || |
---|
| 852 | (taskInstance instanceof ISelectionInstance) || |
---|
| 853 | (taskInstance instanceof IOptionalInstance)) |
---|
[1153] | 854 | { |
---|
| 855 | new TreeItem(item, SWT.NULL); |
---|
| 856 | } |
---|
| 857 | } |
---|
[2033] | 858 | |
---|
| 859 | /** |
---|
| 860 | * |
---|
| 861 | */ |
---|
| 862 | private void showVisualization(String name) { |
---|
| 863 | Color backgroundColor = visualizationsComposite.getBackground(); |
---|
| 864 | Composite parent = new Composite(visualizationsComposite, SWT.EMBEDDED); |
---|
| 865 | parent.setLayout(new GridLayout(1, false)); |
---|
| 866 | parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
---|
| 867 | |
---|
| 868 | Frame chartFrame = SWT_AWT.new_Frame(parent); |
---|
| 869 | chartFrame.setBackground(new java.awt.Color(backgroundColor.getRed(), |
---|
| 870 | backgroundColor.getGreen(), |
---|
| 871 | backgroundColor.getBlue())); |
---|
| 872 | |
---|
| 873 | chartFrame.setLayout(new java.awt.GridLayout()); |
---|
| 874 | |
---|
| 875 | List<ITaskModel> models = new LinkedList<>(); |
---|
| 876 | models.add(taskModel); |
---|
| 877 | |
---|
| 878 | List<String> names = new LinkedList<>(); |
---|
| 879 | names.add(name); |
---|
| 880 | |
---|
| 881 | List<Integer> groups = new LinkedList<>(); |
---|
| 882 | groups.add(0); |
---|
| 883 | |
---|
| 884 | JFreeChart chart = TaskTreePlotUtils.createPlot(name, models, names, groups); |
---|
| 885 | chartFrame.add(new ChartPanel(chart)); |
---|
| 886 | |
---|
| 887 | modelVisualizationTree.getSelection()[0].setData(chart); |
---|
| 888 | |
---|
| 889 | rightHandComposite.layout(); |
---|
| 890 | rightHandComposite.redraw(); |
---|
| 891 | rightHandComposite.update(); |
---|
| 892 | } |
---|
| 893 | |
---|
| 894 | /** |
---|
| 895 | * |
---|
| 896 | */ |
---|
| 897 | private void clearVisualization() { |
---|
| 898 | for (Control child : visualizationsComposite.getChildren()) { |
---|
| 899 | child.dispose(); |
---|
| 900 | } |
---|
| 901 | |
---|
| 902 | visualizationsComposite.pack(); |
---|
| 903 | } |
---|
[1094] | 904 | } |
---|