From ec75361305d8b02c9a0838ca233d373bb92b276e Mon Sep 17 00:00:00 2001 From: Dmitry Abramov Date: Wed, 18 Feb 2009 12:01:08 +0000 Subject: [PATCH] refactor init method --- modules/gui/src/com/haulmont/cuba/gui/WindowManager.java | 4 ++-- .../com/haulmont/cuba/gui/components/AbstractWindow.java | 6 ++++++ .../cuba/web/app/ui/security/group/browse/GroupBrowser.java | 4 +++- .../cuba/web/app/ui/security/role/browse/RoleBrowser.java | 3 ++- .../cuba/web/app/ui/security/user/browse/UserBrowser.java | 4 +++- .../cuba/web/app/ui/security/user/edit/UserEditor.java | 3 ++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/gui/src/com/haulmont/cuba/gui/WindowManager.java b/modules/gui/src/com/haulmont/cuba/gui/WindowManager.java index 1b4f03498d..481db09c53 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/WindowManager.java +++ b/modules/gui/src/com/haulmont/cuba/gui/WindowManager.java @@ -142,7 +142,7 @@ public abstract class WindowManager { try { invokeMethod(window, "init", params); } catch (NoSuchMethodException e) { - invokeMethod(window, "init"); + // Do nothing } return window; } catch (Throwable e) { @@ -349,7 +349,7 @@ public abstract class WindowManager { try { invokeMethod(res, "init", params); } catch (NoSuchMethodException e) { - invokeMethod(res, "init"); + // do nothing } } catch (Throwable e) { throw new RuntimeException(e); diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/AbstractWindow.java b/modules/gui/src/com/haulmont/cuba/gui/components/AbstractWindow.java index 23ba95b082..fd99f22005 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/AbstractWindow.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/AbstractWindow.java @@ -12,6 +12,8 @@ package com.haulmont.cuba.gui.components; import org.dom4j.Element; import com.haulmont.cuba.gui.data.DsContext; +import java.util.Map; + public class AbstractWindow extends AbstractFrame implements Window, Component.HasXmlDescriptor { public AbstractWindow(IFrame frame) { super(frame); @@ -64,4 +66,8 @@ public class AbstractWindow extends AbstractFrame implements Window, Component.H throw new UnsupportedOperationException(); } } + + protected void init(Map params) { + + } } diff --git a/modules/web/src/com/haulmont/cuba/web/app/ui/security/group/browse/GroupBrowser.java b/modules/web/src/com/haulmont/cuba/web/app/ui/security/group/browse/GroupBrowser.java index ce221edbd7..0489b31e90 100644 --- a/modules/web/src/com/haulmont/cuba/web/app/ui/security/group/browse/GroupBrowser.java +++ b/modules/web/src/com/haulmont/cuba/web/app/ui/security/group/browse/GroupBrowser.java @@ -14,13 +14,15 @@ import com.haulmont.cuba.gui.components.AbstractWindow; import com.haulmont.cuba.gui.components.Window; import com.haulmont.cuba.gui.components.Tree; +import java.util.Map; + public class GroupBrowser extends AbstractWindow { public GroupBrowser(Window frame) { super(frame); } - protected void init() { + protected void init(Map params) { Tree tree = getComponent("groups"); tree.getDatasource().refresh(); tree.expandTree(); diff --git a/modules/web/src/com/haulmont/cuba/web/app/ui/security/role/browse/RoleBrowser.java b/modules/web/src/com/haulmont/cuba/web/app/ui/security/role/browse/RoleBrowser.java index 4e7b4f53d3..a4f39bb382 100644 --- a/modules/web/src/com/haulmont/cuba/web/app/ui/security/role/browse/RoleBrowser.java +++ b/modules/web/src/com/haulmont/cuba/web/app/ui/security/role/browse/RoleBrowser.java @@ -15,6 +15,7 @@ import com.haulmont.cuba.gui.WindowManager; import com.haulmont.cuba.security.entity.Role; import java.util.Set; +import java.util.Map; public class RoleBrowser extends AbstractWindow { @@ -22,7 +23,7 @@ public class RoleBrowser extends AbstractWindow super(frame); } - protected void init() { + protected void init(Map params) { final Table table = getComponent("roles"); table.addAction( diff --git a/modules/web/src/com/haulmont/cuba/web/app/ui/security/user/browse/UserBrowser.java b/modules/web/src/com/haulmont/cuba/web/app/ui/security/user/browse/UserBrowser.java index 9c922aea21..bd9060ee2e 100644 --- a/modules/web/src/com/haulmont/cuba/web/app/ui/security/user/browse/UserBrowser.java +++ b/modules/web/src/com/haulmont/cuba/web/app/ui/security/user/browse/UserBrowser.java @@ -12,12 +12,14 @@ package com.haulmont.cuba.web.app.ui.security.user.browse; import com.haulmont.cuba.gui.components.*; import com.haulmont.cuba.web.gui.components.ComponentsHelper; +import java.util.Map; + public class UserBrowser extends AbstractLookup { public UserBrowser(Window frame) { super(frame); } - protected void init() { + protected void init(Map params) { final Button button = getComponent("filter.apply"); final Table table = getComponent("users"); diff --git a/modules/web/src/com/haulmont/cuba/web/app/ui/security/user/edit/UserEditor.java b/modules/web/src/com/haulmont/cuba/web/app/ui/security/user/edit/UserEditor.java index 3cbad6641c..34c500e0bf 100644 --- a/modules/web/src/com/haulmont/cuba/web/app/ui/security/user/edit/UserEditor.java +++ b/modules/web/src/com/haulmont/cuba/web/app/ui/security/user/edit/UserEditor.java @@ -14,13 +14,14 @@ import com.haulmont.cuba.gui.WindowManager; import com.haulmont.cuba.security.entity.User; import java.util.Collection; +import java.util.Map; public class UserEditor extends AbstractEditor { public UserEditor(Window frame) { super(frame); } - protected void init() { + protected void init(Map params) { Button button = getComponent("browse"); button.setAction(new AbstractAction("Browse") { public String getCaption() {