[jbpm-commits] JBoss JBPM SVN: r4792 - in projects/gwt-console/trunk/gui/war/src/main: java/org/jboss/bpm/console/client/task and 2 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue May 12 06:46:01 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-05-12 06:45:58 -0400 (Tue, 12 May 2009)
New Revision: 4792
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/UpdateDetailsAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/events/DetailViewEvent.java
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css
Log:
Fix JBPM-2219: Show task priorities and duedate in console
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java 2009-05-12 10:45:58 UTC (rev 4792)
@@ -0,0 +1,94 @@
+/*
+ * 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.common;
+
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.HTML;
+import org.gwt.mosaic.ui.client.Label;
+
+/**
+ * A simple property grid that displays name-value pairs.
+ * <br>
+ * Use styles:
+ * <ul>
+ * <li>bpm-prop-grid
+ * <li>bpm-prop-grid-label
+ * <li>bpm-prop-grid-even
+ * <li>bpm-prop-grid-odd
+ * </ul>
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class PropertyGrid extends Grid
+{
+ private String[] fieldNames;
+
+ public PropertyGrid(String[] fieldDesc)
+ {
+ super(fieldDesc.length, 2);
+ this.setStyleName("bpm-prop-grid");
+ this.fieldNames = fieldDesc;
+ initReset();
+ }
+
+ private void initReset()
+ {
+ for(int i=0; i< fieldNames.length; i++)
+ {
+ Label label = new Label(fieldNames[i]);
+ label.setStyleName("bpm-prop-grid-label");
+ this.setWidget(i,0, label);
+ this.setWidget(i,1, new HTML(""));
+
+ if (i % 2 == 0)
+ {
+ // even
+ this.getRowFormatter().setStyleName(i, "bpm-prop-grid-even");
+ }
+ else
+ {
+ // odd
+ this.getRowFormatter().setStyleName(i, "bpm-prop-grid-odd");
+ }
+ }
+ }
+
+ public void clear()
+ {
+ initReset();
+ }
+
+ public void update(String[] fieldValues)
+ {
+ if(fieldValues.length!= fieldNames.length)
+ throw new IllegalArgumentException("fieldValues.length doesn't match fieldName.length: "+ fieldNames);
+
+ for(int i=0; i< fieldNames.length; i++)
+ {
+ Label label = new Label(fieldNames[i]);
+ label.setStyleName("bpm-prop-grid-label");
+ this.setWidget(i,0, label);
+ this.setWidget(i,1, new HTML(fieldValues[i]));
+ }
+ }
+
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java 2009-05-12 10:12:27 UTC (rev 4791)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java 2009-05-12 10:45:58 UTC (rev 4792)
@@ -30,14 +30,13 @@
import com.google.gwt.core.client.GWT;
import com.mvc4g.client.Event;
import org.gwt.mosaic.ui.client.*;
-import org.gwt.mosaic.ui.client.layout.BoxLayout;
-import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
-import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.gwt.mosaic.ui.client.layout.*;
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.ApplicationContext;
import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.task.events.TaskIdentityEvent;
+import org.jboss.bpm.console.client.task.events.DetailViewEvent;
import org.jboss.bpm.console.client.util.WindowUtil;
import java.util.List;
@@ -54,8 +53,10 @@
private WindowPanel windowPanel;
private Frame frame;
-
- public AssignedTasksView(ApplicationContext appContext)
+
+ private TaskDetailView detailsView;
+
+ public AssignedTasksView(ApplicationContext appContext, TaskDetailView detailsView)
{
super();
this.appContext = appContext;
@@ -63,6 +64,7 @@
setTitle("Your Tasks");
setIcon(icons.userIcon());
+ this.detailsView = detailsView;
}
public void initialize()
@@ -99,17 +101,21 @@
}
});
- listBox.addChangeListener(new ChangeListener()
- {
- public void onChange(Widget widget)
- {
- int index = listBox.getSelectedIndex();
- if(index!=-1)
- {
- //
+ listBox.addChangeListener(
+ new ChangeListener() {
+
+ public void onChange(Widget widget)
+ {
+ TaskRef task = getSelection(); // first call always null?
+ if(task!=null)
+ {
+ controller.handleEvent(
+ new Event(UpdateDetailsAction.ID, new DetailViewEvent("AssignedDetailView", task))
+ );
+ }
+ }
}
- }
- });
+ );
// toolbar
final LayoutPanel toolBox = new LayoutPanel();
@@ -187,8 +193,12 @@
this.taskList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
this.taskList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
- this.add(taskList);
+ LayoutPanel layout = new LayoutPanel(new BorderLayout());
+ layout.add(taskList, new BorderLayoutData(BorderLayout.Region.CENTER));
+ layout.add(detailsView, new BorderLayoutData(BorderLayout.Region.SOUTH));
+ this.add(layout);
+
isInitialized = true;
}
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java 2009-05-12 10:12:27 UTC (rev 4791)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java 2009-05-12 10:45:58 UTC (rev 4792)
@@ -24,20 +24,21 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ChangeListener;
import com.mvc4g.client.Event;
import org.gwt.mosaic.ui.client.ListBox;
import org.gwt.mosaic.ui.client.MessageBox;
import org.gwt.mosaic.ui.client.ToolBar;
import org.gwt.mosaic.ui.client.ToolButton;
-import org.gwt.mosaic.ui.client.layout.BoxLayout;
-import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
-import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.gwt.mosaic.ui.client.layout.*;
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.client.task.events.TaskIdentityEvent;
+import org.jboss.bpm.console.client.task.events.DetailViewEvent;
import java.util.List;
+import java.util.Date;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
@@ -47,12 +48,17 @@
public final static String ID = OpenTasksView.class.getName();
- public OpenTasksView()
+ private TaskDetailView detailsView;
+
+ public OpenTasksView(TaskDetailView detailView)
{
super();
+
ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
setTitle("Open Tasks");
setIcon(icons.taskIcon());
+
+ this.detailsView = detailView;
}
public void initialize()
@@ -66,7 +72,7 @@
listBox =
new ListBox<TaskRef>(
new String[] {
- "Task ID", "Name", "Status"}
+ "Priority", "Name", "Status", "Due Date"}
);
@@ -75,7 +81,7 @@
TaskRef item) {
switch (column) {
case 0:
- listBox.setText(row, column, String.valueOf(item.getId()));
+ listBox.setText(row, column, String.valueOf(item.getPriority()));
break;
case 1:
listBox.setText(row, column, item.getName());
@@ -83,11 +89,32 @@
case 2:
listBox.setText(row, column, String.valueOf(item.getCurrentState()));
break;
+ case 3:
+ String dueDate = item.getDueDate() != null ? String.valueOf(item.getDueDate()) : "";
+ listBox.setText(row, column, dueDate);
+ break;
default:
throw new RuntimeException("Unexpected column size");
}
}
});
+
+
+ listBox.addChangeListener(
+ new ChangeListener() {
+
+ public void onChange(Widget widget)
+ {
+ TaskRef task = getSelection(); // first call always null?
+ if(task!=null)
+ {
+ controller.handleEvent(
+ new Event(UpdateDetailsAction.ID, new DetailViewEvent("OpenDetailView", task))
+ );
+ }
+ }
+ }
+ );
// toolbar
final LayoutPanel toolBox = new LayoutPanel();
@@ -138,8 +165,12 @@
this.taskList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
this.taskList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
- this.add(taskList);
+ // main layout
+ LayoutPanel layout = new LayoutPanel(new BorderLayout());
+ layout.add(taskList, new BorderLayoutData(BorderLayout.Region.CENTER));
+ layout.add(detailsView, new BorderLayoutData(BorderLayout.Region.SOUTH));
+ this.add(layout);
isInitialized = true;
}
}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailView.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskDetailView.java 2009-05-12 10:45:58 UTC (rev 4792)
@@ -0,0 +1,85 @@
+/*
+ * 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.task;
+
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.ViewInterface;
+import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.common.PropertyGrid;
+import org.jboss.bpm.console.client.model.TaskRef;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class TaskDetailView extends LayoutPanel implements ViewInterface
+{
+ public final static String ID = TaskDetailView.class.getName();
+
+ private Controller controller;
+
+ private TaskRef currentTask = null;
+
+ private PropertyGrid grid;
+
+ private boolean openView;
+
+ public TaskDetailView(boolean openView)
+ {
+ this.openView = openView;
+
+ // render
+ CaptionLayoutPanel panel = new CaptionLayoutPanel("Task details");
+ panel.setStyleName("bpm-detail-panel");
+ grid = new PropertyGrid(
+ new String[] {"ID:", "Name:", "Description:"}
+ );
+
+ panel.add(grid);
+
+ this.add(panel);
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public void update(TaskRef task)
+ {
+ String description = task.getDescription()!=null? task.getDescription():"";
+
+ String[] values = new String[] {
+ String.valueOf(task.getId()),
+ task.getName(),
+ description
+ };
+
+ grid.update(values);
+ }
+
+ public void clear()
+ {
+ currentTask = null;
+ grid.clear();
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-05-12 10:12:27 UTC (rev 4791)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-05-12 10:45:58 UTC (rev 4792)
@@ -80,14 +80,20 @@
this.add(tabPanel, new BorderLayoutData(BorderLayout.Region.CENTER));
+ TaskDetailView openDetailView = new TaskDetailView(true);
+ TaskDetailView assingnedDetailView = new TaskDetailView(false);
+ controller.addView("OpenDetailView", openDetailView);
+ controller.addView("AssignedDetailView", assingnedDetailView);
+
// create and register views
- registerView(OpenTasksView.ID, new OpenTasksView());
- registerView(AssignedTasksView.ID, new AssignedTasksView(appContext));
+ registerView(OpenTasksView.ID, new OpenTasksView(openDetailView));
+ registerView(AssignedTasksView.ID, new AssignedTasksView(appContext, assingnedDetailView));
// create and register actions
registerAction(LoadTasksAction.ID, new LoadTasksAction(appContext));
registerAction(ClaimTaskAction.ID, new ClaimTaskAction(appContext));
registerAction(ReleaseTaskAction.ID, new ReleaseTaskAction(appContext));
+ registerAction(UpdateDetailsAction.ID, new UpdateDetailsAction());
// display tab, needs to visible for correct rendering
tabPanel.selectTab(0);
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/UpdateDetailsAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/UpdateDetailsAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/UpdateDetailsAction.java 2009-05-12 10:45:58 UTC (rev 4792)
@@ -0,0 +1,48 @@
+/*
+ * 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.task;
+
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.model.TaskRef;
+import org.jboss.bpm.console.client.task.events.DetailViewEvent;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class UpdateDetailsAction implements ActionInterface
+{
+
+ public final static String ID = UpdateDetailsAction.class.getName();
+
+ public void execute(Controller controller, Object object)
+ {
+ DetailViewEvent event = (DetailViewEvent)object;
+ TaskRef task = event.getTask()!=null? event.getTask() : null;
+ TaskDetailView view = (TaskDetailView)controller.getView(event.getViewRef());
+
+ if(task!=null)
+ view.update(task);
+ else
+ view.clear();
+ }
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/events/DetailViewEvent.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/events/DetailViewEvent.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/events/DetailViewEvent.java 2009-05-12 10:45:58 UTC (rev 4792)
@@ -0,0 +1,49 @@
+/*
+ * 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.task.events;
+
+import org.jboss.bpm.console.client.model.TaskRef;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public final class DetailViewEvent
+{
+ String viewRef = null;
+ TaskRef task;
+
+ public DetailViewEvent(String viewRef, TaskRef task)
+ {
+ this.viewRef = viewRef;
+ this.task = task;
+ }
+
+ public String getViewRef()
+ {
+ return viewRef;
+ }
+
+ public TaskRef getTask()
+ {
+ return task;
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-05-12 10:12:27 UTC (rev 4791)
+++ projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-05-12 10:45:58 UTC (rev 4792)
@@ -227,4 +227,25 @@
padding:5px;
}
+/* start - custom widgets */
+.bpm-detail-panel {
+ border:1px solid #E8E8E8;
+}
+.bpm-prop-grid {
+
+}
+
+.bpm-prop-grid-even {
+ background: #F8F8F8;
+}
+
+.bpm-prop-grid-odd {
+
+}
+
+.bpm-prop-grid-label {
+
+}
+
+/* end - custom widgets */
More information about the jbpm-commits
mailing list