Package gov.nasa.arc.mct.services.component

Examples of gov.nasa.arc.mct.services.component.ViewInfo


  @Override
  public Collection<ViewInfo> getViews(String componentTypeId) {
    if (componentTypeId.equals(ExecutableButtonComponent.class.getName())) {
      Collection<ViewInfo> views = new ArrayList<ViewInfo>();
      views.add(new ViewInfo(ExecutableButtonManifestation.class, ExecutableButtonManifestation.VIEW_NAME, ExecutableButtonManifestation.class.getName(),
          ViewType.OBJECT, false, ExecutableButtonComponent.class));
      views.add(new ViewInfo(ExecutableButtonManifestation.class, ExecutableButtonManifestation.VIEW_NAME, ExecutableButtonManifestation.class.getName(),
          ViewType.EMBEDDED, false, ExecutableButtonComponent.class));
      return views;
    }
   
    return Collections.emptyList();
View Full Code Here


    }
   
    @SuppressWarnings("serial")
    @Test
    public void test() {
        View manif = new CanvasManifestation(mockParentComponent, new ViewInfo(CanvasManifestation.class,"",ViewType.OBJECT)) {
            @Override
            public ExtendedProperties getViewProperties() {
                return extProps;
            }
        };
View Full Code Here

        robot = BasicRobot.robotWithCurrentAwtHierarchy();    

        manifestationInfo = new MCTViewManifestationInfoImpl();
        manifestationInfo.addInfoProperty(ControlAreaFormattingConstants.PANEL_ORDER,"0");
       
        Mockito.when(mockComponent.getViewInfos(ViewType.TITLE)).thenReturn(Collections.singleton(new ViewInfo(MockTitleManifestation.class,"", ViewType.TITLE)));
        Mockito.when(mockComponent.getDisplayName()).thenReturn("test comp");
        Mockito.when(mockComponent.getComponents()).thenReturn(
                        Collections.<AbstractComponent> emptyList());
       
        Mockito.when(mockPlatform.getPolicyManager())
            .thenReturn(mockPolicyManager);
        Mockito.when(mockPolicyManager.execute(Mockito.anyString(), Mockito.<PolicyContext> any()))
            .thenReturn(new ExecutionResult(null, false, null)); // Nothing is locked

       
        GuiActionRunner.execute(new GuiTask() {
            @SuppressWarnings("serial")
            @Override
            protected void executeInEDT() throws Throwable {
       
                frame = new JFrame(TITLE);
                frame.setName(TITLE);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                final ExtendedProperties viewProps = new ExtendedProperties();
                canvasManifestation = new TestCanvasManifestation(mockComponent, new ViewInfo(CanvasManifestation.class, "", ViewType.CENTER)) {
                    @Override
                    public ExtendedProperties getViewProperties() {
                        return viewProps;
                    }
                };                               
                canvasManifestation.setPreferredSize(new Dimension(PANEL_SIZE * 3, PANEL_SIZE * 3));

                frame.getContentPane().add(canvasManifestation);             
                frame.setLocation(PANEL_SIZE, PANEL_SIZE);
                frame.getContentPane().setSize(new Dimension(PANEL_SIZE * 3, PANEL_SIZE * 3));
                frame.setSize(new Dimension(PANEL_SIZE * 3, PANEL_SIZE * 3));
               
                panelManifestation = new MockManifestation(mockComponent, new ViewInfo(CanvasManifestation.class, "", ViewType.OBJECT));
                MCTViewManifestationInfoImpl info = new MCTViewManifestationInfoImpl();
                panelManifestation.putClientProperty(CanvasManifestation.MANIFEST_INFO, info);

                testPanel = canvasManifestation.createPanel(panelManifestation, 0,
                                canvasManifestation);
View Full Code Here

    @Test
    public void testWithoutEmbeddedView() throws Exception {
        Mockito.when(mockPersistence.getAllProperties(Mockito.anyString())).thenReturn(new HashMap<String, ExtendedProperties>());
        Mockito.when(mockPolicy.execute(Mockito.anyString(), Mockito.<PolicyContext>any())).thenReturn(new ExecutionResult(null, true, ""));
       
        ViewInfo mockCanvasViewInfo = Mockito.mock(ViewInfo.class);
        AbstractComponent mockCanvasComponent = new TestComponent();
        AbstractComponent mockDropComponent = new TestComponent();
        CanvasManifestation canvas = new CanvasManifestation(mockCanvasComponent, mockCanvasViewInfo);
        DropTarget dt = canvas.getDropTarget();
       
View Full Code Here

        Assert.assertEquals(provider.getMenuItemInfos(), Collections.emptyList());
    }

    @Test
    public void testGetViewRoles() {
        Assert.assertTrue(provider.getViews("").contains(new ViewInfo(PlotViewManifestation.class,"","gov.nasa.arc.mct.fastplot.view.PlotViewRole", ViewType.CENTER)));
    }
View Full Code Here

        MockitoAnnotations.initMocks(this);
       
        (new PlatformAccess()).setPlatform(mockPlatform);
        when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
        when(mockPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(new ExecutionResult(null,true,""));
        when(canvasManifestation.getInfo()).thenReturn(new ViewInfo(TestView.class,"",ViewType.CENTER));
        when(canvasManifestation.getComponents()).thenReturn(new Component[] {});
        configureManifestation(canvasManifestation);
        when(canvasManifestation.getSelectionProvider()).thenReturn(mockProvider);
        when(mockProvider.getSelectedManifestations()).thenReturn(Collections.singleton(canvasManifestation2));
       
        when(canvasManifestation2.getComponents()).thenReturn(new Component[] {});
        when(canvasManifestation2.getInfo()).thenReturn(new ViewInfo(TestView.class,"",ViewType.CENTER));
        configureManifestation(canvasManifestation2);
        when(canvasManifestation2.getSelectionProvider()).thenReturn(mockProvider2);
        when(mockProvider2.getSelectedManifestations()).thenReturn(Collections.singleton(canvasManifestation));

        Set<ViewInfo> vrs = new HashSet<ViewInfo>();
        ViewInfo vi = Mockito.mock(ViewInfo.class);
        View v = new TestView(mockComponent, vi);
        Mockito.when(vi.getViewName()).thenReturn("testView");
        Mockito.when(vi.createView(Mockito.any(AbstractComponent.class))).thenReturn(v);
        vrs.add(vi);
        when(mockComponent.getViewInfos(ViewType.CENTER)).thenReturn(vrs);

        PersistenceProvider mockPersistenceProvider = Mockito.mock(PersistenceProvider.class);
        when(mockPersistenceProvider.getComponent(Mockito.anyString())).thenReturn(mockComponent);
View Full Code Here

    }
   
    @Test
    public void testLazyLoading() {
        // Clone subtree of component A
        MCTMutableTreeNode clonedTreeNode = GUIUtil.cloneTreeNode(componentA, new ViewInfo(NodeViewTest.class, "", ViewType.NODE));
        Assert.assertNotNull(clonedTreeNode);
        Assert.assertEquals(clonedTreeNode.getChildCount(), 1);
        Assert.assertTrue(clonedTreeNode.isProxy());
    }
View Full Code Here

        Collection<ViewInfo> embeddedInfos = comp.getViewInfos(ViewType.EMBEDDED);
       
        if (embeddedInfos.isEmpty())
            return null;
       
        ViewInfo matchedVi = null;
        for (ViewInfo vi:embeddedInfos) {
            if (vi.getType().equals(viewType)) {
                matchedVi = vi;
                break;
            }
View Full Code Here

        rootPanel = new JPanel();
        listener = new MarqueSelectionListener(rootPanel, mockSelectionProvider);
       
       
        ///////Harleigh108
        Mockito.when(mockComponent.getViewInfos(ViewType.TITLE)).thenReturn(Collections.singleton(new ViewInfo(MockTitleManifestation.class,"", ViewType.TITLE)));
        Mockito.when(mockComponent.getDisplayName()).thenReturn("test comp");
        Mockito.when(mockComponent.getComponents()).thenReturn(Collections.<AbstractComponent> emptyList());
        //
    }
View Full Code Here

         * But now we have the following:
         */
        View v = new View(){};
        v.putClientProperty(CanvasManifestation.MANIFEST_INFO, new MCTViewManifestationInfoImpl() );
       
        panelManifestation = new MockManifestation(mockComponent, new ViewInfo(CanvasManifestation.class, "", ViewType.OBJECT));
        MCTViewManifestationInfoImpl info = new MCTViewManifestationInfoImpl();
        panelManifestation.putClientProperty(CanvasManifestation.MANIFEST_INFO, info);
       
        Panel child = new Panel(panelManifestation,Mockito.mock(PanelFocusSelectionProvider.class) ) { 
            public Rectangle getBounds() {
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.services.component.ViewInfo

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.