From 5c65ba538ea3c081a81227602ae68661773ba9f2 Mon Sep 17 00:00:00 2001 From: Patrick DURAND Date: Thu, 21 Dec 2017 11:37:44 +0100 Subject: [PATCH] update EZUIStarterListener API with frameDisplayed method --- .../plealog/genericapp/api/EZUIStarterListener.java | 5 +++++ .../plealog/genericapp/api/test/EZUIStarterTest.java | 4 ++++ .../genericapp/ui/starter/EZUIStarterImplem.java | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/src/com/plealog/genericapp/api/EZUIStarterListener.java b/src/com/plealog/genericapp/api/EZUIStarterListener.java index 8573f55..d27fe49 100644 --- a/src/com/plealog/genericapp/api/EZUIStarterListener.java +++ b/src/com/plealog/genericapp/api/EZUIStarterListener.java @@ -32,6 +32,11 @@ public interface EZUIStarterListener { */ public void postStart(); + /** + * This method is called when the application frame has been displayed. + */ + public void frameDisplayed(); + /** * This method is called when application is going to install the user-defined * component within the main frame. diff --git a/src/com/plealog/genericapp/api/test/EZUIStarterTest.java b/src/com/plealog/genericapp/api/test/EZUIStarterTest.java index 0ad28f6..f8ddd93 100644 --- a/src/com/plealog/genericapp/api/test/EZUIStarterTest.java +++ b/src/com/plealog/genericapp/api/test/EZUIStarterTest.java @@ -110,5 +110,9 @@ public Component getApplicationComponent() { public boolean isAboutToQuit() { return true; } + + @Override + public void frameDisplayed() { + } } } diff --git a/src/com/plealog/genericapp/ui/starter/EZUIStarterImplem.java b/src/com/plealog/genericapp/ui/starter/EZUIStarterImplem.java index 99c60bc..037829e 100644 --- a/src/com/plealog/genericapp/ui/starter/EZUIStarterImplem.java +++ b/src/com/plealog/genericapp/ui/starter/EZUIStarterImplem.java @@ -88,6 +88,15 @@ public void run() { EventQueue.invokeLater(runner); } } + + private class UIStarterListenerDisplayedhandler extends Thread { + public void run() { + if(EZEnvironment.getUIStarterListener()!=null){ + EZEnvironment.getUIStarterListener().frameDisplayed(); + } + } + } + private void center(Window frame) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = frame.getSize(); @@ -154,6 +163,7 @@ public void componentMoved(ComponentEvent e) { } }); frame.setVisible(true); + EventQueue.invokeLater(new UIStarterListenerDisplayedhandler()); } } public void startApplication(String[] args){