Examples of WindowEvent


Examples of java.awt.event.WindowEvent

    source.destroy();
  }

  @Test
  public void should_return_true_if_Window_closed() {
    AWTEvent event = new WindowEvent(source, WINDOW_CLOSED);
    assertThat(AWTEvents.wasWindowClosed(event)).isTrue();
  }
View Full Code Here

Examples of java.awt.event.WindowEvent

    assertThat(AWTEvents.wasWindowClosed(event)).isTrue();
  }

  @Test
  public void should_return_false_if_Window_not_closed() {
    AWTEvent event = new WindowEvent(source, WINDOW_CLOSING);
    assertThat(AWTEvents.wasWindowClosed(event)).isFalse();
  }
View Full Code Here

Examples of java.awt.event.WindowEvent

  // we're interested again.
  boolean isDuplicateDispose(AWTEvent event) {
    if (!(event instanceof WindowEvent)) {
      return false;
    }
    WindowEvent windowEvent = (WindowEvent) event;
    int eventId = windowEvent.getID();
    if (eventId == WINDOW_CLOSING) {
      return false;
    }
    if (eventId == WINDOW_CLOSED) {
      Window w = windowEvent.getWindow();
      if (disposedWindows.containsKey(w)) {
        return true;
      }
      disposedWindows.put(w, true);
      // execute(addComponentListenerTask(w, new DisposalMonitor(disposedWindows)));
      w.addComponentListener(new DisposalMonitor(disposedWindows));
      return false;
    }
    disposedWindows.remove(windowEvent.getWindow());
    return false;
  }
View Full Code Here

Examples of java.awt.event.WindowEvent

    assertThat(monitor.disposedWindows).isEmpty();
  }

  @Test
  public void should_return_is_not_duplicate_if_Window_is_closing() {
    WindowEvent e = new WindowEvent(window, WINDOW_CLOSING);
    assertThat(monitor.isDuplicateDispose(e)).isFalse();
    assertThat(monitor.disposedWindows).isEmpty();
  }
View Full Code Here

Examples of java.awt.event.WindowEvent

  }

  @Test
  public void should_return_is_not_duplicate_if_Window_is_not_closing_and_it_is_not_closed() {
    monitor.disposedWindows.put(window, true);
    WindowEvent e = new WindowEvent(window, WINDOW_OPENED);
    assertThat(monitor.isDuplicateDispose(e)).isFalse();
    assertThat(monitor.disposedWindows).isEmpty();
  }
View Full Code Here

Examples of java.awt.event.WindowEvent

  }

  @Test
  public void should_return_is_duplicate_if_Window_is_closed_and_it_is_marked_as_disposed() {
    monitor.disposedWindows.put(window, true);
    WindowEvent e = new WindowEvent(window, WINDOW_CLOSED);
    assertThat(monitor.isDuplicateDispose(e)).isTrue();
    assertThat(monitor.disposedWindows).hasSize(1);
    assertThat(monitor.disposedWindows).includes(entry(window, true));
  }
View Full Code Here

Examples of java.awt.event.WindowEvent

    assertThat(monitor.disposedWindows).includes(entry(window, true));
  }

  @Test
  public void should_return_is_not_duplicate_if_Window_is_closed_and_it_is_not_marked_as_disposed() {
    WindowEvent e = new WindowEvent(window, WINDOW_CLOSED);
    assertThat(monitor.isDuplicateDispose(e)).isFalse();
    assertThat(monitor.disposedWindows).hasSize(1).includes(entry(window, true));
    ComponentListener[] componentListeners = window.getComponentListeners();
    assertThat(componentListeners).hasSize(1);
    assertThat(componentListeners[0]).isInstanceOf(DisposalMonitor.class);
View Full Code Here

Examples of java.awt.event.WindowEvent

    source.destroy();
  }

  @Test
  public void should_return_true_if_Window_opened() {
    AWTEvent event = new WindowEvent(source, WINDOW_OPENED);
    assertThat(AWTEvents.wasWindowOpened(event)).isTrue();
  }
View Full Code Here

Examples of java.awt.event.WindowEvent

    assertThat(AWTEvents.wasWindowOpened(event)).isTrue();
  }

  @Test
  public void should_return_false_if_Window_not_opened() {
    AWTEvent event = new WindowEvent(source, WINDOW_CLOSING);
    assertThat(AWTEvents.wasWindowOpened(event)).isFalse();
  }
View Full Code Here

Examples of java.awt.event.WindowEvent

*/
public class WindowVisibilityMonitor_windowClosed_Test extends WindowVisibilityMonitor_TestCase {
  @Test
  public void should_remove_itself_when_Window_is_closed() {
    window.startRecording();
    monitor.windowClosed(new WindowEvent(window, 8));
    assertThat(window.requireInvoked("removeWindowListener", args(monitor)));
    assertThat(window.requireInvoked("removeComponentListener", args(monitor)));
    verifyZeroInteractions(windows);
  }
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.