Changeset 1146 for trunk/autoquest-ui-swt
- Timestamp:
- 04/04/13 16:06:07 (12 years ago)
- Location:
- trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ModelsTabComposite.java
r1094 r1146 23 23 import org.eclipse.swt.layout.GridData; 24 24 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask Tree;25 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 26 26 import de.ugoe.cs.autoquest.usageprofiles.FirstOrderMarkovModel; 27 27 import de.ugoe.cs.autoquest.usageprofiles.IDotCompatible; … … 130 130 CommandExecuter.getInstance().exec(command); 131 131 } 132 else if (obj instanceof ITask Tree) {132 else if (obj instanceof ITaskModel) { 133 133 ShowTaskTreeDialog showTaskTreeDialog = new ShowTaskTreeDialog 134 (getShell(), SWT.NONE, (ITask Tree) obj, selectedStrings[0]);134 (getShell(), SWT.NONE, (ITaskModel) obj, selectedStrings[0]); 135 135 showTaskTreeDialog.open(); 136 136 } … … 291 291 for (String key : GlobalDataContainer.getInstance().getAllKeys()) { 292 292 if ((GlobalDataContainer.getInstance().getData(key) instanceof IStochasticProcess) || 293 (GlobalDataContainer.getInstance().getData(key) instanceof ITask Tree))293 (GlobalDataContainer.getInstance().getData(key) instanceof ITaskModel)) 294 294 { 295 295 modelList.add(key); -
trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ShowTaskTreeDialog.java
r1122 r1146 15 15 package de.ugoe.cs.autoquest.ui.swt; 16 16 17 import java.util.List; 18 17 19 import org.eclipse.swt.SWT; 20 import org.eclipse.swt.custom.SashForm; 18 21 import org.eclipse.swt.events.SelectionAdapter; 19 22 import org.eclipse.swt.events.SelectionEvent; … … 27 30 import org.eclipse.swt.widgets.TreeItem; 28 31 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship; 33 import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship; 34 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 35 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 36 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; 37 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 38 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 31 39 32 40 import org.eclipse.swt.widgets.Label; … … 45 53 46 54 /** */ 47 private Tree tree; 48 49 /** */ 50 protected ITaskTree taskTree; 51 52 /** 53 * 54 */ 55 public ShowTaskTreeDialog(Shell parent, int style, ITaskTree taskTree, String taskTreeName) { 55 private Tree instanceTree; 56 57 /** */ 58 private Tree modelTree; 59 60 /** */ 61 protected ITaskModel taskModel; 62 63 /** 64 * 65 */ 66 public ShowTaskTreeDialog(Shell parent, int style, ITaskModel taskModel, String taskTreeName) { 56 67 super(parent, style); 57 setText("Task Tree" + taskTreeName);58 this.task Tree = taskTree;68 setText("Task Model " + taskTreeName); 69 this.taskModel = taskModel; 59 70 } 60 71 … … 83 94 84 95 shell.setLayout(new GridLayout(4, false)); 85 86 tree = new Tree(shell, SWT.BORDER | SWT.MULTI); 87 tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1)); 88 89 buildTree(); 96 97 SashForm sashForm = new SashForm(shell, SWT.VERTICAL); 98 sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1)); 99 100 instanceTree = new Tree(sashForm, SWT.BORDER | SWT.MULTI); 101 instanceTree.addSelectionListener(new SelectionAdapter() { 102 @Override 103 public void widgetSelected(SelectionEvent e) { 104 modelTree.removeAll(); 105 TreeItem[] selectedItems = instanceTree.getSelection(); 106 if ((selectedItems.length == 1) && 107 (selectedItems[0].getData() instanceof ITaskInstance)) 108 { 109 buildModelTree((ITaskInstance) selectedItems[0].getData()); 110 } 111 } 112 }); 113 114 buildInstanceTree(); 115 116 modelTree = new Tree(sashForm, SWT.BORDER | SWT.MULTI); 90 117 91 118 Button btnExpandAll = new Button(shell, SWT.NONE); … … 93 120 @Override 94 121 public void widgetSelected(SelectionEvent e) { 95 expandAll( tree, true);122 expandAll(instanceTree, true); 96 123 } 97 124 }); … … 102 129 @Override 103 130 public void widgetSelected(SelectionEvent e) { 104 expandAll( tree, false);131 expandAll(instanceTree, false); 105 132 } 106 133 }); … … 117 144 * 118 145 */ 119 private void buildTree() { 120 ITaskTreeNode root = taskTree.getRoot(); 121 122 TreeItem child = new TreeItem(tree, SWT.NULL); 123 child.setText(root.getName() + " (" + root.getDescription() + ")"); 124 child.setData(root); 125 buildGuiTree(child, root); 126 } 127 128 /** 129 * 130 */ 131 private void buildGuiTree(TreeItem currentParent, ITaskTreeNode node) { 132 if (node.getChildren() != null) { 133 134 for (ITaskTreeNode childTask : node.getChildren()) { 135 TreeItem child = new TreeItem(currentParent, SWT.NULL); 136 child.setText(childTask.getName() + " (" + childTask.getDescription() + ")"); 137 child.setData(childTask); 138 buildGuiTree(child, childTask); 139 } 146 private void buildInstanceTree() { 147 List<IUserSession> sessions = taskModel.getUserSessions(); 148 149 TreeItem root = new TreeItem(instanceTree, SWT.NULL); 150 root.setText(sessions.size() + " sessions"); 151 root.setData(sessions); 152 153 for (IUserSession session : sessions) { 154 buildInstanceTree(root, session); 155 } 156 } 157 158 /** 159 * 160 */ 161 private void buildInstanceTree(TreeItem currentParent, ITaskInstanceList taskInstanceList) { 162 TreeItem child = new TreeItem(currentParent, SWT.NULL); 163 child.setText(taskInstanceList.toString()); 164 child.setData(taskInstanceList); 165 166 for (ITaskInstanceList childTask : taskInstanceList) { 167 buildInstanceTree(child, childTask); 168 } 169 } 170 171 /** 172 * 173 */ 174 private void buildModelTree(ITaskInstance taskInstance) { 175 modelTree.removeAll(); 176 TreeItem root = new TreeItem(modelTree, SWT.NULL); 177 root.setText("model of instance " + taskInstance); 178 root.setData(taskInstance); 179 180 buildModelTree(taskInstance.getTask(), root); 181 expandAll(root, true); 182 } 183 184 /** 185 * 186 */ 187 private void buildModelTree(ITask task, TreeItem parent) { 188 TreeItem node = new TreeItem(parent, SWT.NULL); 189 node.setText(task.toString()); 190 node.setData(task); 191 192 if (task instanceof IStructuringTemporalRelationship) { 193 for (ITask subTask : ((IStructuringTemporalRelationship) task).getChildren()) { 194 buildModelTree(subTask, node); 195 } 196 } 197 else if (task instanceof IMarkingTemporalRelationship) { 198 buildModelTree(((IMarkingTemporalRelationship) task).getMarkedTask(), node); 140 199 } 141 200 }
Note: See TracChangeset
for help on using the changeset viewer.