modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
| 148 +++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
| 200 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
| 57 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
| 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
| 2
6 files changed, 225 insertions(+), 187 deletions(-)
New commits:
commit 8c80f13e1b4b15826e260ebe74d5f3820e6dfea9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Dec 16 19:04:23 2010 -0500
partial BZ 663727 - bundle main view no longer shows repositories unless user has
manage_inventory perm
also adds double click to the bundle list so it drills down just as if you clicked the
link
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index 6528e76..49395c0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -319,4 +319,8 @@ public class LinkManager {
public static String getTagLink(String tag) {
return "#Reports/Subsystems/Tags/" + tag;
}
+
+ public static String getBundleLink(int bundleId) {
+ return "#Bundles/Bundle/" + bundleId;
+ }
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 0dc46b5..e41d351 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -18,7 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle;
-import com.allen_sauer.gwt.log.client.Log;
+import java.util.Set;
+
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
@@ -26,7 +27,10 @@ import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
+import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleView;
@@ -38,19 +42,21 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
/**
+ * This is the main bundle view with left hand side trees and right hand side
list/details view.
+ *
* @author Greg Hinkle
+ * @author John Mazzitelli
*/
public class BundleTopView extends LocatableHLayout implements BookmarkableView {
public static final ViewName VIEW_ID = new ViewName("Bundles",
MSG.view_bundle_bundles());
- private BundleTreeView bundleTreeView;
-
- private VLayout contentCanvas;
-
private ViewId currentNextPath;
- private BundleView bundleView;
- private BundlesListView bundlesListView;
+
+ private BundleTreeView bundleTreeView; // the tree of bundle destinations and
versions
+ private VLayout contentCanvas; // the right-side canvas container
+ private BundleView bundleView; // if the user is viewing an individual bundle, this
is that right-side view
+ private BundlesListView bundlesListView; // if the user is not viewing an indiv.
bundle, this is the right-side list
public BundleTopView(String locatorId) {
super(locatorId);
@@ -59,38 +65,74 @@ public class BundleTopView extends LocatableHLayout implements
BookmarkableView
setHeight100();
}
- @Override
- protected void onDraw() {
- super.onDraw();
-
- SectionStack sectionStack = new LocatableSectionStack(getLocatorId());
- sectionStack.setShowResizeBar(true);
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
- sectionStack.setWidth(250);
- sectionStack.setHeight100();
-
- SectionStackSection bundlesSection = new
SectionStackSection(MSG.view_bundle_bundles());
- bundleTreeView = new BundleTreeView(extendLocatorId("BundleTree"));
- bundlesSection.addItem(bundleTreeView);
- sectionStack.addSection(bundlesSection);
-
- SectionStackSection repositoriesSection = new
SectionStackSection(MSG.common_title_repositories());
- ContentRepositoryTreeView repoTree = new
ContentRepositoryTreeView(extendLocatorId("RepoTree"));
- repositoriesSection.addItem(repoTree);
- sectionStack.addSection(repositoriesSection);
-
- SectionStackSection providersSection = new
SectionStackSection(MSG.common_title_providers());
- sectionStack.addSection(providersSection);
-
- addMember(sectionStack);
-
- contentCanvas = new VLayout();
- contentCanvas.setWidth100();
- contentCanvas.setHeight100();
- addMember(contentCanvas);
+ public void renderView(final ViewPath viewPath) {
+ new PermissionsLoader().loadExplicitGlobalPermissions(new
PermissionsLoadedListener() {
+ @Override
+ public void onPermissionsLoaded(Set<Permission> permissions) {
+ // if we haven't done it yet, build the view components
+ if (bundleTreeView == null) {
+ SectionStack sectionStack = new
LocatableSectionStack(getLocatorId());
+ sectionStack.setShowResizeBar(true);
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ sectionStack.setWidth(250);
+ sectionStack.setHeight100();
+
+ SectionStackSection bundlesSection = new
SectionStackSection(MSG.view_bundle_bundles());
+ bundleTreeView = new
BundleTreeView(extendLocatorId("BundleTree"));
+ bundlesSection.addItem(bundleTreeView);
+ sectionStack.addSection(bundlesSection);
+
+ // we only show repositories if the user has the global
manage_inventory perms since that is required
+ if (permissions != null &&
permissions.contains(Permission.MANAGE_INVENTORY)) {
+ SectionStackSection repositoriesSection = new
SectionStackSection(MSG
+ .common_title_repositories());
+ ContentRepositoryTreeView repoTree = new
ContentRepositoryTreeView(extendLocatorId("RepoTree"));
+ repositoriesSection.addItem(repoTree);
+ sectionStack.addSection(repositoriesSection);
+ }
+
+ // TODO: we aren't doing anything with providers yet
+ // SectionStackSection providersSection = new
SectionStackSection(MSG.common_title_providers());
+ // sectionStack.addSection(providersSection);
+
+ addMember(sectionStack);
+
+ contentCanvas = new VLayout();
+ contentCanvas.setWidth100();
+ contentCanvas.setHeight100();
+ addMember(contentCanvas);
+ }
+
+ if (viewPath.isRefresh()) {
+ bundleTreeView.refresh();
+ }
+
+ bundleTreeView.selectPath(viewPath);
+
+ if (viewPath.isEnd()) {
+ if (currentNextPath == null && bundlesListView != null) {
+ bundlesListView.refresh();
+ } else {
+ currentNextPath = null;
+ bundlesListView = new
BundlesListView(extendLocatorId("BundleList"), permissions);
+ setContent(bundlesListView);
+ }
+ } else {
+ viewPath.getCurrent().getBreadcrumbs().clear();
+ if (!viewPath.getNext().equals(currentNextPath)) {
+ currentNextPath = viewPath.getNext();
+ bundleView = new
BundleView(extendLocatorId("Bundle"));
+ setContent(bundleView);
+ bundleView.renderView(viewPath.next());
+ } else {
+ bundleView.renderView(viewPath.next());
+ }
+ }
+ }
+ });
}
- public void setContent(Canvas newContent) {
+ private void setContent(Canvas newContent) {
for (Canvas c : contentCanvas.getMembers()) {
c.destroy();
}
@@ -98,36 +140,4 @@ public class BundleTopView extends LocatableHLayout implements
BookmarkableView
contentCanvas.markForRedraw();
}
- public void renderView(ViewPath viewPath) {
-
- if (viewPath.isRefresh()) {
- bundleTreeView.refresh();
- }
-
- bundleTreeView.selectPath(viewPath);
-
- if (viewPath.isEnd()) {
- if (currentNextPath == null && bundlesListView != null) {
- // refresh
- Log.info("Refreshing BundleTopView");
-
- bundlesListView.refresh();
- } else {
- currentNextPath = null;
- this.bundlesListView = new
BundlesListView(extendLocatorId("BundleList"));
- setContent(this.bundlesListView);
- }
- } else {
- viewPath.getCurrent().getBreadcrumbs().clear();
- if (!viewPath.getNext().equals(currentNextPath)) {
- currentNextPath = viewPath.getNext();
- bundleView = new BundleView(extendLocatorId("Bundle"));
- setContent(bundleView);
- bundleView.renderView(viewPath.next());
- } else {
- bundleView.renderView(viewPath.next());
- }
- }
- }
-
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index bbe68f2..e06b795 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -18,16 +18,25 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.list;
+import java.util.Set;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreateWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
@@ -35,109 +44,152 @@ import
org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
+ * Shows a list of bundles in the system. The list gives you some actions like new,
delete and deploy but
+ * only if you provide the proper permissions. If you give null permissions, no action
buttons are shown.
+ *
* @author Greg Hinkle
+ * @author John Mazzitelli
*/
-public class BundlesListView extends Table {
-
- public BundlesListView(String locatorId) {
- this(locatorId, null);
+public class BundlesListView extends
Table<RPCDataSource<BundleWithLatestVersionComposite>> {
+
+ private final Set<Permission> permissions;
+
+ /**
+ * Creates a new list view.
+ *
+ * @param locatorId
+ * @param perms if perms is null, no button actions will be shown in the table
+ */
+ public BundlesListView(String locatorId, Set<Permission> perms) {
+ this(locatorId, null, perms);
}
- public BundlesListView(String locatorId, Criteria criteria) {
+ public BundlesListView(String locatorId, Criteria criteria, Set<Permission>
perms) {
super(locatorId, MSG.view_bundle_bundles(), criteria);
+ this.permissions = perms;
setHeaderIcon("subsystems/bundle/Bundle_24.png");
setDataSource(new BundlesWithLatestVersionDataSource());
}
@Override
protected void configureTable() {
- getListGrid().getField("id").setWidth("60");
- getListGrid().getField("link").setWidth("25%");
- getListGrid().getField("link").setType(ListGridFieldType.LINK);
- getListGrid().getField("link").setTarget("_self");
-
- // getListGrid().getField("name").setCellFormatter(new
CellFormatter() {
- // public String format(Object o, ListGridRecord listGridRecord, int
i, int i1) {
- // return "";//<a href=\"#Bundles/Bundle/"
+ listGridRecord.getAttribute("id") + "\">" + o +
"</a>";
- // }
- // });
-
- getListGrid().getField("description").setWidth("25%");
- getListGrid().getField("latestVersion").setWidth("25%");
- getListGrid().getField("versionsCount").setWidth("*");
-
- addTableAction(extendLocatorId("New"), MSG.common_button_new(), null,
new AbstractTableAction() {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- new BundleCreateWizard().startWizard();
+
+ ListGridField idField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_ID, MSG.common_title_id());
+ idField.setType(ListGridFieldType.INTEGER);
+ idField.setWidth("50");
+
+ ListGridField nameField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_NAMELINK, MSG
+ .common_title_name());
+ nameField.setType(ListGridFieldType.LINK);
+ nameField.setTarget("_self");
+ nameField.setWidth("33%");
+
+ ListGridField descField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_DESCRIPTION, MSG
+ .common_title_description());
+ descField.setWidth("33%");
+
+ ListGridField latestVersionField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_LATEST_VERSION,
+ MSG.view_bundle_latestVersion());
+ latestVersionField.setWidth("20%");
+ latestVersionField.setAlign(Alignment.CENTER);
+
+ ListGridField versionsCountField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_VERSIONS_COUNT,
+ MSG.view_bundle_list_versionsCount());
+ versionsCountField.setType(ListGridFieldType.INTEGER);
+ versionsCountField.setWidth("*");
+ versionsCountField.setAlign(Alignment.CENTER);
+
+ setListGridFields(idField, nameField, descField, latestVersionField,
versionsCountField);
+
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ String selectedId =
selectedRows[0].getAttribute(BundlesWithLatestVersionDataSource.FIELD_ID);
+
CoreGUI.goToView(LinkManager.getBundleLink(Integer.valueOf(selectedId)));
+ }
}
});
- addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(),
MSG.common_msg_areYouSure(),
- new AbstractTableAction(TableActionEnablement.ANY) {
- public void executeAction(ListGridRecord[] selections, Object
actionValue) {
- BundlesWithLatestVersionDataSource ds =
(BundlesWithLatestVersionDataSource) getDataSource();
- for (ListGridRecord selection : selections) {
- BundleGWTServiceAsync bundleManager =
GWTServiceLookup.getBundleService();
- final BundleWithLatestVersionComposite object =
ds.copyValues(selection);
- bundleManager.deleteBundle(object.getBundleId(), new
AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_bundle_list_deleteFailure(object.getBundleName()), caught);
- }
+ // only show the buttons if we were given a set of permissions - passing in null
is a way to say you only want the list, no actions
+ if (this.permissions != null) {
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new
Message(MSG.view_bundle_list_deleteSuccessful(object.getBundleName()),
- Severity.Info));
+ boolean hasAuth = permissions.contains(Permission.MANAGE_BUNDLE);
- CoreGUI.refresh();
- }
- });
- }
+ addTableAction(extendLocatorId("New"), MSG.common_button_new(),
null, new AbstractTableAction(
+ (hasAuth) ? TableActionEnablement.ALWAYS : TableActionEnablement.NEVER)
{
+ public void executeAction(ListGridRecord[] selection, Object actionValue)
{
+ new BundleCreateWizard().startWizard();
}
});
- // can change this back to SINGLE selection when we feel like it. currently
allowing the wizard to
- // select the bundle.
- addTableAction(extendLocatorId("Deploy"), MSG.view_bundle_deploy(),
null, new AbstractTableAction() {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- if (selection.length == 0) {
- new BundleDeployWizard().startWizard();
- return;
- }
+ addTableAction(extendLocatorId("Delete"),
MSG.common_button_delete(), MSG.common_msg_areYouSure(),
+ new AbstractTableAction((hasAuth) ? TableActionEnablement.ANY :
TableActionEnablement.NEVER) {
+ public void executeAction(ListGridRecord[] selections, Object
actionValue) {
+ BundlesWithLatestVersionDataSource ds =
(BundlesWithLatestVersionDataSource) getDataSource();
+ for (ListGridRecord selection : selections) {
+ BundleGWTServiceAsync bundleManager =
GWTServiceLookup.getBundleService();
+ final BundleWithLatestVersionComposite object =
ds.copyValues(selection);
+ bundleManager.deleteBundle(object.getBundleId(), new
AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_bundle_list_deleteFailure(object.getBundleName()), caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new
Message(MSG.view_bundle_list_deleteSuccessful(object.getBundleName()),
+ Severity.Info));
+
+ CoreGUI.refresh();
+ }
+ });
+ }
+ }
+ });
- BundlesWithLatestVersionDataSource ds =
(BundlesWithLatestVersionDataSource) getDataSource();
- final BundleWithLatestVersionComposite object =
ds.copyValues(selection[0]);
- BundleCriteria bc = new BundleCriteria();
- bc.addFilterId(object.getBundleId());
- BundleGWTServiceAsync bundleManager =
GWTServiceLookup.getBundleService();
- bundleManager.findBundlesByCriteria(bc, new
AsyncCallback<PageList<Bundle>>() {
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.view_bundle_list_loadFailure(object.getBundleName()),
- caught);
+ // can change this back to SINGLE selection when we feel like it. currently
allowing the wizard to
+ // select the bundle.
+ addTableAction(extendLocatorId("Deploy"), MSG.view_bundle_deploy(),
null, new AbstractTableAction(
+ (hasAuth) ? TableActionEnablement.ALWAYS : TableActionEnablement.NEVER)
{
+ public void executeAction(ListGridRecord[] selection, Object actionValue)
{
+ if (selection.length == 0) {
+ new BundleDeployWizard().startWizard();
+ return;
}
- public void onSuccess(PageList<Bundle> result) {
- if (result == null || result.size() != 1) {
- CoreGUI.getMessageCenter().notify(
- new
Message(MSG.view_bundle_list_singleLoadFailure(object.getBundleName()),
- Severity.Error));
- return;
+ BundlesWithLatestVersionDataSource ds =
(BundlesWithLatestVersionDataSource) getDataSource();
+ final BundleWithLatestVersionComposite object =
ds.copyValues(selection[0]);
+ BundleCriteria bc = new BundleCriteria();
+ bc.addFilterId(object.getBundleId());
+ BundleGWTServiceAsync bundleManager =
GWTServiceLookup.getBundleService();
+ bundleManager.findBundlesByCriteria(bc, new
AsyncCallback<PageList<Bundle>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ MSG.view_bundle_list_loadFailure(object.getBundleName()),
caught);
}
- new BundleDeployWizard(result.get(0).getId()).startWizard();
- }
- });
- }
- });
+ public void onSuccess(PageList<Bundle> result) {
+ if (result == null || result.size() != 1) {
+ CoreGUI.getMessageCenter().notify(
+ new
Message(MSG.view_bundle_list_singleLoadFailure(object.getBundleName()),
+ Severity.Error));
+ return;
+ }
+ new BundleDeployWizard(result.get(0).getId()).startWizard();
+ }
+ });
+ }
+ });
+ }
}
- public int getMatches() {
- return this.getListGrid().getTotalRows();
- }
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
index c513513..0932620 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesWithLatestVersionDataSource.java
@@ -25,15 +25,13 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.data.Record;
-import com.smartgwt.client.data.fields.DataSourceIntegerField;
-import com.smartgwt.client.data.fields.DataSourceLinkField;
-import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
@@ -43,6 +41,13 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class BundlesWithLatestVersionDataSource extends
RPCDataSource<BundleWithLatestVersionComposite> {
+ public static final String FIELD_ID = "id";
+ public static final String FIELD_NAME = "name";
+ public static final String FIELD_NAMELINK = "namelink";
+ public static final String FIELD_DESCRIPTION = "description";
+ public static final String FIELD_LATEST_VERSION = "latestVersion";
+ public static final String FIELD_VERSIONS_COUNT = "versionsCount";
+
private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
public BundlesWithLatestVersionDataSource() {
@@ -52,31 +57,6 @@ public class BundlesWithLatestVersionDataSource extends
RPCDataSource<BundleWith
}
@Override
- protected List<DataSourceField> addDataSourceFields() {
- List<DataSourceField> fields = super.addDataSourceFields();
-
- DataSourceIntegerField idField = new DataSourceIntegerField("id",
MSG.common_title_id());
- idField.setPrimaryKey(true);
- fields.add(idField);
-
- DataSourceLinkField linkField = new DataSourceLinkField("link",
MSG.common_title_name());
- fields.add(linkField);
-
- DataSourceTextField descriptionField = new
DataSourceTextField("description", MSG.common_title_description());
- fields.add(descriptionField);
-
- DataSourceTextField latestVersionField = new
DataSourceTextField("latestVersion", MSG
- .view_bundle_latestVersion());
- fields.add(latestVersionField);
-
- DataSourceIntegerField deploymentCountField = new
DataSourceIntegerField("versionsCount", MSG
- .view_bundle_list_versionsCount());
- fields.add(deploymentCountField);
-
- return fields;
- }
-
- @Override
protected void executeFetch(final DSRequest request, final DSResponse response) {
BundleCriteria criteria = new BundleCriteria();
@@ -112,29 +92,22 @@ public class BundlesWithLatestVersionDataSource extends
RPCDataSource<BundleWith
@Override
public BundleWithLatestVersionComposite copyValues(Record from) {
- Integer idAttrib = from.getAttributeAsInt("id");
- String nameAttrib = from.getAttribute("name");
- String descriptionAttrib = from.getAttribute("description");
- String latestVersionAttrib = from.getAttribute("latestVersion");
- Integer versionsCountAttrib = from.getAttributeAsInt("versionsCount");
-
- return new BundleWithLatestVersionComposite(idAttrib, nameAttrib,
descriptionAttrib, latestVersionAttrib,
- versionsCountAttrib.longValue());
+ return (BundleWithLatestVersionComposite)
from.getAttributeAsObject("object");
}
@Override
public ListGridRecord copyValues(BundleWithLatestVersionComposite from) {
ListGridRecord record = new ListGridRecord();
- record.setAttribute("id", from.getBundleId());
- record.setAttribute("name", from.getBundleName());
+ record.setAttribute(FIELD_ID, from.getBundleId());
+ record.setAttribute(FIELD_NAME, from.getBundleName());
- record.setAttribute("link", "#Bundles/Bundle/" +
from.getBundleId());
+ record.setAttribute(FIELD_NAMELINK,
LinkManager.getBundleLink(from.getBundleId()));
record.setLinkText(from.getBundleName());
- record.setAttribute("description", from.getBundleDescription());
- record.setAttribute("latestVersion", from.getLatestVersion());
- record.setAttribute("versionsCount",
Integer.valueOf(from.getVersionsCount().intValue())); // want int, not long
+ record.setAttribute(FIELD_DESCRIPTION, from.getBundleDescription());
+ record.setAttribute(FIELD_LATEST_VERSION, from.getLatestVersion());
+ record.setAttribute(FIELD_VERSIONS_COUNT,
Integer.valueOf(from.getVersionsCount().intValue())); // want int, not long
record.setAttribute("object", from);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
index 236f728..12b8e23 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
@@ -44,7 +44,6 @@ public class BundleTreeView extends LocatableTreeGrid {
setWidth100();
setHeight100();
setLeaveScrollbarGap(false);
- // setShowRoot(true);
setAutoFetchData(true);
setAnimateFolders(false);
setSelectionType(SelectionStyle.SINGLE);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
index feb325e..7192f94 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
@@ -98,7 +98,7 @@ public class TaggedView extends LocatableVLayout implements
BookmarkableView {
Tab tab;
- BundlesListView bundlesView = new BundlesListView(getLocatorId(), criteria);
+ BundlesListView bundlesView = new BundlesListView(getLocatorId(), criteria,
null);
viewsWithTags.add(bundlesView);
tab = new LocatableTab(extendLocatorId("bundleList"),
MSG.view_bundle_bundles());
tab.setPane(bundlesView);