diff options
author | Jouni Koivuviita <jouni@vaadin.com> | 2014-06-16 10:29:28 +0300 |
---|---|---|
committer | Jouni Koivuviita <jouni@vaadin.com> | 2014-06-16 10:30:24 +0300 |
commit | 7a92b54724133328998e7c7178b5c298bc88fcd0 (patch) | |
tree | 54f340a8ee21e0407fe790e1113881ed947de3cc /client | |
parent | 7a4d0003e9bb6fd920bb879eaff1c24cd6f1f3e7 (diff) | |
parent | ccdc34051d6c74292ce981f66c31c160620a04da (diff) | |
download | vaadin-framework-7a92b54724133328998e7c7178b5c298bc88fcd0.tar.gz vaadin-framework-7a92b54724133328998e7c7178b5c298bc88fcd0.zip |
Merge branch 'master' into valo
Conflicts:
build.properties
Change-Id: I2477f2b420506d1b41d29d9bb1e361d66bedb68d
Diffstat (limited to 'client')
11 files changed, 336 insertions, 140 deletions
diff --git a/client/src/com/vaadin/client/TooltipInfo.java b/client/src/com/vaadin/client/TooltipInfo.java index 67d2ad37c2..06940536c8 100644 --- a/client/src/com/vaadin/client/TooltipInfo.java +++ b/client/src/com/vaadin/client/TooltipInfo.java @@ -21,6 +21,11 @@ public class TooltipInfo { private String errorMessageHtml; + // Contains the tooltip's identifier. If a tooltip's contents and this + // identifier haven't changed, the tooltip won't be updated in subsequent + // events. + private Object identifier; + public TooltipInfo() { } @@ -29,10 +34,23 @@ public class TooltipInfo { } public TooltipInfo(String tooltip, String errorMessage) { + this(tooltip, errorMessage, null); + } + + public TooltipInfo(String tooltip, String errorMessage, Object identifier) { + setIdentifier(identifier); setTitle(tooltip); setErrorMessage(errorMessage); } + public void setIdentifier(Object identifier) { + this.identifier = identifier; + } + + public Object getIdentifier() { + return identifier; + } + public String getTitle() { return title; } @@ -61,6 +79,7 @@ public class TooltipInfo { } public boolean equals(TooltipInfo other) { - return (other != null && other.title == title && other.errorMessageHtml == errorMessageHtml); + return (other != null && other.title == title + && other.errorMessageHtml == errorMessageHtml && other.identifier == identifier); } } diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java index 487f577ae3..8e653a0476 100644 --- a/client/src/com/vaadin/client/VTooltip.java +++ b/client/src/com/vaadin/client/VTooltip.java @@ -153,15 +153,61 @@ public class VTooltip extends VWindowOverlay { offsetWidth = getOffsetWidth(); offsetHeight = getOffsetHeight(); } + int x = getFinalX(offsetWidth); + int y = getFinalY(offsetHeight); - int x = tooltipEventMouseX + 10 + Window.getScrollLeft(); - int y = tooltipEventMouseY + 10 + Window.getScrollTop(); + setPopupPosition(x, y); + sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT); + } + /** + * Return the final X-coordinate of the tooltip based on cursor + * position, size of the tooltip, size of the page and necessary + * margins. + * + * @param offsetWidth + * @return The final X-coordinate + */ + private int getFinalX(int offsetWidth) { + int x = 0; + int widthNeeded = 10 + MARGIN + offsetWidth; + int roomLeft = tooltipEventMouseX; + int roomRight = Window.getClientWidth() - roomLeft; + if (roomRight > widthNeeded) { + x = tooltipEventMouseX + 10 + Window.getScrollLeft(); + } else { + x = tooltipEventMouseX + Window.getScrollLeft() - 10 + - offsetWidth; + } if (x + offsetWidth + MARGIN - Window.getScrollLeft() > Window .getClientWidth()) { x = Window.getClientWidth() - offsetWidth - MARGIN + Window.getScrollLeft(); } + return x; + } + + /** + * Return the final Y-coordinate of the tooltip based on cursor + * position, size of the tooltip, size of the page and necessary + * margins. + * + * @param offsetHeight + * @return The final y-coordinate + * + */ + private int getFinalY(int offsetHeight) { + int y = 0; + int heightNeeded = 10 + MARGIN + offsetHeight; + int roomAbove = tooltipEventMouseY; + int roomBelow = Window.getClientHeight() - roomAbove; + + if (roomBelow > heightNeeded) { + y = tooltipEventMouseY + 10 + Window.getScrollTop(); + } else { + y = tooltipEventMouseY + Window.getScrollTop() - 10 + - offsetHeight; + } if (y + offsetHeight + MARGIN - Window.getScrollTop() > Window .getClientHeight()) { @@ -173,8 +219,7 @@ public class VTooltip extends VWindowOverlay { y = Window.getScrollTop(); } } - setPopupPosition(x, y); - sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT); + return y; } }); } else { @@ -234,8 +279,10 @@ public class VTooltip extends VWindowOverlay { // already about to close return; } - closeTimer.schedule(getCloseTimeout()); - closing = true; + if (isActuallyVisible()) { + closeTimer.schedule(getCloseTimeout()); + closing = true; + } } @Override @@ -311,11 +358,9 @@ public class VTooltip extends VWindowOverlay { * @return TooltipInfo if connector and tooltip found, null if not */ private TooltipInfo getTooltipFor(Element element) { - ApplicationConnection ac = getApplicationConnection(); ComponentConnector connector = Util.getConnectorForElement(ac, RootPanel.get(), element); - // Try to find first connector with proper tooltip info TooltipInfo info = null; while (connector != null) { @@ -348,8 +393,6 @@ public class VTooltip extends VWindowOverlay { /** * Handle hide event * - * @param event - * Event causing hide */ private void handleHideEvent() { hideTooltip(); @@ -402,12 +445,26 @@ public class VTooltip extends VWindowOverlay { return; } + // If the parent (sub)component already has a tooltip open and it + // hasn't changed, we ignore the event. + // TooltipInfo contains a reference to the parent component that is + // checked in it's equals-method. + if (currentElement != null && isActuallyVisible()) { + TooltipInfo currentTooltip = getTooltipFor(currentElement); + TooltipInfo newTooltip = getTooltipFor(element); + if (currentTooltip != null && currentTooltip.equals(newTooltip)) { + return; + } + } + TooltipInfo info = getTooltipFor(element); if (info == null) { - if (isActuallyVisible()) { - handleHideEvent(); - } + handleHideEvent(); } else { + if (closing) { + closeTimer.cancel(); + closing = false; + } setTooltipText(info); updatePosition(event, isFocused); if (isActuallyVisible() && !isFocused) { @@ -417,8 +474,7 @@ public class VTooltip extends VWindowOverlay { closeNow(); } // Schedule timer for showing the tooltip according to if it - // was - // recently closed or not. + // was recently closed or not. int timeout = justClosed ? getQuickOpenDelay() : getOpenDelay(); if (timeout == 0) { diff --git a/client/src/com/vaadin/client/extensions/ResponsiveConnector.java b/client/src/com/vaadin/client/extensions/ResponsiveConnector.java index 1392a1a49a..62913400db 100644 --- a/client/src/com/vaadin/client/extensions/ResponsiveConnector.java +++ b/client/src/com/vaadin/client/extensions/ResponsiveConnector.java @@ -208,58 +208,55 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements } else if(rule.type == 1 || !rule.type) { // Regular selector rule - // IE parses CSS like .class[attr="val"] into [attr="val"].class so we need to check for both - - // Pattern for matching [width-range] selectors - var widths = IE? /\[width-range~?=["|'](.*)-(.*)["|']\]([\.|#]\S+)/i : /([\.|#]\S+)\[width-range~?=["|'](.*)-(.*)["|']\]/i; - - // Patter for matching [height-range] selectors - var heights = IE? /\[height-range~?=["|'](.*)-(.*)["|']\]([\.|#]\S+)/i : /([\.|#]\S+)\[height-range~?=["|'](.*)-(.*)["|']\]/i; + // Helper function + var pushToCache = function(ranges, selector, min, max) { + // Avoid adding duplicates + var duplicate = false; + for(var l = 0, len3 = ranges.length; l < len3; l++) { + var bp = ranges[l]; + if (selector == bp[0] && min == bp[1] && max == bp[2]) { + duplicate = true; + break; + } + } + if (!duplicate) { + ranges.push([selector, min, max]); + } + }; // Array of all of the separate selectors in this ruleset var haystack = rule.selectorText.split(","); + // IE parses CSS like .class[attr="val"] into [attr="val"].class so we need to check for both + var selectorRegEx = IE ? /\[.*\]([\.|#]\S+)/ : /([\.|#]\S+?)\[.*\]/; + // Loop all the selectors in this ruleset for(var k = 0, len2 = haystack.length; k < len2; k++) { - var result; - - // Check for width-range matches - if(result = haystack[k].match(widths)) { - var selector = IE? result[3] : result[1] - var min = IE? result[1] : result[2]; - var max = IE? result[2] : result[3]; - - // Avoid adding duplicates - var duplicate = false; - for(var l = 0, len3 = widthRanges.length; l < len3; l++) { - var bp = widthRanges[l]; - if(selector == bp[0] && min == bp[1] && max == bp[2]) { - duplicate = true; - break; - } - } - if(!duplicate) { - widthRanges.push([selector, min, max]); + + // Split the haystack into parts. + var widthRange = haystack[k].match(/\[width-range.*?\]/); + var heightRange = haystack[k].match(/\[height-range.*?\]/); + var selector = haystack[k].match(selectorRegEx); + + if (selector != null) { + selector = selector[1]; + + // Check for width-ranges. + if (widthRange != null) { + var minMax = widthRange[0].match(/\[width-range~?=["|'](.*?)-(.*?)["|']\]/i); + var min = minMax[1]; + var max = minMax[2]; + + pushToCache(widthRanges, selector, min, max); } - } - // Check for height-range matches - if(result = haystack[k].match(heights)) { - var selector = IE? result[3] : result[1] - var min = IE? result[1] : result[2]; - var max = IE? result[2] : result[3]; - - // Avoid adding duplicates - var duplicate = false; - for(var l = 0, len3 = heightRanges.length; l < len3; l++) { - var bp = heightRanges[l]; - if(selector == bp[0] && min == bp[1] && max == bp[2]) { - duplicate = true; - break; - } - } - if(!duplicate) { - heightRanges.push([selector, min, max]); + // Check for height-ranges. + if (heightRange != null) { + var minMax = heightRange[0].match(/\[height-range~?=["|'](.*?)-(.*?)["|']\]/i); + var min = minMax[1]; + var max = minMax[2]; + + pushToCache(heightRanges, selector, min, max); } } } diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index ccf070698b..c3f14be40c 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -333,14 +333,6 @@ public abstract class AbstractComponentConnector extends AbstractConnector AbstractComponentState state = getState(); String primaryStyleName = getWidget().getStylePrimaryName(); - if (state.primaryStyleName != null - && !state.primaryStyleName.equals(primaryStyleName)) { - /* - * We overwrite the widgets primary stylename if state defines a - * primary stylename. - */ - getWidget().setStylePrimaryName(state.primaryStyleName); - } // Set the core 'v' style name for the widget setWidgetStyleName(StyleConstants.UI_WIDGET, true); @@ -376,6 +368,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector } } + + if (state.primaryStyleName != null + && !state.primaryStyleName.equals(primaryStyleName)) { + /* + * We overwrite the widgets primary stylename if state defines a + * primary stylename. This has to be done after updating other + * styles to be sure the dependent styles are updated correctly. + */ + getWidget().setStylePrimaryName(state.primaryStyleName); + } Profiler.leave("AbstractComponentConnector.updateWidgetStyleNames"); } diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java index 5ffa580371..a1de2c2b6d 100644 --- a/client/src/com/vaadin/client/ui/VFilterSelect.java +++ b/client/src/com/vaadin/client/ui/VFilterSelect.java @@ -30,6 +30,7 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.Display; +import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; @@ -212,6 +213,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, private final Element down = DOM.createDiv(); private final Element status = DOM.createDiv(); + private int desiredHeight = -1; + private boolean isPagingEnabled = true; private long lastAutoClosed; @@ -228,6 +231,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, debug("VFS.SP: constructor()"); setOwner(VFilterSelect.this); menu = new SuggestionMenu(); + menu.getElement().getStyle().setOverflowY(Overflow.AUTO); setWidget(menu); getElement().getStyle().setZIndex(Z_INDEX); @@ -550,16 +554,12 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, public void setPosition(int offsetWidth, int offsetHeight) { debug("VFS.SP: setPosition()"); - int top = -1; - int left = -1; + int top = getPopupTop(); + int left = getPopupLeft(); - // reset menu size and retrieve its "natural" size - menu.setHeight(""); - if (currentPage > 0) { - // fix height to avoid height change when getting to last page - menu.fixHeightTo(pageLength); + if (desiredHeight < 0) { + desiredHeight = offsetHeight; } - offsetHeight = getOffsetHeight(); final int desiredWidth = getMainWidth(); Element menuFirstChild = menu.getElement().getFirstChildElement(); @@ -585,16 +585,20 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, getContainerElement().getStyle().setWidth(rootWidth, Unit.PX); } - if (offsetHeight + getPopupTop() > Window.getClientHeight() - + Window.getScrollTop()) { + final int spaceAvailableBelow = Window.getClientHeight() + - (top - Window.getScrollTop()); + final int spaceAvailableAbove = top - Window.getScrollTop() + - VFilterSelect.this.getOffsetHeight(); + if (spaceAvailableBelow < desiredHeight + && spaceAvailableBelow < spaceAvailableAbove) { // popup on top of input instead - top = getPopupTop() - offsetHeight - - VFilterSelect.this.getOffsetHeight(); + top -= desiredHeight + VFilterSelect.this.getOffsetHeight(); + offsetHeight = desiredHeight; if (top < 0) { + offsetHeight += top; top = 0; } } else { - top = getPopupTop(); /* * Take popup top margin into account. getPopupTop() returns the * top value including the margin but the value we give must not @@ -602,6 +606,19 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ int topMargin = (top - topPosition); top -= topMargin; + offsetHeight = Math.min(desiredHeight, spaceAvailableBelow); + } + + /* + * Resize popup and menu if calculated height doesn't match the + * actual height + */ + if (getOffsetHeight() != offsetHeight) { + int menuHeight = offsetHeight - up.getOffsetHeight() + - down.getOffsetHeight() - status.getOffsetHeight(); + menu.setHeight(menuHeight + "px"); + getContainerElement().getStyle().setHeight(offsetHeight, + Unit.PX); } // fetch real width (mac FF bugs here due GWT popups overflow:auto ) @@ -614,8 +631,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, if (left < 0) { left = 0; } - } else { - left = getPopupLeft(); } setPopupPosition(left, top); } diff --git a/client/src/com/vaadin/client/ui/VGridLayout.java b/client/src/com/vaadin/client/ui/VGridLayout.java index 1c42243621..10e5c00a38 100644 --- a/client/src/com/vaadin/client/ui/VGridLayout.java +++ b/client/src/com/vaadin/client/ui/VGridLayout.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 Vaadin Ltd. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -19,6 +19,7 @@ package com.vaadin.client.ui; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Set; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Document; @@ -71,6 +72,8 @@ public class VGridLayout extends ComplexPanel { /** For internal use only. May be removed or replaced in the future. */ public DivElement spacingMeasureElement; + public Set<Integer> explicitRowRatios; + public Set<Integer> explicitColRatios; public VGridLayout() { super(); @@ -92,7 +95,7 @@ public class VGridLayout extends ComplexPanel { /** * Returns the column widths measured in pixels - * + * * @return */ protected int[] getColumnWidths() { @@ -101,7 +104,7 @@ public class VGridLayout extends ComplexPanel { /** * Returns the row heights measured in pixels - * + * * @return */ protected int[] getRowHeights() { @@ -110,7 +113,7 @@ public class VGridLayout extends ComplexPanel { /** * Returns the spacing between the cells horizontally in pixels - * + * * @return */ protected int getHorizontalSpacing() { @@ -119,7 +122,7 @@ public class VGridLayout extends ComplexPanel { /** * Returns the spacing between the cells vertically in pixels - * + * * @return */ protected int getVerticalSpacing() { @@ -136,18 +139,20 @@ public class VGridLayout extends ComplexPanel { void expandRows() { if (!isUndefinedHeight()) { - int usedSpace = minRowHeights[0]; - int verticalSpacing = getVerticalSpacing(); - for (int i = 1; i < minRowHeights.length; i++) { - usedSpace += verticalSpacing + minRowHeights[i]; - } + int usedSpace = calcRowUsedSpace(); + int[] actualExpandRatio = calcRowExpandRatio(); int availableSpace = LayoutManager.get(client).getInnerHeight( getElement()); int excessSpace = availableSpace - usedSpace; int distributed = 0; if (excessSpace > 0) { + int expandRatioSum = 0; + for (int i = 0; i < rowHeights.length; i++) { + expandRatioSum += actualExpandRatio[i]; + } for (int i = 0; i < rowHeights.length; i++) { - int ew = excessSpace * rowExpandRatioArray[i] / 1000; + int ew = excessSpace * actualExpandRatio[i] + / expandRatioSum; rowHeights[i] = minRowHeights[i] + ew; distributed += ew; } @@ -162,44 +167,52 @@ public class VGridLayout extends ComplexPanel { } } - /** For internal use only. May be removed or replaced in the future. */ - public void updateHeight() { - // Detect minimum heights & calculate spans - detectRowHeights(); - - // Expand - expandRows(); - - // Position - layoutCellsVertically(); + private int[] calcRowExpandRatio() { + int[] actualExpandRatio = new int[minRowHeights.length]; + for (int i = 0; i < minRowHeights.length; i++) { + if (rowHasComponentsOrRowSpan(i)) { + actualExpandRatio[i] = rowExpandRatioArray[i]; + } else { + // Should not do this if this has explicitly been + // expanded + if (explicitRowRatios.contains(i)) { + actualExpandRatio[i] = rowExpandRatioArray[i]; + } else { + actualExpandRatio[i] = 0; + } + } + } + return actualExpandRatio; } - /** For internal use only. May be removed or replaced in the future. */ - public void updateWidth() { - // Detect widths & calculate spans - detectColWidths(); - // Expand - expandColumns(); - // Position - layoutCellsHorizontally(); - + private int calcRowUsedSpace() { + int usedSpace = minRowHeights[0]; + int verticalSpacing = getVerticalSpacing(); + for (int i = 1; i < minRowHeights.length; i++) { + if (rowHasComponentsOrRowSpan(i) || minRowHeights[i] > 0 + || explicitRowRatios.contains(i)) { + usedSpace += verticalSpacing + minRowHeights[i]; + } + } + return usedSpace; } void expandColumns() { if (!isUndefinedWidth()) { - int usedSpace = minColumnWidths[0]; - int horizontalSpacing = getHorizontalSpacing(); - for (int i = 1; i < minColumnWidths.length; i++) { - usedSpace += horizontalSpacing + minColumnWidths[i]; - } - + int usedSpace = calcColumnUsedSpace(); + int[] actualExpandRatio = calcColumnExpandRatio(); int availableSpace = LayoutManager.get(client).getInnerWidth( getElement()); int excessSpace = availableSpace - usedSpace; int distributed = 0; if (excessSpace > 0) { + int expandRatioSum = 0; + for (int i = 0; i < columnWidths.length; i++) { + expandRatioSum += actualExpandRatio[i]; + } for (int i = 0; i < columnWidths.length; i++) { - int ew = excessSpace * colExpandRatioArray[i] / 1000; + int ew = excessSpace * actualExpandRatio[i] + / expandRatioSum; columnWidths[i] = minColumnWidths[i] + ew; distributed += ew; } @@ -214,6 +227,97 @@ public class VGridLayout extends ComplexPanel { } } + /** + * Calculates column expand ratio. + */ + private int[] calcColumnExpandRatio() { + int[] actualExpandRatio = new int[minColumnWidths.length]; + for (int i = 0; i < minColumnWidths.length; i++) { + if (colHasComponentsOrColSpan(i)) { + actualExpandRatio[i] = colExpandRatioArray[i]; + } else { + // Should not do this if this has explicitly been + // expanded + if (explicitColRatios.contains(i)) { + actualExpandRatio[i] = colExpandRatioArray[i]; + } else { + actualExpandRatio[i] = 0; + } + } + } + return actualExpandRatio; + } + + /** + * Calculates column used space + */ + private int calcColumnUsedSpace() { + int usedSpace = minColumnWidths[0]; + int horizontalSpacing = getHorizontalSpacing(); + for (int i = 1; i < minColumnWidths.length; i++) { + if (colHasComponentsOrColSpan(i) || minColumnWidths[i] > 0 + || explicitColRatios.contains(i)) { + usedSpace += horizontalSpacing + minColumnWidths[i]; + } + } + return usedSpace; + } + + private boolean rowHasComponentsOrRowSpan(int i) { + for (Cell cell : widgetToCell.values()) { + if (cell.row == i) { + return true; + } + } + for (SpanList l : rowSpans) { + for (Cell cell : l.cells) { + if (cell.row >= i && i < cell.row + cell.rowspan) { + return true; + } + } + } + return false; + } + + private boolean colHasComponentsOrColSpan(int i) { + for (Cell cell : widgetToCell.values()) { + if (cell.col == i) { + return true; + } + } + for (SpanList l : colSpans) { + for (Cell cell : l.cells) { + if (cell.col >= i && i < cell.col + cell.colspan) { + return true; + } + } + } + return false; + } + + /** For internal use only. May be removed or replaced in the future. */ + public void updateHeight() { + // Detect minimum heights & calculate spans + detectRowHeights(); + + // Expand + expandRows(); + + // Position + layoutCellsVertically(); + } + + /** For internal use only. May be removed or replaced in the future. */ + public void updateWidth() { + // Detect widths & calculate spans + detectColWidths(); + // Expand + expandColumns(); + // Position + layoutCellsHorizontally(); + + } + void layoutCellsVertically() { int verticalSpacing = getVerticalSpacing(); LayoutManager layoutManager = LayoutManager.get(client); @@ -241,7 +345,9 @@ public class VGridLayout extends ComplexPanel { cell.layoutVertically(y, reservedMargin); } - y += rowHeights[row] + verticalSpacing; + if (rowHasComponentsOrRowSpan(row) || rowHeights[row] > 0) { + y += rowHeights[row] + verticalSpacing; + } } } @@ -277,7 +383,9 @@ public class VGridLayout extends ComplexPanel { cell.layoutHorizontally(x, reservedMargin); } } - x += columnWidths[i] + horizontalSpacing; + if (colHasComponentsOrColSpan(i) || columnWidths[i] > 0) { + x += columnWidths[i] + horizontalSpacing; + } } if (isUndefinedWidth()) { @@ -602,7 +710,6 @@ public class VGridLayout extends ComplexPanel { - childComponentData.column1; // Set cell height rowspan = 1 + childComponentData.row2 - childComponentData.row1; - setAlignment(new AlignmentInfo(childComponentData.alignment)); } @@ -644,7 +751,7 @@ public class VGridLayout extends ComplexPanel { * Creates a new Cell with the given coordinates. * <p> * For internal use only. May be removed or replaced in the future. - * + * * @param row * @param col * @return @@ -660,7 +767,7 @@ public class VGridLayout extends ComplexPanel { * child component is also returned if "element" is part of its caption. * <p> * For internal use only. May be removed or replaced in the future. - * + * * @param element * An element that is a nested sub element of the root element in * this layout @@ -681,13 +788,13 @@ public class VGridLayout extends ComplexPanel { * child component is also returned if "element" is part of its caption. * <p> * For internal use only. May be removed or replaced in the future. - * + * * @param element * An element that is a nested sub element of the root element in * this layout * @return The Paintable which the element is a part of. Null if the element * belongs to the layout and not to a child. - * + * * @since 7.2 */ public ComponentConnector getComponent(Element element) { diff --git a/client/src/com/vaadin/client/ui/VMenuBar.java b/client/src/com/vaadin/client/ui/VMenuBar.java index f17ffbefed..11fda6222c 100644 --- a/client/src/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/com/vaadin/client/ui/VMenuBar.java @@ -1034,7 +1034,7 @@ public class VMenuBar extends SimpleFocusablePanel implements return null; } - return new TooltipInfo(description); + return new TooltipInfo(description, null, this); } /** diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index d6eec66561..d3317abd4d 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -5157,7 +5157,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, String rowDescription = uidl.getStringAttribute("rowdescr"); if (rowDescription != null && !rowDescription.equals("")) { - tooltipInfo = new TooltipInfo(rowDescription); + tooltipInfo = new TooltipInfo(rowDescription, null, this); } else { tooltipInfo = null; } @@ -5430,7 +5430,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private void setTooltip(TableCellElement td, String description) { if (description != null && !description.equals("")) { - TooltipInfo info = new TooltipInfo(description); + TooltipInfo info = new TooltipInfo(description, null, this); cellToolTips.put(td, info); } else { cellToolTips.remove(td); diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index 3f2d90b721..15d9c83c49 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -329,7 +329,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, private boolean update(TabState tabState) { if (tabState.description != null || tabState.componentError != null) { setTooltipInfo(new TooltipInfo(tabState.description, - tabState.componentError)); + tabState.componentError, this)); } else { setTooltipInfo(null); } diff --git a/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java b/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java index 67220e5c36..786bd18bf9 100644 --- a/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 Vaadin Ltd. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -119,9 +119,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector layout.rowExpandRatioArray = uidl.getIntArrayAttribute("rowExpand"); layout.updateMarginStyleNames(new MarginInfo(getState().marginsBitmask)); - layout.updateSpacingStyleName(getState().spacing); - getLayoutManager().setNeedsLayout(this); } @@ -171,7 +169,8 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector layout.columnWidths = new int[cols]; layout.rowHeights = new int[rows]; - + layout.explicitRowRatios = getState().explicitRowRatios; + layout.explicitColRatios = getState().explicitColRatios; layout.setSize(rows, cols); } diff --git a/client/src/com/vaadin/client/ui/tree/TreeConnector.java b/client/src/com/vaadin/client/ui/tree/TreeConnector.java index c57430b3b4..55224b455f 100644 --- a/client/src/com/vaadin/client/ui/tree/TreeConnector.java +++ b/client/src/com/vaadin/client/ui/tree/TreeConnector.java @@ -269,7 +269,8 @@ public class TreeConnector extends AbstractComponentConnector implements String description = uidl.getStringAttribute("descr"); if (description != null) { - tooltipMap.put(treeNode, new TooltipInfo(description)); + tooltipMap.put(treeNode, new TooltipInfo(description, null, + treeNode)); } if (uidl.getBooleanAttribute("expanded") && !treeNode.getState()) { |