Package gov.nasa.arc.mct.gui.housing

Examples of gov.nasa.arc.mct.gui.housing.MCTContentArea$PopupListener


        private static final long serialVersionUID = -8750182309057992525L;

        @Override
        protected AbstractComponent getTargetComponent(ActionContextImpl actionContext)  {
            MCTHousing housing = actionContext.getTargetHousing();
            MCTContentArea contentArea = housing.getContentArea();
            return contentArea == null ? null : contentArea.getHousedViewManifestation().getManifestedComponent();
        }       
View Full Code Here


   
    @Override
    public boolean canHandle(ActionContext context) {
        actionContext = context;
        housingManifestation = (MCTHousingViewManifestation) actionContext.getWindowManifestation();
        MCTContentArea contentArea = housingManifestation.getContentArea();
        if (contentArea == null)
            return false;
        return true;
    }
View Full Code Here

            protected Transferable createTransferable(JComponent c) {
                View v = context.getWindowManifestation();
                Container container = v.getTopLevelAncestor();
                if (container instanceof MCTStandardHousing) {
                    MCTStandardHousing housing = (MCTStandardHousing) container;
                    MCTContentArea contentArea = housing.getContentArea();
                    if (contentArea != null) {
                        v = contentArea.getHousedViewManifestation();
                    }
                }
                return new ViewRoleSelection(new View[] { v });
            }
        });
View Full Code Here

        final AbstractComponent child = generateComponent(true, true, true, null);
        final AbstractComponent comp = generateComponent(true, isDirty, true, child);

        // Elaborate mocking to simulate context menu activation
        MCTHousing mockHousing = Mockito.mock(MCTHousing.class);
        MCTContentArea mockContentArea = Mockito.mock(MCTContentArea.class);
        View mockView = Mockito.mock(View.class);
        ActionContextImpl mockContext = Mockito.mock(ActionContextImpl.class);

        Mockito.when(mockContext.getInspectorComponent()).thenReturn(comp);
        Mockito.when(mockContext.getTargetComponent()).thenReturn(comp);
        Mockito.when(mockContext.getTargetHousing()).thenReturn(mockHousing);
        Mockito.when(mockHousing.getContentArea()).thenReturn(mockContentArea);
        Mockito.when(mockContentArea.getHousedViewManifestation()).thenReturn(mockView);
        Mockito.when(mockView.getManifestedComponent()).thenReturn(comp);

        // Generate a new persistence provider each time
        PersistenceProvider persistence = Mockito.mock(PersistenceProvider.class);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(persistence);
View Full Code Here

   
    @Test (dataProvider="generateTestCases")
    public void testSaveAllEnabled(ContextAwareAction action, AbstractComponent comp, boolean shouldHandle, boolean shouldBeEnabled) {
        // Elaborate mocking to simulate context menu activation
        MCTHousing mockHousing = Mockito.mock(MCTHousing.class);
        MCTContentArea mockContentArea = Mockito.mock(MCTContentArea.class);
        View mockView = Mockito.mock(View.class);
        ActionContextImpl mockContext = Mockito.mock(ActionContextImpl.class);
       
        Mockito.when(mockContext.getInspectorComponent()).thenReturn(comp);
        Mockito.when(mockContext.getTargetComponent()).thenReturn(comp);
        Mockito.when(mockContext.getTargetHousing()).thenReturn(mockHousing);
        Mockito.when(mockHousing.getContentArea()).thenReturn(mockContentArea);
        Mockito.when(mockContentArea.getHousedViewManifestation()).thenReturn(mockView);
        Mockito.when(mockView.getManifestedComponent()).thenReturn(comp);
       
        // Verify that enabled/disabled states match expectations
        Assert.assertEquals(action.canHandle(mockContext), shouldHandle);
        if (shouldHandle) { // Only verify isEnabled if case should be handled
View Full Code Here

   
    @Test (dataProvider="generateWarningDialogCases")
    public void testWarningDialog(ContextAwareAction action, AbstractComponent comp, boolean confirm, boolean prompt, final Set<AbstractComponent> expect) {
        // Elaborate mocking to simulate context menu activation
        MCTHousing mockHousing = Mockito.mock(MCTHousing.class);
        MCTContentArea mockContentArea = Mockito.mock(MCTContentArea.class);
        View mockView = Mockito.mock(View.class);
        ActionContextImpl mockContext = Mockito.mock(ActionContextImpl.class);
       
        Mockito.when(mockContext.getInspectorComponent()).thenReturn(comp);
        Mockito.when(mockContext.getTargetComponent()).thenReturn(comp);
        Mockito.when(mockContext.getTargetHousing()).thenReturn(mockHousing);
        Mockito.when(mockHousing.getContentArea()).thenReturn(mockContentArea);
        Mockito.when(mockContentArea.getHousedViewManifestation()).thenReturn(mockView);
        Mockito.when(mockView.getManifestedComponent()).thenReturn(comp);

        // Generate a new persistence provider each time
        PersistenceProvider persistence = Mockito.mock(PersistenceProvider.class);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(persistence);
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.gui.housing.MCTContentArea$PopupListener

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.