modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java | 7 modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java | 43 ++--- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 46 ++--- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java | 10 - modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java | 76 ++++----- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java | 17 +- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java | 28 +-- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 52 +++--- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java | 4 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java | 5 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 7 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java | 6 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java | 9 + modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java | 4 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java | 18 +- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java | 16 + modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewName.java | 38 ++++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java | 82 +++++----- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 5 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 27 +-- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java | 17 -- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 17 +- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 70 ++++---- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java | 6 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java | 9 - modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java | 32 +-- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableCanvas.java | 34 ++++ modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 10 - 35 files changed, 418 insertions(+), 296 deletions(-)
New commits: commit 1957616d40a17eccb9221463720c876eaea8c4ab Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Nov 17 22:52:54 2010 -0500
I18N work - Refactor of VIEW_ID from string to ViewName to allow separation between the name, used in view paths, and the title, used for display in the section trees. Previously the name was used everywhere, with deCamelCase logic for display.
Also, packages: org.rhq.core.client org.rhq.core.domain.measurement org.rhq.core.rebind org.rhq.enterprise.gui.coregui.client org.rhq.enterprise.gui.coregui.client.admin
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java index f084ec0..64eea4a 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/domain/measurement/MeasurementConverterClient.java @@ -29,10 +29,14 @@ import com.google.gwt.i18n.client.NumberFormat;
import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits; import org.rhq.core.domain.measurement.util.MeasurementConversionException; +import org.rhq.enterprise.gui.coregui.client.CoreGUI; +import org.rhq.enterprise.gui.coregui.client.Messages;
public class MeasurementConverterClient { + private static final Messages MSG = CoreGUI.getMessages(); + private static final int MAX_PRECISION_DIGITS = 4; - private static final String NULL_OR_NAN_FORMATTED_VALUE = "--no data available--"; + private static final String NULL_OR_NAN_FORMATTED_VALUE = MSG.view_measure_nan();
private static NumberFormat getDefaultNumberFormat() { NumberFormat nf = NumberFormat.getFormat("0.0"); @@ -122,7 +126,6 @@ public class MeasurementConverterClient { targetUnits = fittedUnits; }
- @SuppressWarnings("unused") Set<String> existingStrings; // technically this *is* unused because int precisionDigits = 0; boolean scaleWithMorePrecision = true; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java index 1196b78..940b7de 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java @@ -18,6 +18,10 @@ */ package org.rhq.core.rebind;
+import java.io.PrintWriter; + +import javax.persistence.Entity; + import com.google.gwt.core.ext.Generator; import com.google.gwt.core.ext.GeneratorContext; import com.google.gwt.core.ext.TreeLogger; @@ -29,10 +33,6 @@ import com.google.gwt.core.ext.typeinfo.TypeOracle; import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; import com.google.gwt.user.rebind.SourceWriter;
-import javax.persistence.Entity; - -import java.io.PrintWriter; - /** * This is the start to a rebinder for our domain entities to allow for the * easy generation of Smart's Record objects. @@ -57,7 +57,8 @@ public class RecordBuilderGenerator extends Generator { * Create a new type that satisfies the rebind request. */ @Override - public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException { + public String generate(TreeLogger logger, GeneratorContext context, String typeName) + throws UnableToCompleteException {
System.out.println("classType " + typeName);
@@ -83,11 +84,8 @@ public class RecordBuilderGenerator extends Generator { return typeOracle; }
- @SuppressWarnings("unused") protected void writeSource() throws UnableToCompleteException {
- - JField[] fields = requestedClass.getFields();
writeBuildRecordMethod(fields, sourceWriter); @@ -100,24 +98,22 @@ public class RecordBuilderGenerator extends Generator { return "__" + baseClass.getSimpleSourceName() + "_RecordBuilder"; }
- private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext ctx, - String packageName, String className, String superclassName) { + private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext ctx, String packageName, String className, + String superclassName) {
PrintWriter printWriter = ctx.tryCreate(logger, packageName, className); if (printWriter == null) { return null; }
- ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory( - packageName, className); + ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className);
composerFactory.setSuperclass(superclassName);
return composerFactory.createSourceWriter(ctx, printWriter); }
- private boolean init(TreeLogger logger, GeneratorContext context, - String typeName) throws UnableToCompleteException { + private boolean init(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException { this.logger = logger; typeOracle = context.getTypeOracle(); assert typeOracle != null; @@ -125,12 +121,8 @@ public class RecordBuilderGenerator extends Generator { try { requestedClass = typeOracle.getType(typeName); } catch (NotFoundException e) { - logger.log( - TreeLogger.ERROR, - "Could not find type '" - + typeName - + "'; please see the log, as this usually indicates a previous error ", - e); + logger.log(TreeLogger.ERROR, "Could not find type '" + typeName + + "'; please see the log, as this usually indicates a previous error ", e); throw new UnableToCompleteException(); }
@@ -139,7 +131,7 @@ public class RecordBuilderGenerator extends Generator { return false; }
- System.out.println("$$$$$$$$Making a record builder for: "+ typeName); + System.out.println("$$$$$$$$Making a record builder for: " + typeName);
// Get the stub class name, and see if its source file exists. // @@ -147,20 +139,21 @@ public class RecordBuilderGenerator extends Generator { packageName = requestedClass.getPackage().getName(); qualifiedStubClassName = packageName + "." + simpleStubClassName;
- sourceWriter = getSourceWriter(logger, context, packageName, - simpleStubClassName, requestedClass.getQualifiedSourceName()); + sourceWriter = getSourceWriter(logger, context, packageName, simpleStubClassName, requestedClass + .getQualifiedSourceName());
return sourceWriter != null; }
private void writeBuildRecordMethod(JField[] fields, SourceWriter sw) { sw.println(); - sw.println("protected final com.smartgwt.client.data.Record buildRecord(" + requestedClass.getQualifiedSourceName() + " entity) throws Throwable {"); + sw.println("protected final com.smartgwt.client.data.Record buildRecord(" + + requestedClass.getQualifiedSourceName() + " entity) throws Throwable {"); sw.indent();
sw.println("com.smartgwt.client.data.Record record = new com.smartgwt.client.data.Record();");
- for (JField field :fields) { + for (JField field : fields) { sw.println("record.setAttribute("" + field.getName() + "", " + field.getName() + ");"); } sw.println("return record;"); 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 dae9e37..6b56f11 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 @@ -41,9 +41,9 @@ import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView; import org.rhq.enterprise.gui.coregui.client.alert.AlertHistoryView; import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView; import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView; +import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView; import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView; import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupTopView; -import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView; import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTopView; import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView; import org.rhq.enterprise.gui.coregui.client.report.ReportTopView; @@ -63,7 +63,9 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility; * @author Ian Springer */ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> { - private static final String DEFAULT_VIEW_PATH = DashboardsView.VIEW_ID; + private static final Messages MSG = CoreGUI.getMessages(); + + private static final String DEFAULT_VIEW_PATH = DashboardsView.VIEW_ID.getName();
// just to avoid constructing this over and over private static final String TREE_NAV_VIEW_PATTERN = "(" + ResourceTopView.VIEW_ID + "|" @@ -120,7 +122,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { public void onUncaughtException(Throwable e) { - getErrorHandler().handleError("Globally uncaught exception", e); + getErrorHandler().handleError(MSG.view_core_uncaught(), e); } });
@@ -191,31 +193,31 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> { public Canvas createContent(String breadcrumbName) { Canvas canvas;
- if (breadcrumbName.equals(AdministrationView.VIEW_ID)) { + if (breadcrumbName.equals(AdministrationView.VIEW_ID.getName())) { canvas = new AdministrationView(); - } else if (breadcrumbName.equals(InventoryView.VIEW_ID)) { + } else if (breadcrumbName.equals(InventoryView.VIEW_ID.getName())) { canvas = new InventoryView(); - } else if (breadcrumbName.equals(ResourceTopView.VIEW_ID)) { - canvas = new ResourceTopView("Resource"); - } else if (breadcrumbName.equals(ResourceGroupTopView.VIEW_ID)) { - canvas = new ResourceGroupTopView("Group"); - } else if (breadcrumbName.equals(DashboardsView.VIEW_ID)) { - canvas = new DashboardsView("Dashboard"); - } else if (breadcrumbName.equals(BundleTopView.VIEW_ID)) { - canvas = new BundleTopView("Bundle"); + } else if (breadcrumbName.equals(ResourceTopView.VIEW_ID.getName())) { + canvas = new ResourceTopView(breadcrumbName); + } else if (breadcrumbName.equals(ResourceGroupTopView.VIEW_ID.getName())) { + canvas = new ResourceGroupTopView(breadcrumbName); + } else if (breadcrumbName.equals(DashboardsView.VIEW_ID.getName())) { + canvas = new DashboardsView(breadcrumbName); + } else if (breadcrumbName.equals(BundleTopView.VIEW_ID.getName())) { + canvas = new BundleTopView(breadcrumbName); } else if (breadcrumbName.equals("LogOut")) { // TODO: don't make LogOut a history event, just perform the logout action by responding to click event - LoginView logoutView = new LoginView(); + LoginView logoutView = new LoginView("Login"); canvas = logoutView; UserSessionManager.logout(); logoutView.showLoginDialog(); - } else if (breadcrumbName.equals(TaggedView.VIEW_ID)) { - canvas = new TaggedView("Tag"); + } else if (breadcrumbName.equals(TaggedView.VIEW_ID.getName())) { + canvas = new TaggedView(breadcrumbName); } else if (breadcrumbName.equals("Subsystems")) { canvas = new AlertHistoryView("Alert"); - } else if (breadcrumbName.equals(ReportTopView.VIEW_ID)) { + } else if (breadcrumbName.equals(ReportTopView.VIEW_ID.getName())) { canvas = new ReportTopView(); - } else if (breadcrumbName.equals(TestTopView.VIEW_ID)) { + } else if (breadcrumbName.equals(TestTopView.VIEW_ID.getName())) { canvas = new TestTopView(); } else { canvas = null; @@ -329,12 +331,12 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
if (this.currentCanvas instanceof BookmarkableView) { if (this.currentCanvas instanceof InitializableView) { - final InitializableView initializableView = (InitializableView)this.currentCanvas; + final InitializableView initializableView = (InitializableView) this.currentCanvas; final long startTime = System.currentTimeMillis(); final Timer timer = new Timer() { public void run() { if (initializableView.isInitialized()) { - ((BookmarkableView)currentCanvas).renderView(viewPath.next()); + ((BookmarkableView) currentCanvas).renderView(viewPath.next()); } else { long elapsedMillis = System.currentTimeMillis() - startTime; if (elapsedMillis < 5000) { @@ -345,12 +347,12 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> { } }; if (initializableView.isInitialized()) { - ((BookmarkableView)currentCanvas).renderView(viewPath.next()); + ((BookmarkableView) currentCanvas).renderView(viewPath.next()); } else { timer.schedule(100); } } else { - ((BookmarkableView)currentCanvas).renderView(viewPath.next()); + ((BookmarkableView) currentCanvas).renderView(viewPath.next()); } }
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java index 87520b7..1c9e15b 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java @@ -119,11 +119,11 @@ public class Footer extends LocatableToolStrip { }
public void refreshLoggedIn() { - setContents("Logged in as " + UserSessionManager.getSessionSubject().getName()); + setContents(MSG.view_core_loggedInAs(UserSessionManager.getSessionSubject().getName())); }
public void refreshLoggedOut() { - setContents("Logged out"); + setContents(MSG.view_core_loggedOut()); } }
@@ -158,15 +158,15 @@ public class Footer extends LocatableToolStrip { GWTServiceLookup.getAlertService().findAlertsByCriteria(alertCriteria, new AsyncCallback<PageList<Alert>>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Latest alerts lookup failed", caught); + CoreGUI.getErrorHandler().handleError(MSG.view_core_error_1(), caught); }
public void onSuccess(PageList<Alert> result) { if (result.isEmpty()) { - setContents("no recent alerts"); + setContents(MSG.view_core_recentAlerts("0")); setIcon("subsystems/alert/Alert_LOW_16.png"); } else { - setContents(result.getTotalSize() + " recent alerts"); + setContents(MSG.view_core_recentAlerts(Integer.toString(result.getTotalSize()))); setIcon("subsystems/alert/Alert_HIGH_16.png"); } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java index 841d8e0..ae10b19 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java @@ -35,7 +35,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.FormErrorOrientation; import com.smartgwt.client.types.VerticalAlignment; -import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.HTMLFlow; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Img; @@ -68,12 +67,15 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository; import org.rhq.enterprise.gui.coregui.client.util.BrowserUtility; import org.rhq.enterprise.gui.coregui.client.util.message.Message; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableCanvas; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm; +import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
/** * @author Greg Hinkle * @author Joseph Marques */ -public class LoginView extends Canvas { +public class LoginView extends LocatableCanvas {
private static boolean loginShowing = false;
@@ -83,7 +85,8 @@ public class LoginView extends Canvas { private SubmitItem loginButton; private ValuesManager valuesManager = new ValuesManager();
- public LoginView() { + public LoginView(String locatorId) { + super(locatorId); }
//registration fields @@ -111,7 +114,7 @@ public class LoginView extends Canvas { loginShowing = true; UserSessionManager.logout();
- form = new DynamicForm(); + form = new LocatableDynamicForm("LoginView"); form.setMargin(25); form.setAutoFocus(true); form.setShowErrorText(true); @@ -122,17 +125,17 @@ public class LoginView extends Canvas { logo.setShowTitle(false);
HeaderItem header = new HeaderItem(); - header.setValue("Please Login"); + header.setValue(MSG.view_login_prompt());
- TextItem user = new TextItem("user", "User"); + TextItem user = new TextItem("user", MSG.common_title_user()); user.setRequired(true); user.setAttribute("autoComplete", "native");
- final PasswordItem password = new PasswordItem("password", "Password"); + final PasswordItem password = new PasswordItem("password", MSG.dataSource_users_field_password()); password.setRequired(true); password.setAttribute("autoComplete", "native");
- loginButton = new SubmitItem("login", "Login"); + loginButton = new SubmitItem("login", MSG.view_login_login()); loginButton.setAlign(Alignment.CENTER); loginButton.setColSpan(2);
@@ -201,35 +204,33 @@ public class LoginView extends Canvas {
VLayout column = new VLayout(); HeaderItem header = new HeaderItem(); - header - .setValue("Welcome to JBoss ON! <br/><br/> Enter/update the following fields to complete your registration process." - + "<br/> Once you click "OK" you will be logged in.<br/><br/>"); + header.setValue(MSG.view_login_welcome()); //build ui elements for registration screen - first = new TextItem(FIRST, "First Name"); + first = new TextItem(FIRST, MSG.dataSource_users_field_firstName()); { first.setRequired(true); first.setWrapTitle(false); first.setWidth(fieldWidth); } - last = new TextItem(LAST, "Last Name"); + last = new TextItem(LAST, MSG.dataSource_users_field_lastName()); { last.setWrapTitle(false); last.setWidth(fieldWidth); last.setRequired(true); } - final TextItem username = new TextItem(USERNAME, "Username"); + final TextItem username = new TextItem(USERNAME, MSG.dataSource_users_field_name()); { username.setValue(user);
username.setDisabled(true); username.setWidth(fieldWidth); } - email = new TextItem(EMAIL, "Email"); + email = new TextItem(EMAIL, MSG.dataSource_users_field_emailAddress()); email.setRequired(true); email.setWidth(fieldWidth); - phone = new TextItem(PHONE, "Phone"); + phone = new TextItem(PHONE, MSG.dataSource_users_field_phoneNumber()); phone.setWidth(fieldWidth); - department = new TextItem(DEPARTMENT, "Department"); + department = new TextItem(DEPARTMENT, MSG.dataSource_users_field_department()); department.setWidth(fieldWidth); SpacerItem space = new SpacerItem(); space.setColSpan(1); @@ -256,7 +257,7 @@ public class LoginView extends Canvas { .trim().isEmpty())); //check for session timeout if (UserSessionManager.isLoggedOut() || (credentialsEmpty)) { - resetLogin(); + resetLogin(LoginView.this.extendLocatorId("Register")); return; }
@@ -272,7 +273,7 @@ public class LoginView extends Canvas { form.setValue(DEPARTMENT, String.valueOf(department.getValue())); form.setValue(SESSIONID, sessionId); form.setValue(PASSWORD, password); - registerLdapUser(form, callback); + registerLdapUser(LoginView.this.extendLocatorId("RegisterLdap"), form, callback); } }
@@ -307,20 +308,20 @@ public class LoginView extends Canvas { }
public void onFailure(Throwable caught) { - form.setFieldErrors(FIRST, - "Note: Optional retrieval of ldap details unsuccessful. Manual entry required.", true); - Log.debug("Optional LDAP detail retrieval did not succeed. Registration prepopulation will not occur."); + form.setFieldErrors(FIRST, MSG.view_login_noLdap(), true); + Log + .debug("Optional LDAP detail retrieval did not succeed. Registration prepopulation will not occur."); } });
- IButton resetButton = new IButton("Reset"); + IButton resetButton = new LocatableIButton(MSG.common_button_reset()); resetButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //F5 refresh check? If they've reloaded the form for some reason then bail. boolean credentialsEmpty = ((user == null) || (user.trim().isEmpty()) || (password == null) || (password .trim().isEmpty())); if (UserSessionManager.isLoggedOut() || credentialsEmpty) { - resetLogin(); + resetLogin(LoginView.this.extendLocatorId("Reset")); return; }
@@ -341,16 +342,16 @@ public class LoginView extends Canvas { }); row.addMember(resetButton);
- IButton logout = new IButton("Logout"); + IButton logout = new LocatableIButton(MSG.view_login_logout()); logout.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { UserSessionManager.logout(); - resetLogin(); + resetLogin(LoginView.this.extendLocatorId("Reset")); return; } }); row.addMember(logout); - Label logoutLabel = new Label("(Logout - Complete registration later.)"); + Label logoutLabel = new Label(MSG.view_login_registerLater()); logoutLabel.setWrap(false); row.addMember(logoutLabel); column.addMember(row); @@ -359,7 +360,7 @@ public class LoginView extends Canvas { window = new Window(); window.setWidth(800); window.setHeight(300); - window.setTitle("Register User"); + window.setTitle(MSG.view_login_registerUser());
// forced focused, static size, can't close / dismiss window.setIsModal(true); @@ -377,11 +378,11 @@ public class LoginView extends Canvas {
/** Go through steps of invalidating this login and piping them back to CoreGUI Login. */ - private void resetLogin() { + private void resetLogin(String locatorId) { window.destroy(); loginShowing = false; UserSessionManager.logout(); - new LoginView().showLoginDialog(); + new LoginView(locatorId).showLoginDialog(); }
/**Uses the information from the populated form to create the Subject for the new LDAP user. @@ -389,7 +390,8 @@ public class LoginView extends Canvas { * @param populatedForm - validated data * @param callback */ - protected void registerLdapUser(DynamicForm populatedForm, final AsyncCallback<Subject> callback) { + protected void registerLdapUser(final String locatorId, DynamicForm populatedForm, + final AsyncCallback<Subject> callback) {
final Subject newSubject = new Subject(); newSubject.setId(0);//enforce registration element for LDAP processing @@ -446,14 +448,14 @@ public class LoginView extends Canvas { Log.debug("Failed to register LDAP subject '" + newSubject.getName() + "' " + caught.getMessage()); //TODO: pass in warning message to Login Dialog. - new LoginView().showLoginDialog(); + new LoginView(locatorId).showLoginDialog(); }
public void onSuccess(Subject checked) { Log.trace("Successfully registered LDAP subject '" + checked + "'.");
CoreGUI.getMessageCenter().notify( - new Message("Succesfully registered the new ldap Subject.", Message.Severity.Info)); + new Message(MSG.view_login_registerLdapSuccess(), Message.Severity.Info)); Log.trace("Succesfully registered the new ldap Subject."); window.destroy(); loginShowing = false; @@ -467,7 +469,7 @@ public class LoginView extends Canvas { window.destroy(); loginShowing = false; //TODO: pass informative message to login. - new LoginView().showLoginDialog(); + new LoginView(locatorId).showLoginDialog(); } }
@@ -492,7 +494,7 @@ public class LoginView extends Canvas { } if (name.equals(EMAIL)) { RegExpValidator emailValidator = new RegExpValidator(); - emailValidator.setErrorMessage("Invalid email address"); + emailValidator.setErrorMessage(MSG.view_login_invalidEmail()); emailValidator.setExpression("^([a-zA-Z0-9_.\-+])+@(([a-zA-Z0-9\-])+\.)+[a-zA-Z0-9]{2,4}$"); item.setValidators(emailValidator); } @@ -545,9 +547,9 @@ public class LoginView extends Canvas {
private void handleError(int statusCode) { if (statusCode == 401) { - form.setFieldErrors("login", "The username or password provided does not match our records", true); + form.setFieldErrors("login", MSG.view_login_noUser(), true); } else { - form.setFieldErrors("login", "The backend data source is unavailable", true); + form.setFieldErrors("login", MSG.view_login_noBackend(), true); } loginButton.setDisabled(false); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java index 0932e6f..97d784e 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/SearchGUI.java @@ -29,6 +29,7 @@ import org.rhq.enterprise.gui.coregui.client.search.SearchBar; * @author Joseph Marques */ public class SearchGUI implements EntryPoint { + private static final Messages MSG = CoreGUI.getMessages();
public static SearchGUI singleton = new SearchGUI(); private SearchBar searchBar; @@ -49,7 +50,7 @@ public class SearchGUI implements EntryPoint { UserSessionManager.checkLoginStatus(null, null, new AsyncCallback<Subject>() { @Override public void onFailure(Throwable caught) { - SC.say("Unable to determine login status, check server status"); + SC.say(MSG.view_searchGUI_loginStatus()); }
@Override diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java index fbf32a9..acbb575 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserPermissionsManager.java @@ -44,6 +44,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter; * @author Ian Springer */ public class UserPermissionsManager { + private static final Messages MSG = CoreGUI.getMessages();
private static final UserPermissionsManager INSTANCE = new UserPermissionsManager(); private static final AuthorizationGWTServiceAsync AUTHORIZATION_SERVICE = GWTServiceLookup @@ -179,8 +180,8 @@ public class UserPermissionsManager { private void loadGlobalPermissions() { AUTHORIZATION_SERVICE.getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() { public void onFailure(Throwable throwable) { - MESSAGE_CENTER.notify(new Message("Failed to load your global permissions - assuming none for now.", - throwable, Message.Severity.Error, EnumSet.of(Message.Option.BackgroundJobResult))); + MESSAGE_CENTER.notify(new Message(MSG.util_userPerm_loadFailGlobal(), throwable, + Message.Severity.Error, EnumSet.of(Message.Option.BackgroundJobResult))); UserPermissionsManager.this.globalPermissions.clear(); UserPermissionsManager.this.globalCacheDirty = true; notifyGlobalPermissionsLoadedListener(); @@ -204,9 +205,9 @@ public class UserPermissionsManager { private void loadCurrentResourcePermissions() { AUTHORIZATION_SERVICE.getExplicitResourcePermissions(this.currentId, new AsyncCallback<Set<Permission>>() { public void onFailure(Throwable throwable) { - MESSAGE_CENTER.notify(new Message("Failed to load your permissions for Resource with id [" - + UserPermissionsManager.this.currentId + "] - assuming none for now.", throwable, - Message.Severity.Error, EnumSet.of(Message.Option.BackgroundJobResult))); + MESSAGE_CENTER.notify(new Message(MSG.util_userPerm_loadFailResource(Integer + .toString(UserPermissionsManager.this.currentId)), throwable, Message.Severity.Error, EnumSet + .of(Message.Option.BackgroundJobResult))); UserPermissionsManager.this.resourcePermissions.clear(); UserPermissionsManager.this.resourceCacheDirty = true; notifyResourcePermissionsLoadedListener(); @@ -223,9 +224,9 @@ public class UserPermissionsManager { private void loadCurrentGroupPermissions() { AUTHORIZATION_SERVICE.getExplicitGroupPermissions(this.currentId, new AsyncCallback<Set<Permission>>() { public void onFailure(Throwable throwable) { - MESSAGE_CENTER.notify(new Message("Failed to load your permissions for group with id [" - + UserPermissionsManager.this.currentId + "] - assuming none for now.", throwable, - Message.Severity.Error, EnumSet.of(Message.Option.BackgroundJobResult))); + MESSAGE_CENTER.notify(new Message(MSG.util_userPerm_loadFailGroup(Integer + .toString(UserPermissionsManager.this.currentId)), throwable, Message.Severity.Error, EnumSet + .of(Message.Option.BackgroundJobResult))); UserPermissionsManager.this.resourcePermissions.clear(); UserPermissionsManager.this.resourceCacheDirty = true; notifyResourcePermissionsLoadedListener(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java index 759d3e3..179ecbe 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/UserSessionManager.java @@ -57,12 +57,16 @@ import org.rhq.enterprise.gui.coregui.client.util.preferences.UserPreferences; * @author Joseph Marques */ public class UserSessionManager { + private static final Messages MSG = CoreGUI.getMessages(); + public static int SESSION_TIMEOUT = 29 * 60 * 1000; // 29 mins, just shorter than the 30-min web session timeout private static int LOGOUT_DELAY = 5 * 1000; // wait 5 seconds for in-flight requests to complete before logout
public static final String SESSION_NAME = "RHQ_Session"; private static final UserPermissionsManager USER_PERMISSIONS_MANAGER = UserPermissionsManager.getInstance();
+ private static final String LOCATOR_ID = "SessionManagerLogin"; + private static Subject sessionSubject; private static UserPreferences userPreferences;
@@ -78,7 +82,7 @@ public class UserSessionManager { public void run() { Log.info("Session timer expired."); sessionState = State.IS_LOGGED_OUT; - new LoginView().showLoginDialog(); // log user out, show login dialog + new LoginView(LOCATOR_ID).showLoginDialog(); // log user out, show login dialog } }; private static Timer logoutTimer = new Timer() { @@ -156,7 +160,7 @@ public class UserSessionManager { Log .trace("Unable to locate information critical to ldap registration/account lookup. Log back in."); sessionState = State.IS_LOGGED_OUT; - new LoginView().showLoginDialog(); + new LoginView(LOCATOR_ID).showLoginDialog(); return; }
@@ -185,8 +189,8 @@ public class UserSessionManager { if (results.size() == 0) {//no case insensitive matches found, launch registration Log.trace("Proceeding with registration for ldap user '" + user + "'."); sessionState = State.IS_REGISTERING; - new LoginView().showRegistrationDialog(subject.getName(), sessionId, - password, callback); + new LoginView(LOCATOR_ID).showRegistrationDialog(subject.getName(), + sessionId, password, callback); return; } else {//launch case sensitive code handling Subject locatedSubject = results.get(0); @@ -204,7 +208,7 @@ public class UserSessionManager { Log.debug("Failed to complete ldap processing for subject:" + caught.getMessage()); //TODO: pass message to login dialog. - new LoginView().showLoginDialog(); + new LoginView(LOCATOR_ID).showLoginDialog(); return; }
@@ -232,11 +236,11 @@ public class UserSessionManager { GWTServiceLookup.getSubjectService().findSubjectsByCriteria(criteria, new AsyncCallback<PageList<Subject>>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError( - "UserSessionManager: Failed to load user's subject", caught); + CoreGUI.getErrorHandler().handleError(MSG.util_userSession_loadFailSubject(), + caught); Log.info("Failed to load user's subject"); //TODO: pass message to login ui. - new LoginView().showLoginDialog(); + new LoginView(LOCATOR_ID).showLoginDialog(); return; }
@@ -277,7 +281,7 @@ public class UserSessionManager { }//end of server side session check; } else {//invalid client session. Back to login sessionState = State.IS_LOGGED_OUT; - new LoginView().showLoginDialog(); + new LoginView(LOCATOR_ID).showLoginDialog(); return; } } @@ -369,7 +373,7 @@ public class UserSessionManager { sessionState = State.IS_LOGGED_OUT; Log.info("Destroying session timer..."); sessionTimer.cancel(); - + USER_PERMISSIONS_MANAGER.clearCache();
// log out the web session on the server-side in a delayed fashion, @@ -383,7 +387,7 @@ public class UserSessionManager { GWTServiceLookup.getSubjectService().logout(UserSessionManager.getSessionSubject(), new AsyncCallback<Void>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to logout.", caught); + CoreGUI.getErrorHandler().handleError(MSG.util_userSession_logoutFail(), caught); }
public void onSuccess(Void result) { @@ -392,7 +396,7 @@ public class UserSessionManager { }); } } catch (Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to logout.", caught); + CoreGUI.getErrorHandler().handleError(MSG.util_userSession_logoutFail(), caught); } }
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java index a439288..c253fda 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java @@ -33,6 +33,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLe import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem; import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection; import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/** * The Administration top-level view. @@ -41,27 +42,32 @@ import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory; * @author Ian Springer */ public class AdministrationView extends AbstractSectionedLeftNavigationView { - public static final String VIEW_ID = "Administration"; + public static final ViewName VIEW_ID = new ViewName("Administration", MSG.view_admin_administration());
- public static final String SECTION_SECURITY_VIEW_ID = "Security"; - public static final String SECTION_TOPOLOGY_VIEW_ID = "Topology"; - public static final String SECTION_CONFIGURATION_VIEW_ID = "Configuration"; + public static final ViewName SECTION_SECURITY_VIEW_ID = new ViewName("Security", MSG.view_admin_security()); + public static final ViewName SECTION_TOPOLOGY_VIEW_ID = new ViewName("Topology", MSG.view_admin_topology()); + public static final ViewName SECTION_CONFIGURATION_VIEW_ID = new ViewName("Configuration", MSG + .view_admin_configuration());
// TODO these iframe page view ids should go away in favor of the gwt view page view_id, when available - private static final String PAGE_SERVERS_VIEW_ID = "Servers"; - private static final String PAGE_AGENTS_VIEW_ID = "Agents"; - private static final String PAGE_AFFINITY_GROUPS_VIEW_ID = "AffinityGroups"; - private static final String PAGE_PARTITION_EVENTS_VIEW_ID = "PartitionEvents"; + private static final ViewName PAGE_SERVERS_VIEW_ID = new ViewName("Servers", MSG.view_adminTopology_servers()); + private static final ViewName PAGE_AGENTS_VIEW_ID = new ViewName("Agents", MSG.view_adminTopology_agents()); + private static final ViewName PAGE_AFFINITY_GROUPS_VIEW_ID = new ViewName("AffinityGroups", MSG + .view_adminTopology_affinityGroups()); + private static final ViewName PAGE_PARTITION_EVENTS_VIEW_ID = new ViewName("PartitionEvents", MSG + .view_adminTopology_partitionEvents());
- private static final String PAGE_SYSTEM_SETTINGS_VIEW_ID = "SystemSettings"; - private static final String PAGE_TEMPLATES_VIEW_ID = "Templates"; - private static final String PAGE_DOWNLOADS_VIEW_ID = "Downloads"; - private static final String PAGE_LICENSE_VIEW_ID = "License"; - private static final String PAGE_PLUGINS_VIEW_ID = "Plugins"; + // TODO these iframe page view ids should go away in favor of the gwt view page view_id, when available + private static final ViewName PAGE_SYSTEM_SETTINGS_VIEW_ID = new ViewName("SystemSettings", MSG + .view_adminConfig_systemSettings()); + private static final ViewName PAGE_TEMPLATES_VIEW_ID = new ViewName("Templates", MSG.view_adminConfig_templates()); + private static final ViewName PAGE_DOWNLOADS_VIEW_ID = new ViewName("Downloads", MSG.view_adminConfig_downloads()); + private static final ViewName PAGE_LICENSE_VIEW_ID = new ViewName("License", MSG.view_adminConfig_license()); + private static final ViewName PAGE_PLUGINS_VIEW_ID = new ViewName("Plugins", MSG.view_adminConfig_plugins());
public AdministrationView() { // This is a top level view, so our locator id can simply be our view id. - super(VIEW_ID); + super(VIEW_ID.getName()); }
@Override @@ -108,28 +114,28 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView { private NavigationSection buildTopologySection() { NavigationItem serversItem = new NavigationItem(PAGE_SERVERS_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new FullHTMLPane(extendLocatorId(PAGE_SERVERS_VIEW_ID), + return new FullHTMLPane(extendLocatorId(PAGE_SERVERS_VIEW_ID.getName()), "/rhq/ha/listServers-plain.xhtml?nomenu=true"); } });
NavigationItem agentsItem = new NavigationItem(PAGE_AGENTS_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new FullHTMLPane(extendLocatorId(PAGE_AGENTS_VIEW_ID), + return new FullHTMLPane(extendLocatorId(PAGE_AGENTS_VIEW_ID.getName()), "/rhq/ha/listAgents-plain.xhtml?nomenu=true"); } });
NavigationItem affinityGroupsItem = new NavigationItem(PAGE_AFFINITY_GROUPS_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new FullHTMLPane(extendLocatorId(PAGE_AFFINITY_GROUPS_VIEW_ID), + return new FullHTMLPane(extendLocatorId(PAGE_AFFINITY_GROUPS_VIEW_ID.getName()), "/rhq/ha/listAffinityGroups-plain.xhtml?nomenu=true"); } });
NavigationItem partitionEventsItem = new NavigationItem(PAGE_PARTITION_EVENTS_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new FullHTMLPane(extendLocatorId(PAGE_PARTITION_EVENTS_VIEW_ID), + return new FullHTMLPane(extendLocatorId(PAGE_PARTITION_EVENTS_VIEW_ID.getName()), "/rhq/ha/listPartitionEvents-plain.xhtml?nomenu=true"); } }); @@ -148,35 +154,35 @@ public class AdministrationView extends AbstractSectionedLeftNavigationView { private NavigationSection buildConfigurationSection() { NavigationItem systemSettingsItem = new NavigationItem(PAGE_SYSTEM_SETTINGS_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new FullHTMLPane(extendLocatorId(PAGE_SYSTEM_SETTINGS_VIEW_ID), + return new FullHTMLPane(extendLocatorId(PAGE_SYSTEM_SETTINGS_VIEW_ID.getName()), "/admin/config/Config.do?mode=edit&nomenu=true"); } });
NavigationItem templatesItem = new NavigationItem(PAGE_TEMPLATES_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new ResourceTypeTreeView(extendLocatorId(PAGE_TEMPLATES_VIEW_ID)); + return new ResourceTypeTreeView(extendLocatorId(PAGE_TEMPLATES_VIEW_ID.getName())); } }); templatesItem.setRefreshRequired(true); // we always need a new page
NavigationItem downloadsItem = new NavigationItem(PAGE_DOWNLOADS_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new FullHTMLPane(extendLocatorId(PAGE_DOWNLOADS_VIEW_ID), + return new FullHTMLPane(extendLocatorId(PAGE_DOWNLOADS_VIEW_ID.getName()), "/rhq/admin/downloads-body.xhtml?nomenu=true"); } });
NavigationItem licenseItem = new NavigationItem(PAGE_LICENSE_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new FullHTMLPane(extendLocatorId(PAGE_LICENSE_VIEW_ID), + return new FullHTMLPane(extendLocatorId(PAGE_LICENSE_VIEW_ID.getName()), "/admin/license/LicenseAdmin.do?mode=view&nomenu=true"); } });
NavigationItem pluginsItem = new NavigationItem(PAGE_PLUGINS_VIEW_ID, null, new ViewFactory() { public Canvas createView() { - return new FullHTMLPane(extendLocatorId(PAGE_PLUGINS_VIEW_ID), + return new FullHTMLPane(extendLocatorId(PAGE_PLUGINS_VIEW_ID.getName()), "/rhq/admin/plugin/plugin-list-plain.xhtml?nomenu=true"); } }); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java index eb07c45..86e7f11 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/agent/install/RemoteAgentInstallView.java @@ -48,6 +48,7 @@ import org.rhq.core.domain.install.remote.RemoteAccessInfo; import org.rhq.core.domain.measurement.MeasurementConverterClient; import org.rhq.core.domain.measurement.MeasurementUnits; import org.rhq.enterprise.gui.coregui.client.CoreGUI; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.gwt.RemoteInstallGWTServiceAsync; import org.rhq.enterprise.gui.coregui.client.util.message.Message; @@ -58,7 +59,8 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; * @author Greg Hinkle */ public class RemoteAgentInstallView extends LocatableVLayout { - public static final String VIEW_ID = "RemoteAgentInstall"; + public static final ViewName VIEW_ID = new ViewName("RemoteAgentInstall", MSG + .view_adminTopology_remoteAgentInstall());
private RemoteInstallGWTServiceAsync remoteInstallService = GWTServiceLookup.getRemoteInstallService();
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 dbf0f76..393293c 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,6 +26,7 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView; import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction; import org.rhq.enterprise.gui.coregui.client.components.table.TableAction; import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/** * A table that lists all roles and provides the ability to view details of or delete those roles and to create new @@ -35,7 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; * @author Ian Springer */ public class RolesView extends TableSection implements BookmarkableView { - public static final String VIEW_ID = "Roles"; + public static final ViewName VIEW_ID = new ViewName("Roles", MSG.view_adminSecurity_roles());
private static final int ID_SUPERUSER = 1; private static final int ID_ALL_RESOURCES = 2; @@ -44,7 +45,7 @@ public class RolesView extends TableSection implements BookmarkableView { private static final String HEADER_ICON = "global/Role_16.png";
public RolesView(String locatorId) { - super(locatorId, "Roles"); + super(locatorId, MSG.view_adminSecurity_roles());
final RolesDataSource datasource = RolesDataSource.getInstance(); setDataSource(datasource); 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 905abbc..7118d31 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 @@ -28,6 +28,7 @@ import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableActio 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.TableSection; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/** @@ -39,12 +40,10 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message; */ public class UsersView extends TableSection {
- public static final String VIEW_ID = "Users"; + public static final ViewName VIEW_ID = new ViewName("Users", MSG.view_adminSecurity_users()); public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/" + AdministrationView.SECTION_SECURITY_VIEW_ID + "/" + VIEW_ID;
- private static final String TITLE = "Users"; - private static final int ID_OVERLORD = 1; private static final int ID_RHQADMIN = 2;
@@ -53,7 +52,7 @@ public class UsersView extends TableSection { private static Message message;
public UsersView(String locatorId) { - super(locatorId, TITLE); + super(locatorId, MSG.view_adminSecurity_users());
final UsersDataSource dataSource = UsersDataSource.getInstance();
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 deb6727..b6f34ca 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 @@ -40,6 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableActio import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement; import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; 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; import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -57,8 +58,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message; */ public class AlertHistoryView extends TableSection { // TODO: Create a subclass for the subsystem view. - public static final String SUBSYSTEM_VIEW_ID = "RecentAlerts"; - private static final String SUBSYSTEM_VIEW_TITLE = "Recent Alerts"; + public static final ViewName SUBSYSTEM_VIEW_ID = new ViewName("RecentAlerts", MSG.common_title_recent_alerts());
private static SortSpecifier DEFAULT_SORT_SPECIFIER = new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING); @@ -67,7 +67,7 @@ public class AlertHistoryView extends TableSection {
// for subsystem views public AlertHistoryView(String locatorId) { - this(locatorId, SUBSYSTEM_VIEW_TITLE, EntityContext.forSubsystemView(), false); + this(locatorId, SUBSYSTEM_VIEW_ID.getTitle(), EntityContext.forSubsystemView(), false); }
protected AlertHistoryView(String locatorId, String tableTitle, EntityContext context, boolean hasWriteAccess) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java index fa823e3..e08a373 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java @@ -31,6 +31,7 @@ import org.rhq.enterprise.gui.coregui.client.ViewPath; import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleView; import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView; import org.rhq.enterprise.gui.coregui.client.bundle.tree.BundleTreeView; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.content.repository.tree.ContentRepositoryTreeView; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack; @@ -39,7 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack * @author Greg Hinkle */ public class BundleTopView extends LocatableHLayout implements BookmarkableView { - public static final String VIEW_ID = "Bundles"; + public static final ViewName VIEW_ID = new ViewName("Bundles", MSG.view_bundle_bundles());
private BundleTreeView bundleTreeView;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java index 13c8835..db654e7 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java @@ -99,7 +99,7 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
this.bundle = bundle;
- addMember(new BackButton(extendLocatorId("BackButton"), "Back to All Bundles", BundleTopView.VIEW_ID)); + addMember(new BackButton(extendLocatorId("BackButton"), "Back to All Bundles", BundleTopView.VIEW_ID.getTitle()));
headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png", bundle.getName());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java index a2b8b37..ec81e48 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tree/EnhancedTreeNode.java @@ -44,6 +44,15 @@ public class EnhancedTreeNode extends TreeNode { } }
+ public EnhancedTreeNode(String name, String title, TreeNode... children) { + super(name, children); + if (!(null == title || "".equals(title.trim()))) { + setTitle(title); + } else if (name != null) { + setTitle(StringUtils.deCamelCase(name)); + } + } + @Override public void setName(String name) { super.setName(name); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java index 46ddd52..bee3bb6 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java @@ -121,13 +121,13 @@ public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayo TreeNode[] treeNodes = new TreeNode[navigationItems.size()]; for (int i = 0, navigationItemsSize = navigationItems.size(); i < navigationItemsSize; i++) { NavigationItem item = navigationItems.get(i); - final TreeNode treeNode = new EnhancedTreeNode(item.getName()); + final TreeNode treeNode = new EnhancedTreeNode(item.getName(), item.getTitle()); treeNode.setIcon(item.getIcon()); treeNode.setEnabled(item.isEnabled()); treeNodes[i] = treeNode; }
- TreeNode rootNode = new EnhancedTreeNode(navigationSection.getName(), treeNodes); + TreeNode rootNode = new EnhancedTreeNode(navigationSection.getName(), navigationSection.getTitle(), treeNodes); Tree tree = new Tree(); tree.setRoot(rootNode); treeGrid.setData(tree); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java index 90339d3..2319d4d 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java @@ -23,26 +23,34 @@ package org.rhq.enterprise.gui.coregui.client.components.view; * @author Ian Springer */ public class NavigationItem { - private final String name; + private final ViewName viewName; private final String icon; private final ViewFactory viewFactory; private final boolean enabled;
private boolean refreshRequired = false;
- public NavigationItem(String name, String icon, ViewFactory viewFactory) { + public NavigationItem(ViewName name, String icon, ViewFactory viewFactory) { this(name, icon, viewFactory, true); }
- public NavigationItem(String name, String icon, ViewFactory viewFactory, boolean enabled) { + public NavigationItem(ViewName name, String icon, ViewFactory viewFactory, boolean enabled) { this.icon = icon; - this.name = name; + this.viewName = name; this.viewFactory = viewFactory; this.enabled = enabled; }
+ public ViewName getViewName() { + return viewName; + } + public String getName() { - return name; + return viewName.getName(); + } + + public String getTitle() { + return viewName.getTitle(); }
public String getIcon() { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java index f4d04fb..31e9567 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java @@ -28,12 +28,12 @@ import java.util.Map; * @author Ian Springer */ public class NavigationSection { - private String name; + private ViewName viewName; private List<NavigationItem> navigationItems; private Map<String, NavigationItem> navigationItemsByName;
- public NavigationSection(String name, NavigationItem ... navigationItems) { - this.name = name; + public NavigationSection(ViewName name, NavigationItem... navigationItems) { + this.viewName = name; this.navigationItems = Arrays.asList(navigationItems); this.navigationItemsByName = new LinkedHashMap<String, NavigationItem>(navigationItems.length); for (NavigationItem navigationItem : navigationItems) { @@ -41,8 +41,16 @@ public class NavigationSection { } }
+ public ViewName getViewName() { + return viewName; + } + public String getName() { - return name; + return viewName.getName(); + } + + public String getTitle() { + return viewName.getTitle(); }
public List<NavigationItem> getNavigationItems() { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewName.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewName.java new file mode 100644 index 0000000..ebececd --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewName.java @@ -0,0 +1,38 @@ +package org.rhq.enterprise.gui.coregui.client.components.view; + +import org.rhq.core.domain.util.StringUtils; + +public class ViewName { + + private String name; + private String title; + + public ViewName(String name) { + this(name, null); + } + + public ViewName(String name, String title) { + super(); + this.name = name; + this.title = (null == title || "".equals(title.trim())) ? StringUtils.deCamelCase(name) : title; + } + + public String getName() { + return name; + } + + public String getTitle() { + return title; + } + + /* + * Return just the name so String construction of view path works as expected + * (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return name; + } + +} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java index 9592684..ad5550d 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java @@ -49,6 +49,7 @@ import org.rhq.core.domain.dashboard.DashboardPortlet; 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.view.ViewName; import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet; import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet; import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedView; @@ -69,7 +70,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; * @author Greg Hinkle */ public class DashboardsView extends LocatableVLayout implements BookmarkableView { - public static final String VIEW_ID = MSG.view_dashboards_title(); + public static final ViewName VIEW_ID = new ViewName("Dashboard", MSG.view_dashboards_title());
private TabSet tabSet;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java index e7fa7fa..4a563c7 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java @@ -46,6 +46,7 @@ import org.rhq.core.domain.resource.ResourceCategory; import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.domain.util.PageList; import org.rhq.enterprise.gui.coregui.client.CoreGUI; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet; import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory; import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow; @@ -59,7 +60,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid; * @author Greg Hinkle */ public class PlatformPortletView extends LocatableListGrid implements Portlet { - public static final String VIEW_ID = "CpuAndMemoryUtilization"; + public static final ViewName VIEW_ID = new ViewName("CpuAndMemoryUtilization", MSG.view_reports_platforms());
private MeasurementDataGWTServiceAsync measurementService = GWTServiceLookup.getMeasurementDataService(); private ResourceTypeGWTServiceAsync typeService = GWTServiceLookup.getResourceTypeGWTService(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java index af5518a..fb4b084 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/InventoryView.java @@ -37,6 +37,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLe import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem; import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection; import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField; import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupListView; @@ -53,32 +54,37 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.Resour * @author Ian Springer */ public class InventoryView extends AbstractSectionedLeftNavigationView { - public static final String VIEW_ID = "Inventory"; + public static final ViewName VIEW_ID = new ViewName("Inventory", MSG.common_title_inventory());
// view IDs for Resources section - private static final String RESOURCES_SECTION_VIEW_ID = "Resources"; + private static final ViewName RESOURCES_SECTION_VIEW_ID = new ViewName("Resources", MSG + .view_inventory_resources_title());
- private static final String PAGE_AUTODISCOVERY_QUEUE = "AutodiscoveryQueue"; - private static final String PAGE_ALL_RESOURCES = "AllResources"; - private static final String PAGE_PLATFORMS = "Platforms"; - private static final String PAGE_SERVERS = "Servers"; - private static final String PAGE_SERVICES = "Services"; - private static final String PAGE_DOWN_SERVERS = "DownServers"; + private static final ViewName PAGE_AUTODISCOVERY_QUEUE = new ViewName("AutodiscoveryQueue", MSG + .view_inventory_adq()); + private static final ViewName PAGE_ALL_RESOURCES = new ViewName("AllResources", MSG.view_inventory_allResources()); + private static final ViewName PAGE_PLATFORMS = new ViewName("Platforms", MSG.view_inventory_platforms()); + private static final ViewName PAGE_SERVERS = new ViewName("Servers", MSG.view_inventory_servers()); + private static final ViewName PAGE_SERVICES = new ViewName("Services", MSG.view_inventory_services()); + private static final ViewName PAGE_DOWN_SERVERS = new ViewName("DownServers", MSG.view_inventory_downServers());
// view IDs for Groups section - private static final String GROUPS_SECTION_VIEW_ID = "Groups"; + private static final ViewName GROUPS_SECTION_VIEW_ID = new ViewName("Groups", MSG.view_inventory_groups());
- private static final String PAGE_DYNAGROUP_DEFINITIONS = "DynagroupDefinitions"; - private static final String PAGE_ALL_GROUPS = "AllGroups"; - private static final String PAGE_COMPATIBLE_GROUPS = "CompatibleGroups"; - private static final String PAGE_MIXED_GROUPS = "MixedGroups"; - private static final String PAGE_PROBLEM_GROUPS = "ProblemGroups"; + private static final ViewName PAGE_DYNAGROUP_DEFINITIONS = new ViewName("DynagroupDefinitions", MSG + .view_inventory_dynagroupDefs()); + private static final ViewName PAGE_ALL_GROUPS = new ViewName("AllGroups", MSG.view_inventory_allGroups()); + private static final ViewName PAGE_COMPATIBLE_GROUPS = new ViewName("CompatibleGroups", MSG + .common_title_compatibleGroups()); + private static final ViewName PAGE_MIXED_GROUPS = new ViewName("MixedGroups", MSG.common_title_mixedGroups()); + private static final ViewName PAGE_PROBLEM_GROUPS = new ViewName("ProblemGroups", MSG + .view_inventory_problemGroups());
private Set<Permission> globalPermissions;
public InventoryView() { // This is a top level view, so our locator id can simply be our view id. - super(VIEW_ID); + super(VIEW_ID.getName()); }
@Override @@ -123,40 +129,40 @@ public class InventoryView extends AbstractSectionedLeftNavigationView { NavigationItem autodiscoveryQueueItem = new NavigationItem(PAGE_AUTODISCOVERY_QUEUE, "global/Recent_16.png", new ViewFactory() { public Canvas createView() { - return new ResourceAutodiscoveryView(extendLocatorId(PAGE_AUTODISCOVERY_QUEUE)); + return new ResourceAutodiscoveryView(extendLocatorId(PAGE_AUTODISCOVERY_QUEUE.getName())); } }, this.globalPermissions.contains(Permission.MANAGE_INVENTORY));
// TODO: Specify an icon for this item. NavigationItem allResourcesItem = new NavigationItem(PAGE_ALL_RESOURCES, null, new ViewFactory() { public Canvas createView() { - return new ResourceSearchView(extendLocatorId(PAGE_ALL_RESOURCES), null, PAGE_ALL_RESOURCES, - "types/Platform_up_24.png", "types/Server_up_24.png", "types/Service_up_24.png"); + return new ResourceSearchView(extendLocatorId(PAGE_ALL_RESOURCES.getName()), null, PAGE_ALL_RESOURCES + .getTitle(), "types/Platform_up_24.png", "types/Server_up_24.png", "types/Service_up_24.png"); } });
NavigationItem platformsItem = new NavigationItem(PAGE_PLATFORMS, "types/Platform_up_16.png", new ViewFactory() { public Canvas createView() { - return new ResourceSearchView(extendLocatorId(PAGE_PLATFORMS), new Criteria( + return new ResourceSearchView(extendLocatorId(PAGE_PLATFORMS.getName()), new Criteria( ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.PLATFORM.name()), - PAGE_PLATFORMS, "types/Platform_up_24.png"); + PAGE_PLATFORMS.getTitle(), "types/Platform_up_24.png"); } });
NavigationItem serversItem = new NavigationItem(PAGE_SERVERS, "types/Server_up_16.png", new ViewFactory() { public Canvas createView() { - return new ResourceSearchView(extendLocatorId(PAGE_SERVERS), new Criteria( - ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVER.name()), PAGE_SERVERS, - "types/Server_up_24.png"); + return new ResourceSearchView(extendLocatorId(PAGE_SERVERS.getName()), new Criteria( + ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVER.name()), PAGE_SERVERS + .getTitle(), "types/Server_up_24.png"); } });
NavigationItem servicesItem = new NavigationItem(PAGE_SERVICES, "types/Service_up_16.png", new ViewFactory() { public Canvas createView() { - return new ResourceSearchView(extendLocatorId(PAGE_SERVICES), new Criteria( - ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVICE.name()), PAGE_SERVICES, - "types/Service_up_24.png"); + return new ResourceSearchView(extendLocatorId(PAGE_SERVICES.getName()), new Criteria( + ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVICE.name()), PAGE_SERVICES + .getTitle(), "types/Service_up_24.png"); } });
@@ -168,7 +174,7 @@ public class InventoryView extends AbstractSectionedLeftNavigationView { criteria.addCriteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVER .name()); // TODO (ips, 10/28/10): Should we include down platforms too? - return new ResourceSearchView(extendLocatorId(PAGE_DOWN_SERVERS), criteria, MSG + return new ResourceSearchView(extendLocatorId(PAGE_DOWN_SERVERS.getName()), criteria, MSG .view_inventory_downServers()); } }); @@ -182,33 +188,33 @@ public class InventoryView extends AbstractSectionedLeftNavigationView { "types/GroupDefinition_16.png", new ViewFactory() { public Canvas createView() { // TODO: Do we have a 24x24 groupdef icon? - return new GroupDefinitionListView(extendLocatorId(PAGE_DYNAGROUP_DEFINITIONS), + return new GroupDefinitionListView(extendLocatorId(PAGE_DYNAGROUP_DEFINITIONS.getName()), "types/GroupDefinition_16.png"); } }, this.globalPermissions.contains(Permission.MANAGE_INVENTORY));
NavigationItem allGroupsItem = new NavigationItem(PAGE_ALL_GROUPS, "types/Group_up_16.png", new ViewFactory() { public Canvas createView() { - return new ResourceGroupListView(extendLocatorId(PAGE_ALL_GROUPS), null, - MSG.view_inventory_allGroups(), "types/Cluster_up_24.png", "types/Group_up_24.png"); + return new ResourceGroupListView(extendLocatorId(PAGE_ALL_GROUPS.getName()), null, PAGE_ALL_GROUPS + .getTitle(), "types/Cluster_up_24.png", "types/Group_up_24.png"); } });
NavigationItem compatibleGroupsItem = new NavigationItem(PAGE_COMPATIBLE_GROUPS, "types/Cluster_up_16.png", new ViewFactory() { public Canvas createView() { - return new ResourceGroupListView(extendLocatorId(PAGE_COMPATIBLE_GROUPS), new Criteria( - ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.COMPATIBLE.name()), MSG - .common_title_compatibleGroups(), "types/Cluster_up_24.png"); + return new ResourceGroupListView(extendLocatorId(PAGE_COMPATIBLE_GROUPS.getName()), new Criteria( + ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.COMPATIBLE.name()), + PAGE_COMPATIBLE_GROUPS.getTitle(), "types/Cluster_up_24.png"); } });
NavigationItem mixedGroupsItem = new NavigationItem(PAGE_MIXED_GROUPS, "types/Group_up_16.png", new ViewFactory() { public Canvas createView() { - return new ResourceGroupListView(extendLocatorId(PAGE_MIXED_GROUPS), new Criteria( - ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.MIXED.name()), MSG - .common_title_mixedGroups(), "types/Group_up_24.png"); + return new ResourceGroupListView(extendLocatorId(PAGE_MIXED_GROUPS.getName()), new Criteria( + ResourceGroupDataSourceField.CATEGORY.propertyName(), GroupCategory.MIXED.name()), + PAGE_MIXED_GROUPS.getTitle(), "types/Group_up_24.png"); } });
@@ -217,8 +223,8 @@ public class InventoryView extends AbstractSectionedLeftNavigationView { public Canvas createView() { // TODO: There is no underlying support for this criteria. Also, there should not be an active New // button on this page. - return new ResourceGroupListView(extendLocatorId(PAGE_PROBLEM_GROUPS), new Criteria("availability", - "down"), MSG.view_inventory_problemGroups(), "types/Cluster_down_16.png"); + return new ResourceGroupListView(extendLocatorId(PAGE_PROBLEM_GROUPS.getName()), new Criteria( + "availability", "down"), PAGE_PROBLEM_GROUPS.getTitle(), "types/Cluster_down_16.png"); } });
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java index 5c8670e..874d407 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java @@ -26,13 +26,14 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView; import org.rhq.enterprise.gui.coregui.client.ViewPath; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/** * @author Greg Hinkle */ public class ResourceGroupTopView extends LocatableHLayout implements BookmarkableView { - public static final String VIEW_ID = "ResourceGroup"; + public static final ViewName VIEW_ID = new ViewName("ResourceGroup", MSG.common_title_resource_group());
private Canvas contentCanvas; private ResourceGroupTreeView treeView; @@ -50,7 +51,7 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab setHeight100();
treeView = new ResourceGroupTreeView(extendLocatorId("Tree")); - detailView = new ResourceGroupDetailView(extendLocatorId("Detail"), ResourceGroupTopView.VIEW_ID); + detailView = new ResourceGroupDetailView(extendLocatorId("Detail"), ResourceGroupTopView.VIEW_ID.getName()); addMember(treeView);
contentCanvas = new Canvas(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java index 29647f1..b8f8445 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java @@ -370,7 +370,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo new Message(MSG.view_inventory_resource_loadFailed(String.valueOf(resourceId)), Message.Severity.Warning));
- CoreGUI.goToView(InventoryView.VIEW_ID); + CoreGUI.goToView(InventoryView.VIEW_ID.getName()); }
public void onSuccess(PageList<ResourceComposite> result) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java index 836b35e..09c75e6 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java @@ -22,6 +22,7 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView; import org.rhq.enterprise.gui.coregui.client.ViewPath; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupDetailView; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
@@ -29,7 +30,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout; * @author Greg Hinkle */ public class ResourceTopView extends LocatableHLayout implements BookmarkableView { - public static final String VIEW_ID = "Resource"; + public static final ViewName VIEW_ID = new ViewName("Resource", MSG.common_title_resource());
private Canvas contentCanvas; private ResourceTreeView treeView; 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 1e933ef..767b151 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 @@ -35,14 +35,14 @@ import org.rhq.enterprise.gui.coregui.client.components.configuration.Configurat import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction; import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement; import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/** * @author Greg Hinkle */ public class ConfigurationHistoryView extends TableSection { - - public static final String VIEW_ID = "RecentConfigurationChanges"; - private static final String TITLE = MSG.view_configurationHistoryList_title(); + public static final ViewName VIEW_ID = new ViewName("RecentConfigurationChanges", MSG + .view_configurationHistoryList_title());
private Integer resourceId;
@@ -50,7 +50,7 @@ public class ConfigurationHistoryView extends TableSection { * Use this constructor to view config histories for all viewable Resources. */ public ConfigurationHistoryView(String locatorId) { - super(locatorId, TITLE); + super(locatorId, VIEW_ID.getTitle()); final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource(); setDataSource(datasource); } @@ -61,7 +61,7 @@ public class ConfigurationHistoryView extends TableSection { * @param resourceId a Resource ID */ public ConfigurationHistoryView(String locatorId, int resourceId) { - super(locatorId, TITLE, createCriteria(resourceId)); + super(locatorId, VIEW_ID.getTitle(), createCriteria(resourceId)); this.resourceId = resourceId; ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource(); setDataSource(datasource); @@ -124,15 +124,14 @@ public class ConfigurationHistoryView extends TableSection {
setListGridFields(fields.toArray(new ListGridField[fields.size()]));
- addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), - MSG.common_msg_deleteConfirm(MSG.common_msg_deleteConfirm(MSG.view_configurationHistoryList_itemNamePlural())), - new AbstractTableAction( - TableActionEnablement.ANY) { - public void executeAction(ListGridRecord[] selection, Object actionValue) { - // TODO: Implement this method. - CoreGUI.getErrorHandler().handleError("Not implemented"); - } - }); + addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG.common_msg_deleteConfirm(MSG + .common_msg_deleteConfirm(MSG.view_configurationHistoryList_itemNamePlural())), new AbstractTableAction( + TableActionEnablement.ANY) { + public void executeAction(ListGridRecord[] selection, Object actionValue) { + // TODO: Implement this method. + CoreGUI.getErrorHandler().handleError("Not implemented"); + } + });
addTableAction(extendLocatorId("Compare"), MSG.common_button_compare(), null, new AbstractTableAction( TableActionEnablement.MULTIPLE) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java index 662dff7..3b7accc 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java @@ -36,6 +36,7 @@ import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.domain.resource.composite.ResourceComposite; import org.rhq.enterprise.gui.coregui.client.components.table.TableSection; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard; import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail.OperationDetailsView; import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository; @@ -46,15 +47,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu; * @author Greg Hinkle */ public class OperationHistoryView extends TableSection { - - public static final String VIEW_ID = "RecentOperations"; - private static final String TITLE = MSG.view_operationHistoryList_title(); + public static final ViewName VIEW_ID = new ViewName("RecentOperations", MSG.common_title_recent_operations());
private ResourceComposite composite; private Resource resource;
public OperationHistoryView(String locatorId) { - super(locatorId, TITLE); + super(locatorId, VIEW_ID.getTitle()); setWidth100(); setHeight100();
@@ -63,9 +62,8 @@ public class OperationHistoryView extends TableSection { }
public OperationHistoryView(String locatorId, ResourceComposite resourceComposite) { - super(locatorId, TITLE, new Criteria(OperationHistoryDataSource.CriteriaField.RESOURCE_ID, - String.valueOf(resourceComposite.getResource() - .getId()))); + super(locatorId, VIEW_ID.getTitle(), new Criteria(OperationHistoryDataSource.CriteriaField.RESOURCE_ID, String + .valueOf(resourceComposite.getResource().getId()))); this.composite = resourceComposite; this.resource = resourceComposite.getResource();
@@ -134,9 +132,8 @@ public class OperationHistoryView extends TableSection { } });
- IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"), - MSG.view_operationHistoryList_button_runOperation(), - operationMenu); + IMenuButton operationsButton = new LocatableIMenuButton(this.extendLocatorId("Run"), MSG + .view_operationHistoryList_button_runOperation(), operationMenu); operationsButton.setShowMenuBelow(false); operationsButton.setAutoFit(true); addExtraWidget(operationsButton); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java index 212b8e1..38bfba0 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java @@ -34,6 +34,7 @@ import com.smartgwt.client.widgets.toolbar.ToolStrip; import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView; import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView; import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView; import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView; import org.rhq.enterprise.gui.coregui.client.report.ReportTopView; @@ -47,10 +48,10 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility; */ public class MenuBarView extends LocatableVLayout {
- public static final String[] SECTIONS = {DashboardsView.VIEW_ID, InventoryView.VIEW_ID, ReportTopView.VIEW_ID, - BundleTopView.VIEW_ID, AdministrationView.VIEW_ID}; + public static final ViewName[] SECTIONS = { DashboardsView.VIEW_ID, InventoryView.VIEW_ID, ReportTopView.VIEW_ID, + BundleTopView.VIEW_ID, AdministrationView.VIEW_ID };
- private String currentlySelectedSection = DashboardsView.VIEW_ID; + private String currentlySelectedSection = DashboardsView.VIEW_ID.getName();
public MenuBarView(String locatorId) { super(locatorId); @@ -111,7 +112,7 @@ public class MenuBarView extends LocatableVLayout { "<table style="height: 34px;" cellpadding="0" cellspacing="0"><tr>");
headerString.append("<td style="width: 1px;"><img src="images/header/header_bg_line.png"/></td>"); - for (String section : SECTIONS) { + for (ViewName section : SECTIONS) {
String styleClass = "TopSectionLink"; if (section.equals(currentlySelectedSection)) { @@ -119,9 +120,9 @@ public class MenuBarView extends LocatableVLayout { }
// Set explicit identifiers because the generated scLocator is not getting picked up by Selenium. - headerString.append("<td id="").append(section).append("" class="").append(styleClass) - .append("" onclick="document.location='#").append(section).append("'" >"); - headerString.append(section); + headerString.append("<td id="").append(section).append("" class="").append(styleClass).append( + "" onclick="document.location='#").append(section).append("'" >"); + headerString.append(section.getTitle()); headerString.append("</td>\n");
headerString.append("<td style="width: 1px;"><img src="images/header/header_bg_line.png"/></td>"); @@ -147,5 +148,5 @@ public class MenuBarView extends LocatableVLayout {
return layout; } - + } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java index 57ed643..5e1e957 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java @@ -34,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLe import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem; import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection; import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformPortletView; import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView; import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView; @@ -47,14 +48,14 @@ import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView; * @author Ian Springer */ public class ReportTopView extends AbstractSectionedLeftNavigationView { - public static final String VIEW_ID = "Reports"; + public static final ViewName VIEW_ID = new ViewName("Reports", MSG.view_reportsTop_title());
- private static final String SUBSYSTEMS_SECTION_VIEW_ID = "Subsystems"; - private static final String INVENTORY_SECTION_VIEW_ID = "Inventory"; + private static final ViewName SUBSYSTEMS_SECTION_VIEW_ID = new ViewName("Subsystems", MSG.view_reports_subsystems()); + private static final ViewName INVENTORY_SECTION_VIEW_ID = new ViewName("Inventory", MSG.common_title_inventory());
public ReportTopView() { // This is a top level view, so our locator id can simply be our view id. - super(VIEW_ID); + super(VIEW_ID.getName()); }
@Override @@ -81,65 +82,64 @@ public class ReportTopView extends AbstractSectionedLeftNavigationView { private NavigationSection buildSubsystemsSection() { NavigationItem tagItem = new NavigationItem(TaggedView.VIEW_ID, "global/Cloud_16.png", new ViewFactory() { public Canvas createView() { - return new TaggedView(extendLocatorId("Tag")); + return new TaggedView(extendLocatorId(TaggedView.VIEW_ID.getName())); } });
NavigationItem suspectMetricsItem = new NavigationItem(MeasurementOOBView.VIEW_ID, "subsystems/monitor/Monitor_failed_16.png", new ViewFactory() { - public Canvas createView() { - return new MeasurementOOBView(extendLocatorId("SuspectMetrics")); - } - }); + public Canvas createView() { + return new MeasurementOOBView(extendLocatorId(MeasurementOOBView.VIEW_ID.getName())); + } + });
NavigationItem recentConfigurationChangesItem = new NavigationItem(ConfigurationHistoryView.VIEW_ID, "subsystems/configure/Configure_16.png", new ViewFactory() { - public Canvas createView() { - return new ConfigurationHistoryView(extendLocatorId("ConfigHistory")); - } - }); + public Canvas createView() { + return new ConfigurationHistoryView(extendLocatorId(ConfigurationHistoryView.VIEW_ID.getName())); + } + });
NavigationItem recentOperationsItem = new NavigationItem(OperationHistoryView.VIEW_ID, "subsystems/control/Operation_16.png", new ViewFactory() { - public Canvas createView() { - return new OperationHistoryView(extendLocatorId("RecentOps")); - } - }); + public Canvas createView() { + return new OperationHistoryView(extendLocatorId(OperationHistoryView.VIEW_ID.getName())); + } + });
NavigationItem recentAlertsItem = new NavigationItem(AlertHistoryView.SUBSYSTEM_VIEW_ID, "subsystems/alert/Alert_LOW_16.png", new ViewFactory() { - public Canvas createView() { - return new AlertHistoryView(extendLocatorId("RecentAlerts")); - } - }); + public Canvas createView() { + return new AlertHistoryView(extendLocatorId(AlertHistoryView.SUBSYSTEM_VIEW_ID.getName())); + } + });
- NavigationItem alertDefinitionsItem = new NavigationItem("AlertDefinitions", + NavigationItem alertDefinitionsItem = new NavigationItem(new ViewName("AlertDefinitions"), "subsystems/alert/Alerts_16.png", new ViewFactory() { - public Canvas createView() { - return null; // TODO: mazz - } - }); + public Canvas createView() { + return null; // TODO: mazz + } + });
return new NavigationSection(SUBSYSTEMS_SECTION_VIEW_ID, tagItem, suspectMetricsItem, recentConfigurationChangesItem, recentOperationsItem, recentAlertsItem, alertDefinitionsItem); }
private NavigationSection buildInventorySection() { - NavigationItem - inventorySummaryItem = new NavigationItem("InventorySummary", "subsystems/inventory/Inventory_16.png", - new ViewFactory() { + NavigationItem inventorySummaryItem = new NavigationItem(new ViewName("InventorySummary", MSG + .common_title_inventorySummary()), "subsystems/inventory/Inventory_16.png", new ViewFactory() { public Canvas createView() { return new FullHTMLPane(extendLocatorId("InventorySummary"), "/rhq/admin/report/resourceInstallReport-body.xhtml"); } });
- NavigationItem platformSystemInfoItem = new NavigationItem(PlatformPortletView.VIEW_ID, "types/Platform_up_16.png", - new ViewFactory() { - public Canvas createView() { - return new PlatformPortletView(extendLocatorId("Platforms")); - } - }); + NavigationItem platformSystemInfoItem = new NavigationItem(PlatformPortletView.VIEW_ID, + "types/Platform_up_16.png", new ViewFactory() { + public Canvas createView() { + return new PlatformPortletView(extendLocatorId(PlatformPortletView.VIEW_ID.getName())); + } + });
return new NavigationSection(INVENTORY_SECTION_VIEW_ID, inventorySummaryItem, platformSystemInfoItem); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java index 33a706c..e70a673 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java @@ -26,17 +26,17 @@ import com.smartgwt.client.widgets.grid.CellFormatter; import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.enterprise.gui.coregui.client.components.table.Table; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
/** * @author Greg Hinkle */ public class MeasurementOOBView extends Table {
- public static final String VIEW_ID = "SuspectMetrics"; - private static final String TITLE = MSG.view_measurementOob_title(); + public static final ViewName VIEW_ID = new ViewName("SuspectMetrics", MSG.view_measurementOob_title());
public MeasurementOOBView(String locatorId) { - super(locatorId, TITLE); + super(locatorId, VIEW_ID.getTitle());
setDataSource(new MeasurementOOBDataSource()); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java index 1c61a5e..192b0f6 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java @@ -34,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.bundle.destination.BundleDestinatio import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView; import org.rhq.enterprise.gui.coregui.client.bundle.version.BundleVersionListView; import org.rhq.enterprise.gui.coregui.client.components.table.Table; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTileLayout; import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; @@ -43,7 +44,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; */ public class TaggedView extends LocatableVLayout implements BookmarkableView {
- public static final String VIEW_ID = "Tag"; + public static final ViewName VIEW_ID = new ViewName("Tag", MSG.view_tags_tags());
private TagCloudView tagCloudView;
@@ -103,8 +104,8 @@ public class TaggedView extends LocatableVLayout implements BookmarkableView { criteria); tiles.add(bundleDestinationListView);
- ResourceSearchView resourceView = new ResourceSearchView(getLocatorId(), criteria, - MSG.view_taggedResources_title()); + ResourceSearchView resourceView = new ResourceSearchView(getLocatorId(), criteria, MSG + .view_taggedResources_title()); tiles.add(resourceView);
for (Table t : tiles) { @@ -124,5 +125,5 @@ public class TaggedView extends LocatableVLayout implements BookmarkableView { viewTag(tagString); } } - + } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java index d1e1c85..522bc5d 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java @@ -28,6 +28,7 @@ import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLe import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem; import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection; import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory; +import org.rhq.enterprise.gui.coregui.client.components.view.ViewName; import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector; import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeView; import org.rhq.enterprise.gui.coregui.client.test.configuration.TestConfigurationView; @@ -41,28 +42,27 @@ import org.rhq.enterprise.gui.coregui.client.test.i18n.TestPluralizationView; * @author Ian Springer */ public class TestTopView extends AbstractSectionedLeftNavigationView { - - public static final String VIEW_ID = "Test"; + public static final ViewName VIEW_ID = new ViewName("Test");
// view IDs for Inventory section - private static final String INVENTORY_SECTION_VIEW_ID = "Inventory"; + private static final ViewName INVENTORY_SECTION_VIEW_ID = new ViewName("Inventory");
- private static final String PAGE_RESOURCE_SELECTOR = "ResourceSelector"; - private static final String PAGE_TYPE_TREE = "TypeTree"; + private static final ViewName PAGE_RESOURCE_SELECTOR = new ViewName("ResourceSelector"); + private static final ViewName PAGE_TYPE_TREE = new ViewName("TypeTree");
// view IDs for Configuration section - private static final String CONFIGURATION_SECTION_VIEW_ID = "Configuration"; + private static final ViewName CONFIGURATION_SECTION_VIEW_ID = new ViewName("Configuration");
- private static final String PAGE_CONFIG_EDITOR = "ConfigEditor"; - private static final String PAGE_GROUP_CONFIG_EDITOR = "GroupConfigEditor"; + private static final ViewName PAGE_CONFIG_EDITOR = new ViewName("ConfigEditor"); + private static final ViewName PAGE_GROUP_CONFIG_EDITOR = new ViewName("GroupConfigEditor");
// view IDs for Misc section - private static final String MISC_SECTION_VIEW_ID = "Misc"; - private static final String PAGE_PLURALIZATION_TEST = "PluralizationTest"; + private static final ViewName MISC_SECTION_VIEW_ID = new ViewName("Misc"); + private static final ViewName PAGE_PLURALIZATION_TEST = new ViewName("PluralizationTest");
public TestTopView() { // This is a top level view, so our locator id can simply be our view id. - super(VIEW_ID); + super(VIEW_ID.getName()); }
protected Canvas defaultView() { @@ -91,13 +91,13 @@ public class TestTopView extends AbstractSectionedLeftNavigationView { private NavigationSection buildInventorySection() { NavigationItem resourceSelectorItem = new NavigationItem(PAGE_RESOURCE_SELECTOR, null, new ViewFactory() { public Canvas createView() { - return new ResourceSelector(extendLocatorId(PAGE_RESOURCE_SELECTOR)); + return new ResourceSelector(extendLocatorId(PAGE_RESOURCE_SELECTOR.getName())); } });
NavigationItem typeTreeItem = new NavigationItem(PAGE_TYPE_TREE, null, new ViewFactory() { public Canvas createView() { - return new ResourceTypeTreeView(extendLocatorId(PAGE_TYPE_TREE)); + return new ResourceTypeTreeView(extendLocatorId(PAGE_TYPE_TREE.getName())); } });
@@ -107,13 +107,13 @@ public class TestTopView extends AbstractSectionedLeftNavigationView { private NavigationSection buildConfigurationSection() { NavigationItem configEditorItem = new NavigationItem(PAGE_CONFIG_EDITOR, null, new ViewFactory() { public Canvas createView() { - return new TestConfigurationView(extendLocatorId(PAGE_CONFIG_EDITOR)); + return new TestConfigurationView(extendLocatorId(PAGE_CONFIG_EDITOR.getName())); } });
NavigationItem groupConfigEditorItem = new NavigationItem(PAGE_GROUP_CONFIG_EDITOR, null, new ViewFactory() { public Canvas createView() { - return new TestGroupConfigurationView(extendLocatorId(PAGE_GROUP_CONFIG_EDITOR)); + return new TestGroupConfigurationView(extendLocatorId(PAGE_GROUP_CONFIG_EDITOR.getName())); } });
@@ -123,7 +123,7 @@ public class TestTopView extends AbstractSectionedLeftNavigationView { private NavigationSection buildMiscSection() { NavigationItem pluralizationItem = new NavigationItem(PAGE_PLURALIZATION_TEST, null, new ViewFactory() { public Canvas createView() { - return new TestPluralizationView(extendLocatorId(PAGE_PLURALIZATION_TEST)); + return new TestPluralizationView(extendLocatorId(PAGE_PLURALIZATION_TEST.getName())); } });
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableCanvas.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableCanvas.java new file mode 100644 index 0000000..41e7fa4 --- /dev/null +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableCanvas.java @@ -0,0 +1,34 @@ +package org.rhq.enterprise.gui.coregui.client.util.selenium; + +import com.smartgwt.client.widgets.Canvas; + +/** + * Wrapper for com.smartgwt.client.widgets.Canvas that sets the ID for use with selenium scLocators. + * + * @author Jay Shaughnessy + */ +public class LocatableCanvas extends Canvas implements Locatable { + + private String locatorId; + + /** + * <pre> + * ID Format: "simpleClassname_locatorId" + * </pre> + * @param locatorId not null or empty. + */ + public LocatableCanvas(String locatorId) { + super(); + this.locatorId = locatorId; + SeleniumUtility.setID(this, locatorId); + } + + public String getLocatorId() { + return locatorId; + } + + public String extendLocatorId(String extension) { + return this.locatorId + "_" + extension; + } + +} diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties index d8c930b..18d2094 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties @@ -107,8 +107,9 @@ common_title_recent_alerts = Recent Alerts~ common_title_recent_operations=Recent Operations~ common_title_remove_column=Remove Column~ common_title_resource = Resource~ +common_title_resource_group = Resource Group~ common_title_resource_inventory=Resource Inventory~ -ommon_title_resource_id=Resource ID~ +common_title_resource_id=Resource ID~ common_title_resource_name=Resource Name~ common_title_scheduled_operations=Scheduled Operations~ common_title_selected_resources=Selected Resources~ @@ -571,7 +572,7 @@ view_portlet_operations_config_scheduled_enable=Whether to enable scheduled oper view_portlet_operations_config_scheduled_maximum=Maximum number of Scheduled operations to display.~ view_portlet_operations_config_completed=completed operations~ view_portlet_operations_config_show_last=show Last~ -view_portlet_operations_config_show_next=show Next~ +view_portlet_operations_config_show_next=show Next~ view_portlet_operations_config_title=OperationsPortlet Configuration~ view_portlet_operations_config_title_desc=The configuration settings for the Operations portlet.~ view_portlet_operations_disabled=(Results currently disabled. Change settings to enable results.~ @@ -592,7 +593,7 @@ view_portlet_recentAlerts_config_members=Select Members~ view_portlet_recentAlerts_config_priority_label = priority Alerts,~ view_portlet_recentAlerts_config_when=within the past~ view_portlet_recentAlerts_help_msg = Displays recent alerts fired on resources visible to the current user login.~ -# dup in common +// dup in common view_portlet_recentAlerts_title = Recent Alerts~ view_portlet_recentlyAdded_approved_platforms=recently approved platforms on dashboard.~ view_portlet_recentlyAdded_error1=Failed to load recently added resources~ @@ -962,7 +963,8 @@ view_searchGUI_loginStatus = Unable to determine login status, check server stat #-------------------------- view_messageCenter_button_messages = Messages~ view_messageCenter_noRecentMessages = No Recent Messages~ -view_messageCenter_messageTitle= Title~ +view_messageCenter_messageTitle= Message Center~ view_messageCenter_messageSeverity= Severity~ view_messageCenter_messageTime= Time~ view_messageCenter_messageDetail= Detail~ +
rhq-commits@lists.fedorahosted.org