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

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


        c.getCapability(ComponentInitializer.class).initialize();

        mockComponent(leafComponent, null);
        mockComponent(rootComponent,leafComponent);
        treeNode = createMCTMutableTreeStructure(rootComponent);
        dirArea = new MCTDirectoryArea(rootComponent, new ViewInfo(MCTDirectoryArea.class,"", ViewType.NAVIGATOR));
    }
View Full Code Here


        MCTMutableTreeNode rootNode = new MCTMutableTreeNode(root.getViewInfos(ViewType.NODE).iterator().next().createView(root), tree);

        // Populate the tree
        for (AbstractComponent childComponent : root.getComponents()) {
            Set<ViewInfo> setViewInfos = childComponent.getViewInfos(ViewType.NODE);
            ViewInfo viewRole = setViewInfos.iterator().next();
            MCTMutableTreeNode childNode = new MCTMutableTreeNode(viewRole.createView(childComponent), tree);
            rootNode.add(childNode);
            if (!childComponent.getComponents().isEmpty()) {
                childNode.setProxy(true);
                MCTMutableTreeNode grandChildNode = new MCTMutableTreeNode(View.NULL_VIEW_MANIFESTATION);
                childNode.add(grandChildNode);
View Full Code Here

    }
   
    private void mockComponent(AbstractComponent mockedComponent, AbstractComponent child) {
        View mockView = Mockito.mock(View.class);
        Mockito.when(mockView.getManifestedComponent()).thenReturn(mockedComponent);
        Mockito.when(mockedComponent.getViewInfos(ViewType.NODE)).thenReturn(Collections.singleton(new ViewInfo(NodeViewManifestation.class, "", ViewType.NODE)));
        Mockito.when(mockedComponent.getComponents()).thenReturn(child == null ? Collections.<AbstractComponent>emptyList() : Collections.<AbstractComponent>singletonList(child));
        Mockito.when(mockedComponent.isLeaf()).thenReturn(child == null);
       
    }
View Full Code Here

    public void testActiveHousingComponentNullPermission() {
        if (GraphicsEnvironment.isHeadless()) {
            return;
        }
       
        MockHousing housing = new MockHousing(0, 0, 0, MCTHousingFactory.DIRECTORY_AREA_ENABLE, new MCTHousingViewManifestation(componentA,new ViewInfo(MCTHousingViewManifestation.class,"",ViewType.LAYOUT)));
        MCTStandardHousingMenuBar standardMenuBar = new MCTStandardHousingMenuBar(housing);
        Assert.assertEquals(standardMenuBar.getMenuCount(), 6);

        for (int i = 0; i < standardMenuBar.getMenuCount(); i++) {
            Assert.assertFalse(standardMenuBar.getMenu(i) instanceof EditMenu);
View Full Code Here

    public void testActiveHousingComponentRWPermission() {
        if (GraphicsEnvironment.isHeadless()) {
            return;
        }
       
        MockHousing housing = new MockHousing(0, 0, 0, MCTHousingFactory.DIRECTORY_AREA_ENABLE, new MCTHousingViewManifestation(componentB,new ViewInfo(MCTHousingViewManifestation.class,"",ViewType.LAYOUT)));
        MCTStandardHousingMenuBar standardMenuBar = new MCTStandardHousingMenuBar(housing);
        Assert.assertEquals(standardMenuBar.getMenuCount(), 6);

        for (int i = 0; i < standardMenuBar.getMenuCount(); i++) {
            Assert.assertFalse(standardMenuBar.getMenu(i) instanceof EditMenu);
View Full Code Here

  @BeforeMethod
  public void setup() {
    MockitoAnnotations.initMocks(this);

    mockView = new GraphicalManifestation(mockComponent,
        new ViewInfo(GraphicalManifestation.class,"", ViewType.OBJECT)) {
      private static final long serialVersionUID = 6036948129496070106L;

      public ExtendedProperties getViewProperties() {
        return mockViewProperties;
      }
View Full Code Here

    public void testActiveHousingComponent() {
        if (GraphicsEnvironment.isHeadless()) {
            return;
        }

        MockHousing housing = new MockHousing(0, 0, 0, MCTHousingFactory.CONTENT_AREA_ENABLE, new MCTHousingViewManifestation(componentC,new ViewInfo(MCTHousingViewManifestation.class,"",ViewType.LAYOUT)));
        MCTStandardHousingMenuBar standardMenuBar = new MCTStandardHousingMenuBar(housing);
        Assert.assertEquals(standardMenuBar.getMenuCount(), 6);

        ActionContextImpl context = new ActionContextImpl();
        context.setTargetHousing(housing);
View Full Code Here

    List<AbstractComponent> children = getManifestedComponent().getComponents();
    for (int selectedIndex:selected) {
      AbstractComponent comp = children.get(selectedIndex);
      Set<ViewInfo> views = comp.getViewInfos(ViewType.NODE);
      // there should always be a node view for a component
      ViewInfo nodeView = views.iterator().next();
      selections.add(nodeView.createView(comp));
    }
   
    return selections;
  }
View Full Code Here

       
        Assert.assertFalse(gridMenu.canHandle(actionContext));
        Assert.assertFalse(windowGridMenu.canHandle(actionContext));
       
        selectedManifestations = new ArrayList<View>();
        CanvasManifestation canvasManifestation = new CanvasManifestation(mockComponent, new ViewInfo(CanvasManifestation.class,"",ViewType.CENTER)) {
            @Override
            public ExtendedProperties getViewProperties() {
                return new ExtendedProperties();
            }
        };
View Full Code Here

    if (!checkArguments(context))
      return trueResult; // Return true to skip this policy and pass the context to the next one.
   
    ExampleComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), ExampleComponent.class);
    ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class);
    if (viewInfo.getViewClass().equals(PublicInfoView.class))
      return new ExecutionResult(context, false, targetComponent.getDisplayName()
                + " is private, cannot show " + viewInfo.getClass().getName()); //NOI18N
   
    if (viewInfo.getViewClass().equals(PrivateInfoView.class))
      return new ExecutionResult(context, false, targetComponent.getDisplayName()
                + " is public, cannot show " + viewInfo.getClass().getName()); //NOI18N
   
    return trueResult;
  }
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.