modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java | 405 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java | 128 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 365 +--------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java | 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/ResourceDriftChangeSetsTreeView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 42 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupOperationHistoryListView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryView.java | 21
28 files changed, 667 insertions(+), 415 deletions(-)
New commits:
commit b7c8d2f78a437a375f250d38de47dc08aa0e633c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Jul 29 16:18:20 2011 -0400
make sure the URL id is prefexed with 0id_ so CoreGUI knows this is an ID
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 378350d..646c32f 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
@@ -25,6 +25,7 @@ package org.rhq.enterprise.gui.coregui.client;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
+import org.rhq.enterprise.gui.coregui.client.components.table.StringIDTableSection;
/**
* @author Greg Hinkle
@@ -218,14 +219,6 @@ public class LinkManager {
return link;
}
- public static String getSubsystemDriftHistoryLink(int resourceId, String driftId) {
- return "#Resource/" + resourceId + "/Drift/History/" + driftId;
- }
-
- public static String getSubsystemDriftConfigLink(int resourceId, int driftConfigId) {
- return "#Resource/" + resourceId + "/Drift/Config/" + driftConfigId;
- }
-
public static String getAutodiscoveryQueueLink() {
if (GWT) {
return "#Administration/Security/Auto%20Discovery%20Queue";
@@ -459,7 +452,14 @@ public class LinkManager {
return "#Bundles/Bundle/" + bundleId + "/deployments/" + bundleDeploymentId;
}
- public static String getDriftHistoryLink(int resourceId, int driftId) {
+ public static String getDriftHistoryLink(int resourceId, String driftId) {
+ if (!driftId.startsWith(StringIDTableSection.ID_PREFIX)) {
+ driftId = StringIDTableSection.ID_PREFIX + driftId;
+ }
return "#Resource/" + resourceId + "/Drift/History/" + driftId;
}
+
+ public static String getDriftConfigLink(int resourceId, int driftConfigId) {
+ return "#Resource/" + resourceId + "/Drift/Config/" + driftConfigId;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
index c4118af..1c5a333 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
@@ -93,7 +93,7 @@ public abstract class StringIDTableSection<DS extends RPCDataSource> extends Abs
@Override
public void showDetails(String id) {
if (id != null && id.length() > 0) {
- History.newItem(getBasePath() + "/" + id);
+ History.newItem(getBasePath() + "/" + convertIDToCurrentViewPath(id));
} else {
String msg = MSG.view_tableSection_error_badId(this.getClass().toString(), (id == null) ? "null" : id
.toString());
@@ -105,18 +105,24 @@ public abstract class StringIDTableSection<DS extends RPCDataSource> extends Abs
@Override
public abstract Canvas getDetailsView(String id);
- private static final String ID_PREFIX = "0id_"; // the prefix to be placed in front of the string IDs in URLs
+ // the main CoreGUI class will assume anything with a digit as the first character in a path segment in the URL is an ID.
+ public static final String ID_PREFIX = "0id_"; // the prefix to be placed in front of the string IDs in URLs
@Override
protected String convertCurrentViewPathToID(String path) {
+ if (!path.startsWith(ID_PREFIX)) {
+ return path; // prefixed has already been stripped
+ }
return path.substring(ID_PREFIX.length()); // skip the initial "0id_" - see convertIDToCurrentViewPath for what this is all about
}
@Override
protected String convertIDToCurrentViewPath(String id) {
- // the main CoreGUI class will assume anything with a digit as the first character in a path segment in the URL
- // is an ID. Because we aren't assured the given ID will be a digit, let's prepend the digit here and make it
+ // Because we aren't assured the given ID will be a digit, let's prepend the digit here and make it
// look like an ID to CoreGUI. We will strip this off when we convert this back to an ID - see convertCurrentViewPathToID
+ if (id.startsWith(ID_PREFIX)) {
+ return id; // it is already prefixed
+ }
return ID_PREFIX + id;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java
index 6f4bbf2..aee99cf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDetailsView.java
@@ -20,6 +20,8 @@
package org.rhq.enterprise.gui.coregui.client.drift;
+import static org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter.DATE_TIME_FORMAT_FULL;
+
import java.util.LinkedHashMap;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -30,34 +32,29 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import org.rhq.core.domain.criteria.BasicDriftCriteria;
import org.rhq.core.domain.drift.Drift;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-import static org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter.DATE_TIME_FORMAT_FULL;
-
/**
* @author Jay Shaughnessy
*/
-public class DriftDetailsView extends LocatableVLayout implements BookmarkableView {
+public class DriftDetailsView extends LocatableVLayout {
private String driftId;
- private static DriftDetailsView INSTANCE = new DriftDetailsView("DriftDetailsView");
-
- public static DriftDetailsView getInstance() {
- return INSTANCE;
+ public DriftDetailsView(String locatorId, String driftId) {
+ super(locatorId);
+ this.driftId = driftId;
+ setMembersMargin(10);
}
- private DriftDetailsView(String id) {
- // access through the static singleton only (see renderView)
- super(id);
-
- setMembersMargin(10);
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ show(this.driftId);
}
private void show(String driftId) {
@@ -80,7 +77,7 @@ public class DriftDetailsView extends LocatableVLayout implements BookmarkableVi
private void show(Drift drift) {
for (Canvas child : getMembers()) {
- removeChild(child);
+ removeMember(child);
}
// the change set to which the drift belongs
@@ -157,11 +154,4 @@ public class DriftDetailsView extends LocatableVLayout implements BookmarkableVi
addMember(driftForm);
}
-
- @Override
- public void renderView(ViewPath viewPath) {
- driftId = viewPath.getCurrent().getPath();
- show(driftId);
- }
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
index 060c9d1..cf42485 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
@@ -156,7 +156,7 @@ public class DriftHistoryView extends StringIDTableSection<DriftDataSource> {
public String format(Object value, ListGridRecord record, int i, int i1) {
Integer resourceId = record.getAttributeAsInt(AncestryUtil.RESOURCE_ID);
String driftId = getId(record);
- String url = LinkManager.getSubsystemDriftHistoryLink(resourceId, driftId);
+ String url = LinkManager.getDriftHistoryLink(resourceId, driftId);
String formattedValue = TimestampCellFormatter.format(value);
return SeleniumUtility.getLocatableHref(url, formattedValue, null);
}
@@ -285,7 +285,7 @@ public class DriftHistoryView extends StringIDTableSection<DriftDataSource> {
@Override
public Canvas getDetailsView(String driftId) {
- return DriftDetailsView.getInstance();
+ return new DriftDetailsView(extendLocatorId("Details"), driftId);
}
public EntityContext getContext() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/ResourceDriftChangeSetsTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/ResourceDriftChangeSetsTreeView.java
index 3ee0b5f..51f2ec2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/ResourceDriftChangeSetsTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/ResourceDriftChangeSetsTreeView.java
@@ -47,7 +47,7 @@ public class ResourceDriftChangeSetsTreeView extends AbstractDriftChangeSetsTree
protected String getNodeTargetLink(TreeNode node) {
if (node instanceof DriftTreeNode) {
String driftIdStr = node.getAttribute(AbstractDriftChangeSetsTreeDataSource.ATTR_ID).split("_")[1];
- String path = LinkManager.getDriftHistoryLink(this.context.resourceId, Integer.valueOf(driftIdStr));
+ String path = LinkManager.getDriftHistoryLink(this.context.resourceId, driftIdStr);
return path;
}
return null;
commit 385db545221d5aa7bcbdca6abc23b3ffbb294d70
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Jul 29 15:13:29 2011 -0400
factor TableSection to support string IDs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 85f5e92..1c52477 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -53,8 +53,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceT
import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
-import org.rhq.enterprise.gui.coregui.client.test.TestRemoteServiceStatisticsView;
import org.rhq.enterprise.gui.coregui.client.test.TestDataSourceResponseStatisticsView;
+import org.rhq.enterprise.gui.coregui.client.test.TestRemoteServiceStatisticsView;
import org.rhq.enterprise.gui.coregui.client.test.TestTopView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -383,6 +383,11 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String>, Event.Na
} else {
if (view.matches(TREE_NAV_VIEW_PATTERN)) {
// e.g. "Resource/10001" or "Resource/AutoGroup/10003"
+ // TODO: need to support string IDs "Drift/History/0id_abcdefghijk"
+ // TODO: see StringIDTableSection.ID_PREFIX
+ // TODO: remember \D is a non-digit, and \d is a digit
+ // TODO: String suffix = currentViewPath.replaceFirst("\\D*[^/]*", ""); // this might be OK if 0id_ starts with a digit
+ // TODO: suffix = suffix.replaceFirst("((\\d.*)|(0id_[^/]*))", "");
if (!currentViewPath.startsWith(view)) {
// The Node that was selected is not the same Node that was previously selected - it
// may not even be the same node type. For example, the user could have moved from a
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 115d4a8..bfa9ae6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -26,9 +26,9 @@ import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-
import com.smartgwt.client.widgets.grid.events.CellClickEvent;
import com.smartgwt.client.widgets.grid.events.CellClickHandler;
+
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
@@ -85,7 +85,7 @@ public class RolesView extends TableSection<RolesDataSource> implements Bookmark
addTableAction(extendLocatorId("New"), MSG.common_button_new(), createNewAction());
addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), getDeleteConfirmMessage(),
- createDeleteAction());
+ createDeleteAction());
super.configureTable();
}
@@ -184,7 +184,7 @@ public class RolesView extends TableSection<RolesDataSource> implements Bookmark
}
@Override
- public Canvas getDetailsView(int roleId) {
+ public Canvas getDetailsView(Integer roleId) {
return new RoleEditView(extendLocatorId("Detail"), roleId);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index 427b1c2..4fdd6e5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -26,9 +26,9 @@ import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-
import com.smartgwt.client.widgets.grid.events.CellClickEvent;
import com.smartgwt.client.widgets.grid.events.CellClickHandler;
+
import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
@@ -211,7 +211,8 @@ public class UsersView extends TableSection<UsersDataSource> {
};
}
- public Canvas getDetailsView(int subjectId) {
+ @Override
+ public Canvas getDetailsView(Integer subjectId) {
return new UserEditView(extendLocatorId("Detail"), subjectId);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
index 45dd32c..3fa6202 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
@@ -277,7 +277,7 @@ public class AlertHistoryView extends TableSection<AlertDataSource> {
}
@Override
- public Canvas getDetailsView(int alertId) {
+ public Canvas getDetailsView(Integer alertId) {
return AlertDetailsView.getInstance();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
index c49fc4f..7f2cce0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
@@ -134,7 +134,7 @@ public abstract class AbstractAlertDefinitionsView extends TableSection<Abstract
}
@Override
- public SingleAlertDefinitionView getDetailsView(final int id) {
+ public SingleAlertDefinitionView getDetailsView(final Integer id) {
final SingleAlertDefinitionView singleAlertDefinitionView = new SingleAlertDefinitionView(this
.extendLocatorId("singleAlertDefinitionView"), this);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
index 9fa9c31..fc0dbb1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
@@ -93,7 +93,7 @@ public class GroupAlertDefinitionsView extends AbstractAlertDefinitionsView {
}
@Override
- public SingleAlertDefinitionView getDetailsView(int id) {
+ public SingleAlertDefinitionView getDetailsView(Integer id) {
SingleAlertDefinitionView view = super.getDetailsView(id);
if (id == 0) {
// when creating a new alert def, make sure to set this in the new alert def
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
index ea41bc2..e31e554 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
@@ -93,7 +93,7 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
}
@Override
- public SingleAlertDefinitionView getDetailsView(int id) {
+ public SingleAlertDefinitionView getDetailsView(Integer id) {
SingleAlertDefinitionView view = super.getDetailsView(id);
if (id == 0) {
// when creating a new alert def, make sure to set this in the new alert def
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
index 688dea4..755c8d7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
@@ -100,7 +100,7 @@ public class TemplateAlertDefinitionsView extends AbstractAlertDefinitionsView {
}
@Override
- public SingleAlertDefinitionView getDetailsView(int id) {
+ public SingleAlertDefinitionView getDetailsView(Integer id) {
SingleAlertDefinitionView view = super.getDetailsView(id);
if (id == 0) {
// when creating a new alert def, make sure to set this in the new alert def
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
index df8a406..7178269 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
@@ -39,7 +39,6 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.DetailsView;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
@@ -49,10 +48,16 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
+ * Provides the typical table view with the additional ability of traversing to a "details" view
+ * when double-clicking a individual row in the table - a masters/detail view in effect.
+ *
+ * @param <DS> the datasource used to obtain data for the table
+ * @param <ID> the type used for IDs. This identifies the type used to uniquely refer to a row in the table
+ *
* @author Greg Hinkle
* @author John Mazzitelli
*/
-public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> implements BookmarkableView {
+public abstract class AbstractTableSection<DS extends RPCDataSource, ID> extends Table<DS> implements BookmarkableView {
private VLayout detailsHolder;
private Canvas detailsView;
@@ -60,38 +65,39 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
private boolean escapeHtmlInDetailsLinkColumn;
private boolean initialDisplay;
- protected TableSection(String locatorId, String tableTitle) {
+ protected AbstractTableSection(String locatorId, String tableTitle) {
super(locatorId, tableTitle);
}
- protected TableSection(String locatorId, String tableTitle, Criteria criteria) {
+ protected AbstractTableSection(String locatorId, String tableTitle, Criteria criteria) {
super(locatorId, tableTitle, criteria);
}
- protected TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers) {
+ protected AbstractTableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers) {
super(locatorId, tableTitle, sortSpecifiers);
}
- protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers) {
+ protected AbstractTableSection(String locatorId, String tableTitle, Criteria criteria,
+ SortSpecifier[] sortSpecifiers) {
super(locatorId, tableTitle, sortSpecifiers, criteria);
}
- protected TableSection(String locatorId, String tableTitle, boolean autoFetchData) {
+ protected AbstractTableSection(String locatorId, String tableTitle, boolean autoFetchData) {
super(locatorId, tableTitle, autoFetchData);
}
- protected TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers,
+ protected AbstractTableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers,
String[] excludedFieldNames) {
super(locatorId, tableTitle, null, sortSpecifiers, excludedFieldNames);
}
- protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
- String[] excludedFieldNames) {
+ protected AbstractTableSection(String locatorId, String tableTitle, Criteria criteria,
+ SortSpecifier[] sortSpecifiers, String[] excludedFieldNames) {
super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames);
}
- protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
- String[] excludedFieldNames, boolean autoFetchData) {
+ protected AbstractTableSection(String locatorId, String tableTitle, Criteria criteria,
+ SortSpecifier[] sortSpecifiers, String[] excludedFieldNames, boolean autoFetchData) {
super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
}
@@ -177,8 +183,8 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
if (value == null) {
return "";
}
- Integer recordId = getId(record);
- String detailsUrl = "#" + getBasePath() + "/" + recordId;
+ ID recordId = getId(record);
+ String detailsUrl = "#" + getBasePath() + "/" + convertIDToCurrentViewPath(recordId);
String formattedValue = (escapeHtmlInDetailsLinkColumn) ? StringUtility.escapeHtml(value.toString())
: value.toString();
return SeleniumUtility.getLocatableHref(detailsUrl, formattedValue, null);
@@ -190,7 +196,7 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
* Shows the details view for the given record of the table.
*
* The default implementation of this method assumes there is an
- * id attribute on the record and passes it to {@link #showDetails(int)}.
+ * id attribute on the record and passes it to {@link #showDetails(Object)}.
* Subclasses are free to override this behavior. Subclasses usually
* will need to set the {@link #setDetailsView(Canvas) details view}
* explicitly.
@@ -202,7 +208,7 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
throw new IllegalArgumentException("'record' parameter is null.");
}
- Integer id = getId(record);
+ ID id = getId(record);
showDetails(id);
}
@@ -210,7 +216,7 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
* Returns the details canvas with information on the item given its list grid record.
*
* The default implementation of this method is to assume there is an
- * id attribute on the record and pass that ID to {@link #getDetailsView(int)}.
+ * id attribute on the record and pass that ID to {@link #getDetailsView(Object)}.
* Subclasses are free to override this - which you usually want to do
* if you know the full details of the item are stored in the record attributes
* and thus help avoid making a round trip to the DB.
@@ -218,66 +224,76 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
* @param record the record of the item whose details to be shown; ; null if empty details view should be shown.
*/
public Canvas getDetailsView(ListGridRecord record) {
- Integer id = getId(record);
+ ID id = getId(record);
return getDetailsView(id);
}
- protected Integer getId(ListGridRecord record) {
- Integer id = (record != null) ? record.getAttributeAsInt("id") : 0;
- if (id == null) {
- String msg = MSG.view_tableSection_error_noId(this.getClass().toString());
- CoreGUI.getErrorHandler().handleError(msg);
- throw new IllegalStateException(msg);
- }
- return id;
- }
+ /**
+ * Subclasses define how they want to format their identifiers. These uniquely identify
+ * rows in the table. Typical values/types for IDs are Integers or Strings.
+ *
+ * @param record the individual record that contains the ID to be extracted and returned
+ *
+ * @return the ID of the given row/record from the table.
+ */
+ protected abstract ID getId(ListGridRecord record);
/**
* Shows empty details for a new item being created.
* This method is usually called when a user clicks a 'New' button.
*
+ * Subclasses are free to override this if they need a custom way to show the details view.
+ *
* @see #showDetails(ListGridRecord)
*/
public void newDetails() {
- History.newItem(basePath + "/0");
+ History.newItem(basePath + "/0"); // assumes the subclasses will understand "0" means "new details page"
}
/**
- * Shows the details for an item has the given ID.
+ * Shows the details for an item that has the given ID.
* This method is usually called when a user goes to the details
* page via a bookmark, double-cick on a list view row, or direct link.
*
- * @param id the id of the row whose details are to be shown; Should be a valid id, > 0.
+ * @param id the id of the row whose details are to be shown; Must be a valid ID.
*
* @see #showDetails(ListGridRecord)
*
- * @throws IllegalArgumentException if id <= 0.
+ * @throws IllegalArgumentException if id is invalid
*/
- public void showDetails(int id) {
- if (id > 0) {
- History.newItem(basePath + "/" + id);
- } else {
- String msg = MSG.view_tableSection_error_badId(this.getClass().toString(), Integer.toString(id));
- CoreGUI.getErrorHandler().handleError(msg);
- throw new IllegalArgumentException(msg);
- }
- }
+ public abstract void showDetails(ID id);
/**
* Returns the details canvas with information on the item that has the given ID.
* Note that an empty details view should be returned if the id passed in is 0 (as would
* be the case if a new item is to be created using the details view).
*
- * @param id the id of the details to be shown; will be 0 if an empty details view should be shown.
+ * @param id the id of the details to be shown; will be "0" if an empty details view should be shown.
+ */
+ public abstract Canvas getDetailsView(ID id);
+
+ /**
+ * Given the path from the URL that identifies the ID, this returns the ID represented by that path string.
+ * @param path the path as it was found in the current view path (i.e. in the URL)
+ * @return the ID that identifies the item referred to by the URL
+ */
+ protected abstract ID convertCurrentViewPathToID(String path);
+
+ /**
+ * Given the ID of a particular item, this returns a path string suitable for placement in a URL such that that URL will
+ * identify the particular item.
+ *
+ * @return how the ID can be represented within a view path (i.e. in a URL)
+ * @param id the ID that identifies the item to be referred by in a URL
*/
- public abstract Canvas getDetailsView(int id);
+ protected abstract String convertIDToCurrentViewPath(ID id);
@Override
public void renderView(ViewPath viewPath) {
this.basePath = viewPath.getPathToCurrent();
if (!viewPath.isEnd()) {
- int id = Integer.parseInt(viewPath.getCurrent().getPath());
+ ID id = convertCurrentViewPathToID(viewPath.getCurrent().getPath());
this.detailsView = getDetailsView(id);
if (this.detailsView instanceof BookmarkableView) {
((BookmarkableView) this.detailsView).renderView(viewPath);
@@ -325,7 +341,7 @@ public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> i
* detailsView in edit-mode, the content canvas will already be hidden, which means the
* animateHide would be a no-op (the event won't fire). this causes the detailsHolder
* to keep a reference to the previous detailsView (the one in create-mode) instead of the
- * newly returned reference from getDetailsView(int) that was called when the renderView
+ * newly returned reference from getDetailsView(ID) that was called when the renderView
* methods were called hierarchically down to render the new detailsView in edit-mode.
* therefore, we need to explicitly destroy what's already there (presumably the detailsView
* in create-mode), and then rebuild it (presumably the detailsView in edit-mode).
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
new file mode 100644
index 0000000..c4118af
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/StringIDTableSection.java
@@ -0,0 +1,122 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.google.gwt.user.client.History;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * The TableSection abstract implementation that supports IDs as basic Strings.
+ *
+ * Use this if you have tabular data whose rows are not identified with Integers but
+ * some other non-numeric string.
+ *
+ * If you have tabular data whose rows have integer IDs, use {@link TableSection}.
+ *
+ * @author John Mazzitelli
+ */
+public abstract class StringIDTableSection<DS extends RPCDataSource> extends AbstractTableSection<DS, String> {
+
+ public StringIDTableSection(String locatorId, String tableTitle, boolean autoFetchData) {
+ super(locatorId, tableTitle, autoFetchData);
+ }
+
+ public StringIDTableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames, boolean autoFetchData) {
+ super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
+ }
+
+ public StringIDTableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames) {
+ super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames);
+ }
+
+ public StringIDTableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers) {
+ super(locatorId, tableTitle, criteria, sortSpecifiers);
+ }
+
+ public StringIDTableSection(String locatorId, String tableTitle, Criteria criteria) {
+ super(locatorId, tableTitle, criteria);
+ }
+
+ public StringIDTableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames) {
+ super(locatorId, tableTitle, sortSpecifiers, excludedFieldNames);
+ }
+
+ public StringIDTableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers) {
+ super(locatorId, tableTitle, sortSpecifiers);
+ }
+
+ public StringIDTableSection(String locatorId, String tableTitle) {
+ super(locatorId, tableTitle);
+ }
+
+ @Override
+ protected String getId(ListGridRecord record) {
+ String id = null;
+ if (record != null) {
+ id = record.getAttribute("id");
+ }
+
+ if (id == null || id.length() == 0) {
+ String msg = MSG.view_tableSection_error_noId(this.getClass().toString());
+ CoreGUI.getErrorHandler().handleError(msg);
+ throw new IllegalStateException(msg);
+ }
+ return id;
+ }
+
+ @Override
+ public void showDetails(String id) {
+ if (id != null && id.length() > 0) {
+ History.newItem(getBasePath() + "/" + id);
+ } else {
+ String msg = MSG.view_tableSection_error_badId(this.getClass().toString(), (id == null) ? "null" : id
+ .toString());
+ CoreGUI.getErrorHandler().handleError(msg);
+ throw new IllegalArgumentException(msg);
+ }
+ }
+
+ @Override
+ public abstract Canvas getDetailsView(String id);
+
+ private static final String ID_PREFIX = "0id_"; // the prefix to be placed in front of the string IDs in URLs
+
+ @Override
+ protected String convertCurrentViewPathToID(String path) {
+ return path.substring(ID_PREFIX.length()); // skip the initial "0id_" - see convertIDToCurrentViewPath for what this is all about
+ }
+
+ @Override
+ protected String convertIDToCurrentViewPath(String id) {
+ // the main CoreGUI class will assume anything with a digit as the first character in a path segment in the URL
+ // is an ID. Because we aren't assured the given ID will be a digit, let's prepend the digit here and make it
+ // look like an ID to CoreGUI. We will strip this off when we convert this back to an ID - see convertCurrentViewPathToID
+ return ID_PREFIX + id;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
new file mode 100644
index 0000000..3eb65c5
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -0,0 +1,114 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.google.gwt.user.client.History;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * The TableSection abstract implementation that supports IDs as Integers.
+ *
+ * Since most master/detail table views have Integers for IDs that uniquely identify
+ * rows in the table, this is the typical superclass implementation used for
+ * most of RHQ's concrete TableSection views.
+ *
+ * @author John Mazzitelli
+ */
+public abstract class TableSection<DS extends RPCDataSource> extends AbstractTableSection<DS, Integer> {
+
+ public TableSection(String locatorId, String tableTitle, boolean autoFetchData) {
+ super(locatorId, tableTitle, autoFetchData);
+ }
+
+ public TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames, boolean autoFetchData) {
+ super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
+ }
+
+ public TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames) {
+ super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames);
+ }
+
+ public TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers) {
+ super(locatorId, tableTitle, criteria, sortSpecifiers);
+ }
+
+ public TableSection(String locatorId, String tableTitle, Criteria criteria) {
+ super(locatorId, tableTitle, criteria);
+ }
+
+ public TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames) {
+ super(locatorId, tableTitle, sortSpecifiers, excludedFieldNames);
+ }
+
+ public TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers) {
+ super(locatorId, tableTitle, sortSpecifiers);
+ }
+
+ public TableSection(String locatorId, String tableTitle) {
+ super(locatorId, tableTitle);
+ }
+
+ @Override
+ protected Integer getId(ListGridRecord record) {
+ Integer id = (record != null) ? record.getAttributeAsInt("id") : 0;
+ if (id == null) {
+ String msg = MSG.view_tableSection_error_noId(this.getClass().toString());
+ CoreGUI.getErrorHandler().handleError(msg);
+ throw new IllegalStateException(msg);
+ }
+ return id;
+ }
+
+ @Override
+ public void showDetails(Integer id) {
+ if (id != null && id.intValue() > 0) {
+ History.newItem(getBasePath() + "/" + id);
+ } else {
+ String msg = MSG.view_tableSection_error_badId(this.getClass().toString(), (id == null) ? "null" : id
+ .toString());
+ CoreGUI.getErrorHandler().handleError(msg);
+ throw new IllegalArgumentException(msg);
+ }
+ }
+
+ @Override
+ public abstract Canvas getDetailsView(Integer id);
+
+ @Override
+ protected Integer convertCurrentViewPathToID(String path) {
+ return Integer.valueOf(path);
+ }
+
+ @Override
+ protected String convertIDToCurrentViewPath(Integer id) {
+ if (id == null) {
+ return "0";
+ }
+ return id.toString();
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationView.java
index 071e2de..f090bd8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftConfigurationView.java
@@ -226,7 +226,7 @@ public class DriftConfigurationView extends TableSection<DriftConfigurationDataS
}
@Override
- public Canvas getDetailsView(int driftConfigId) {
+ public Canvas getDetailsView(Integer driftConfigId) {
return new DriftConfigurationEditView(extendLocatorId("ConfigEdit"), context, driftConfigId, hasWriteAccess);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
index f00640a..060c9d1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
@@ -42,9 +42,9 @@ import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.form.EnumSelectItem;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.StringIDTableSection;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableSection2;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -62,7 +62,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
*
* @author Jay Shaughnessy
*/
-public class DriftHistoryView extends TableSection2<DriftDataSource> {
+public class DriftHistoryView extends StringIDTableSection<DriftDataSource> {
public static final ViewName SUBSYSTEM_VIEW_ID = new ViewName("RecentDrifts", MSG.common_title_recent_drifts());
@@ -283,7 +283,6 @@ public class DriftHistoryView extends TableSection2<DriftDataSource> {
// });
// }
-
@Override
public Canvas getDetailsView(String driftId) {
return DriftDetailsView.getInstance();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
index fa623f1..e146f0e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
@@ -211,7 +211,7 @@ public class EventCompositeHistoryView extends TableSection<EventCompositeDataso
}
@Override
- public Canvas getDetailsView(int eventId) {
+ public Canvas getDetailsView(Integer eventId) {
return EventCompositeDetailsView.getInstance();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index 7e1d548..4a6db81 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -128,26 +128,26 @@ public class GroupDefinitionListView extends TableSection<GroupDefinitionDataSou
nextCalculationTimeField);
addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(),
- new AbstractTableAction(TableActionEnablement.ANY) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- final int[] groupDefinitionIds = TableUtility.getIds(selection);
- ResourceGroupGWTServiceAsync groupManager = GWTServiceLookup.getResourceGroupService(60000);
- groupManager.deleteGroupDefinitions(groupDefinitionIds, new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_dynagroup_deleteSuccessfulSelection(String
- .valueOf(groupDefinitionIds.length)), Severity.Info));
- GroupDefinitionListView.this.refresh();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_deleteFailureSelection(), caught);
- }
- });
- }
- });
+ new AbstractTableAction(TableActionEnablement.ANY) {
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ final int[] groupDefinitionIds = TableUtility.getIds(selection);
+ ResourceGroupGWTServiceAsync groupManager = GWTServiceLookup.getResourceGroupService(60000);
+ groupManager.deleteGroupDefinitions(groupDefinitionIds, new AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_dynagroup_deleteSuccessfulSelection(String
+ .valueOf(groupDefinitionIds.length)), Severity.Info));
+ GroupDefinitionListView.this.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_deleteFailureSelection(), caught);
+ }
+ });
+ }
+ });
addTableAction(extendLocatorId("New"), MSG.common_button_new(), null, new AbstractTableAction() {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
@@ -180,7 +180,7 @@ public class GroupDefinitionListView extends TableSection<GroupDefinitionDataSou
}
@Override
- public Canvas getDetailsView(int id) {
+ public Canvas getDetailsView(Integer id) {
final SingleGroupDefinitionView singleGroupDefinitionView = new SingleGroupDefinitionView(this
.extendLocatorId("Details"));
return singleGroupDefinitionView;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java
index f1c7cfa..10d2cb9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java
@@ -74,7 +74,7 @@ public class TraitsView extends AbstractMeasurementDataTraitListView {
}
@Override
- public Canvas getDetailsView(int definitionId) {
+ public Canvas getDetailsView(Integer definitionId) {
return new TraitsDetailView(extendLocatorId("Detail"), this.groupId, definitionId);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
index b9eb6bb..03dde04 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupMemberResourceOperationHistoryListView.java
@@ -80,7 +80,7 @@ public class GroupMemberResourceOperationHistoryListView extends
}
@Override
- public Canvas getDetailsView(int id) {
+ public Canvas getDetailsView(Integer id) {
return new ResourceOperationHistoryDetailsView(extendLocatorId("DetailsView"), true);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupOperationHistoryListView.java
index 8ad3170..ecf55ca 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupOperationHistoryListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/history/GroupOperationHistoryListView.java
@@ -45,7 +45,7 @@ public class GroupOperationHistoryListView extends AbstractOperationHistoryListV
}
@Override
- public Canvas getDetailsView(int id) {
+ public Canvas getDetailsView(Integer id) {
return new GroupOperationHistoryDetailsView(extendLocatorId("DetailsView"), this.groupComposite);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java
index 7f9c2f1..6561291 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/operation/schedule/GroupOperationScheduleListView.java
@@ -20,6 +20,7 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.operation.schedule;
import com.smartgwt.client.widgets.Canvas;
+
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.schedule.AbstractOperationScheduleListView;
@@ -45,9 +46,8 @@ public class GroupOperationScheduleListView extends AbstractOperationScheduleLis
}
@Override
- public Canvas getDetailsView(int scheduleId) {
- return new GroupOperationScheduleDetailsView(extendLocatorId("DetailsView"),
- this.groupComposite, scheduleId);
+ public Canvas getDetailsView(Integer scheduleId) {
+ return new GroupOperationScheduleDetailsView(extendLocatorId("DetailsView"), this.groupComposite, scheduleId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index c445d32..50fbc30 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -58,7 +58,7 @@ public class ConfigurationHistoryView extends AbstractConfigurationHistoryView<C
}
@Override
- public Canvas getDetailsView(int id) {
+ public Canvas getDetailsView(Integer id) {
ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView(this.getLocatorId());
return detailView;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java
index fdd6657..4fad987 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/inventory/PluginConfigurationHistoryView.java
@@ -60,7 +60,7 @@ public class PluginConfigurationHistoryView extends
}
@Override
- public Canvas getDetailsView(int id) {
+ public Canvas getDetailsView(Integer id) {
PluginConfigurationHistoryDetailView detailView = new PluginConfigurationHistoryDetailView(this.getLocatorId());
return detailView;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java
index 55a6f99..fe7b9ec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java
@@ -38,7 +38,7 @@ public class TraitsView extends AbstractMeasurementDataTraitListView {
}
@Override
- public Canvas getDetailsView(int definitionId) {
+ public Canvas getDetailsView(Integer definitionId) {
return new TraitsDetailView(extendLocatorId("Detail"), this.resourceId, definitionId);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java
index 3d64039..a222b73 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryListView.java
@@ -47,7 +47,7 @@ public class ResourceOperationHistoryListView extends OperationHistoryView {
}
@Override
- public Canvas getDetailsView(int id) {
+ public Canvas getDetailsView(Integer id) {
return new ResourceOperationHistoryDetailsView(this.extendLocatorId("DetailsView"));
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java
index 221390c..859747a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/schedule/ResourceOperationScheduleListView.java
@@ -46,9 +46,9 @@ public class ResourceOperationScheduleListView extends AbstractOperationSchedule
}
@Override
- public Canvas getDetailsView(int scheduleId) {
- return new ResourceOperationScheduleDetailsView(extendLocatorId("DetailsView"),
- this.resourceComposite, scheduleId);
+ public Canvas getDetailsView(Integer scheduleId) {
+ return new ResourceOperationScheduleDetailsView(extendLocatorId("DetailsView"), this.resourceComposite,
+ scheduleId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryView.java
index 70a5ff9..5461aa0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryView.java
@@ -23,13 +23,9 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.DSCallback;
import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.data.DSResponse;
-import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.Canvas;
@@ -191,7 +187,8 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
final List<Integer> successIds = new ArrayList<Integer>();
final List<Integer> failureIds = new ArrayList<Integer>();
for (ListGridRecord record : recordsToBeDeleted) {
- final ResourceOperationHistory operationHistoryToRemove = new OperationHistoryDataSource().copyValues(record);
+ final ResourceOperationHistory operationHistoryToRemove = new OperationHistoryDataSource()
+ .copyValues(record);
GWTServiceLookup.getOperationService().deleteOperationHistory(operationHistoryToRemove.getId(), force,
new AsyncCallback<Void>() {
public void onSuccess(Void result) {
@@ -202,7 +199,7 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
public void onFailure(Throwable caught) {
// TODO: i18n
CoreGUI.getErrorHandler().handleError("Failed to delete " + operationHistoryToRemove + ".",
- caught);
+ caught);
failureIds.add(operationHistoryToRemove.getId());
handleCompletion(successIds, failureIds, numberOfRecordsToBeDeleted);
}
@@ -214,10 +211,13 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
if ((successIds.size() + failureIds.size()) == numberOfRecordsToBeDeleted) {
// TODO: i18n
if (successIds.size() == numberOfRecordsToBeDeleted) {
- CoreGUI.getMessageCenter().notify(new Message("Deleted " + numberOfRecordsToBeDeleted + " operation history items."));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Deleted " + numberOfRecordsToBeDeleted + " operation history items."));
} else {
- CoreGUI.getMessageCenter().notify(new Message("Deleted " + successIds.size()
- + " operation history items, but failed to delete the items with the following IDs: " + failureIds));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Deleted " + successIds.size()
+ + " operation history items, but failed to delete the items with the following IDs: "
+ + failureIds));
}
refresh();
}
@@ -228,7 +228,7 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
}
@Override
- public Canvas getDetailsView(int id) {
+ public Canvas getDetailsView(Integer id) {
return new ResourceOperationHistoryDetailsView(extendLocatorId("Detail"));
}
@@ -237,5 +237,4 @@ public class OperationHistoryView extends TableSection<OperationHistoryDataSourc
return OperationHistoryDataSource.Field.OPERATION_NAME;
}
-
}
commit 66bcc38c099082f3077f7cf5f1b0429cb826f2d8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Jul 29 15:13:12 2011 -0400
rename TableSection to AbstractTableSection to prepare for refactoring of the TableSection hierarchy
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
new file mode 100644
index 0000000..df8a406
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/AbstractTableSection.java
@@ -0,0 +1,389 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program 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 General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.History;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.AnimationEffect;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.AnimationCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.DetailsView;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
+
+/**
+ * @author Greg Hinkle
+ * @author John Mazzitelli
+ */
+public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> implements BookmarkableView {
+
+ private VLayout detailsHolder;
+ private Canvas detailsView;
+ private String basePath;
+ private boolean escapeHtmlInDetailsLinkColumn;
+ private boolean initialDisplay;
+
+ protected TableSection(String locatorId, String tableTitle) {
+ super(locatorId, tableTitle);
+ }
+
+ protected TableSection(String locatorId, String tableTitle, Criteria criteria) {
+ super(locatorId, tableTitle, criteria);
+ }
+
+ protected TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers) {
+ super(locatorId, tableTitle, sortSpecifiers);
+ }
+
+ protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers) {
+ super(locatorId, tableTitle, sortSpecifiers, criteria);
+ }
+
+ protected TableSection(String locatorId, String tableTitle, boolean autoFetchData) {
+ super(locatorId, tableTitle, autoFetchData);
+ }
+
+ protected TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames) {
+ super(locatorId, tableTitle, null, sortSpecifiers, excludedFieldNames);
+ }
+
+ protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames) {
+ super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames);
+ }
+
+ protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames, boolean autoFetchData) {
+ super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ this.initialDisplay = true;
+
+ detailsHolder = new LocatableVLayout(extendLocatorId("tableSection"));
+ detailsHolder.setAlign(VerticalAlignment.TOP);
+ //detailsHolder.setWidth100();
+ //detailsHolder.setHeight100();
+ detailsHolder.setMargin(4);
+ detailsHolder.hide();
+
+ addMember(detailsHolder);
+
+ // if the detailsView is already defined it means we want the details view to be rendered prior to
+ // the master view, probably due to a direct navigation or refresh (like F5 when sitting on the details page)
+ if (null != detailsView) {
+ switchToDetailsView();
+ }
+ }
+
+ /**
+ * The default implementation wraps the {@link #getDetailsLinkColumnCellFormatter()} column with the
+ * {@link #getDetailsLinkColumnCellFormatter()}. This is typically the 'name' column linking to the detail
+ * view, given the 'id'. Also, establishes a double click handler for the row which invokes
+ * {@link #showDetails(com.smartgwt.client.widgets.grid.ListGridRecord)}</br>
+ * </br>
+ * In general, in overrides, call super.configureTable *after* manipulating the ListGrid fields.
+ *
+ * @see org.rhq.enterprise.gui.coregui.client.components.table.Table#configureTable()
+ */
+ @Override
+ protected void configureTable() {
+ if (isDetailsEnabled()) {
+ ListGrid grid = getListGrid();
+
+ // Make the value of some specific field a link to the details view for the corresponding record.
+ ListGridField field = (grid != null) ? grid.getField(getDetailsLinkColumnName()) : null;
+ if (field != null) {
+ field.setCellFormatter(getDetailsLinkColumnCellFormatter());
+ }
+
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ showDetails(selectedRows[0]);
+ }
+ }
+ });
+ }
+ }
+
+ protected boolean isDetailsEnabled() {
+ return true;
+ }
+
+ public void setEscapeHtmlInDetailsLinkColumn(boolean escapeHtmlInDetailsLinkColumn) {
+ this.escapeHtmlInDetailsLinkColumn = escapeHtmlInDetailsLinkColumn;
+ }
+
+ /**
+ * Override if you don't want FIELD_NAME to be wrapped ina link.
+ * @return the name of the field to be wrapped, or null if no field should be wrapped.
+ */
+ protected String getDetailsLinkColumnName() {
+ return FIELD_NAME;
+ }
+
+ /**
+ * Override if you don't want the detailsLinkColumn to have the default link wrapper.
+ * @return the desired CellFormatter.
+ */
+ protected CellFormatter getDetailsLinkColumnCellFormatter() {
+ return new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int i, int i1) {
+ if (value == null) {
+ return "";
+ }
+ Integer recordId = getId(record);
+ String detailsUrl = "#" + getBasePath() + "/" + recordId;
+ String formattedValue = (escapeHtmlInDetailsLinkColumn) ? StringUtility.escapeHtml(value.toString())
+ : value.toString();
+ return SeleniumUtility.getLocatableHref(detailsUrl, formattedValue, null);
+ }
+ };
+ }
+
+ /**
+ * Shows the details view for the given record of the table.
+ *
+ * The default implementation of this method assumes there is an
+ * id attribute on the record and passes it to {@link #showDetails(int)}.
+ * Subclasses are free to override this behavior. Subclasses usually
+ * will need to set the {@link #setDetailsView(Canvas) details view}
+ * explicitly.
+ *
+ * @param record the record whose details are to be shown
+ */
+ public void showDetails(ListGridRecord record) {
+ if (record == null) {
+ throw new IllegalArgumentException("'record' parameter is null.");
+ }
+
+ Integer id = getId(record);
+ showDetails(id);
+ }
+
+ /**
+ * Returns the details canvas with information on the item given its list grid record.
+ *
+ * The default implementation of this method is to assume there is an
+ * id attribute on the record and pass that ID to {@link #getDetailsView(int)}.
+ * Subclasses are free to override this - which you usually want to do
+ * if you know the full details of the item are stored in the record attributes
+ * and thus help avoid making a round trip to the DB.
+ *
+ * @param record the record of the item whose details to be shown; ; null if empty details view should be shown.
+ */
+ public Canvas getDetailsView(ListGridRecord record) {
+ Integer id = getId(record);
+ return getDetailsView(id);
+ }
+
+ protected Integer getId(ListGridRecord record) {
+ Integer id = (record != null) ? record.getAttributeAsInt("id") : 0;
+ if (id == null) {
+ String msg = MSG.view_tableSection_error_noId(this.getClass().toString());
+ CoreGUI.getErrorHandler().handleError(msg);
+ throw new IllegalStateException(msg);
+ }
+ return id;
+ }
+
+ /**
+ * Shows empty details for a new item being created.
+ * This method is usually called when a user clicks a 'New' button.
+ *
+ * @see #showDetails(ListGridRecord)
+ */
+ public void newDetails() {
+ History.newItem(basePath + "/0");
+ }
+
+ /**
+ * Shows the details for an item has the given ID.
+ * This method is usually called when a user goes to the details
+ * page via a bookmark, double-cick on a list view row, or direct link.
+ *
+ * @param id the id of the row whose details are to be shown; Should be a valid id, > 0.
+ *
+ * @see #showDetails(ListGridRecord)
+ *
+ * @throws IllegalArgumentException if id <= 0.
+ */
+ public void showDetails(int id) {
+ if (id > 0) {
+ History.newItem(basePath + "/" + id);
+ } else {
+ String msg = MSG.view_tableSection_error_badId(this.getClass().toString(), Integer.toString(id));
+ CoreGUI.getErrorHandler().handleError(msg);
+ throw new IllegalArgumentException(msg);
+ }
+ }
+
+ /**
+ * Returns the details canvas with information on the item that has the given ID.
+ * Note that an empty details view should be returned if the id passed in is 0 (as would
+ * be the case if a new item is to be created using the details view).
+ *
+ * @param id the id of the details to be shown; will be 0 if an empty details view should be shown.
+ */
+ public abstract Canvas getDetailsView(int id);
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ this.basePath = viewPath.getPathToCurrent();
+
+ if (!viewPath.isEnd()) {
+ int id = Integer.parseInt(viewPath.getCurrent().getPath());
+ this.detailsView = getDetailsView(id);
+ if (this.detailsView instanceof BookmarkableView) {
+ ((BookmarkableView) this.detailsView).renderView(viewPath);
+ }
+
+ switchToDetailsView();
+ } else {
+ switchToTableView();
+ }
+ }
+
+ protected String getBasePath() {
+ return this.basePath;
+ }
+
+ /**
+ * For use by subclasses that want to define their own details view.
+ *
+ * @param detailsView the new details view
+ */
+ protected void setDetailsView(Canvas detailsView) {
+ this.detailsView = detailsView;
+ }
+
+ /**
+ * Switches to viewing the details canvas, hiding the table. This does not
+ * do anything with reloading data or switching to the selected row in the table;
+ * this only changes the visibility of canvases.
+ */
+ protected void switchToDetailsView() {
+ Canvas contents = getTableContents();
+
+ // If the Table has not yet been initialized then ignore
+ if (contents != null) {
+ if (contents.isVisible()) {
+ contents.animateHide(AnimationEffect.WIPE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ buildDetailsView();
+ }
+ });
+ } else {
+ /*
+ * if the programmer chooses to go directly from the detailView in create-mode to the
+ * detailsView in edit-mode, the content canvas will already be hidden, which means the
+ * animateHide would be a no-op (the event won't fire). this causes the detailsHolder
+ * to keep a reference to the previous detailsView (the one in create-mode) instead of the
+ * newly returned reference from getDetailsView(int) that was called when the renderView
+ * methods were called hierarchically down to render the new detailsView in edit-mode.
+ * therefore, we need to explicitly destroy what's already there (presumably the detailsView
+ * in create-mode), and then rebuild it (presumably the detailsView in edit-mode).
+ */
+ SeleniumUtility.destroyMembers(detailsHolder);
+
+ buildDetailsView();
+ }
+ }
+ }
+
+ private void buildDetailsView() {
+ detailsView.setWidth100();
+ detailsView.setHeight100();
+
+ boolean isEditable = (detailsView instanceof DetailsView && ((DetailsView) detailsView).isEditable());
+ if (!isEditable) {
+ // Only add the "Back to List" button if the details are definitely not editable, because if they are
+ // editable, a Cancel button should already be provided by the details view.
+ BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
+ basePath);
+ detailsHolder.addMember(backButton);
+ VLayout verticalSpacer = new LocatableVLayout(extendLocatorId("verticalSpacer"));
+ verticalSpacer.setHeight(8);
+ detailsHolder.addMember(verticalSpacer);
+ }
+
+ detailsHolder.addMember(detailsView);
+ detailsHolder.animateShow(AnimationEffect.WIPE);
+ }
+
+ /**
+ * Switches to viewing the table, hiding the details canvas.
+ */
+ protected void switchToTableView() {
+ final Canvas contents = getTableContents();
+ if (contents != null) {
+ // If this is not the initial display of the table, refresh the table's data. Otherwise, a refresh would be
+ // redundant, since the data was just loaded when the table was drawn.
+ if (this.initialDisplay) {
+ this.initialDisplay = false;
+ } else {
+ Log.debug("Refreshing data for Table [" + getClass().getName() + "]...");
+ refresh();
+ }
+ if (detailsHolder != null && detailsHolder.isVisible()) {
+ detailsHolder.animateHide(AnimationEffect.WIPE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ SeleniumUtility.destroyMembers(detailsHolder);
+
+ contents.animateShow(AnimationEffect.WIPE);
+ }
+ });
+ } else {
+ contents.animateShow(AnimationEffect.WIPE);
+ }
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
deleted file mode 100644
index df8a406..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program 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 General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.components.table;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.user.client.History;
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.SortSpecifier;
-import com.smartgwt.client.types.AnimationEffect;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.AnimationCallback;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.events.DoubleClickEvent;
-import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.DetailsView;
-import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
-
-/**
- * @author Greg Hinkle
- * @author John Mazzitelli
- */
-public abstract class TableSection<DS extends RPCDataSource> extends Table<DS> implements BookmarkableView {
-
- private VLayout detailsHolder;
- private Canvas detailsView;
- private String basePath;
- private boolean escapeHtmlInDetailsLinkColumn;
- private boolean initialDisplay;
-
- protected TableSection(String locatorId, String tableTitle) {
- super(locatorId, tableTitle);
- }
-
- protected TableSection(String locatorId, String tableTitle, Criteria criteria) {
- super(locatorId, tableTitle, criteria);
- }
-
- protected TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers) {
- super(locatorId, tableTitle, sortSpecifiers);
- }
-
- protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers) {
- super(locatorId, tableTitle, sortSpecifiers, criteria);
- }
-
- protected TableSection(String locatorId, String tableTitle, boolean autoFetchData) {
- super(locatorId, tableTitle, autoFetchData);
- }
-
- protected TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers,
- String[] excludedFieldNames) {
- super(locatorId, tableTitle, null, sortSpecifiers, excludedFieldNames);
- }
-
- protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
- String[] excludedFieldNames) {
- super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames);
- }
-
- protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
- String[] excludedFieldNames, boolean autoFetchData) {
- super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- this.initialDisplay = true;
-
- detailsHolder = new LocatableVLayout(extendLocatorId("tableSection"));
- detailsHolder.setAlign(VerticalAlignment.TOP);
- //detailsHolder.setWidth100();
- //detailsHolder.setHeight100();
- detailsHolder.setMargin(4);
- detailsHolder.hide();
-
- addMember(detailsHolder);
-
- // if the detailsView is already defined it means we want the details view to be rendered prior to
- // the master view, probably due to a direct navigation or refresh (like F5 when sitting on the details page)
- if (null != detailsView) {
- switchToDetailsView();
- }
- }
-
- /**
- * The default implementation wraps the {@link #getDetailsLinkColumnCellFormatter()} column with the
- * {@link #getDetailsLinkColumnCellFormatter()}. This is typically the 'name' column linking to the detail
- * view, given the 'id'. Also, establishes a double click handler for the row which invokes
- * {@link #showDetails(com.smartgwt.client.widgets.grid.ListGridRecord)}</br>
- * </br>
- * In general, in overrides, call super.configureTable *after* manipulating the ListGrid fields.
- *
- * @see org.rhq.enterprise.gui.coregui.client.components.table.Table#configureTable()
- */
- @Override
- protected void configureTable() {
- if (isDetailsEnabled()) {
- ListGrid grid = getListGrid();
-
- // Make the value of some specific field a link to the details view for the corresponding record.
- ListGridField field = (grid != null) ? grid.getField(getDetailsLinkColumnName()) : null;
- if (field != null) {
- field.setCellFormatter(getDetailsLinkColumnCellFormatter());
- }
-
- setListGridDoubleClickHandler(new DoubleClickHandler() {
- @Override
- public void onDoubleClick(DoubleClickEvent event) {
- ListGrid listGrid = (ListGrid) event.getSource();
- ListGridRecord[] selectedRows = listGrid.getSelection();
- if (selectedRows != null && selectedRows.length == 1) {
- showDetails(selectedRows[0]);
- }
- }
- });
- }
- }
-
- protected boolean isDetailsEnabled() {
- return true;
- }
-
- public void setEscapeHtmlInDetailsLinkColumn(boolean escapeHtmlInDetailsLinkColumn) {
- this.escapeHtmlInDetailsLinkColumn = escapeHtmlInDetailsLinkColumn;
- }
-
- /**
- * Override if you don't want FIELD_NAME to be wrapped ina link.
- * @return the name of the field to be wrapped, or null if no field should be wrapped.
- */
- protected String getDetailsLinkColumnName() {
- return FIELD_NAME;
- }
-
- /**
- * Override if you don't want the detailsLinkColumn to have the default link wrapper.
- * @return the desired CellFormatter.
- */
- protected CellFormatter getDetailsLinkColumnCellFormatter() {
- return new CellFormatter() {
- public String format(Object value, ListGridRecord record, int i, int i1) {
- if (value == null) {
- return "";
- }
- Integer recordId = getId(record);
- String detailsUrl = "#" + getBasePath() + "/" + recordId;
- String formattedValue = (escapeHtmlInDetailsLinkColumn) ? StringUtility.escapeHtml(value.toString())
- : value.toString();
- return SeleniumUtility.getLocatableHref(detailsUrl, formattedValue, null);
- }
- };
- }
-
- /**
- * Shows the details view for the given record of the table.
- *
- * The default implementation of this method assumes there is an
- * id attribute on the record and passes it to {@link #showDetails(int)}.
- * Subclasses are free to override this behavior. Subclasses usually
- * will need to set the {@link #setDetailsView(Canvas) details view}
- * explicitly.
- *
- * @param record the record whose details are to be shown
- */
- public void showDetails(ListGridRecord record) {
- if (record == null) {
- throw new IllegalArgumentException("'record' parameter is null.");
- }
-
- Integer id = getId(record);
- showDetails(id);
- }
-
- /**
- * Returns the details canvas with information on the item given its list grid record.
- *
- * The default implementation of this method is to assume there is an
- * id attribute on the record and pass that ID to {@link #getDetailsView(int)}.
- * Subclasses are free to override this - which you usually want to do
- * if you know the full details of the item are stored in the record attributes
- * and thus help avoid making a round trip to the DB.
- *
- * @param record the record of the item whose details to be shown; ; null if empty details view should be shown.
- */
- public Canvas getDetailsView(ListGridRecord record) {
- Integer id = getId(record);
- return getDetailsView(id);
- }
-
- protected Integer getId(ListGridRecord record) {
- Integer id = (record != null) ? record.getAttributeAsInt("id") : 0;
- if (id == null) {
- String msg = MSG.view_tableSection_error_noId(this.getClass().toString());
- CoreGUI.getErrorHandler().handleError(msg);
- throw new IllegalStateException(msg);
- }
- return id;
- }
-
- /**
- * Shows empty details for a new item being created.
- * This method is usually called when a user clicks a 'New' button.
- *
- * @see #showDetails(ListGridRecord)
- */
- public void newDetails() {
- History.newItem(basePath + "/0");
- }
-
- /**
- * Shows the details for an item has the given ID.
- * This method is usually called when a user goes to the details
- * page via a bookmark, double-cick on a list view row, or direct link.
- *
- * @param id the id of the row whose details are to be shown; Should be a valid id, > 0.
- *
- * @see #showDetails(ListGridRecord)
- *
- * @throws IllegalArgumentException if id <= 0.
- */
- public void showDetails(int id) {
- if (id > 0) {
- History.newItem(basePath + "/" + id);
- } else {
- String msg = MSG.view_tableSection_error_badId(this.getClass().toString(), Integer.toString(id));
- CoreGUI.getErrorHandler().handleError(msg);
- throw new IllegalArgumentException(msg);
- }
- }
-
- /**
- * Returns the details canvas with information on the item that has the given ID.
- * Note that an empty details view should be returned if the id passed in is 0 (as would
- * be the case if a new item is to be created using the details view).
- *
- * @param id the id of the details to be shown; will be 0 if an empty details view should be shown.
- */
- public abstract Canvas getDetailsView(int id);
-
- @Override
- public void renderView(ViewPath viewPath) {
- this.basePath = viewPath.getPathToCurrent();
-
- if (!viewPath.isEnd()) {
- int id = Integer.parseInt(viewPath.getCurrent().getPath());
- this.detailsView = getDetailsView(id);
- if (this.detailsView instanceof BookmarkableView) {
- ((BookmarkableView) this.detailsView).renderView(viewPath);
- }
-
- switchToDetailsView();
- } else {
- switchToTableView();
- }
- }
-
- protected String getBasePath() {
- return this.basePath;
- }
-
- /**
- * For use by subclasses that want to define their own details view.
- *
- * @param detailsView the new details view
- */
- protected void setDetailsView(Canvas detailsView) {
- this.detailsView = detailsView;
- }
-
- /**
- * Switches to viewing the details canvas, hiding the table. This does not
- * do anything with reloading data or switching to the selected row in the table;
- * this only changes the visibility of canvases.
- */
- protected void switchToDetailsView() {
- Canvas contents = getTableContents();
-
- // If the Table has not yet been initialized then ignore
- if (contents != null) {
- if (contents.isVisible()) {
- contents.animateHide(AnimationEffect.WIPE, new AnimationCallback() {
- @Override
- public void execute(boolean b) {
- buildDetailsView();
- }
- });
- } else {
- /*
- * if the programmer chooses to go directly from the detailView in create-mode to the
- * detailsView in edit-mode, the content canvas will already be hidden, which means the
- * animateHide would be a no-op (the event won't fire). this causes the detailsHolder
- * to keep a reference to the previous detailsView (the one in create-mode) instead of the
- * newly returned reference from getDetailsView(int) that was called when the renderView
- * methods were called hierarchically down to render the new detailsView in edit-mode.
- * therefore, we need to explicitly destroy what's already there (presumably the detailsView
- * in create-mode), and then rebuild it (presumably the detailsView in edit-mode).
- */
- SeleniumUtility.destroyMembers(detailsHolder);
-
- buildDetailsView();
- }
- }
- }
-
- private void buildDetailsView() {
- detailsView.setWidth100();
- detailsView.setHeight100();
-
- boolean isEditable = (detailsView instanceof DetailsView && ((DetailsView) detailsView).isEditable());
- if (!isEditable) {
- // Only add the "Back to List" button if the details are definitely not editable, because if they are
- // editable, a Cancel button should already be provided by the details view.
- BackButton backButton = new BackButton(extendLocatorId("BackButton"), MSG.view_tableSection_backButton(),
- basePath);
- detailsHolder.addMember(backButton);
- VLayout verticalSpacer = new LocatableVLayout(extendLocatorId("verticalSpacer"));
- verticalSpacer.setHeight(8);
- detailsHolder.addMember(verticalSpacer);
- }
-
- detailsHolder.addMember(detailsView);
- detailsHolder.animateShow(AnimationEffect.WIPE);
- }
-
- /**
- * Switches to viewing the table, hiding the details canvas.
- */
- protected void switchToTableView() {
- final Canvas contents = getTableContents();
- if (contents != null) {
- // If this is not the initial display of the table, refresh the table's data. Otherwise, a refresh would be
- // redundant, since the data was just loaded when the table was drawn.
- if (this.initialDisplay) {
- this.initialDisplay = false;
- } else {
- Log.debug("Refreshing data for Table [" + getClass().getName() + "]...");
- refresh();
- }
- if (detailsHolder != null && detailsHolder.isVisible()) {
- detailsHolder.animateHide(AnimationEffect.WIPE, new AnimationCallback() {
- @Override
- public void execute(boolean b) {
- SeleniumUtility.destroyMembers(detailsHolder);
-
- contents.animateShow(AnimationEffect.WIPE);
- }
- });
- } else {
- contents.animateShow(AnimationEffect.WIPE);
- }
- }
- }
-
-}