Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wagner2014-01-28 07:09:46 +0000
committerKen Lee2014-01-28 09:51:43 +0000
commit85b01185f64c1ca473157243e9b707ae78f407e5 (patch)
treea0eee886826abd6a955636612eda44533f8c539e
parent223c838209313bf7b7df4ad6271bad87e002c8ad (diff)
downloadorg.eclipse.scout.rt-85b01185f64c1ca473157243e9b707ae78f407e5.tar.gz
org.eclipse.scout.rt-85b01185f64c1ca473157243e9b707ae78f407e5.tar.xz
org.eclipse.scout.rt-85b01185f64c1ca473157243e9b707ae78f407e5.zip
Bug 426761 - RAP Tablet/Mobile: dialog resizes to fit content and is not
scrollable anymore Change-Id: I9d3801441d5b3f03e5396a248015c546da665077 Signed-off-by: Michael Wagner <mwa@bsiag.com> Reviewed-on: https://git.eclipse.org/r/21174 Tested-by: Hudson CI Reviewed-by: Ken Lee <kle@bsiag.com> IP-Clean: Ken Lee <kle@bsiag.com>
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/AbstractMobileStandaloneRwtEnvironment.java2
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/RwtMobileShellValidateRoot.java60
-rw-r--r--org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java7
-rw-r--r--org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java8
4 files changed, 74 insertions, 3 deletions
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/AbstractMobileStandaloneRwtEnvironment.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/AbstractMobileStandaloneRwtEnvironment.java
index 94a46ae517..cf9c5b6c4e 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/AbstractMobileStandaloneRwtEnvironment.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/AbstractMobileStandaloneRwtEnvironment.java
@@ -46,7 +46,7 @@ import org.osgi.framework.Bundle;
public abstract class AbstractMobileStandaloneRwtEnvironment extends AbstractStandaloneRwtEnvironment {
//TODO CGU move to look and feel decoration
- private static final int FORM_HEADER_HEIGHT = 43;
+ public static final int FORM_HEADER_HEIGHT = 43;
public AbstractMobileStandaloneRwtEnvironment(Bundle applicationBundle, Class<? extends IClientSession> clientSessionClazz) {
super(applicationBundle, clientSessionClazz);
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/RwtMobileShellValidateRoot.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/RwtMobileShellValidateRoot.java
new file mode 100644
index 0000000000..51aaa5bb79
--- /dev/null
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/RwtMobileShellValidateRoot.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.ui.rap.mobile;
+
+import org.eclipse.scout.rt.client.mobile.ui.form.AbstractMobileForm;
+import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
+import org.eclipse.scout.rt.ui.rap.RwtShellValidateRoot;
+import org.eclipse.scout.rt.ui.rap.mobile.window.dialog.RwtScoutMobileDialog;
+import org.eclipse.scout.rt.ui.rap.window.IRwtScoutPart;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ *
+ */
+public class RwtMobileShellValidateRoot extends RwtShellValidateRoot {
+
+ /**
+ * @param root
+ * @param env
+ */
+ public RwtMobileShellValidateRoot(Shell root, IRwtEnvironment env) {
+ super(root, env);
+ }
+
+ @Override
+ protected void setBoundsIfResizeIsNeeded(Rectangle curShellBounds, Point prefSize) {
+ int dhPref = 0;
+ if (curShellBounds != null && prefSize != null) {
+ dhPref = prefSize.y - curShellBounds.height;
+
+ for (IRwtScoutPart rwtScoutPart : getEnvironment().getOpenFormParts()) {
+ if (rwtScoutPart.isActive() && rwtScoutPart instanceof RwtScoutMobileDialog) {
+ // If the header of mobile forms is visible subtract the header height from the perSize
+ if (AbstractMobileForm.isHeaderVisible(rwtScoutPart.getScoutObject()) && prefSize.y >= AbstractMobileStandaloneRwtEnvironment.FORM_HEADER_HEIGHT) {
+ dhPref -= AbstractMobileStandaloneRwtEnvironment.FORM_HEADER_HEIGHT;
+ // if perfSize is higher than the parents client area reduce the height to the parent height (because mobile forms are always scrollable)
+ if (getShell().getParent() != null && prefSize.y > getShell().getParent().getClientArea().height) {
+ prefSize.y = getShell().getParent().getClientArea().height;
+ }
+ break;
+ }
+ }
+ }
+
+ if (dhPref != 0) {
+ getShell().setBounds(new Rectangle(curShellBounds.x, curShellBounds.y, curShellBounds.width, prefSize.y));
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java
index d78ba7018c..ae24d96099 100644
--- a/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java
+++ b/org.eclipse.scout.rt.ui.rap.mobile/src/org/eclipse/scout/rt/ui/rap/mobile/window/dialog/RwtScoutMobileDialog.java
@@ -11,8 +11,10 @@
package org.eclipse.scout.rt.ui.rap.mobile.window.dialog;
import org.eclipse.scout.rt.client.ui.form.IForm;
+import org.eclipse.scout.rt.ui.rap.DefaultValidateRoot;
import org.eclipse.scout.rt.ui.rap.IRwtEnvironment;
import org.eclipse.scout.rt.ui.rap.IRwtStandaloneEnvironment;
+import org.eclipse.scout.rt.ui.rap.mobile.RwtMobileShellValidateRoot;
import org.eclipse.scout.rt.ui.rap.window.IFormBoundsProvider;
import org.eclipse.scout.rt.ui.rap.window.dialog.RwtScoutDialog;
import org.eclipse.swt.SWT;
@@ -87,4 +89,9 @@ public class RwtScoutMobileDialog extends RwtScoutDialog {
}
}
+ @Override
+ protected DefaultValidateRoot createShellValidateRoot(Shell shell, IRwtEnvironment env) {
+ return new RwtMobileShellValidateRoot(shell, env);
+ }
+
}
diff --git a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java
index 926b2a8743..de80c5eeb3 100644
--- a/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java
+++ b/org.eclipse.scout.rt.ui.rap/src/org/eclipse/scout/rt/ui/rap/RwtShellValidateRoot.java
@@ -30,7 +30,7 @@ public class RwtShellValidateRoot extends DefaultValidateRoot {
m_env = env;
}
- private Shell getShell() {
+ protected Shell getShell() {
return (Shell) getUiComposite();
}
@@ -50,11 +50,15 @@ public class RwtShellValidateRoot extends DefaultValidateRoot {
super.validate();
Rectangle curShellBounds = getShell().getBounds();
Point prefSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ setBoundsIfResizeIsNeeded(curShellBounds, prefSize);
+ }
+ protected void setBoundsIfResizeIsNeeded(Rectangle curShellBounds, Point prefSize) {
int dhPref = 0;
if (curShellBounds != null && prefSize != null) {
dhPref = prefSize.y - curShellBounds.height;
- if (dhPref > 0) {
+
+ if (dhPref != 0) {
getShell().setBounds(new Rectangle(curShellBounds.x, curShellBounds.y, curShellBounds.width, prefSize.y));
}
}

Back to the top