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

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


    public static MCTStandardHousing newHousing(String housingTitle, byte areaSelection, int housingCloseAction, View initialView, double hscale,
            double vscale, Window relativeWindow) {
        Dimension dimension = getWindowDimension(hscale, vscale);
        AbstractComponent housedComponent = initialView.getManifestedComponent();
        Set<ViewInfo> vrs = housedComponent.getViewInfos(ViewType.LAYOUT);
        ViewInfo viewRole = vrs.iterator().next();

       
        MCTStandardHousing housing = new MCTStandardHousing(housingTitle, dimension.width, dimension.height, housingCloseAction, viewRole.createView(housedComponent));
       
        if (relativeWindow != null) {
            if (housing.getGraphicsConfiguration() != relativeWindow.getGraphicsConfiguration()) {
                housing = new MCTStandardHousing(relativeWindow.getGraphicsConfiguration(),
                        housingTitle, dimension.width, dimension.height, housingCloseAction, viewRole.createView(housedComponent));
            }
           
            housing.setLocationRelativeTo(relativeWindow);
        }
View Full Code Here


        private Collection<Panel> addToCanvas(Collection<View> toBeAddedViews,
                        CanvasManifestation containerManifestation, Point dropPoint) {
            Collection<Panel> panels = new LinkedHashSet<Panel>();
            for (View v : toBeAddedViews) {
                AbstractComponent viewComp = v.getManifestedComponent();
                ViewInfo newViewInfo = getViewInfoForCanvas(v, viewComp);
                AbstractComponent comp = viewComp;
               
                int nextPanelId = containerManifestation.panelId++;
                MCTViewManifestationInfo viewManifestationInfo = new MCTViewManifestationInfoImpl();
                viewManifestationInfo.setComponentId(comp.getComponentId());
                viewManifestationInfo.setStartPoint(dropPoint);
                viewManifestationInfo.setManifestedViewType(newViewInfo.getType());
                if (v.getInfo().equals(newViewInfo)) {
                    ExtendedProperties ep = v.getViewProperties().clone();
                    ep.addProperty(CanvasViewStrategy.OWNED_TYPE_PROPERTY_NAME, v.getInfo().getType());
                    viewManifestationInfo.getOwnedProperties().add(ep);
                }
View Full Code Here

     */
    public static MCTStandardHousing newHousing(int housingCloseAction, AbstractComponent component, double hscale, double vscale, Window relativeWindow, byte areaSelection) {
        Dimension dimension = getWindowDimension(hscale, vscale);

        Set<ViewInfo> vrs = component.getViewInfos(ViewType.LAYOUT);
        ViewInfo viewRole = vrs.iterator().next();

        MCTStandardHousing housing = new MCTStandardHousing(component.getDisplayName() + " - " + viewRole.getViewName(), dimension.width,
                dimension.height, housingCloseAction, viewRole.createView(component));
       
        if (relativeWindow != null) {
            if (housing.getGraphicsConfiguration() != relativeWindow.getGraphicsConfiguration()) {
                housing = new MCTStandardHousing(relativeWindow.getGraphicsConfiguration(),
                        component.getDisplayName() + " - " + viewRole.getViewName(), dimension.width, dimension.height, housingCloseAction, viewRole.createView(component));
            }
           
            housing.setLocationRelativeTo(relativeWindow);
        }
       
View Full Code Here

       
        /*Harleigh108:
         * Rather than mocking a view, we create one with dummy-content, this is because adding a mocked container to a container
         * will cause a NPE.  See testMouseDragIncremental in MarqueSelectionListenerTest.java
         */
        view = new MockManifestation(mockComponent, new ViewInfo(MockManifestation.class, "", ViewType.OBJECT)) {
            /*
             * Originally, in 'testLockedState()' we had Mockito.verify(view, Mockito.times(1)).exitLockedState(), that is we verified
             * that the method 'exitLockedState()' is called exactly once during the test 'testLockedState()'.  Since we can not use
             * mock-types (see comments in 'testLockedState()') we implemented the following instead:
             */
            private int NumberCalls = 0; //Number of calls to method exitLockedState
           
            @Override
            public void exitLockedState() {
                NumberCalls= NumberCalls +1;
                super.exitLockedState();
            }
           
            @Override
            public int getNumberCallsToExitLockedState() {
                return NumberCalls;
            }
           
        };//--end class
       
        MCTViewManifestationInfoImpl info = new MCTViewManifestationInfoImpl();
        view.putClientProperty(CanvasManifestation.MANIFEST_INFO, info);
       
        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());
               
        AbstractComponent ac = Mockito.mock(AbstractComponent.class);
        ViewInfo vi = Mockito.mock(ViewInfo.class);
        panelInspector = new PanelInspector(ac, vi) {
            @Override
            protected JComponent getViewControls() {
                return new JPanel();
            }
View Full Code Here

    // Test for root cause of https://github.com/nasa/mct/issues/172
    @Test
    public void testLabelTransferHandler() throws Exception {
        Mockito.when(mockComponent.getViewInfos(Mockito.<ViewType>any()))
            .thenReturn(Collections.singleton(
                            new ViewInfo(MockManifestation.class, "", ViewType.OBJECT)));
       
        PropertyChangeEvent mockEvent = Mockito.mock(PropertyChangeEvent.class);
       
        Field viewTitleField = PanelInspector.class.getDeclaredField("viewTitle");
        viewTitleField.setAccessible(true);
View Full Code Here

   
    // Also, note that the default node view, canvas view, and housing view will be supplied
    // by the MCT platform.
    if (componentTypeId.equals(ExampleComponent.class.getName())) {
      return Arrays.asList(
          new ViewInfo(CenterPanePanel.class, bundle.getString("CenterPaneViewName"), ViewType.CENTER),
          new ViewInfo(CenterPanePanel.class, bundle.getString("CenterPaneViewName"), ViewType.OBJECT),
          new ViewInfo(PublicInfoView.class, bundle.getString("PublicViewName"), ViewType.OBJECT),
          new ViewInfo(PrivateInfoView.class, bundle.getString("PrivateViewName"), ViewType.OBJECT),
          new ViewInfo(SaveModelStateView.class, bundle.getString("SaveModelStateViewName"), ViewType.OBJECT),
          new ViewInfo(ShowChildrenInTableView.class, bundle.getString("ShowChildrenInTableViewName"), ViewType.OBJECT)
         
      );
    }
    return Collections.emptyList();
  }
View Full Code Here

       
        @SuppressWarnings("unchecked")
        ComponentProvider provider = new MockComponentProvider(Collections
                .EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
                Arrays.asList(
                        new ViewInfo(NodeViewManifestation.class, "test", ViewType.NODE)));
       
        ExternalComponentRegistryImpl.getInstance().refreshComponents(Collections.singletonList(new ExtendedComponentProvider(provider, "")));
       
        AbstractComponent mockedComponent = Mockito.mock(AbstractComponent.class);
        Set<ViewInfo> returnedViewInfos = Collections.singleton(new ViewInfo(NodeViewManifestation.class, "t", ViewType.NODE));
        Mockito.when(mockedComponent.getViewInfos(ViewType.NODE)).thenReturn(returnedViewInfos);
        Mockito.when(mockedComponent.getDisplayName()).thenReturn("testComponent");
       
        Mockito.when(mockedComponent.isLeaf()).thenReturn(true);
        Assert.assertTrue(mockedComponent.isLeaf());
View Full Code Here

  @Override
  public Collection<ViewInfo> getViews(String componentTypeId) {
    if (MultiComponent.class.getName().equals(componentTypeId)) {
      List<ViewInfo> views = new ArrayList<ViewInfo>();
      views.add(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, InfoViewManifestation.class.getName(), ViewType.OBJECT, false, MultiComponent.class));
      views.add(new ViewInfo(MultiViewManifestation.class, MultiViewManifestation.VIEW_NAME, ViewType.OBJECT));
      views.add(new ViewInfo(MultiViewManifestation.class, MultiViewManifestation.VIEW_NAME, InfoViewManifestation.class.getName(), ViewType.CENTER, true, MultiComponent.class));
      return views;
    }   
    return Collections.singleton(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, ViewType.OBJECT));
  }
View Full Code Here

  @Override
  public Collection<ViewInfo> getViews(String componentTypeId) {
    if (EvaluatorComponent.class.getName().equals(componentTypeId)) {
      List<ViewInfo> views = new ArrayList<ViewInfo>();
      views.add(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, ViewType.OBJECT));
      views.add(new ViewInfo(ExpressionsViewManifestation.class, ExpressionsViewManifestation.VIEW_NAME,
          ExpressionsViewManifestation.class.getName(), ViewType.OBJECT));
      views.add(new ViewInfo(ExpressionsViewManifestation.class, ExpressionsViewManifestation.VIEW_NAME, ExpressionsViewManifestation.class.getName(), ViewType.CENTER, true, EvaluatorComponent.class));
      return views;
    }   
    return Collections.singleton(new ViewInfo(InfoViewManifestation.class, InfoViewManifestation.VIEW_NAME, ViewType.OBJECT));
  }
View Full Code Here

    @BeforeMethod
    public void setup() {
        MockitoAnnotations.initMocks(this);
       
        canvasViewInfo = new ViewInfo(CanvasManifestation.class, "", ViewType.OBJECT);
        Mockito.when(mockIconInfo.createView(Mockito.any(AbstractComponent.class))).thenReturn(mockIconView);
        Mockito.when(mockTitleInfo.createView(Mockito.any(AbstractComponent.class))).thenReturn(mockTitleView);
        Mockito.when(mockComponent.getViewInfos(ViewType.TITLE)).thenReturn(Collections.singleton(mockTitleInfo));
        Mockito.when(mockComponent.getDisplayName()).thenReturn("test comp");
        Mockito.when(mockComponent.getComponents()).thenReturn(
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.