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

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


    }
    // Verify that unknown types consistently return null
    TypeInfo<?>[] unknowns = {
        new TypeInfo<Object>(UnknownType.class){},
        new ComponentTypeInfo("","",UnknownComponent.class),
        new ViewInfo(UnknownView.class, "", "", ViewType.OBJECT)
    };
    for (TypeInfo<?> unknown : unknowns) {
      Assert.assertNull(provider.getAsset(unknown, ImageIcon.class));
      Assert.assertNull(provider.getAsset(unknown, CreateWizardUI.class));
      Assert.assertNull(provider.getAsset(unknown, UnknownType.class));
View Full Code Here


    public void testSetHousedViewManifestation(boolean stale, boolean dirty, final boolean save, boolean expectPrompt, boolean expectChange, boolean expectSave) {
        // 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");
        Mockito.when(mockWindowManager.showInputDialog(Mockito.anyString(), Mockito.anyString(), Mockito.<Object[]>any(), Mockito.any(), Mockito.<Map<String,Object>>any())).thenAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                Object[] options = (Object[]) invocation.getArguments()[2];
                return save ? options[0] : options[1]; // options[0] presumed to mean "OK"
View Full Code Here

  public void testViewConstruction() throws Exception {
    Mockito.when(mockComponent.getModelRole()).thenReturn(checkersModelPNG);
   
    /* Create a new static graphical view */
    StaticGraphicalView view = new StaticGraphicalView(mockComponent,
        new ViewInfo(StaticGraphicalView.class, "", ViewType.OBJECT));; 

    /* Give image time to load or fail */
    Thread.sleep(1000);
       
    /* Should have one component (a JPanel) */
 
View Full Code Here

  public void testViewPaintingSVG() throws Exception {
    Mockito.when(mockComponent.getModelRole()).thenReturn(checkersModelSVG);
   
    /* Create a new static graphical view for the sample SVG */
    StaticGraphicalView view = new StaticGraphicalView(mockComponent,
        new ViewInfo(StaticGraphicalView.class, "", ViewType.OBJECT));; 
   
    /* Should force rendering */
      view.setSize(PAINT_SIZE, PAINT_SIZE);     
      view.setVisible(true);
      view.doLayout();
View Full Code Here

  public void testViewPaintingPNG() throws Exception {
    Mockito.when(mockComponent.getModelRole()).thenReturn(checkersModelPNG);
   
    /* Create a new static graphical view for the sample PNG */
    StaticGraphicalView view = new StaticGraphicalView(mockComponent,
        new ViewInfo(StaticGraphicalView.class, "", ViewType.OBJECT));; 
   
    /* Should force rendering */
      view.setSize(PAINT_SIZE, PAINT_SIZE);     
      view.setVisible(true);
      view.doLayout();
View Full Code Here

      componentA.setDisplayName(MY_MODEL_A);
      componentA.getCapability(ComponentInitializer.class).initialize();
      componentB.setDisplayName(MY_MODEL_B);
      componentB.getCapability(ComponentInitializer.class).initialize();

      ViewInfo housingInfo = new ViewInfo(MCTHousingViewManifestation.class,"Housing",ViewType.LAYOUT);
    housingA = new MockHousing(new MCTHousingViewManifestation(componentA, housingInfo));
    housingB = new MockHousing(new MCTHousingViewManifestation(componentB, housingInfo));
    access.releasePlatform();
  }
View Full Code Here

   
    @Test
    public void testClone() {    
        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;
View Full Code Here

            double vscale, Window relativeWindow) {
        Dimension dimension = getWindowDimension(hscale, vscale);

        AbstractComponent housedComponent = ((View) top.getUserObject()).getManifestedComponent();
        Set<ViewInfo> vrs = housedComponent.getViewInfos(ViewType.LAYOUT);
        ViewInfo viewRole = vrs.iterator().next();
       
        MCTStandardHousing housing = new MCTStandardHousing(dimension.width, dimension.height, housingCloseAction, viewRole.createView(housedComponent));
        if (relativeWindow == null) {
            Point location = getWindowDisplayLocation(dimension);
            housing.setLocation(location);
        } else
            housing.setLocationRelativeTo(relativeWindow);
View Full Code Here

    }
   
    private static View getDirectoryArea(AbstractComponent component, MCTMutableTreeNode rootNode) {
        Set<ViewInfo> navigatorAreas = component.getViewInfos(ViewType.NAVIGATOR);
        //Set<ViewFactory> navigatorAreas = component.getViewRole(NavigatorViewRole.class);
        ViewInfo navigatorView = navigatorAreas.iterator().next();
        return navigatorView.createView(component);
        //return getMCTViewManifestation(navigatorViewRole);
    }
View Full Code Here

            double hscale, double vscale, Window relativeWindow) {
        Dimension dimension = getWindowDimension(hscale, vscale);
       
        AbstractComponent housedComponent = ((View) top.getUserObject()).getManifestedComponent();
        Set<ViewInfo> vrs = housedComponent.getViewInfos(ViewType.LAYOUT);
        ViewInfo viewRole = vrs.iterator().next();
       
        MCTStandardHousing housing = new MCTStandardHousing(housingTitle + " - " + viewRole.getViewName(), dimension.width, dimension.height, housingCloseAction, viewRole.createView(housedComponent));

        if (relativeWindow == null) {
            Point location = getWindowDisplayLocation(dimension);
            housing.setLocation(location);
        } else {
            
            if (housing.getGraphicsConfiguration() != relativeWindow.getGraphicsConfiguration()) {
                housing = new MCTStandardHousing(relativeWindow.getGraphicsConfiguration(),
                    housingTitle + " - " + viewRole.getViewName(), dimension.width, dimension.height, housingCloseAction, viewRole.createView(housedComponent));
            }
           
            housing.setLocationRelativeTo(relativeWindow);
        }
       
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.