From 4f6bc36661f0d07a6bafd7af3a0cd386f3ab9675 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?=
- #1155: - Uncompressing the installation package fails in Windows if using - the default Zip uncompression. Uncompression gives (in Windows - Vista) an error message about too long filenames, and a more - obscure message in other versions of Windows. Workaround: use 7-Zip or some other good unzip - program for Windows. -
-The following instructions and limitations apply when you run a @@ -480,11 +461,11 @@
diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java
index a72c9c1dc2..3dbbd22329 100644
--- a/src/com/vaadin/terminal/gwt/client/Util.java
+++ b/src/com/vaadin/terminal/gwt/client/Util.java
@@ -1080,6 +1080,8 @@ public class Util {
VConsole.log("\t\t" + var[1] + " (" + var[2] + ")" + " : "
+ var[0]);
}
+ } else {
+ VConsole.log("\t" + id + ": Warning: no corresponding paintable!");
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index f1c1927b26..553934bf98 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -2292,26 +2292,17 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* of the caption container element by the correct amount
*/
public void resizeCaptionContainer(int rightSpacing) {
+
+ int captionContainerWidth = width
+ - colResizeWidget.getOffsetWidth() - rightSpacing;
+
if (BrowserInfo.get().isIE6() || td.getClassName().contains("-asc")
|| td.getClassName().contains("-desc")) {
- /*
- * Room for the sort indicator is made by subtracting the styled
- * margin and width of the resizer from the width of the caption
- * container.
- */
- int captionContainerWidth = width
- - sortIndicator.getOffsetWidth()
- - colResizeWidget.getOffsetWidth() - rightSpacing;
- captionContainer.getStyle().setPropertyPx("width",
- captionContainerWidth);
- } else {
- /*
- * Set the caption container element as wide as possible when
- * the sorting indicator is not visible.
- */
- captionContainer.getStyle().setPropertyPx("width",
- width - rightSpacing);
+ // Leave room for the sort indicator
+ captionContainerWidth -= sortIndicator.getOffsetWidth();
}
+ captionContainer.getStyle().setPropertyPx("width",
+ captionContainerWidth);
// Apply/Remove spacing if defined
if (rightSpacing > 0) {
@@ -6071,7 +6062,15 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
public void onScroll(ScrollEvent event) {
scrollLeft = scrollBodyPanel.getElement().getScrollLeft();
scrollTop = scrollBodyPanel.getScrollPosition();
- if (!initializedAndAttached) {
+ /*
+ * #6970 - IE sometimes fires scroll events for a detached table.
+ *
+ * FIXME initializedAndAttached should probably be renamed - its name
+ * doesn't seem to reflect its semantics. onDetach() doesn't set it to
+ * false, and changing that might break something else, so we need to
+ * check isAttached() separately.
+ */
+ if (!initializedAndAttached || !isAttached()) {
return;
}
if (!enabled) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java b/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java
index a74fd9f5dc..cd09e24d67 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java
@@ -69,4 +69,11 @@ public class VTextArea extends VTextField {
super.onBrowserEvent(event);
}
+ @Override
+ public int getCursorPos() {
+ // This is needed so that TextBoxImplIE6 is used to return the correct
+ // position for old Internet Explorer versions where it has to be
+ // detected in a different way.
+ return getImpl().getTextAreaCursorPos(getElement());
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/VView.java
index f21c0aaac0..07ade6a8b1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VView.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VView.java
@@ -591,6 +591,11 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
String ownAppId = connection.getConfiguration().getRootPanelId();
+ // Hiding elements causes browser to forget scroll position -> must
+ // save values and restore when the elements are visible again #7976
+ int originalScrollTop = Window.getScrollTop();
+ int originalScrollLeft = Window.getScrollLeft();
+
// Set display: none for all Vaadin apps
for (int i = 0; i < vaadinApps.size(); i++) {
String appId = vaadinApps.get(i);
@@ -629,6 +634,9 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
}
}
+ // Scroll back to original location
+ Window.scrollTo(originalScrollLeft, originalScrollTop);
+
return w;
}
diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java
index b7235dd37b..d8c59c2e91 100644
--- a/src/com/vaadin/ui/Table.java
+++ b/src/com/vaadin/ui/Table.java
@@ -5148,4 +5148,14 @@ public class Table extends AbstractSelect implements Action.Container,
public RowGenerator getRowGenerator() {
return rowGenerator;
}
+
+ @Override
+ public void setVisible(boolean visible) {
+ if (!isVisible() && visible) {
+ // We need to ensure that the rows are sent to the client when the
+ // Table is made visible if it has been rendered as invisible.
+ setRowCacheInvalidated(true);
+ }
+ super.setVisible(visible);
+ }
}
diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java
new file mode 100644
index 0000000000..d8b01c4099
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java
@@ -0,0 +1,197 @@
+package com.vaadin.tests.components.orderedlayout;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.TestUtils;
+import com.vaadin.ui.AbstractOrderedLayout;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.VerticalLayout;
+
+public class OrderedLayoutCases extends TestBase {
+ private static final String[] dimensionValues = { "-1px", "5px", "300px",
+ "800px", "100%", "50%" };
+
+ private static class SampleChild extends VerticalLayout {
+ public SampleChild() {
+ setStyleName("showBorders");
+ addComponent(createSimpleSelector("Child width",
+ new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ setWidth(event.getProperty().getValue().toString());
+ }
+ }, dimensionValues));
+ addComponent(createSimpleSelector("Child height",
+ new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ setHeight(event.getProperty().getValue().toString());
+ }
+ }, dimensionValues));
+ addComponent(createSimpleSelector("Caption",
+ new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ String value = event.getProperty().getValue()
+ .toString();
+ if (value.length() == 0) {
+ setCaption(null);
+ } else if (value.equals("Long")) {
+ setCaption("A rather long caption just to see what happens");
+ } else {
+ setCaption(value);
+ }
+ }
+ }, "", "Short", "Long"));
+
+ addComponent(createSimpleSelector("Expand ratio",
+ new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ AbstractOrderedLayout parent = (AbstractOrderedLayout) getParent();
+ if (parent == null) {
+ return;
+ }
+ String value = event.getProperty().getValue()
+ .toString();
+ parent.setExpandRatio(SampleChild.this,
+ Float.parseFloat(value));
+ }
+ }, "0", "1", "2"));
+
+ // Why is Alignment not an enum? Now we have to use reflection just
+ // to get the different values as hardcoding is never an option! ;)
+ List
+
+
+
+
diff --git a/tests/testbench/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java b/tests/testbench/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java
new file mode 100644
index 0000000000..e5947576a2
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.Application;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+public class WrapTabSheetInTabSheet extends TestBase {
+ @Override
+ protected void setup() {
+ final VerticalLayout mainLayout = new VerticalLayout();
+ mainLayout.addComponent(new Label("This is main layout"));
+ addComponent(mainLayout);
+
+ Button b = new Button("Wrap main layout in a TabSheet");
+ b.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ TabSheet tabsheet = new TabSheet();
+ ComponentContainer mainParent = (ComponentContainer) mainLayout
+ .getParent();
+ mainParent.replaceComponent(mainLayout, tabsheet);
+ tabsheet.addTab(mainLayout, "Default tab");
+ }
+ });
+ mainLayout.addComponent(b);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Click the button to add a TabSheet and move the window content into the TabSheet. Every click should wrap the contents with a new TabSheet and the contents should remain visible.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8238;
+ }
+}
diff --git a/tests/testbench/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java b/tests/testbench/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java
new file mode 100644
index 0000000000..0fc63860e1
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java
@@ -0,0 +1,54 @@
+package com.vaadin.tests.components.textarea;
+
+import com.vaadin.event.FieldEvents.TextChangeEvent;
+import com.vaadin.event.FieldEvents.TextChangeListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.AbstractTextField;
+import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+
+public class TextAreaCursorPosition extends TestBase {
+
+ private TextField cursorPosition = new TextField("Cursor position");
+
+ @Override
+ public void setup() {
+ Label label = new Label(
+ "Test of calculation of cursor position of TextArea");
+ TextArea textArea = new TextArea();
+ addListener(textArea);
+ addComponent(label);
+ addComponent(textArea);
+ addComponent(cursorPosition);
+ cursorPosition.setValue("?");
+ addComponent(new Button("Force position update"));
+ }
+
+ public void addListener(AbstractField newField) {
+ AbstractTextField newTextField = (AbstractTextField) newField;
+ newTextField.setTextChangeEventMode(TextChangeEventMode.EAGER);
+
+ newTextField.addListener(new TextChangeListener() {
+ public void textChange(TextChangeEvent event) {
+ AbstractTextField component = (AbstractTextField) event
+ .getComponent();
+ cursorPosition.setValue(component.getCursorPosition());
+ }
+ });
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Writing something in the field updates the cursor position field. The position field can also be updated using the button.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7726;
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java
new file mode 100644
index 0000000000..6aac7caddd
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java
@@ -0,0 +1,57 @@
+package com.vaadin.tests.components.textfield;
+
+import com.vaadin.event.ShortcutAction.KeyCode;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.TextField;
+
+public class TextFieldInputPromptAndClickShortcut extends TestBase {
+
+ @Override
+ protected void setup() {
+ final Log log = new Log(5);
+
+ final TextField textField = new TextField();
+ Button button = new Button("Show Text", new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ log.log("Field value: " + textField.getValue());
+ }
+ });
+ button.setClickShortcut(KeyCode.ESCAPE);
+
+ final CheckBox inputPromptSelection = new CheckBox("Input prompt",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (event.getButton().getValue() == Boolean.TRUE) {
+ textField.setInputPrompt("Input prompt");
+ } else {
+ textField.setInputPrompt(null);
+ }
+ log.log("Set input prompt: "
+ + textField.getInputPrompt());
+ }
+ });
+ inputPromptSelection.setImmediate(true);
+
+ addComponent(textField);
+ addComponent(button);
+ addComponent(inputPromptSelection);
+ addComponent(log);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "With the input propmpt enabled, enter something into the field, press enter, remove the entered text and press the button. The previous text is still reported as the value. Without the input prompt, the new value is instead reported as blank.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--
2.39.5
+
+New Test
+
+open
+ /run/com.vaadin.tests.components.table.TableRepaintWhenMadeVisibile?restartApplication
+
+
+
+click
+ vaadin=runcomvaadintestscomponentstableTableRepaintWhenMadeVisibile::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
+
+
+
+open
+ /run/com.vaadin.tests.components.table.TableRepaintWhenMadeVisibile
+
+
+
+click
+ vaadin=runcomvaadintestscomponentstableTableRepaintWhenMadeVisibile::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
+
+
+
+
+screenCapture
+
+ hidden-then-shown
+