Package gov.nasa.arc.mct.gui

Examples of gov.nasa.arc.mct.gui.View$GlassPanelRepaintManager


        }
    }
   
    @DataProvider(name="createTransferableTests")
    public Object[][] getCreateTransferableTests() {
       View p1View = mock(View.class);
         View cView = mock(View.class);
         MCTMutableTreeNode g = createMockNode(null);
         MCTMutableTreeNode p1 = createMockNode(p1View);
         MCTMutableTreeNode p2 = createMockNode(null);
         MCTMutableTreeNode c = createMockNode(cView);
        
View Full Code Here


    public void testImport(int childIndex) throws Exception {
        // To verify (AbstractComponent cannot be entirely stubbed)
        final Collection<AbstractComponent> added = new ArrayList<AbstractComponent>();
       
        // Set up the root node.
        View rootView = mock(View.class);
        MCTMutableTreeNode root = createMockNode(rootView);
        when(model.getRoot()).thenReturn(root);

        DataFlavor[] flavors = new DataFlavor[]{GOOD_FLAVOR};
        Transferable transferable = createMockTransferable(flavors);
       
        Component mockTree = mock(Component.class);
       
        TransferSupport support = createDropTransferSupport(mockTree, transferable, flavors);

        View targetView = mock(View.class);
        MCTMutableTreeNode target = createMockNode(targetView);
        AbstractComponent targetComponent = new AbstractComponent() {

            @Override
            protected void addDelegateComponentsCallback(Collection<AbstractComponent> childComponents) {
                added.addAll(childComponents);
                super.addDelegateComponentsCallback(childComponents);
            }
           
           
        };
        when(targetView.getManifestedComponent()).thenReturn(targetComponent);
       
        View mockView = mock(View.class);
        AbstractComponent mockComponent = new AbstractComponent() {};
        when(mockView.getManifestedComponent()).thenReturn(mockComponent);
       
        when(transferable.getTransferData(eq(GOOD_FLAVOR))).thenReturn(new View[]{mockView});
       
        // Mock persistence provider, policy manager, and platform
        PlatformAccess access = new PlatformAccess();
View Full Code Here

   
    @SuppressWarnings("unchecked")
    @Test(dataProvider="importTests")
    public void testImportIntoEmptyRoot(int childIndex) throws Exception {
        // Set up the root node.
        View rootView = mock(View.class);
        MCTMutableTreeNode root = createMockNode(rootView);
        when(model.getRoot()).thenReturn(root);
        AbstractComponent rootComponent = Mockito.mock(AbstractComponent.class);
        Mockito.when(rootView.getManifestedComponent()).thenReturn(rootComponent);

        DataFlavor[] flavors = new DataFlavor[]{GOOD_FLAVOR};
        Transferable transferable = createMockTransferable(flavors);
       
        Component mockTree = mock(Component.class);
       
        TransferSupport support = createDropTransferSupport(mockTree, transferable, flavors);

        View sourceView = mock(View.class);
       
        when(transferable.getTransferData(eq(GOOD_FLAVOR))).thenReturn(new View[]{sourceView});
       
        // Mock persistence provider, policy manager, and platform.
        PlatformAccess access = new PlatformAccess();
View Full Code Here

    @Override
    public void closeHousing() {
        boolean toCloseWindow = true;
        MCTContentArea centerPane = housingViewManifestation.getContentArea();
        if (centerPane != null) {
            View centerPaneView = centerPane.getHousedViewManifestation();
            AbstractComponent centerComponent = centerPaneView.getManifestedComponent();
            if (!centerComponent.isStale() && centerComponent.isDirty()) {
                toCloseWindow = commitOrAbortPendingChanges(centerPaneView,
                        MessageFormat.format(BUNDLE.getString("centerpane.modified.alert.text"),
                                centerPaneView.getInfo().getViewName(),
                                centerComponent.getDisplayName()));
            }
        }
        View inspectionArea = housingViewManifestation.getInspectionArea();
        if (inspectionArea != null) {
            View inspectorPaneView = inspectionArea.getHousedViewManifestation();
            AbstractComponent inspectorComponent = inspectorPaneView.getManifestedComponent();
            if (!inspectorComponent.isStale() && inspectorComponent.isDirty()) {
                toCloseWindow = commitOrAbortPendingChanges(inspectionArea,
                            MessageFormat.format(BUNDLE.getString("inspectorpane.modified.alert.text"),
                                inspectorPaneView.getInfo().getViewName(),
                                inspectorComponent.getDisplayName()));
            }
        }
        if (toCloseWindow) {
            disposeHousing();
View Full Code Here

            }
           
            if (selectedViews.isEmpty() || selectedViews.size() > 1) {
                inspectorView = new EmptyInspector();
            } else {           
                View v = (View) SwingUtilities.getAncestorOfClass(View.class, selectedViews.iterator().next());
                if (v != null) {
                    if (v.isContentOwner()) {
                        inspectorView = v.getManifestedComponent().getViewInfos(ViewType.CENTER_OWNED_INSPECTOR).iterator().next().createView(getManifestedComponent());
                    }
                }
                if (inspectorView == null)
                    inspectorView = getManifestedComponent().getViewInfos(ViewType.INSPECTOR).iterator().next().createView(getManifestedComponent());
            }
View Full Code Here

//    }

    private void showPopupMenu(MouseEvent e) {
        Set<View> viewManifestationSet = new HashSet<View>();
        if (inspector != null) {
            View selectedManifestation = inspector.getHousedViewManifestation();
            if (selectedManifestation != null) {
                viewManifestationSet.add(selectedManifestation);
            }
        }
        if (viewManifestationSet.size() == 0) {
View Full Code Here

                firePropertyChange(SelectionProvider.SELECTION_CHANGED_PROP, selections, Collections.emptyList());
            }
        }
       
        // setup new manifestation.
        View oldManifestation = ownerComponentCanvasManifestation;
        ownerComponentCanvasManifestation = viewManifestation;
        setupSelectionPropertyChangeListener(oldManifestation);
       
        controlManifestation = ownerComponentCanvasManifestation.getControlManifestation();
       
View Full Code Here

     * a canvas view. In the future this method may change to invoke a more specific method on the
     * view manifestation.
     * @return true if the the content area is empty, false otherwise.
     */
    public boolean isAreaEmpty() {
        View manifestation = getHousedViewManifestation();
        return manifestation == null ||
               !containsMCTViewManifestation(manifestation);
    }
View Full Code Here

       
    }

    @Override
    public boolean setHousedViewManifestation(ViewInfo viewInfo) {
        View newView = viewInfo.createView(ownerComponent);
        setOwnerComponentCanvasManifestation(newView);
        return true;
    }
View Full Code Here

  @Test
  public void testCanHandle() {
    // Setup mocks
    ActionContext mockContext = Mockito.mock(ActionContext.class);
    View mockView = Mockito.mock(View.class);
    AbstractComponent mockComponent = Mockito.mock(AbstractComponent.class);
    Mockito.when(mockView.getManifestedComponent()).thenReturn(mockComponent);
   
    // This-style import needs a window manifestation
    Mockito.when(mockContext.getWindowManifestation()).thenReturn(null);
    Assert.assertFalse(importThisAction.canHandle(mockContext));
    Mockito.when(mockContext.getWindowManifestation()).thenReturn(mockView);
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.gui.View$GlassPanelRepaintManager

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.