Examples of GlassPanelRepaintManager


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

    @SuppressWarnings("serial")
    @Test
    public void testRepaintManager() {
        final AtomicReference<JComponent> reference = new AtomicReference<JComponent>();
       
        GlassPanelRepaintManager repaintManager = new GlassPanelRepaintManager() {
            @Override
            void addDirtyRegionToSuperRepaintManager(JComponent c, int x, int y, int w, int h) {
                reference.set(c);
            }
        };
       
        // Test control manifestation and its glass panel
        JPanel controlPanel = new JPanel();
        ControlWrapper controlWrapper = new ControlWrapper(controlPanel);
        repaintManager.addDirtyRegion(controlPanel, 0, 0, 0, 0);
        Assert.assertSame(reference.get(), controlWrapper.getGlassPanel());

        // Test view manifestation and its glass panel
        View manifestation = new View() {
            @Override
            public AbstractComponent getManifestedComponent() {
                return Mockito.mock(AbstractComponent.class);
           
        };
       
        repaintManager.addDirtyRegion(manifestation, 0, 0, 0, 0);
        Assert.assertSame(reference.get(), manifestation);
       
        // Test other unrelated JComponent
        JComponent widget = Mockito.mock(JComponent.class);
        repaintManager.addDirtyRegion(widget, 0, 0, 0, 0);
        Assert.assertSame(reference.get(), widget);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.