[jbpm-commits] JBoss JBPM SVN: r3269 - in projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client: report and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Dec 8 08:05:48 EST 2008
Author: heiko.braun at jboss.com
Date: 2008-12-08 08:05:48 -0500 (Mon, 08 Dec 2008)
New Revision: 3269
Added:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/WelcomeEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportEditor.java
Removed:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/ReportOverviewEditor.java
Modified:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Application.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/ConsoleConfig.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java
Log:
Decouple authentication from main view assembly
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Application.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Application.java 2008-12-08 12:02:07 UTC (rev 3268)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Application.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -1,17 +1,39 @@
package org.jboss.bpm.console.client;
import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.Response;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.Window;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.TextField;
+import com.gwtext.client.widgets.layout.VerticalLayout;
+import com.gwtext.client.widgets.layout.BorderLayout;
+import com.gwtext.client.widgets.layout.BorderLayoutData;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.core.RegionPosition;
import org.jboss.bpm.console.client.util.ConsoleLog;
/**
* Entry point classes define <code>onModuleLoad()</code>.
+ * Does the authentication and reads the comfiguration before launching
+ * the {@link org.jboss.bpm.console.client.MainView}
*/
public class Application implements EntryPoint
{
private MainView mainView;
+ private Authentication auth;
+ private ConsoleConfig config;
+ private URLBuilder urlBuilder;
+ public final static String[] KNOWN_ROLES = {"admin", "manager", "user"};
+
/**
* Note, we defer all application initialization code to
* {@link #onModuleLoad2()} so that the UncaughtExceptionHandler
@@ -20,7 +42,7 @@
public void onModuleLoad() {
ConsoleLog.setEnabled(true);
-
+
/* Install an UncaughtExceptionHandler which will
* produce <code>FATAL</code> log messages
*/
@@ -41,11 +63,104 @@
*/
public void onModuleLoad2()
{
- mainView = new MainView();
+ config = new ConsoleConfig();
+
+ // setup
+
+ if(!GWT.isScript())
+ {
+ String proxyUrl = GWT.getModuleBaseURL() + "xhp";
+ config.setConsoleServerUrl(proxyUrl);
+ }
+
+ ConsoleLog.debug("Console server: " + config.getConsoleServerUrl());
+ ConsoleLog.debug("Report server: " + config.getReportServerUrl());
+
+ urlBuilder = new URLBuilder(config);
+
+ // authentiction
+
+ forceLogin();
}
public MainView getConsoleView()
{
return mainView;
}
+
+ private void forceLogin()
+ {
+ Panel panel = new Panel();
+ panel.setPaddings(20);
+ panel.setStyleName("login-panel-content");
+ panel.setLayout(new VerticalLayout(10));
+ panel.add( new HTML("Welcome, please login.") );
+
+ final Window window = new Window();
+ window.setTitle("GWT-Console");
+ window.setClosable(false);
+ window.setResizable(false);
+ window.setWidth(300);
+ window.setHeight(180);
+ window.setLayout(new BorderLayout());
+ window.setCloseAction(Window.CLOSE);
+
+ final FormPanel loginForm = new FormPanel();
+ loginForm.setBorder(false);
+ loginForm.add(new TextField("Username", "user"));
+ TextField passwordField = new TextField("Password", "pass");
+ passwordField.setPassword(true);
+ loginForm.add(passwordField);
+
+ final Button submitBtn = new Button("Login",
+ new ButtonListenerAdapter()
+ {
+ public void onClick(Button button, EventObject e)
+ {
+ String user = loginForm.getForm().findField("user").getValueAsString();
+ String pass = loginForm.getForm().findField("pass").getValueAsString();
+
+ String url = urlBuilder.getUserInRoleURL(KNOWN_ROLES);
+ auth = new Authentication(url);
+ auth.setCallback(
+ new Authentication.AuthCallback()
+ {
+
+ public void onLoginSuccess(Request request, Response response)
+ {
+ // clear the form
+ loginForm.getForm().reset();
+
+ // display main console
+ window.close();
+
+ // assemble main view
+ mainView = new MainView(auth, urlBuilder, config);
+ }
+
+ public void onLoginFailed(Request request, Throwable t)
+ {
+ // auth failed
+ ConsoleLog.error("Authentication failed.", t);
+ }
+ }
+ );
+
+ auth.doLogin(user,pass);
+
+ }
+ });
+
+ loginForm.addButton(submitBtn);
+ panel.add(loginForm);
+
+ BorderLayoutData centerData = new BorderLayoutData(RegionPosition.CENTER);
+ centerData.setMargins(3, 0, 3, 3);
+
+ window.add(panel, centerData);
+ // ------------------------------------------
+
+ window.show();
+ }
+
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/ConsoleConfig.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/ConsoleConfig.java 2008-12-08 12:02:07 UTC (rev 3268)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/ConsoleConfig.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -47,9 +47,10 @@
private String instanceReportFile;
- public ConsoleConfig(String consoleServerUrl)
+ public ConsoleConfig(String consoleServerUrl, String reportServerUrl)
{
this.consoleServerUrl = consoleServerUrl;
+ this.reportServerUrl = reportServerUrl;
}
public ConsoleConfig()
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2008-12-08 12:02:07 UTC (rev 3268)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -21,26 +21,21 @@
*/
package org.jboss.bpm.console.client;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.http.client.Request;
-import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
-import com.gwtext.client.core.EventObject;
import com.gwtext.client.core.Margins;
import com.gwtext.client.core.RegionPosition;
-import com.gwtext.client.widgets.*;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-import com.gwtext.client.widgets.form.FormPanel;
-import com.gwtext.client.widgets.form.TextField;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.MessageBoxConfig;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.Viewport;
import com.gwtext.client.widgets.layout.BorderLayout;
import com.gwtext.client.widgets.layout.BorderLayoutData;
import com.gwtext.client.widgets.layout.FitLayout;
-import com.gwtext.client.widgets.layout.VerticalLayout;
import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
+import org.jboss.bpm.console.client.report.OverviewReportEditor;
import org.jboss.bpm.console.client.task.TaskListEditor;
import org.jboss.bpm.console.client.util.ConsoleLog;
-import org.jboss.bpm.console.client.report.ReportOverviewEditor;
import java.util.List;
@@ -55,39 +50,29 @@
private Header header;
private Menu menu;
private Workspace workspace;
- private URLBuilder urlBuilder;
- public final static String[] KNOWN_ROLES = {"admin", "manager", "user"};
-
+ private URLBuilder urlBuilder;
private Viewport viewport;
-
private Authentication auth;
+ private ConsoleConfig config;
+
public boolean isAttached()
{
return super.isAttached(); //To change body of overridden methods use File | Settings | File Templates.
}
- public MainView()
+ public MainView(Authentication auth, URLBuilder urlBuilder, ConsoleConfig config)
{
- ConsoleConfig config = null;
+ this.auth = auth;
+ this.config = config;
+ this.urlBuilder = urlBuilder;
- if(GWT.isScript())
- {
- config = new ConsoleConfig();
- }
- else
- {
- config = new ConsoleConfig(GWT.getModuleBaseURL()+"xhp");
- }
-
- ConsoleLog.debug("Console server: " + config.getConsoleServerUrl());
- ConsoleLog.debug("Report server: " + config.getReportServerUrl());
-
- urlBuilder = new URLBuilder(config);
Panel mainPanel = createMainPanel();
assembleMainApplication(mainPanel);
- forceLogin(mainPanel);
+ mainPanel.show();
+ mainPanel.doLayout();
+
viewport = new Viewport(mainPanel);
}
@@ -132,94 +117,16 @@
borderPanel.add(workspace, new BorderLayoutData(RegionPosition.CENTER));
// ------------------------------------------
- // TODO: these don't initialze correctly when ordered differently or launched form Menu
+ // TODO: these don't initialze correctly when ordered differently or launched from Menu
workspace.addEditor( new ProcessDefinitionListEditor(this), false );
workspace.addEditor( new TaskListEditor(this), false );
- workspace.addEditor( new ReportOverviewEditor(this), false);
+ workspace.addEditor( new OverviewReportEditor(this), false);
// ------------------------------------------
mainPanel.add(borderPanel);
}
- private void forceLogin(final Panel mainPanel)
- {
- Panel panel = new Panel();
- panel.setPaddings(20);
- panel.setStyleName("login-panel-content");
- panel.setLayout(new VerticalLayout(10));
- panel.add( new HTML("Welcome, please login.") );
-
- final Window window = new Window();
- window.setTitle("GWT-Console");
- window.setClosable(false);
- window.setResizable(false);
- window.setWidth(300);
- window.setHeight(180);
- window.setLayout(new BorderLayout());
- window.setCloseAction(Window.CLOSE);
-
- final FormPanel loginForm = new FormPanel();
- loginForm.setBorder(false);
- loginForm.add(new TextField("Username", "user"));
- TextField passwordField = new TextField("Password", "pass");
- passwordField.setPassword(true);
- loginForm.add(passwordField);
-
- final Button submitBtn = new Button("Login",
- new ButtonListenerAdapter()
- {
- public void onClick(Button button, EventObject e)
- {
- String user = loginForm.getForm().findField("user").getValueAsString();
- String pass = loginForm.getForm().findField("pass").getValueAsString();
-
- String url = getUrlBuilder().getUserInRoleURL(KNOWN_ROLES);
- auth = new Authentication(url);
- auth.setCallback(
- new Authentication.AuthCallback()
- {
-
- public void onLoginSuccess(Request request, Response response)
- {
- // clear the form
- loginForm.getForm().reset();
-
- // display main console
- window.close();
- mainPanel.show();
- mainPanel.doLayout();
-
- // update header
- header.setUserInfo(auth.getUsername(), auth.getRolesAssigned());
- }
-
- public void onLoginFailed(Request request, Throwable t)
- {
- // auth failed
- ConsoleLog.error("Authentication failed.", t);
- }
- }
- );
-
- auth.doLogin(user,pass);
-
- }
- });
-
- loginForm.addButton(submitBtn);
- panel.add(loginForm);
-
- BorderLayoutData centerData = new BorderLayoutData(RegionPosition.CENTER);
- centerData.setMargins(3, 0, 3, 3);
-
- window.add(panel, centerData);
- // ------------------------------------------
-
- window.show();
- }
-
-
public void addEditor(Editor editor)
{
ConsoleLog.debug("Add editor " + editor.getEditorId());
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java 2008-12-08 12:02:07 UTC (rev 3268)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -28,7 +28,7 @@
import com.gwtext.client.widgets.tree.TreeNode;
import com.gwtext.client.widgets.tree.TreePanel;
import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
-import org.jboss.bpm.console.client.report.ReportOverviewEditor;
+import org.jboss.bpm.console.client.report.OverviewReportEditor;
import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
import org.jboss.bpm.console.client.task.TaskListEditor;
@@ -127,13 +127,13 @@
{
public void onClick(Node node, EventObject eventObject)
{
- if(view.hasEditor(ReportOverviewEditor.ID))
+ if(view.hasEditor(OverviewReportEditor.ID))
{
- view.showEditor(ReportOverviewEditor.ID);
+ view.showEditor(OverviewReportEditor.ID);
}
else
{
- view.addEditor( new ReportOverviewEditor(view) );
+ view.addEditor( new OverviewReportEditor(view) );
}
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-12-08 12:02:07 UTC (rev 3268)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -22,6 +22,7 @@
package org.jboss.bpm.console.client;
import com.google.gwt.http.client.URL;
+import com.google.gwt.core.client.GWT;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
@@ -159,12 +160,20 @@
public String getOverviewReportUrl()
{
- return config.getReportServerUrl()+"/preview?__report="+config.getOverviewReportFile();
+ String name = URL.encode(config.getOverviewReportFile());
+ String url = config.getReportServerUrl() + "/rs/report/view/" + name;
+ if(!GWT.isScript())
+ url += "&id=birt";
+ return url;
}
public String getDefinitionReportUrl(String name)
{
- String encodedName = URL.encode(name);
- return config.getReportServerUrl()+"/preview?__report="+config.getDefinitionReportFile()+"&name="+encodedName;
+ String reportName = URL.encode(name);
+ String reportFileName = URL.encode(config.getDefinitionReportFile());
+ String url = config.getReportServerUrl() + "/rs/report/view/" + reportFileName + "&name=" + reportName;
+ if(!GWT.isScript())
+ url += "&id=birt";
+ return url;
}
}
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/WelcomeEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/WelcomeEditor.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/WelcomeEditor.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class WelcomeEditor extends Editor
+{
+
+ public String getEditorId()
+ {
+ return "org.jboss.bpm.console.welcome";
+ }
+
+ public String getTitle()
+ {
+ return "GWT-Console";
+ }
+
+ public String getIconCSS()
+ {
+ return "";
+ }
+}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java 2008-12-08 12:02:07 UTC (rev 3268)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -44,7 +44,7 @@
this.setTabWidth(135);
this.setEnableTabScroll(true);
this.setAutoScroll(true);
- this.setActiveTab(0);
+ this.setActiveTab(0);
}
private Panel addTab(Editor editor, boolean closeable) {
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportEditor.java (from rev 3266, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/ReportOverviewEditor.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportEditor.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportEditor.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -0,0 +1,183 @@
+/*
+ * 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.report;
+
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.data.*;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.Component;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.event.PanelListenerAdapter;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.Label;
+import com.gwtext.client.widgets.layout.HorizontalLayout;
+import com.gwtext.client.widgets.layout.VerticalLayout;
+import com.gwtext.client.widgets.menu.Separator;
+import org.jboss.bpm.console.client.Editor;
+import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class OverviewReportEditor extends Editor
+{
+ public final static String ID = "org.jboss.bpm.metric.ProcessMetricOverview";
+ private MainView view;
+
+ public OverviewReportEditor(final MainView view)
+ {
+ super();
+ this.view = view;
+ this.setId(ID);
+ this.setPaddings(10);
+
+ // -------------------------------------
+ this.setLayout(new VerticalLayout(10) );
+
+ this.addListener(
+ new PanelListenerAdapter()
+ {
+ public void onRender(Component component)
+ {
+ Panel panel = new Panel("Metric overview");
+ panel.setPaddings(10);
+
+ final String reportUrl= view.getUrlBuilder().getOverviewReportUrl();
+ ConsoleLog.debug("Report resource:" + reportUrl);
+
+ final ComboBox comboBox = buildProcessSelection();
+
+ final BirtPanel birtPanel = new BirtPanel();
+ birtPanel.setUrl(reportUrl);
+
+ // --
+
+ Button refreshBtn = new Button("Refresh", new ButtonListenerAdapter()
+ {
+
+ public void onClick(Button button, EventObject eventObject)
+ {
+ birtPanel.setUrl(reportUrl);
+ }
+ });
+
+ Button viewBtn = new Button("Examine", new ButtonListenerAdapter()
+ {
+
+ public void onClick(Button button, EventObject eventObject)
+ {
+ String rawValue = comboBox.getRawValue();
+ if(rawValue==null || rawValue.equals(""))
+ MessageBox.alert("Please enter a process definition name!");
+ else
+ onExamine(rawValue);
+ }
+ });
+
+ // --
+
+ Panel toolsPanel = new Panel();
+ toolsPanel.setLayout( new HorizontalLayout(10) );
+ Label label = new Label("Process definition");
+ label.setStyleName("bpm-label");
+ toolsPanel.add(label);
+ toolsPanel.add(comboBox);
+ toolsPanel.add( viewBtn );
+ toolsPanel.add( new Separator() );
+ toolsPanel.add( refreshBtn );
+
+ panel.add(toolsPanel);
+ panel.add(birtPanel);
+
+ add(panel);
+ }
+ }
+ );
+ }
+
+
+ private void onExamine(String definitionName)
+ {
+ String editorId = ProcessReportEditor.createWidgetID(definitionName);
+
+ if(view.hasEditor(editorId))
+ view.showEditor(editorId);
+ else
+ view.addEditor( new ProcessReportEditor(definitionName, view) );
+ }
+
+ private ComboBox buildProcessSelection()
+ {
+
+ final RecordDef recordDef = new RecordDef(
+ new FieldDef[]{
+ new IntegerFieldDef("processId"),
+ new StringFieldDef("name"),
+ new StringFieldDef("version")
+ }
+ );
+
+ final JsonReader reader = new JsonReader(recordDef);
+ reader.setRoot("definitions");
+ reader.setTotalProperty("totalCount");
+ reader.setId("processId");
+
+ DataProxy dataProxy = new ScriptTagProxy(
+ view.getUrlBuilder().getProcessDefinitionsURL(), 1000*10);
+
+ final Store store = new Store(dataProxy, reader, false);
+ store.load();
+
+ ComboBox cb = new ComboBox();
+ cb.setMinChars(1);
+ cb.setFieldLabel("Process definition");
+ cb.setStore(store);
+ cb.setDisplayField("name");
+ cb.setMode(ComboBox.LOCAL);
+ cb.setTriggerAction(ComboBox.ALL);
+ cb.setEmptyText("Please enter a name");
+ cb.setLoadingText("Searching...");
+ cb.setTypeAhead(true);
+ cb.setSelectOnFocus(true);
+ cb.setWidth(180);
+
+ return cb;
+ }
+
+ public String getEditorId()
+ {
+ return ID;
+ }
+
+ public String getTitle()
+ {
+ return "Metrics and Stats";
+ }
+
+ public String getIconCSS()
+ {
+ return "bpm-report-icon";
+ }
+}
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/ReportOverviewEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/ReportOverviewEditor.java 2008-12-08 12:02:07 UTC (rev 3268)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/report/ReportOverviewEditor.java 2008-12-08 13:05:48 UTC (rev 3269)
@@ -1,185 +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.report;
-
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.data.*;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.Component;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.MessageBox;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-import com.gwtext.client.widgets.event.PanelListenerAdapter;
-import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.Label;
-import com.gwtext.client.widgets.layout.HorizontalLayout;
-import com.gwtext.client.widgets.layout.VerticalLayout;
-import com.gwtext.client.widgets.menu.Separator;
-import org.jboss.bpm.console.client.Editor;
-import org.jboss.bpm.console.client.MainView;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class ReportOverviewEditor extends Editor
-{
- public final static String ID = "org.jboss.bpm.metric.ProcessMetricOverview";
- private MainView view;
-
- public ReportOverviewEditor(final MainView view)
- {
- super();
- this.view = view;
- this.setId(ID);
- this.setPaddings(10);
-
- // -------------------------------------
- this.setLayout(new VerticalLayout(10) );
-
- this.addListener(
- new PanelListenerAdapter()
- {
-
- public void onRender(Component component)
- {
-
- Panel panel = new Panel("Metric overview");
- panel.setPaddings(10);
-
- final String reportUrl= view.getUrlBuilder().getOverviewReportUrl();
- ConsoleLog.debug("Report resource:" + reportUrl);
-
- final ComboBox comboBox = buildProcessSelection();
-
- final BirtPanel birtPanel = new BirtPanel();
- birtPanel.setUrl(reportUrl);
-
- // --
-
- Button refreshBtn = new Button("Refresh", new ButtonListenerAdapter()
- {
-
- public void onClick(Button button, EventObject eventObject)
- {
- birtPanel.setUrl(reportUrl);
- }
- });
-
- Button viewBtn = new Button("Examine", new ButtonListenerAdapter()
- {
-
- public void onClick(Button button, EventObject eventObject)
- {
- String rawValue = comboBox.getRawValue();
- if(rawValue==null || rawValue.equals(""))
- MessageBox.alert("Please enter a process definition name!");
- else
- onExamine(rawValue);
- }
- });
-
- // --
-
- Panel toolsPanel = new Panel();
- toolsPanel.setLayout( new HorizontalLayout(10) );
- Label label = new Label("Process definition");
- label.setStyleName("bpm-label");
- toolsPanel.add(label);
- toolsPanel.add(comboBox);
- toolsPanel.add( viewBtn );
- toolsPanel.add( new Separator() );
- toolsPanel.add( refreshBtn );
-
- panel.add(toolsPanel);
- panel.add(birtPanel);
-
- add(panel);
- }
- }
- );
- }
-
-
- private void onExamine(String definitionName)
- {
- String editorId = ProcessReportEditor.createWidgetID(definitionName);
-
- if(view.hasEditor(editorId))
- view.showEditor(editorId);
- else
- view.addEditor( new ProcessReportEditor(definitionName, view) );
- }
-
- private ComboBox buildProcessSelection()
- {
-
- final RecordDef recordDef = new RecordDef(
- new FieldDef[]{
- new IntegerFieldDef("processId"),
- new StringFieldDef("name"),
- new StringFieldDef("version")
- }
- );
-
- final JsonReader reader = new JsonReader(recordDef);
- reader.setRoot("definitions");
- reader.setTotalProperty("totalCount");
- reader.setId("processId");
-
- DataProxy dataProxy = new ScriptTagProxy(
- view.getUrlBuilder().getProcessDefinitionsURL(), 1000*10);
-
- final Store store = new Store(dataProxy, reader, false);
- store.load();
-
- ComboBox cb = new ComboBox();
- cb.setMinChars(1);
- cb.setFieldLabel("Process definition");
- cb.setStore(store);
- cb.setDisplayField("name");
- cb.setMode(ComboBox.LOCAL);
- cb.setTriggerAction(ComboBox.ALL);
- cb.setEmptyText("Please enter a name");
- cb.setLoadingText("Searching...");
- cb.setTypeAhead(true);
- cb.setSelectOnFocus(true);
- cb.setWidth(180);
-
- return cb;
- }
-
- public String getEditorId()
- {
- return ID;
- }
-
- public String getTitle()
- {
- return "Metrics and Stats";
- }
-
- public String getIconCSS()
- {
- return "bpm-report-icon";
- }
-}
More information about the jbpm-commits
mailing list