Fixed the content area in Showcase so it resizes correctly when the page is first loaded in an RTL language. Also fixed the alignment of the contents in RTL. This patch is TBR.
Patch by: jlabanca
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2377 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/Application.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/Application.java
index c8c2774..2d77d25 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/Application.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/Application.java
@@ -159,8 +159,15 @@
contentDecorator.setWidget(contentLayout);
contentDecorator.addStyleName(DEFAULT_STYLE_NAME + "-content-decorator");
bottomPanel.add(contentDecorator);
- bottomPanel.setCellHorizontalAlignment(contentDecorator,
- HasHorizontalAlignment.ALIGN_RIGHT);
+ if (LocaleInfo.getCurrentLocale().isRTL()) {
+ bottomPanel.setCellHorizontalAlignment(contentDecorator,
+ HasHorizontalAlignment.ALIGN_LEFT);
+ contentDecorator.getElement().setAttribute("align", "LEFT");
+ } else {
+ bottomPanel.setCellHorizontalAlignment(contentDecorator,
+ HasHorizontalAlignment.ALIGN_RIGHT);
+ contentDecorator.getElement().setAttribute("align", "RIGHT");
+ }
CellFormatter formatter = contentLayout.getCellFormatter();
// Add the content title
@@ -221,7 +228,7 @@
windowWidth = width;
int menuWidth = mainMenu.getOffsetWidth();
int contentWidth = width - menuWidth - 30;
- int contentWidthInner = width - menuWidth - 10;
+ int contentWidthInner = contentWidth - 10;
bottomPanel.setCellWidth(mainMenu, menuWidth + "px");
bottomPanel.setCellWidth(contentLayout, contentWidth + "px");
contentLayout.getCellFormatter().setWidth(0, 0, contentWidthInner + "px");
@@ -299,6 +306,7 @@
// Setup the main menu
ApplicationImages treeImages = GWT.create(ApplicationImages.class);
mainMenu = new Tree(treeImages);
+ mainMenu.setWidth("180px");
mainMenu.addStyleName(DEFAULT_STYLE_NAME + "-menu");
mainMenu.addTreeListener(new TreeListener() {
public void onTreeItemSelected(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 cfea6dd..077dca5 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
@@ -54,7 +54,6 @@
background: #222222;
}
.Application-menu {
- width: 180px;
text-align: left;
}