Search in sources :

Example 1 with MainFrame

use of org.apache.sling.reqanalyzer.impl.gui.MainFrame in project sling by apache.

the class RequestAnalyzerWebConsole method showWindow.

private synchronized void showWindow() throws ServletException, IOException {
    if (this.frame == null) {
        final File toAnalyze = this.getLogFileCopy();
        final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        MainFrame frame = new MainFrame(toAnalyze, Integer.MAX_VALUE, screenSize);
        // exit the application if the main frame is closed
        frame.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                // remove the tmp file we showed
                if (toAnalyze.exists()) {
                    toAnalyze.delete();
                }
                // clear the window reference
                RequestAnalyzerWebConsole.this.frame = null;
            }
        });
        this.frame = frame;
    }
    // make sure the window is visible, try to bring to the front
    this.frame.setVisible(true);
    this.frame.toFront();
}
Also used : WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) File(java.io.File) MainFrame(org.apache.sling.reqanalyzer.impl.gui.MainFrame)

Example 2 with MainFrame

use of org.apache.sling.reqanalyzer.impl.gui.MainFrame in project sling by apache.

the class RequestAnalyzerWebConsole method dispose.

void dispose() {
    if (this.frame != null) {
        MainFrame frame = this.frame;
        this.frame = null;
        AWTEvent e = new WindowEvent(frame, WindowEvent.WINDOW_CLOSING);
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
    }
}
Also used : WindowEvent(java.awt.event.WindowEvent) AWTEvent(java.awt.AWTEvent) MainFrame(org.apache.sling.reqanalyzer.impl.gui.MainFrame)

Aggregations

WindowEvent (java.awt.event.WindowEvent)2 MainFrame (org.apache.sling.reqanalyzer.impl.gui.MainFrame)2 AWTEvent (java.awt.AWTEvent)1 Dimension (java.awt.Dimension)1 WindowAdapter (java.awt.event.WindowAdapter)1 File (java.io.File)1