Examples of MCTDirectoryArea


Examples of gov.nasa.arc.mct.gui.housing.MCTDirectoryArea

        if (!(activeHousing.getDirectoryArea() instanceof MCTDirectoryArea)) {
            return false;
        }
       
        MCTDirectoryArea directory = MCTDirectoryArea.class.cast(activeHousing.getDirectoryArea());
        MCTMutableTreeNode firstSelectedNode = directory.getSelectedDirectoryNode();
       
        if (firstSelectedNode == null)
            return false;
       
        JTree tree = firstSelectedNode.getParentTree();
View Full Code Here

Examples of gov.nasa.arc.mct.gui.housing.MCTDirectoryArea

                MCTLogger.getLogger(NewObjectAction.class).warn(
                        "new object not selected in directory as only MCTDirectoryArea instances are supported " + directoryAreaView.getClass().getName());
            }
           
            if (newComponentId != null && directoryAreaView instanceof MCTDirectoryArea) {
                MCTDirectoryArea directoryArea = MCTDirectoryArea.class.cast(directoryAreaView);
                JTree activeTree = directoryArea.getActiveTree();

                // Identify the currently selected node in the directory area.
                MCTMutableTreeNode initiallySelectedNode = directoryArea.getSelectedNode();   

                if (initiallySelectedNode == null) {
                    // set the root of the tree as the initially selected node.
                    initiallySelectedNode = (MCTMutableTreeNode) activeTree.getModel().getRoot();
                }
                assert initiallySelectedNode!=null : "Selected node must not be null by this point";

                // Check to see if children have been loaded. If not fire are tree expansion event to force them to be loaded.
                if (initiallySelectedNode.isProxy()) {
                    // Force children to be loaded.
                    DefaultTreeModel treeModel = (DefaultTreeModel) activeTree.getModel();
                    TreePath path = new TreePath(treeModel.getPathToRoot(initiallySelectedNode));

                    if (path!=null) {
                        View initiallySelectedManifestation = directoryArea.getSelectedManifestations().iterator().next()
                        initiallySelectedManifestation.getViewListener().actionPerformed(new TreeExpansionEvent(activeTree, path));
                    }

                }
               
                // Find the child that corresponds to our new component.
                for(int i=0; i< initiallySelectedNode.getChildCount(); i++) {
                    MCTMutableTreeNode childNode = (MCTMutableTreeNode) initiallySelectedNode.getChildAt(i);
                    if(childNode.getUserObject() instanceof View) {
                        View man = (View) childNode.getUserObject();
                        if (man.getManifestedComponent().getId().equalsIgnoreCase(newComponentId)) {
                            // Found the child that corresponds to our new component. Set it as selected.
                            directoryArea.setSelectedNode(childNode);
                            PropertyChangeEvent pce = new PropertyChangeEvent(man.getManifestedComponent());
                            pce.setProperty(PropertyChangeEvent.DISPLAY_NAME, PropertyChangeEvent.DISPLAY_NAME);
                            man.updateMonitoredGUI(pce);
                            break;
                        }
View Full Code Here

Examples of gov.nasa.arc.mct.gui.housing.MCTDirectoryArea

        if (!(activeHousing.getDirectoryArea() instanceof MCTDirectoryArea)) {
            return false;
        }
       
        MCTDirectoryArea directory = MCTDirectoryArea.class.cast(activeHousing.getDirectoryArea());
        MCTMutableTreeNode firstSelectedNode = directory.getSelectedDirectoryNode();
       
        if (firstSelectedNode == null)
            return false;
       
        JTree tree = firstSelectedNode.getParentTree();
View Full Code Here

Examples of gov.nasa.arc.mct.gui.housing.MCTDirectoryArea

    };
   
    @Test
    public void testHandleNoSelectionInDirectory() {
        MCTHousing mockHousing = Mockito.mock(MCTHousing.class);
        MCTDirectoryArea mockDirectoryArea = Mockito.mock(MCTDirectoryArea.class);
        Mockito.when(mockHousing.getDirectoryArea()).thenReturn(mockDirectoryArea);
        Mockito.when(mockDirectoryArea.getSelectedManifestations()).thenReturn(Collections.<View>emptySet());
       
        ActionContextImpl context = new ActionContextImpl();       
        context.setTargetHousing(mockHousing);
        Assert.assertFalse(action.canHandle(context));
    }
View Full Code Here

Examples of gov.nasa.arc.mct.gui.housing.MCTDirectoryArea

   
    @Test
    public void cannotHandle() {
        PolicyManagerImpl.getInstance().refreshExtendedPolicies(Collections.<ExtendedComponentProvider>singletonList(new ExtendedComponentProviderTest()));
        MCTHousing housing = Mockito.mock(MCTHousing.class);
        MCTDirectoryArea directoryArea = Mockito.mock(MCTDirectoryArea.class);
        MCTMutableTreeNode selectedNode = Mockito.mock(MCTMutableTreeNode.class);
        MCTMutableTreeNode parentNode = Mockito.mock(MCTMutableTreeNode.class);
        AbstractComponent ac = Mockito.mock(AbstractComponent.class);
        AbstractComponent parent = Mockito.mock(AbstractComponent.class);
        JTree tree = Mockito.mock(JTree.class);
        TreePath treePath = Mockito.mock(TreePath.class);
       
        ActionContextImpl actionContext = Mockito.mock(ActionContextImpl.class);
        NodeViewManifestation selectedNodeView = Mockito.mock(NodeViewManifestation.class);       
        NodeViewManifestation parentNodeView = Mockito.mock(NodeViewManifestation.class);       
        Mockito.when(actionContext.getTargetHousing()).thenReturn(housing);
        Mockito.when(actionContext.getTargetComponent()).thenReturn(ac);
        Mockito.when(housing.getDirectoryArea()).thenReturn(directoryArea);
        Mockito.when(directoryArea.getSelectedManifestations()).thenReturn(Collections.<View>singleton(selectedNodeView));
        Mockito.when(directoryArea.getSelectedDirectoryNode()).thenReturn(selectedNode);
        Mockito.when(selectedNode.getParentTree()).thenReturn(tree);
        Mockito.when(tree.getSelectionPaths()).thenReturn(Arrays.array(treePath));
        Mockito.when(treePath.getLastPathComponent()).thenReturn(selectedNode);
        Mockito.when(selectedNode.getParent()).thenReturn(parentNode);
        Mockito.when(parentNode.getUserObject()).thenReturn(parentNodeView);
View Full Code Here

Examples of gov.nasa.arc.mct.gui.housing.MCTDirectoryArea

        if (!(activeHousing.getDirectoryArea() instanceof MCTDirectoryArea)) {
            return false;
        }
           
        MCTDirectoryArea directory = MCTDirectoryArea.class.cast(activeHousing.getDirectoryArea());
        MCTMutableTreeNode firstSelectedNode = directory.getSelectedDirectoryNode();
        if (firstSelectedNode == null)
            return false;
       
        JTree tree = firstSelectedNode.getParentTree();
        selectedTreePaths = tree.getSelectionPaths();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.