From ca9fab0922d9db510c51f2d363b46577f7f6c0c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Thu, 26 Jul 2012 09:57:12 +0000 Subject: [PATCH] A better patch and test for #7036 svn changeset:24027/svn branch:6.8 --- .../VAADIN/themes/base/textfield/richtext.css | 4 +- .../client/ui/richtextarea/VRichTextArea.java | 2 + .../richtextarea/RichTextAreaScrolling.html | 27 +++++++++ .../richtextarea/RichTextAreaScrolling.java | 57 +++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.html create mode 100644 tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java diff --git a/WebContent/VAADIN/themes/base/textfield/richtext.css b/WebContent/VAADIN/themes/base/textfield/richtext.css index a304fa2a57..6a236886cc 100644 --- a/WebContent/VAADIN/themes/base/textfield/richtext.css +++ b/WebContent/VAADIN/themes/base/textfield/richtext.css @@ -6,7 +6,9 @@ background: #fff; border: none; } - +.v-richtextarea .gwt-HTML { + height: 100%; +} .v-richtextarea .gwt-RichTextToolbar { white-space: nowrap; background: #959595 url(img/richtext-toolbar-bg.png) repeat-x 0 -42px; diff --git a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java index bf0a423474..08df928194 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java +++ b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextArea.java @@ -34,6 +34,7 @@ import com.vaadin.terminal.gwt.client.ui.Field; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; +import com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate; /** * This class implements a basic client side rich text editor component. @@ -89,6 +90,7 @@ public class VRichTextArea extends Composite implements Paintable, Field, initWidget(fp); setStyleName(CLASSNAME); + TouchScrollDelegate.enableTouchScrolling(html, html.getElement()); } private void createRTAComponents() { diff --git a/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.html b/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.html new file mode 100644 index 0000000000..be1c5a2cde --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.html @@ -0,0 +1,27 @@ + + + + + + +RichTextAreaScrolling + + + + + + + + + + + + + + + + + +
RichTextAreaScrolling
open/run/com.vaadin.tests.components.richtextarea.RichTextAreaScrolling?restartApplication
screenCapture
+ + diff --git a/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java b/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java new file mode 100644 index 0000000000..f88ed0c67c --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java @@ -0,0 +1,57 @@ +package com.vaadin.tests.components.richtextarea; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.RichTextArea; +import com.vaadin.ui.VerticalLayout; + +public class RichTextAreaScrolling extends TestBase { + + @Override + protected String getDescription() { + return "A read-only RichTextArea should be (touch) scrollable"; + } + + @Override + protected Integer getTicketNumber() { + return 7036; + } + + @Override + protected void setup() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 50; ++i) { + sb.append("A long string with several lines
"); + } + + HorizontalLayout main = new HorizontalLayout(); + main.setSpacing(true); + addComponent(main); + + RichTextArea first = new RichTextArea("Defined height"); + RichTextArea second = new RichTextArea("Full height"); + RichTextArea third = new RichTextArea("Undefined height"); + + first.setValue(sb); + second.setValue(sb); + third.setValue(sb); + + first.setReadOnly(true); + second.setReadOnly(true); + third.setReadOnly(true); + + first.setWidth("200px"); + first.setHeight("400px"); + second.setSizeFull(); + third.setSizeUndefined(); + + VerticalLayout secondLayout = new VerticalLayout(); + secondLayout.setWidth("200px"); + secondLayout.setHeight("200px"); + secondLayout.addComponent(second); + + main.addComponent(first); + main.addComponent(secondLayout); + main.addComponent(third); + } +} -- 2.39.5