Overlord SVN: r1045 - bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2010-05-11 08:31:59 -0400 (Tue, 11 May 2010)
New Revision: 1045
Modified:
bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportLaunchPadView.java
Log:
Fix BPMC-67: Create report button not displayed
Modified: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportLaunchPadView.java
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportLaunchPadView.java 2010-05-10 10:30:13 UTC (rev 1044)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportLaunchPadView.java 2010-05-11 12:31:59 UTC (rev 1045)
@@ -40,6 +40,7 @@
import org.jboss.bpm.report.model.ReportReference;
import org.jboss.errai.workspaces.client.framework.Registry;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -67,6 +68,8 @@
private HTML description;
private ReportFrame reportFrame;
+ private Map<String, ReportParameterForm> forms = new HashMap<String, ReportParameterForm>();
+
public ReportLaunchPadView()
{
super(new BoxLayout(BoxLayout.Orientation.VERTICAL));
@@ -85,10 +88,8 @@
public void onChange(ChangeEvent changeEvent)
{
- final ReportReference reportRef = getCurrentSelection();
- description.setText(reportRef.getDescription());
- createInput(reportRef, inputPanel);
- ReportLaunchPadView.this.layout();
+ String reportTitle = dropBox.getItemText(dropBox.getSelectedIndex());
+ selectForm(reportTitle);
}
});
@@ -112,10 +113,8 @@
}
- private void createInput(final ReportReference reportRef, MosaicPanel inputPanel)
+ private ReportParameterForm createInput(final ReportReference reportRef)
{
- inputPanel.clear();
-
final ReportParameterForm form =
new ReportParameterForm(reportRef,
new ReportParamCallback()
@@ -144,7 +143,7 @@
}
});
- inputPanel.add(form);
+ return form;
}
private ReportReference getCurrentSelection()
@@ -162,16 +161,32 @@
public void update(List<ReportReference> reports)
{
reportTemplates = reports;
+ forms.clear();
for(ReportReference report : reports)
{
- dropBox.addItem(report.getTitle());
+ dropBox.addItem(report.getTitle());
+
+ forms.put(report.getTitle(), createInput(report));
}
dropBox.setSelectedIndex(0);
+
+ // default form
+ selectForm(dropBox.getItemText(0));
+
Registry.get(ApplicationContext.class).refreshView();
}
+ private void selectForm(String reportTitle)
+ {
+ inputPanel.clear();
+ ReportReference current = getCurrentSelection();
+ description.setText(current.getDescription());
+ inputPanel.add(forms.get(reportTitle));
+ ReportLaunchPadView.this.layout();
+ }
+
public void displayReport(String title, String dispatchUrl)
{
reportFrame.setFrameUrl(dispatchUrl);