Package gov.nasa.arc.mct.gui

Examples of gov.nasa.arc.mct.gui.View


    Collection<View> selectedManifestations = context.getSelectedManifestations();
   
    if (selectedManifestations.size() != 1)
      return false;
   
    View manifestation = selectedManifestations.iterator().next();
   
    if (!(manifestation.getManifestedComponent() instanceof ExampleComponent))
      return false;
   
    RadioAction[] radioActions = {
      new AddLineBorder(manifestation),
      new RemoveLineBorder(manifestation)
View Full Code Here


       
        Field f = JTree.class.getDeclaredField("dropLocation");
        f.setAccessible(true);
        f.set(tree, loc);
       
        View view = mock(View.class);
        MCTMutableTreeNode node = new MCTMutableTreeNode();
        node.setUserObject(view);

        View renderView = (View) renderer.getTreeCellRendererComponent(tree, node, sel, false, false, row, false);
       
        assertSame(renderView, view);
       
        // If we do the same thing again, we should get the same thing back.
        // But the 2nd time we don't expect another call to addMonitoredGUI().
View Full Code Here

           
            c.anchor = GridBagConstraints.LINE_END;
            c.gridwidth = GridBagConstraints.REMAINDER;
            c.weightx = 0;      
            JPanel p = new JPanel(new BorderLayout());
            View switcher = SwitcherView.VIEW_INFO.createView(view.getManifestedComponent());
            switcher.addMonitoredGUI(this);
            switcher.setForeground(FOREGROUND_COLOR);
            p.setOpaque(false);
            p.add(refreshButton, BorderLayout.WEST);
            p.add(switcher, BorderLayout.CENTER);
            p.add(controlAreaToggle, BorderLayout.EAST);
            titlebar.add(p, c);
View Full Code Here

        MockitoAnnotations.initMocks(this);

        originalPlatform = PlatformAccess.getPlatform();
       
        // Can't mock Swing components reliably, so create a real one
        view = new View(mockComponent, mockViewInfo) {};
       
        new PlatformAccess().setPlatform(mockPlatform);
       
        inspectorPropertyChangeListener = null;
       
View Full Code Here

        // Select something in the inspector
        inspectorPropertyChangeListener.propertyChange(mockPropertyEvent);
       
        // Create a new view to switch to
        ViewInfo newViewInfo = Mockito.mock(ViewInfo.class);      
        @SuppressWarnings("serial")
        View     newView = new View(mockComponent, newViewInfo) {};
              
        Mockito.when(mockComponent.isStale()).thenReturn(stale);
        Mockito.when(mockComponent.isDirty()).thenReturn(dirty);
        Mockito.when(newViewInfo.createView(mockComponent)).thenReturn(newView);
        Mockito.when(newViewInfo.getType()).thenReturn("new");
View Full Code Here

        AbstractComponent canvasComponent = Mockito.mock(AbstractComponent.class);
        AbstractComponent component = new DerivedMock();
        ViewInfo viewInfo = new ViewInfo(CanvasManifestation.class, "", "", ViewType.OBJECT) {
            @Override
            public View createView(final AbstractComponent component) {
                View view = Mockito.mock(View.class);
                Mockito.when(view.getManifestedComponent()).thenReturn(component);
                return view;
            }
        };
       
        PlatformAccess access = new PlatformAccess();
        Platform mockPlatform = Mockito.mock(Platform.class);
        PersistenceProvider mockPersistenceProvider = Mockito.mock(PersistenceProvider.class);
        access.setPlatform(mockPlatform);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistenceProvider);
        Mockito.when(mockPersistenceProvider.getComponent(component.getComponentId())).thenReturn(component);
        MCTViewManifestationInfo manifInfo = Mockito.mock(MCTViewManifestationInfo.class);       
        View view = CanvasViewStrategy.CANVAS_OWNED.createViewFromManifestInfo(viewInfo, component, canvasComponent, manifInfo);
        Assert.assertEquals(view.getManifestedComponent().getComponentId(), canvasComponent.getComponentId());
    }   
View Full Code Here

                    ep.addProperty(CanvasViewStrategy.OWNED_TYPE_PROPERTY_NAME, v.getInfo().getType());
                    viewManifestationInfo.getOwnedProperties().add(ep);
                }
                viewManifestationInfo.addInfoProperty(ControlAreaFormattingConstants.PANEL_ORDER, String.valueOf(nextPanelId));
                // use the viewComp here instead of the master component to retrieve the actual properties for the view
                View addManifestation = CanvasViewStrategy.CANVAS_OWNED.createViewFromManifestInfo(newViewInfo, comp, canvasManifestation.getManifestedComponent(), viewManifestationInfo);
               
                addManifestation.putClientProperty(CanvasManifestation.MANIFEST_INFO, viewManifestationInfo);
                Panel panel = containerManifestation.createPanel(addManifestation, nextPanelId, containerManifestation);
                viewManifestationInfo.setDimension(panel.getPreferredSize());

                addManifestation.setNamingContext(panel);
                assert addManifestation.getNamingContext() == panel;
               
                // Add new panel info to the canvas content property list
                ExtendedProperties viewTypeProperties = containerManifestation.getViewProperties();
                viewTypeProperties.addProperty(CANVAS_CONTENT_PROPERTY, viewManifestationInfo);               
                containerManifestation.renderedPanels.put(
View Full Code Here

        targetHousingViewManifestation.setControlArea(controlArea);
        targetHousingViewManifestation.setControlAreaVisible(oldHousingManifestation.isControlAreaVisible());
       
        AbstractComponent component = newHousingView.getManifestedComponent();
        if (!component.isLeaf()) {
            View directoryArea = component.getViewInfos(ViewType.NAVIGATOR).iterator().next().createView(component);
            targetHousingViewManifestation.setDirectoryArea(directoryArea);
        }
        if (component != PlatformAccess.getPlatform().getRootComponent()) {
            MCTContentArea contentArea = housing.getContentArea();
            contentArea.clearHousedManifestations();
            contentArea.setParentHousing(housing);
            contentArea.setOwnerComponentCanvasManifestation(component.getViewInfos(ViewType.CENTER).iterator().next().createView(component));
            targetHousingViewManifestation.setContentArea(contentArea);
        }
        if (!component.isLeaf()) {
            View inspectionArea = component.getViewInfos(ViewType.RIGHT).iterator().next().createView(component);
            targetHousingViewManifestation.setInspectionArea(inspectionArea);
        }
        if (!component.isLeaf()) {
            MCTStatusArea statusArea = housing.getStatusArea();
            targetHousingViewManifestation.setStatusArea(statusArea);
View Full Code Here

   
    @Test
    public void testPropertyChanges() {
        Object source = new Object();
        MockRoot root = new MockRoot();
        View m1 = Mockito.mock(View.class);
        View m2 = Mockito.mock(View.class);
        MockRoot root2 = new MockRoot();
       
        SelectionManager sm = new SelectionManager(source);
        sm.manageComponent(root);
        sm.manageComponent(root2);
View Full Code Here

                controlAreaToggle.doClick();
            }
            controlAreaToggle.setEnabled(getViewControls() != null);
           
            JPanel p = new JPanel(new BorderLayout());
            View viewSwitcher = view.getManifestedComponent().getViewInfos(ViewType.VIEW_SWITCHER).iterator().next().createView(view.getManifestedComponent());
            viewSwitcher.addMonitoredGUI(this);
            viewSwitcher.setForeground(FOREGROUND_COLOR);
            p.setOpaque(false);
            p.add(viewSwitcher, BorderLayout.CENTER);
            p.add(controlAreaToggle, BorderLayout.EAST);
           
            c.anchor = GridBagConstraints.LINE_END;
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.gui.View

Copyright © 2018 www.massapicom. 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.