modules/enterprise/gui/coregui/pom.xml
| 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
| 86 +++-------
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/MessageConstants.properties
| 52 ++++++
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/MessageConstants_de.properties
| 52 ++++++
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
| 11 -
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
| 12 -
7 files changed, 149 insertions(+), 70 deletions(-)
New commits:
commit fbde2b7f3a1955bbd78645b39d573aff26f76c43
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 8 17:59:44 2011 -0500
Improve the Help View
Migrate the urls to I18N properties for easy modification. Moreover, make
the help sections table-driven from properties. To do this defined the necessary
properties in a new file, MessageConstants.properties. This file is used
to generate a ConstantsWithLookup interface, which allows for querying for
properties at runtime, when you may not know the method name at compile
time.
- added generation of new MessageConstants.java to the pom
- added public accessor in CoreGUI
- Changed HelpView to be table-driven off new props
- added new propertis file
- tried my best at keeping the German translation in sync
= Make the Help sections
diff --git a/modules/enterprise/gui/coregui/pom.xml
b/modules/enterprise/gui/coregui/pom.xml
index fc41629..ee8fa77 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -277,6 +277,7 @@
<debugSuspend>false</debugSuspend>
<servicePattern>**/gwt/*GWTService.java</servicePattern>
<i18nMessagesBundle>org.rhq.enterprise.gui.coregui.client.Messages</i18nMessagesBundle>
+
<i18nConstantsWithLookupBundle>org.rhq.enterprise.gui.coregui.client.MessageConstants</i18nConstantsWithLookupBundle>
<compileSourcesArtifacts>org.rhq:rhq-core-domain</compileSourcesArtifacts>
<style>DETAILED</style>
</configuration>
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 d523ab9..fb04a3b 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
@@ -68,6 +68,7 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
// This must come first to ensure proper I18N class loading for dev mode
private static final Messages MSG = GWT.create(Messages.class);
+ private static final MessageConstants MSGCONST = GWT.create(MessageConstants.class);
private static final String DEFAULT_VIEW_PATH = DashboardsView.VIEW_ID.getName();
@@ -309,6 +310,10 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
return MSG;
}
+ public static MessageConstants getMessageConstants() {
+ return MSGCONST;
+ }
+
private class RootCanvas extends VLayout implements BookmarkableView {
private ViewId currentViewId;
private Canvas currentCanvas;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
index d5380a8..47865a8 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/help/HelpView.java
@@ -24,6 +24,7 @@ package org.rhq.enterprise.gui.coregui.client.help;
import java.util.ArrayList;
import java.util.List;
+import java.util.MissingResourceException;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
@@ -31,6 +32,7 @@ import com.smartgwt.client.widgets.HTMLFlow;
import org.rhq.core.domain.common.ProductInfo;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.MessageConstants;
import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import
org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLeftNavigationView;
@@ -48,9 +50,8 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class HelpView extends AbstractSectionedLeftNavigationView {
public static final ViewName VIEW_ID = new ViewName("Help",
MSG.common_title_help());
- private static final ViewName SECTION_DOC_VIEW_ID = new
ViewName("Documentation", MSG
- .view_helpSection_documentation());
- private static final ViewName SECTION_TUTORIAL_VIEW_ID = new
ViewName("Tutorial", MSG.view_helpSection_tutorial());
+ private static final ViewName SECTION_PRODUCT_VIEW_ID = new
ViewName("Product", MSG.view_help_section_product());
+
private static ProductInfo PRODUCT_INFO;
public HelpView() {
@@ -62,11 +63,10 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
protected List<NavigationSection> getNavigationSections() {
List<NavigationSection> sections = new
ArrayList<NavigationSection>();
- NavigationSection docSection = buildDocSection();
+ NavigationSection docSection = buildProductSection();
sections.add(docSection);
- NavigationSection tutorialSection = buildTutorialSection();
- sections.add(tutorialSection);
+ addUrlSections(sections);
return sections;
}
@@ -79,9 +79,9 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
return flow;
}
- private NavigationSection buildDocSection() {
+ private NavigationSection buildProductSection() {
- NavigationItem aboutItem = new NavigationItem(new ViewName("AboutBox",
MSG.view_help_docAbout()),
+ NavigationItem aboutItem = new NavigationItem(new ViewName("AboutBox",
MSG.view_help_section_product_about()),
"[SKIN]/../actions/help.png", new ViewFactory() {
public Canvas createView() {
final AboutModalWindow aboutModalWindow = new AboutModalWindow();
@@ -104,58 +104,40 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
}
});
- NavigationItem docItem = new NavigationItem(new ViewName("TOC",
MSG.view_help_docToc()),
- "[SKIN]/../headerIcons/document.png", new ViewFactory() {
- public Canvas createView() {
- return new FullHTMLPane(extendLocatorId("TOC"),
"http://www.rhq-project.org/display/JOPR2/Home");
- }
- });
-
- NavigationItem faqItem = new NavigationItem(new ViewName("FAQ",
MSG.view_help_docFaq()),
- "[SKIN]/../headerIcons/document.png", new ViewFactory() {
- public Canvas createView() {
- return new FullHTMLPane(extendLocatorId("FAQ"),
"http://www.rhq-project.org/display/JOPR2/FAQ");
- }
- });
-
- return new NavigationSection(SECTION_DOC_VIEW_ID, aboutItem, docItem, faqItem);
+ return new NavigationSection(SECTION_PRODUCT_VIEW_ID, aboutItem);
}
- private NavigationSection buildTutorialSection() {
+ private void addUrlSections(List<NavigationSection> sections) {
- NavigationItem searchItem = new NavigationItem(new
ViewName("TutorialSearch", MSG.view_help_tutorialSearch()),
- "[SKIN]/../actions/help.png", new ViewFactory() {
- public Canvas createView() {
- return new FullHTMLPane(extendLocatorId("TutorialSearch"),
- "http://www.rhq-project.org/display/JOPR2/Search");
- }
- });
+ MessageConstants mc = CoreGUI.getMessageConstants();
+ int numSections = Integer.valueOf(mc.view_help_section_count());
- NavigationItem dynaGroupItem = new NavigationItem(new
ViewName("TutorialDynaGroup", MSG
- .view_help_tutorialDynaGroup()), "[SKIN]/../actions/help.png", new
ViewFactory() {
- public Canvas createView() {
- return new FullHTMLPane(
- extendLocatorId("TutorialDynaGroup"),
-
"http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/2.4/html/Basic_Admin_Guide/sect-Basic_Admin_Guide-Managing_Groups.html#sect-Basic_Admin_Guide-Managing_Groups-Tutorial");
- }
- });
+ for (int i = 1; i <= numSections; ++i) {
+ int numItems = Integer.valueOf(mc.getString("view_help_section_" +
i + "_item_count"));
+ NavigationItem[] items = new NavigationItem[numItems];
+ String sectionTitle = mc.getString("view_help_section_" + i +
"_title");
- NavigationItem demoAllItem = new NavigationItem(new ViewName("DemoAll",
MSG.view_help_tutorialDemoAll()),
- "[SKIN]/../headerIcons/document.png", new ViewFactory() {
- public Canvas createView() {
- return new FullHTMLPane(extendLocatorId("DemoAll"),
- "http://www.rhq-project.org/display/JOPR2/Demos");
+ for (int j = 1; j <= numItems; ++j) {
+ String title = mc.getString("view_help_section_" + i +
"_propTitle_" + j);
+ final String url = mc.getString("view_help_section_" + i +
"_propUrl_" + j);
+ String icon;
+ try {
+ icon = mc.getString("view_help_section_" + i +
"_propIcon_" + j);
+ } catch (MissingResourceException e) {
+ icon = "[SKIN]/../headerIcons/document.png";
}
- });
- NavigationItem demoBundleItem = new NavigationItem(new
ViewName("DemoBundle", MSG
- .view_help_tutorialDemoBundle()),
"[SKIN]/../headerIcons/document.png", new ViewFactory() {
- public Canvas createView() {
- return new FullHTMLPane(extendLocatorId("DemoBundle"),
-
"http://mazz.fedorapeople.org/demos/provisioning_beta/prov-beta.htm");
+ final String itemName = "Section" + i + "Item" + j;
+ NavigationItem item = new NavigationItem(new ViewName(itemName, title),
icon, new ViewFactory() {
+ public Canvas createView() {
+ return new FullHTMLPane(extendLocatorId(itemName), url);
+ }
+ });
+ items[j - 1] = item;
}
- });
- return new NavigationSection(SECTION_TUTORIAL_VIEW_ID, searchItem, dynaGroupItem,
demoAllItem, demoBundleItem);
+ NavigationSection section = new NavigationSection(new
ViewName("Section" + i, sectionTitle), items);
+ sections.add(section);
+ }
}
}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/MessageConstants.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/MessageConstants.properties
new file mode 100644
index 0000000..5eedb0a
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/MessageConstants.properties
@@ -0,0 +1,52 @@
+#
+# RHQ GUI i18n Message Constants - English
+# This is used specifically for properties needing lookup by name, at runtime. These
+# constant properties can be localized but can not have arguments.
+###################################
+
+#=================== Help URLs =====================
+# The Help sections and entries are table driven via property lookups. The following
property
+# names are expected:
+#
+# The number of help sections:
+#
+# view_help_section_count = numSectionsInteger
+#
+# For each section:
+# N = 1..numSections
+#
+# view_help_section_N_title = localized title for section in the sectionStack
+# view_help_section_N_item_count = numSectionItemsInteger
+#
+# For each url entry in the section N:
+# M = 1..numSectionItems
+#
+# view_help_section_N_propTitle_M = localized title for the help (required)
+# view_help_section_N_propIcon_M = icon path (optional, defaults to document icon)
+# view_help_section_N_propUrl_M = url for the help (required)
+#
+view_help_section_count = 2
+
+view_help_section_1_title = Documentation
+view_help_section_1_item_count = 3
+
+view_help_section_1_propTitle_1 = Frequently Asked Questions (FAQ)
+view_help_section_1_propUrl_1 =
http://www.rhq-project.org/display/JOPR2/FAQ
+view_help_section_1_propTitle_2 = Documentation Set
+view_help_section_1_propUrl_2 =
http://www.rhq-project.org/display/JOPR2/Home
+view_help_section_1_propTitle_3 = API Javadoc
+view_help_section_1_propUrl_3 =
http://www.rhq-project.org/display/JOPR2/API+Documentation
+
+view_help_section_2_title = Tutorial
+view_help_section_2_item_count = 4
+
+view_help_section_2_propTitle_1 = Demo: All Demos
+view_help_section_2_propUrl_1 =
http://www.rhq-project.org/display/JOPR2/Demos
+view_help_section_2_propTitle_2 = Demo: Bundle Provisioning
+view_help_section_2_propUrl_2 =
http://management-platform.blogspot.com/2011/01/bundle-provisioning-via-r...
+view_help_section_2_propTitle_3 = How to build Group Definitions
+view_help_section_2_propIcon_3 = [SKIN]/../actions/help.png
+view_help_section_2_propUrl_3 =
http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/2.4/html/Basic...
+view_help_section_2_propTitle_4 = How to use the Search Bar
+view_help_section_2_propIcon_4 = [SKIN]/../actions/help.png
+view_help_section_2_propUrl_4 =
http://www.rhq-project.org/display/JOPR2/Search
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/MessageConstants_de.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/MessageConstants_de.properties
new file mode 100644
index 0000000..f864527
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/MessageConstants_de.properties
@@ -0,0 +1,52 @@
+#
+# RHQ GUI i18n Message Constants - English
+# This is used specifically for properties needing lookup by name, at runtime. These
+# constant properties can be localized but can not have arguments.
+###################################
+
+#=================== Help URLs =====================
+# The Help sections and entries are table driven via property lookups. The following
property
+# names are expected:
+#
+# The number of help sections:
+#
+# view_help_section_count = numSectionsInteger
+#
+# For each section:
+# N = 1..numSections
+#
+# view_help_section_N_title = localized title for section in the sectionStack
+# view_help_section_N_item_count = numSectionItemsInteger
+#
+# For each url entry in the section N:
+# M = 1..numSectionItems
+#
+# view_help_section_N_propTitle_M = localized title for the help (required)
+# view_help_section_N_propIcon_M = icon path (optional, defaults to document icon)
+# view_help_section_N_propUrl_M = url for the help (required)
+#
+view_help_section_count = 2
+
+view_help_section_1_title = Dokumentation
+view_help_section_1_item_count = 3
+
+view_help_section_1_propTitle_1 = Frequently Asked Questions (FAQ)
+view_help_section_1_propUrl_1 =
http://www.rhq-project.org/display/JOPR2/FAQ
+view_help_section_1_propTitle_2 = Dokumentation
+view_help_section_1_propUrl_2 =
http://www.rhq-project.org/display/JOPR2/Home
+view_help_section_1_propTitle_3 = API Javadoc
+view_help_section_1_propUrl_3 =
http://www.rhq-project.org/display/JOPR2/API+Documentation
+
+view_help_section_2_title = Tutorium
+view_help_section_2_item_count = 4
+
+view_help_section_2_propTitle_1 = Demo: Alles
+view_help_section_2_propUrl_1 =
http://www.rhq-project.org/display/JOPR2/Demos
+view_help_section_2_propTitle_2 = Demo: Bundles Installieren
+view_help_section_2_propUrl_2 =
http://management-platform.blogspot.com/2011/01/bundle-provisioning-via-r...
+view_help_section_2_propTitle_3 = Wie erstellt man Gruppen-Definitionen
+view_help_section_2_propIcon_3 = [SKIN]/../actions/help.png
+view_help_section_2_propUrl_3 =
http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/2.4/html/Basic...
+view_help_section_2_propTitle_4 = Wie benutzt man die Suchleiste
+view_help_section_2_propIcon_4 = [SKIN]/../actions/help.png
+view_help_section_2_propUrl_4 =
http://www.rhq-project.org/display/JOPR2/Search
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 ff8d7bd..f6d33a2 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
@@ -1654,16 +1654,9 @@ view_taggedResources_title = Tagged Resources
#==================== Help ======================
-view_help_docAbout = About
-view_help_docFaq = Frequently Asked Questions (FAQ)
-view_help_docToc = Documentation
-view_help_tutorialDemoAll = Demo: All
-view_help_tutorialDemoBundle = Demo: Bundle Provisioning
-view_help_tutorialDynaGroup = How to build Group Definitions
-view_help_tutorialSearch = How to use the Search Bar
-view_helpSection_documentation = Documentation
-view_helpSection_tutorial = Tutorial
view_helpTop_description = This section provides access to documentation, tutorials,
version, and other helpful information.
+view_help_section_product = Product
+view_help_section_product_about = About
#===================== Test =======================
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index 35de497..a2223fa 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1406,16 +1406,10 @@ view_taggedResources_title = Markierte Ressourcen
#==================== Help ======================
-view_help_docAbout = Über
-view_help_docFaq = Frequently Asked Questions (FAQ)
-view_help_docToc = Dockumentation
-view_help_tutorialDemoAll = Demo: Alles
-view_help_tutorialDemoBundle = Demo: Bundles Installieren
-view_help_tutorialDynaGroup = Wie erstellt man Gruppen-Definitionen
-view_help_tutorialSearch = Wie benutzt man die Suchleiste
-view_helpSection_documentation = Dokumentation
-view_helpSection_tutorial = Tutorium
view_helpTop_description = Dieser Abschnitt bietet Zugang zu Dokumentation, Tutorien,
Versions- und anderer hilfreicher Information.
+view_help_section_product = Produkt
+view_help_section_product_about = Über
+
#===================== Test =======================
view_testTop_title = Test
view_testTop_description = This section contains pages for testing various GUI
components.~