diff options
author | John Ahlroos <john@vaadin.com> | 2012-09-05 18:04:37 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2012-09-05 18:04:37 +0300 |
commit | 64f96ece116c5077a0d92e5488755812429f93d6 (patch) | |
tree | e534c04ee5ee559d13b9a0bbb39a7b96dca5082f /client | |
parent | 2fd07a0bd26754d72e77810bc280c6abac740f29 (diff) | |
download | vaadin-framework-64f96ece116c5077a0d92e5488755812429f93d6.tar.gz vaadin-framework-64f96ece116c5077a0d92e5488755812429f93d6.zip |
Applied proper formatting
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java | 96 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/orderedlayout/VOrderedLayout.java | 12 |
2 files changed, 59 insertions, 49 deletions
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index 8807fcfbc0..d7b0520784 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -239,45 +239,44 @@ public abstract class AbstractOrderedLayoutConnector extends String iconUrlString = iconUrl != null ? iconUrl.toString() : null; List<String> styles = child.getState().styles; String error = child.getState().errorMessage; - boolean showError = error != null; - if (child.getState() instanceof AbstractFieldState) { - AbstractFieldState abstractFieldState = (AbstractFieldState) child - .getState(); + boolean showError = error != null; + if (child.getState() instanceof AbstractFieldState) { + AbstractFieldState abstractFieldState = (AbstractFieldState) child + .getState(); showError = showError && !abstractFieldState.hideErrors; - } - boolean required = false; - if (child instanceof AbstractFieldConnector) { - required = ((AbstractFieldConnector) child).isRequired(); - } + } + boolean required = false; + if (child instanceof AbstractFieldConnector) { + required = ((AbstractFieldConnector) child).isRequired(); + } boolean enabled = child.getState().enabled; slot.setCaption(caption, iconUrlString, styles, error, showError, - required, - enabled); + required, enabled); - slot.setRelativeWidth(child.isRelativeWidth()); - slot.setRelativeHeight(child.isRelativeHeight()); + slot.setRelativeWidth(child.isRelativeWidth()); + slot.setRelativeHeight(child.isRelativeHeight()); - if (slot.hasCaption()) { - CaptionPosition pos = slot.getCaptionPosition(); - getLayoutManager().addElementResizeListener( - slot.getCaptionElement(), slotCaptionResizeListener); - if (child.isRelativeHeight() - && (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) { - getWidget().updateCaptionOffset(slot.getCaptionElement()); - } else if (child.isRelativeWidth() - && (pos == CaptionPosition.LEFT || pos == CaptionPosition.RIGHT)) { - getWidget().updateCaptionOffset(slot.getCaptionElement()); - } - } else { - childCaptionElementHeight.remove(child.getWidget().getElement()); - } + if (slot.hasCaption()) { + CaptionPosition pos = slot.getCaptionPosition(); + getLayoutManager().addElementResizeListener( + slot.getCaptionElement(), slotCaptionResizeListener); + if (child.isRelativeHeight() + && (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) { + getWidget().updateCaptionOffset(slot.getCaptionElement()); + } else if (child.isRelativeWidth() + && (pos == CaptionPosition.LEFT || pos == CaptionPosition.RIGHT)) { + getWidget().updateCaptionOffset(slot.getCaptionElement()); + } + } else { + childCaptionElementHeight.remove(child.getWidget().getElement()); + } - updateLayoutHeight(); + updateLayoutHeight(); - if (needsExpand()) { + if (needsExpand()) { getWidget().updateExpand(); - } + } } /* @@ -317,9 +316,9 @@ public abstract class AbstractOrderedLayoutConnector extends childComponentResizeListener); if (slot.hasCaption()) { getLayoutManager() - .removeElementResizeListener( - slot.getCaptionElement(), - slotCaptionResizeListener); + .removeElementResizeListener( + slot.getCaptionElement(), + slotCaptionResizeListener); } if (slot.getSpacingElement() != null) { getLayoutManager().removeElementResizeListener( @@ -401,7 +400,6 @@ public abstract class AbstractOrderedLayoutConnector extends updateLayoutHeight(); } - /** * Does the layout need a fixed height? */ @@ -442,32 +440,40 @@ public abstract class AbstractOrderedLayoutConnector extends Slot slot = getWidget().getSlot(child.getWidget()); // Clear all possible listeners first - rmeoveResizeListener(slot.getWidget().getElement(), childComponentResizeListener); + rmeoveResizeListener(slot.getWidget().getElement(), + childComponentResizeListener); if (slot.hasCaption()) { - rmeoveResizeListener(slot.getCaptionElement(), slotCaptionResizeListener); + rmeoveResizeListener(slot.getCaptionElement(), + slotCaptionResizeListener); } if (slot.hasSpacing()) { - rmeoveResizeListener(slot.getSpacingElement(), spacingResizeListener); + rmeoveResizeListener(slot.getSpacingElement(), + spacingResizeListener); } // Add all necessary listeners if (needsFixedHeight()) { - addResizeListener(slot.getWidget().getElement(), childComponentResizeListener); + addResizeListener(slot.getWidget().getElement(), + childComponentResizeListener); if (slot.hasCaption()) { - addResizeListener(slot.getCaptionElement(), slotCaptionResizeListener); + addResizeListener(slot.getCaptionElement(), + slotCaptionResizeListener); } } else if ((child.isRelativeHeight() || child.isRelativeWidth()) && slot.hasCaption()) { // If the slot has caption, we need to listen for it's size changes // in order to update the padding/margin offset for relative sized // components - addResizeListener(slot.getCaptionElement(), slotCaptionResizeListener); + addResizeListener(slot.getCaptionElement(), + slotCaptionResizeListener); } if (needsExpand()) { - addResizeListener(slot.getWidget().getElement(), childComponentResizeListener); + addResizeListener(slot.getWidget().getElement(), + childComponentResizeListener); if (slot.hasSpacing()) { - addResizeListener(slot.getSpacingElement(), spacingResizeListener); + addResizeListener(slot.getSpacingElement(), + spacingResizeListener); } } @@ -548,11 +554,13 @@ public abstract class AbstractOrderedLayoutConnector extends for (ComponentConnector child : getChildComponents()) { Slot slot = getWidget().getSlot(child.getWidget()); if (slot.hasCaption()) { - rmeoveResizeListener(slot.getCaptionElement(), slotCaptionResizeListener); + rmeoveResizeListener(slot.getCaptionElement(), + slotCaptionResizeListener); } if (slot.getSpacingElement() != null) { - rmeoveResizeListener(slot.getSpacingElement(), spacingResizeListener); + rmeoveResizeListener(slot.getSpacingElement(), + spacingResizeListener); } rmeoveResizeListener(slot.getWidget().getElement(), diff --git a/client/src/com/vaadin/client/ui/orderedlayout/VOrderedLayout.java b/client/src/com/vaadin/client/ui/orderedlayout/VOrderedLayout.java index 9c45680d92..7dc816f287 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/VOrderedLayout.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/VOrderedLayout.java @@ -504,6 +504,7 @@ public class VOrderedLayout extends FlowPanel { * static width */ private boolean relativeWidth = false; + protected void setRelativeWidth(boolean relativeWidth) { this.relativeWidth = relativeWidth; updateRelativeSize(relativeWidth, "width"); @@ -517,6 +518,7 @@ public class VOrderedLayout extends FlowPanel { * has a static height */ private boolean relativeHeight = false; + protected void setRelativeHeight(boolean relativeHeight) { this.relativeHeight = relativeHeight; updateRelativeSize(relativeHeight, "height"); @@ -535,7 +537,7 @@ public class VOrderedLayout extends FlowPanel { captionWrap.getStyle().setProperty( direction, getWidget().getElement().getStyle() - .getProperty(direction)); + .getProperty(direction)); captionWrap.addClassName("v-has-" + direction); } else if (hasCaption()) { if (direction.equals("height")) { @@ -665,7 +667,7 @@ public class VOrderedLayout extends FlowPanel { public void setLayoutManager(LayoutManager manager) { layoutManager = manager; } - + /** * Get the layout manager used by this layout * @@ -935,11 +937,11 @@ public class VOrderedLayout extends FlowPanel { if (vertical) { expandWrapper.getStyle().setPaddingTop(totalSize, Unit.PX); expandWrapper.getFirstChildElement().getStyle() - .setMarginTop(-totalSize, Unit.PX); + .setMarginTop(-totalSize, Unit.PX); } else { expandWrapper.getStyle().setPaddingLeft(totalSize, Unit.PX); expandWrapper.getFirstChildElement().getStyle() - .setMarginLeft(-totalSize, Unit.PX); + .setMarginLeft(-totalSize, Unit.PX); } recalculateExpands(); @@ -980,7 +982,7 @@ public class VOrderedLayout extends FlowPanel { newHeight = getElement().getOffsetHeight(); } VOrderedLayout.this.getElement().getStyle() - .setHeight(newHeight, Unit.PX); + .setHeight(newHeight, Unit.PX); } } |