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

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


        if (!checkArguments(context, component))
            return trueResult; // pass it over to the next policy in the chain       

        ViewType viewType = context
                .getProperty(PolicyContext.PropertyName.VIEW_TYPE.getName(), ViewType.class);
        ViewInfo targetViewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class);
        if (viewType == ViewType.OBJECT || viewType == ViewType.CENTER) {
                if (DropboxCanvasView.class.isAssignableFrom(targetViewInfo.getViewClass()) ||
                        targetViewInfo.getViewName().equals("Info"))
                    return new ExecutionResult(context, true, "");
        }
        return new ExecutionResult(context, false, "");
    }
View Full Code Here


  @Override
  public ExecutionResult execute(PolicyContext context) {
    boolean result = true;
    AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class);
    if (TelemetryDataTaxonomyComponent.class.isAssignableFrom(targetComponent.getClass())) {
        ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class);
        if (viewInfo.getViewType() == ViewType.OBJECT) {
            result = FeedView.class.isAssignableFrom(viewInfo.getViewClass());
        }
    }
    return new ExecutionResult(context, result, null);
  }
View Full Code Here

    }
   
    @Test
    public void testGetViews() {
        Assert.assertTrue(registry.getViewInfos("someType", ViewType.CENTER).isEmpty(), "views should be empty prior to populating registry");
        ViewInfo vi1 = new ViewInfo(TestingView.class, "abc", ViewType.OBJECT);
        ViewInfo vi3 = new ViewInfo(TestingView2.class, "abc", ViewType.CENTER);
        ViewInfo vi2 = new ViewInfo(TestingView3.class, "def", ViewType.CENTER);
        ExtendedComponentProvider provider = createProvider(Collections.<ComponentTypeInfo>emptyList(), Arrays.asList(vi1, vi2, vi3));
        registry.refreshComponents(Collections.singletonList(provider));
        Collection<ViewInfo> infos = registry.getViewInfos("abc", ViewType.CENTER);
        Assert.assertEquals(infos.size(),2);
        Assert.assertTrue(infos.containsAll(Arrays.asList(vi2,vi3)));
View Full Code Here

    @Test
    public void testDefaultViews() {
        ExtendedComponentProvider provider = createProvider(Collections.<ComponentTypeInfo>singleton(new ComponentTypeInfo("displayName", "desc", TestBaseComponent.class)), Collections.<ViewInfo>emptyList());
        registry.refreshComponents(Collections.singletonList(provider));
        Assert.assertTrue(registry.getViewInfos("someType", ViewType.CENTER).isEmpty(), "views should be empty prior to populating registry");
        ExtendedComponentProvider defaultProvider = createProvider(Collections.<ComponentTypeInfo>emptyList(), Collections.<ViewInfo>singleton(new ViewInfo(TestingView.class,"",ViewType.CENTER)));
        registry.setDefaultViewProvider(defaultProvider);
        Assert.assertEquals(Collections.singletonList(new ViewInfo(TestingView.class,"", ViewType.CENTER)), registry.getViewInfos(TestBaseComponent.class.getName(), ViewType.CENTER), "default test view should be provided");
        // TODO add additional tests to verify the multiplicity of the ViewType is considered
    }
View Full Code Here

    }
   
    @Test
    public void testMultipleReturnsFromGetInfos() {
        ComponentTypeInfo info = new ComponentTypeInfo("displayName", "desc", TestBaseComponent.class);
        ViewInfo providerViewInfo = new ViewInfo(TestingView.class,"", ViewType.CENTER);
        ViewInfo defaultViewInfo = new ViewInfo(OtherTestingView.class,"", ViewType.CENTER);
        ExtendedComponentProvider cp = createProvider(Collections.singleton(info), Collections.<ViewInfo>singleton(providerViewInfo));
        registry.refreshComponents(Collections.singletonList(cp));
       
        ExtendedComponentProvider defaultProvider = createProvider(Collections.<ComponentTypeInfo>emptyList(), Collections.singleton(defaultViewInfo));
        registry.setDefaultViewProvider(defaultProvider);
View Full Code Here

       
        if (selection.isEmpty()) {
            return false;
        }
       
        ViewInfo vi = selection.iterator().next().getInfo();
       
        if (!(vi != null && vi.getViewType() == ViewType.NODE)){
            return false;
        }

        if (!(activeHousing.getDirectoryArea() instanceof MCTDirectoryArea)) {
            return false;
View Full Code Here

            AbstractComponent component = getManifestedComponent();

            for (AbstractComponent childComponent : component.getComponents()) {
                Set<ViewInfo> nodeViews = childComponent.getViewInfos(ViewType.NODE);
                if (!nodeViews.isEmpty()) {
                    ViewInfo nextViewInfo = nodeViews.iterator().next();
                   
                    // Children are only allowed if the component is not a leaf or the component is another users drop box
                    boolean allowsChildren =!childComponent.isLeaf();
                   
                    View childNodeView = nextViewInfo.createView(childComponent);
                    MCTMutableTreeNode childNode = new MCTMutableTreeNode(childNodeView, tree, allowsChildren);

                    if (allowsChildren){
                        MCTMutableTreeNode grandChildNode = new MCTMutableTreeNode(View.NULL_VIEW_MANIFESTATION, tree);
                        childNode.add(grandChildNode);
View Full Code Here

        JFrame frame = new JFrame();
        JPanel panel = new JPanel();
        frame.add(panel);
        panel.add(tree);
       
        nodeViewManifestation = new NodeViewManifestation(mockComponent, new ViewInfo(NodeViewManifestation.class,"", ViewType.NODE));
    }
View Full Code Here

    }
   
   
    @Test
    public void testUpdateMonitoredGUI_Reorder() {
      ViewInfo viewInfo = new ViewInfo(NodeViewManifestation.class, "", ViewType.NODE);
      Mockito.when(view1.getManifestedComponent()).thenReturn(comp1);
      Mockito.when(view2.getManifestedComponent()).thenReturn(comp2);
      Mockito.when(view3.getManifestedComponent()).thenReturn(comp3);
      Mockito.when(comp1.getViewInfos(ViewType.NODE)).thenReturn(Collections.singleton(viewInfo));
        Mockito.when(comp2.getViewInfos(ViewType.NODE)).thenReturn(Collections.singleton(viewInfo));
View Full Code Here

     *  that the View label has been updated to the component's name.
     */
    @Test
    public void testUpdateMonitoredGUI_None() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {

        nodeViewManifestation = new NodeViewManifestation(mockComponent, new ViewInfo(NodeViewManifestation.class,"", ViewType.NODE));

        Field field = nodeViewManifestation.getClass().getDeclaredField("label");
        field.setAccessible(true);
        JLabel label = (JLabel) field.get(nodeViewManifestation);// get label field of View under test
        String fixedName = "outdatedView";
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.