Author: heiko.braun(a)jboss.com
Date: 2009-07-28 07:50:37 -0400 (Tue, 28 Jul 2009)
New Revision: 5359
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/BootstrapAction.java
Removed:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusAction.java
Modified:
projects/gwt-console/trunk/gui/profiles/drools/src/main/resources/org/jboss/bpm/console/workspace.cfg
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerPlugins.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/SettingsEditor.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDetailView.java
Log:
Fix initialization sequence
Modified:
projects/gwt-console/trunk/gui/profiles/drools/src/main/resources/org/jboss/bpm/console/workspace.cfg
===================================================================
---
projects/gwt-console/trunk/gui/profiles/drools/src/main/resources/org/jboss/bpm/console/workspace.cfg 2009-07-28
10:13:08 UTC (rev 5358)
+++
projects/gwt-console/trunk/gui/profiles/drools/src/main/resources/org/jboss/bpm/console/workspace.cfg 2009-07-28
11:50:37 UTC (rev 5359)
@@ -1,4 +1,4 @@
-org.jboss.bpm.console.client.SettingsEditor
+org.jboss.bpm.console.client.task.TaskEditor
org.jboss.bpm.console.client.process.ProcessEditor
-org.jboss.bpm.console.client.task.TaskEditor
-org.jboss.bpm.console.client.report.ReportEditor
\ No newline at end of file
+org.jboss.bpm.console.client.report.ReportEditor
+org.jboss.bpm.console.client.SettingsEditor
\ No newline at end of file
Copied:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/BootstrapAction.java
(from rev 5345,
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusAction.java)
===================================================================
---
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/BootstrapAction.java
(rev 0)
+++
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/BootstrapAction.java 2009-07-28
11:50:37 UTC (rev 5359)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client;
+
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.model.ServerStatus;
+import org.jboss.bpm.console.client.model.DTOParser;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.json.client.JSONParser;
+import com.mvc4g.client.Controller;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BootstrapAction extends AbstractRESTAction
+{
+ public final static String ID = BootstrapAction.class.getName();
+
+ public BootstrapAction(ApplicationContext appContetext)
+ {
+ super(appContetext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ return appContext.getUrlBuilder().getServerStatusURL();
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(final Controller controller, final Object event,
Response response)
+ {
+ JSONValue json = JSONParser.parse(response.getText());
+ ServerStatus status = DTOParser.parseStatus(json);
+
+ // global var
+ ServerPlugins.setStatus(status);
+ }
+}
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
===================================================================
---
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-07-28
10:13:08 UTC (rev 5358)
+++
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-07-28
11:50:37 UTC (rev 5359)
@@ -27,7 +27,7 @@
import com.google.gwt.user.client.*;
import com.google.gwt.user.client.ui.*;
import com.google.gwt.user.client.ui.HTML;
-import com.mvc4g.client.Controller;
+import com.mvc4g.client.*;
import org.gwt.mosaic.ui.client.*;
import org.gwt.mosaic.ui.client.layout.BorderLayout;
import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
@@ -131,12 +131,25 @@
// Turn on DivLogger
Log.getDivLogger().getWidget().setVisible(true);
- // default editor
- if(workspace.hasEditor(TaskEditor.ID))
- workspace.showEditor(TaskEditor.ID);
+ // bootstrap
+ controller.handleEvent(
+ new com.mvc4g.client.Event(BootstrapAction.ID, null)
+ );
+ // show default editor
+ DeferredCommand.addCommand(
+ new Command()
+ {
+ public void execute()
+ {
+ if(workspace.hasEditor(TaskEditor.ID))
+ workspace.showEditor(TaskEditor.ID);
+ }
+ }
+ );
+
return layoutPanel;
-
+
}
/**
@@ -150,6 +163,7 @@
controller.addAction(ViewDeploymentAction.ID, new ViewDeploymentAction(this));
controller.addAction(UpdateDeploymentsAction.ID, new UpdateDeploymentsAction(this));
controller.addAction(UpdateDefinitionsAction.ID, new UpdateDefinitionsAction(this));
+ controller.addAction(BootstrapAction.ID, new BootstrapAction(this));
}
private CaptionLayoutPanel createMessagePanel(final LayoutPanel layoutPanel)
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerPlugins.java
===================================================================
---
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerPlugins.java 2009-07-28
10:13:08 UTC (rev 5358)
+++
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerPlugins.java 2009-07-28
11:50:37 UTC (rev 5359)
@@ -36,6 +36,11 @@
status = s;
}
+ public static ServerStatus getStatus()
+ {
+ return status;
+ }
+
public static boolean has(String type)
{
boolean match = false;
Deleted:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusAction.java
===================================================================
---
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusAction.java 2009-07-28
10:13:08 UTC (rev 5358)
+++
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusAction.java 2009-07-28
11:50:37 UTC (rev 5359)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.bpm.console.client;
-
-import org.jboss.bpm.console.client.common.AbstractRESTAction;
-import org.jboss.bpm.console.client.model.ServerStatus;
-import org.jboss.bpm.console.client.model.DTOParser;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-import com.google.gwt.http.client.RequestBuilder;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.json.client.JSONValue;
-import com.google.gwt.json.client.JSONParser;
-import com.mvc4g.client.Controller;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class ServerStatusAction extends AbstractRESTAction
-{
- public final static String ID = ServerStatusAction.class.getName();
-
- public ServerStatusAction(ApplicationContext appContetext)
- {
- super(appContetext);
- }
-
- public String getId()
- {
- return ID;
- }
-
- public String getUrl(Object event)
- {
- return appContext.getUrlBuilder().getServerStatusURL();
- }
-
- public RequestBuilder.Method getRequestMethod()
- {
- return RequestBuilder.GET;
- }
-
- public void handleSuccessfulResponse(final Controller controller, final Object event,
Response response)
- {
- JSONValue json = JSONParser.parse(response.getText());
- ServerStatus status = DTOParser.parseStatus(json);
- ServerStatusView view = (ServerStatusView)controller.getView(ServerStatusView.ID);
-
- ConsoleLog.info("Loaded server status");
-
- view.update(status);
-
- // global var
- ServerPlugins.setStatus(status);
- }
-}
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusView.java
===================================================================
---
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusView.java 2009-07-28
10:13:08 UTC (rev 5358)
+++
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/ServerStatusView.java 2009-07-28
11:50:37 UTC (rev 5359)
@@ -33,7 +33,7 @@
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public class ServerStatusView extends LayoutPanel
- implements ViewInterface
+ implements ViewInterface, LazyPanel
{
public final static String ID = ServerStatusView.class.getName();
@@ -42,6 +42,8 @@
private ApplicationContext appContext;
+ private boolean initialized;
+
public ServerStatusView(ApplicationContext appContext)
{
super();
@@ -53,8 +55,23 @@
this.controller = controller;
}
- public void update(ServerStatus status)
+
+ public boolean isInitialized()
{
+ return initialized;
+ }
+
+ public void initialize()
+ {
+ if(!initialized)
+ {
+ update(ServerPlugins.getStatus());
+ initialized = true;
+ }
+ }
+
+ private void update(ServerStatus status)
+ {
this.clear();
Grid g = new Grid(status.getPlugins().size(), 2);
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/SettingsEditor.java
===================================================================
---
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/SettingsEditor.java 2009-07-28
10:13:08 UTC (rev 5358)
+++
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/SettingsEditor.java 2009-07-28
11:50:37 UTC (rev 5359)
@@ -77,7 +77,8 @@
layoutPanel.add(server, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
ServerStatusView serverStatus = new ServerStatusView(appContext);
-
+ serverStatus.initialize();
+
Grid g2 = new Grid(1,2);
g2.setWidget(0,0, new Label("Host:"));
g2.setWidget(0,1, new Label(appContext.getConfig().getConsoleServerUrl()));
@@ -101,12 +102,15 @@
// view and actions
super.controller.addView(ServerStatusView.ID, serverStatus);
- super.controller.addAction(ServerStatusAction.ID, new
ServerStatusAction(appContext));
-
+
// load server status
super.controller.handleEvent(
- new Event(ServerStatusAction.ID, null)
+ new Event(BootstrapAction.ID, null)
);
+
+ // repaint
+ appContext.refreshView();
+
isInitialized = true;
}
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDetailView.java
===================================================================
---
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDetailView.java 2009-07-28
10:13:08 UTC (rev 5358)
+++
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDetailView.java 2009-07-28
11:50:37 UTC (rev 5359)
@@ -96,7 +96,8 @@
public void setController(Controller controller)
{
this.controller = controller;
- deploymentPanel.setController(controller);
+
if(deploymentPanel!=null)//if(ServerPlugins.has("org.jboss.bpm.console.server.plugin.ProcessEnginePlugin"))
+ deploymentPanel.setController(controller);
}
public void update(ProcessDefinitionRef process)