From 6fc4fd79a6b96bcdd66058173e78beec3d9ce9ac Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 13 Jun 2012 09:03:15 +0000 Subject: Change Chameleon -> chameleon + unit test for all builtin themes (#8386) svn changeset:23930/svn branch:6.8 --- src/com/vaadin/ui/themes/ChameleonTheme.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/ui/themes/ChameleonTheme.java b/src/com/vaadin/ui/themes/ChameleonTheme.java index bfb9686018..5ae8cd4e57 100644 --- a/src/com/vaadin/ui/themes/ChameleonTheme.java +++ b/src/com/vaadin/ui/themes/ChameleonTheme.java @@ -5,7 +5,7 @@ package com.vaadin.ui.themes; public class ChameleonTheme extends BaseTheme { - public static final String THEME_NAME = "Chameleon"; + public static final String THEME_NAME = "chameleon"; /*************************************************************************** * Label styles -- cgit v1.2.3 From 835c03b8633454861b491dd6053a990579e19de8 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 14 Jun 2012 08:18:04 +0000 Subject: #7766 Applied Sami's patch svn changeset:23935/svn branch:6.8 --- .../gwt/client/ui/VDragAndDropWrapper.java | 9 +++- .../TooltipHandlingWhenNotDefined.html | 52 ++++++++++++++++++++++ .../TooltipHandlingWhenNotDefined.java | 40 +++++++++++++++++ 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html create mode 100644 tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.java (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java b/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java index ff649ebeb1..c16ad8a76f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java @@ -62,6 +62,8 @@ public class VDragAndDropWrapper extends VCustomComponent implements private static final String CLASSNAME = "v-ddwrapper"; protected static final String DRAGGABLE = "draggable"; + private boolean hasTooltip = false; + public VDragAndDropWrapper() { super(); sinkEvents(VTooltip.TOOLTIP_EVENTS); @@ -94,7 +96,8 @@ public class VDragAndDropWrapper extends VCustomComponent implements public void onBrowserEvent(Event event) { super.onBrowserEvent(event); - if (client != null) { + if (hasTooltip && client != null) { + // Override child tooltips if the wrapper has a tooltip defined client.handleTooltipEvent(event, this); } } @@ -158,6 +161,10 @@ public class VDragAndDropWrapper extends VCustomComponent implements this.client = client; super.updateFromUIDL(uidl, client); if (!uidl.hasAttribute("cached") && !uidl.hasAttribute("hidden")) { + + // Used to prevent wrapper from stealing tooltips when not defined + hasTooltip = uidl.hasAttribute("description"); + UIDL acceptCrit = uidl.getChildByTagName("-ac"); if (acceptCrit == null) { dropHandler = null; diff --git a/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html b/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html new file mode 100644 index 0000000000..4d2fde6b45 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.html @@ -0,0 +1,52 @@ + + + + + + +TooltipHandlingWhenNotDefined + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TooltipHandlingWhenNotDefined
open/run/com.vaadin.tests.components.draganddropwrapper.TooltipHandlingWhenNotDefined?restartApplication
mouseOvervaadin=runcomvaadintestscomponentsdraganddropwrapperTooltipHandlingWhenNotDefined::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VDragAndDropWrapper[0]/VCssLayout[0]/VCssLayout$FlowPane[0]/VLabel[0]
pause5000
screenCapturetooltip_shown
mouseOutvaadin=runcomvaadintestscomponentsdraganddropwrapperTooltipHandlingWhenNotDefined::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VDragAndDropWrapper[0]/VCssLayout[0]/VCssLayout$FlowPane[0]/VLabel[0]
pause2000
screenCapturetooltip_hidden
+ + diff --git a/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.java b/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.java new file mode 100644 index 0000000000..4b07175cd8 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.java @@ -0,0 +1,40 @@ +package com.vaadin.tests.components.draganddropwrapper; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.DragAndDropWrapper; +import com.vaadin.ui.DragAndDropWrapper.DragStartMode; +import com.vaadin.ui.Label; + +public class TooltipHandlingWhenNotDefined extends TestBase { + + @Override + protected void setup() { + + CssLayout wrapperLayout = new CssLayout(); + wrapperLayout.setWidth("100%"); + + Label label = new Label("Can I has the tooltip?", Label.CONTENT_XHTML); + label.setDescription("Good! Tooltip works!"); + label.setSizeUndefined(); + wrapperLayout.addComponent(label); + + DragAndDropWrapper wrapper = new DragAndDropWrapper(wrapperLayout); + wrapper.setWidth("100%"); + wrapper.setDragStartMode(DragStartMode.WRAPPER); + + addComponent(wrapper); + + } + + @Override + protected String getDescription() { + return "Wrapper most not prevent child from showing tooltip"; + } + + @Override + protected Integer getTicketNumber() { + return 7766; + } + +} -- cgit v1.2.3 From 0abcf847a27cff763f3dfea6aeec04b5aeb633d4 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 14 Jun 2012 13:11:37 +0000 Subject: #8852 Applied Sami's patch with minor changes to comments and the test svn changeset:23938/svn branch:6.8 --- src/com/vaadin/terminal/gwt/client/ui/VForm.java | 5 -- src/com/vaadin/terminal/gwt/client/ui/VWindow.java | 24 +++++++-- .../window/UndefinedHeightSubWindowAndContent.html | 57 +++++++++++++++++++++ .../window/UndefinedHeightSubWindowAndContent.java | 58 ++++++++++++++++++++++ 4 files changed, 135 insertions(+), 9 deletions(-) create mode 100644 tests/testbench/com/vaadin/tests/components/window/UndefinedHeightSubWindowAndContent.html create mode 100644 tests/testbench/com/vaadin/tests/components/window/UndefinedHeightSubWindowAndContent.java (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VForm.java b/src/com/vaadin/terminal/gwt/client/ui/VForm.java index c0a6e5b275..546f90a39b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VForm.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VForm.java @@ -6,7 +6,6 @@ package com.vaadin.terminal.gwt.client.ui; import java.util.Set; -import com.google.gwt.dom.client.Style.Display; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.event.shared.HandlerRegistration; @@ -39,7 +38,6 @@ public class VForm extends ComplexPanel implements Container, KeyDownHandler { private Container lo; private Element legend = DOM.createLegend(); private Element caption = DOM.createSpan(); - private Element errorIndicatorElement = DOM.createDiv(); private Element desc = DOM.createDiv(); private Icon icon; private VErrorMessage errorMessage = new VErrorMessage(); @@ -70,9 +68,6 @@ public class VForm extends ComplexPanel implements Container, KeyDownHandler { setStyleName(CLASSNAME); fieldSet.appendChild(legend); legend.appendChild(caption); - errorIndicatorElement.setClassName("v-errorindicator"); - errorIndicatorElement.getStyle().setDisplay(Display.NONE); - errorIndicatorElement.setInnerText(" "); // needed for IE desc.setClassName("v-form-description"); fieldSet.appendChild(desc); // Adding description for initial padding // measurements, removed later if no diff --git a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java index 2355a9c65a..2384ee7ddd 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java @@ -390,6 +390,17 @@ public class VWindow extends VOverlay implements Container, layoutRelativeWidth = uidl.hasAttribute("layoutRelativeWidth"); layoutRelativeHeight = uidl.hasAttribute("layoutRelativeHeight"); + // Ticket #8852: We have to override min height if height of both window + // and layout have undefined height. 0 is used to as undefined value and + // replacing it with 30 will lead to calculation errors (as browser + // takes care of height modifications). + if (dynamicHeight && !layoutRelativeHeight + && !childUidl.hasAttribute("height")) { + renderSpace.setHeight(0); + } else if (renderSpace.getHeight() < MIN_CONTENT_AREA_HEIGHT) { + renderSpace.setHeight(MIN_CONTENT_AREA_HEIGHT); + } + if (dynamicWidth && layoutRelativeWidth) { /* * Relative layout width, fix window width before rendering (width @@ -1161,12 +1172,17 @@ public class VWindow extends VOverlay implements Container, return; } if (height == null || "".equals(height)) { + getElement().getStyle().clearHeight(); contentPanel.getElement().getStyle().clearHeight(); - // Reset to default, the exact value does not actually - // matter as an undefined-height parent should not have - // a relative-height child anyway. - renderSpace.setHeight(MIN_CONTENT_AREA_HEIGHT); + + // If content and window both have undefined height do not set min + // height to render space + if (renderSpace.getHeight() != 0 || !dynamicHeight + || layoutRelativeHeight) { + renderSpace.setHeight(MIN_CONTENT_AREA_HEIGHT); + } + } else { getElement().getStyle().setProperty("height", height); int contentHeight = getElement().getOffsetHeight() diff --git a/tests/testbench/com/vaadin/tests/components/window/UndefinedHeightSubWindowAndContent.html b/tests/testbench/com/vaadin/tests/components/window/UndefinedHeightSubWindowAndContent.html new file mode 100644 index 0000000000..a3b56cd12a --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/window/UndefinedHeightSubWindowAndContent.html @@ -0,0 +1,57 @@ + + + + + + +UndefinedHeightSubWindowAndContent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UndefinedHeightSubWindowAndContent
open/run/com.vaadin.tests.components.window.UndefinedHeightSubWindowAndContent?restartApplication
mouseClickvaadin=runcomvaadintestscomponentswindowUndefinedHeightSubWindowAndContent::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]52,11
enterCharactervaadin=runcomvaadintestscomponentswindowUndefinedHeightSubWindowAndContent::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]invalid
pressSpecialKeyvaadin=runcomvaadintestscomponentswindowUndefinedHeightSubWindowAndContent::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]enter
screenCaptureform_full_width_1_error
enterCharactervaadin=runcomvaadintestscomponentswindowUndefinedHeightSubWindowAndContent::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]valid
pressSpecialKeyvaadin=runcomvaadintestscomponentswindowUndefinedHeightSubWindowAndContent::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]enter
screenCaptureform_full_width_2_valid
+ + diff --git a/tests/testbench/com/vaadin/tests/components/window/UndefinedHeightSubWindowAndContent.java b/tests/testbench/com/vaadin/tests/components/window/UndefinedHeightSubWindowAndContent.java new file mode 100644 index 0000000000..ed259b2f4c --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/window/UndefinedHeightSubWindowAndContent.java @@ -0,0 +1,58 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.data.Validator; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Form; +import com.vaadin.ui.TextField; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +public class UndefinedHeightSubWindowAndContent extends TestBase { + + @Override + protected void setup() { + Window subWindow = new Window("No scrollbars!"); + subWindow.setWidth("300px"); + subWindow.center(); + subWindow.setModal(true); + VerticalLayout layout = new VerticalLayout(); + layout.setWidth("100%"); + subWindow.setContent(layout); + + final Form form = new Form(); + form.setImmediate(true); + form.setValidationVisible(true); + form.setCaption("This is a form"); + form.setDescription("How do you do?"); + final TextField field1 = new TextField("Write here"); + field1.setImmediate(true); + field1.addValidator(new Validator() { + + public void validate(Object value) throws InvalidValueException { + if (!isValid(value)) { + throw new InvalidValueException("FAIL!"); + } + } + + public boolean isValid(Object value) { + return field1.getValue().equals("valid"); + } + }); + form.addField("Field 1", field1); + layout.addComponent(form); + + getMainWindow().addWindow(subWindow); + subWindow.bringToFront(); + } + + @Override + protected String getDescription() { + return "When both window and its content have undefined height, window must not reserve space for a scroll bar when it is not needed."; + } + + @Override + protected Integer getTicketNumber() { + return 8852; + } + +} -- cgit v1.2.3 From de3833b8a08060fbc74a05a04daeb3f328120c94 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 14 Jun 2012 14:53:11 +0000 Subject: Fixed typo (: instead of =) (#8941) svn changeset:23941/svn branch:6.8 --- src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java index ffa34b11cd..b7a6fd3479 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java @@ -1332,7 +1332,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements * parameter in web.xml */ response.setHeader("Cache-Control", - "max-age: " + String.valueOf(resourceCacheTime)); + "max-age= " + String.valueOf(resourceCacheTime)); } // Write the resource to the client. -- cgit v1.2.3 From 087f7666d59f10884ead2cb085c8df372d4f509f Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Fri, 15 Jun 2012 11:56:15 +0000 Subject: #7938 Clarified Window.center() javadoc svn changeset:23949/svn branch:6.8 --- src/com/vaadin/ui/Window.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java index f20090fead..347f2725fe 100644 --- a/src/com/vaadin/ui/Window.java +++ b/src/com/vaadin/ui/Window.java @@ -1618,8 +1618,10 @@ public class Window extends Panel implements URIHandler, ParameterHandler, } /** - * Request to center this window on the screen. Note: affects - * sub-windows only. + * Sets this window to be centered relative to its parent window. Affects + * sub-windows only. If the window is resized as a result of the size of its + * content changing, it will keep itself centered as long as its position is + * not explicitly changed programmatically or by the user. */ public void center() { centerRequested = true; -- cgit v1.2.3 From 1401003a10eb328995b92351e9f716fce705dfc8 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Fri, 15 Jun 2012 12:41:34 +0000 Subject: #7938 Added reference to #8971 to the javadoc svn changeset:23950/svn branch:6.8 --- src/com/vaadin/ui/Window.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/com/vaadin') diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java index 347f2725fe..32415433ad 100644 --- a/src/com/vaadin/ui/Window.java +++ b/src/com/vaadin/ui/Window.java @@ -1622,6 +1622,9 @@ public class Window extends Panel implements URIHandler, ParameterHandler, * sub-windows only. If the window is resized as a result of the size of its * content changing, it will keep itself centered as long as its position is * not explicitly changed programmatically or by the user. + *

+ * NOTE: This method has several issues as currently implemented. + * Please refer to http://dev.vaadin.com/ticket/8971 for details. */ public void center() { centerRequested = true; -- cgit v1.2.3