diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java | 10 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java | 54 |
2 files changed, 44 insertions, 20 deletions
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index 5653e1d1cf..afe81c79a0 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -251,9 +251,6 @@ public abstract class AbstractOrderedLayoutConnector extends slot.setCaption(caption, iconUrlString, styles, error, showError, required, enabled); - slot.setRelativeWidth(child.isRelativeWidth()); - slot.setRelativeHeight(child.isRelativeHeight()); - if (slot.hasCaption()) { CaptionPosition pos = slot.getCaptionPosition(); getLayoutManager().addElementResizeListener( @@ -360,12 +357,15 @@ public abstract class AbstractOrderedLayoutConnector extends // First update bookkeeping for all children for (ComponentConnector child : getChildComponents()) { + Slot slot = getWidget().getSlot(child.getWidget()); + + slot.setRelativeWidth(child.isRelativeWidth()); + slot.setRelativeHeight(child.isRelativeHeight()); + if (child.delegateCaptionHandling()) { updateCaptionInternal(child); } - Slot slot = getWidget().getSlot(child.getWidget()); - // Update slot style names List<String> childStyles = child.getState().styles; if (childStyles == null) { diff --git a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index c9f5b92c90..93176f67bb 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -21,6 +21,7 @@ import java.util.Map; import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.Unit; +import com.google.gwt.dom.client.Style.Visibility; import com.google.gwt.regexp.shared.MatchResult; import com.google.gwt.regexp.shared.RegExp; import com.google.gwt.user.client.DOM; @@ -367,34 +368,54 @@ public class VAbstractOrderedLayout extends FlowPanel { // Sum up expand ratios to get the denominator double total = 0; for (Slot slot : widgetToSlot.values()) { - if (slot.getExpandRatio() != 0) { - total += slot.getExpandRatio(); - } else { - if (vertical) { - slot.getElement().getStyle().clearHeight(); - } else { - slot.getElement().getStyle().clearWidth(); - } - } - slot.getElement().getStyle().clearMarginLeft(); - slot.getElement().getStyle().clearMarginTop(); + // FIXME expandRatio might be <0 + total += slot.getExpandRatio(); } - // Give each child its own share + // Give each expanded child its own share for (Slot slot : widgetToSlot.values()) { + + Element slotElement = slot.getElement(); + slotElement.removeAttribute("aria-hidden"); + + Style slotStyle = slotElement.getStyle(); + slotStyle.clearVisibility(); + slotStyle.clearMarginLeft(); + slotStyle.clearMarginTop(); + if (slot.getExpandRatio() != 0) { + // FIXME expandRatio might be <0 + double size = 100 * (slot.getExpandRatio() / total); + if (vertical) { - slot.setHeight((100 * (slot.getExpandRatio() / total)) - + "%"); + slot.setHeight(size + "%"); if (slot.hasRelativeHeight()) { Util.notifyParentOfSizeChange(this, true); } } else { - slot.setWidth((100 * (slot.getExpandRatio() / total)) + "%"); + slot.setWidth(size + "%"); if (slot.hasRelativeWidth()) { Util.notifyParentOfSizeChange(this, true); } } + + } else if (slot.isRelativeInDirection(vertical)) { + // Relative child without expansion gets no space at all + if (vertical) { + slot.setHeight("0"); + } else { + slot.setWidth("0"); + } + slotStyle.setVisibility(Visibility.HIDDEN); + slotElement.setAttribute("aria-hidden", "true"); + + } else { + // Non-relative child without expansion should be unconstrained + if (vertical) { + slotStyle.clearHeight(); + } else { + slotStyle.clearWidth(); + } } } } @@ -440,6 +461,7 @@ public class VAbstractOrderedLayout extends FlowPanel { public void updateExpandCompensation() { boolean isExpanding = false; for (Widget slot : getChildren()) { + // FIXME expandRatio might be <0 if (((Slot) slot).getExpandRatio() != 0) { isExpanding = true; break; @@ -501,6 +523,7 @@ public class VAbstractOrderedLayout extends FlowPanel { } } } else { + // FIXME expandRatio might be <0 totalSize += vertical ? slot.getOffsetHeight() : slot .getOffsetWidth(); } @@ -532,6 +555,7 @@ public class VAbstractOrderedLayout extends FlowPanel { lastExpandSize = totalSize; for (Widget w : getChildren()) { Slot slot = (Slot) w; + // FIXME expandRatio might be <0 if (slot.getExpandRatio() != 0) { if (layoutManager != null) { layoutManager.setNeedsMeasure(Util |