Include the RTL versions of style sheets only after the Application has been added to the page in Showcase. Otherwise, the app will attempt to set the width of the content based on the width of the main nav menu, which isn't available because we dropped the LTR style sheet but we haven't loaded the RTL version yet. Also removed some unnecessary style definitions.
Patch by: jlabanca
Review by: rajeev
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2404 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
index d432827..f35b8c2 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
@@ -165,9 +165,6 @@
* This is the entry point method.
*/
public void onModuleLoad() {
- // Immediately add the CSS files
- includeStyleSheets();
-
// Create the constants
ShowcaseConstants constants = (ShowcaseConstants) GWT.create(ShowcaseConstants.class);
@@ -179,6 +176,16 @@
setupMainMenu(constants);
RootPanel.get().add(app);
+ // Swap out the style sheets for the RTL versions if needed. We need to do
+ // this after the app is loaded because the app will setup the layout based
+ // on the width of the main menu, which is defined in the style sheet. If
+ // we swap the style sheets first, the app may load without any style sheet
+ // to define the main menu width, because the RTL version is still being
+ // loaded. Note that we are basing the layout on the width defined in the
+ // LTR version, so both versions should use the same width for the main nav
+ // menu.
+ includeStyleSheets();
+
// Add an listener that sets the content widget when a menu item is selected
app.setListener(new ApplicationListener() {
public void onMenuItemSelected(TreeItem item) {
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.css b/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.css
index ee4a580..eb13d60 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.css
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.css
@@ -64,12 +64,6 @@
.Application-content-decorator {
margin-right: 8px;
}
-
-.Application-content-decorator .middleCenter .topRightInner,
-.Application-content-decorator .middleCenter .middleRightInner,
-.Application-content-decorator .middleCenter .bottomRightInner {
- display: block;
-}
.Application-content-title {
padding: 4px 0px 3px 6px;
text-align: left;
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.rtl.css b/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.rtl.css
index 546888c..f963318 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.rtl.css
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/public/Showcase.rtl.css
@@ -64,12 +64,6 @@
.Application-content-decorator {
margin-left: 8px;
}
-
-.Application-content-decorator .middleCenter .topLeftInner,
-.Application-content-decorator .middleCenter .middleLeftInner,
-.Application-content-decorator .middleCenter .bottomLeftInner {
- display: block;
-}
.Application-content-title {
padding: 4px 6px 3px 0px;
text-align: right;