Changeset 99 for java/main/src/main/java/com/framsticks/gui/Frame.java
- Timestamp:
- 07/10/13 22:41:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/gui/Frame.java
r98 r99 38 38 import org.apache.log4j.Logger; 39 39 40 import com.framsticks.core.Mode;41 40 import com.framsticks.core.Path; 42 41 import com.framsticks.core.Tree; 43 import com.framsticks.core.TreeOperations; 44 import com.framsticks.gui.view.TreeCellRenderer; 45 import com.framsticks.params.AccessInterface; 42 import com.framsticks.gui.tree.MetaNode; 43 import com.framsticks.gui.tree.TreeCellRenderer; 44 import com.framsticks.gui.tree.TreeModel; 45 import com.framsticks.gui.tree.TreeNode; 46 46 import com.framsticks.util.dispatching.Dispatching; 47 47 import com.framsticks.util.dispatching.FutureHandler; … … 126 126 @Override 127 127 public void valueChanged(TreeSelectionEvent e) { 128 chooseTreeNode(e.getNewLeadSelectionPath());128 treeModel.chooseTreeNode(e.getNewLeadSelectionPath()); 129 129 } 130 130 }); … … 139 139 @Override 140 140 public void treeExpanded(TreeExpansionEvent e) { 141 loadChildren(treeModel.convertToPath(e.getPath()), false);141 // loadChildren(treeModel.convertToPath(e.getPath()), false); 142 142 } 143 143 }); … … 243 243 public void actionPerformed(ActionEvent actionEvent) { 244 244 245 loadPath(treeModel.convertToPath(jtree.getSelectionPath()), true);245 treeModel.loadPath(treeModel.convertToPath(jtree.getSelectionPath()), true); 246 246 } 247 247 }); … … 258 258 Tree tree = path.getTree(); 259 259 260 log. info("trying mount: " + path);260 log.debug("trying mount: " + path); 261 261 if (!tree.getAssignedRoot().isResolved()) { 262 tree.get(path, Mode.FETCH,new FutureHandler<Path>(this) {262 tree.get(path, new FutureHandler<Path>(this) { 263 263 264 264 @Override … … 275 275 treeAtFrames.put(tree, e); 276 276 277 rootNode.getChildren().add(new TreeNode( tree.getAssignedRoot()));277 rootNode.getChildren().add(new TreeNode(e, Path.to(tree, "/"))); 278 278 e.rootNode = tree.getAssignedRoot(); 279 279 treeModel.nodeStructureChanged(new TreePath(rootNode)); … … 311 311 } 312 312 313 public void loadChildren(Path path, boolean reload) { 314 if (path == null) { 315 return; 313 public void updatePanelIfIsLeadSelection(TreePath treePath, Path path) { 314 assert isActive(); 315 if (treePath.equals(jtree.getSelectionPath())) { 316 treeAtFrames.get(path.getTree()).useOrCreatePanel(treePath); 316 317 } 317 AccessInterface access = TreeOperations.bindAccess(path); 318 319 int count = access.getCompositeParamCount(); 320 for (int i = 0; i < count; ++i) { 321 Path childPath = path.appendParam(access.getCompositeParam(i)).tryFindResolution(); 322 loadPath(childPath, reload); 323 } 324 325 } 326 327 public void loadPath(Path path, boolean reload) { 328 if (path == null) { 329 return; 330 } 331 if (path.isResolved() && !reload) { 332 return; 333 } 334 path.getTree().get(path, Mode.FETCH, new FutureHandler<Path>(this) { 335 @Override 336 protected void result(Path result) { 337 final TreePath treePath = treeModel.convertToTreePath(result); 338 339 treeModel.nodeStructureChanged(treePath); 340 if (treePath.equals(jtree.getSelectionPath())) { 341 treeAtFrames.get(result.getTree()).useOrCreatePanel(treePath); 342 } 343 } 344 }); 345 } 346 347 public void chooseTreeNode(final TreePath treePath) { 348 assert isActive(); 349 if (treePath == null) { 350 return; 351 } 352 if (treeModel.isChanging()) { 353 return; 354 } 355 356 Path path = treeModel.convertToPath(treePath); 357 if (path == null) { 358 return; 359 } 360 path = path.assureResolved(); 361 final Tree tree = path.getTree(); 362 363 treeAtFrames.get(tree).useOrCreatePanel(treePath); 364 loadChildren(path, false); 365 366 } 318 } 319 367 320 368 321 … … 420 373 421 374 /** 375 * @return the jtree 376 */ 377 public JTree getJtree() { 378 return jtree; 379 } 380 381 /** 422 382 * @return the treeModel 423 383 */ … … 426 386 } 427 387 388 /** 389 * @return the rootNode 390 */ 391 public MetaNode getRootNode() { 392 return rootNode; 393 } 394 395 /** 396 * @return the treeAtFrames 397 */ 398 public Map<Tree, TreeAtFrame> getTreeAtFrames() { 399 return treeAtFrames; 400 } 401 428 402 }
Note: See TracChangeset
for help on using the changeset viewer.