diff options
author | Mika Murtojarvi <mika@vaadin.com> | 2014-12-11 18:25:40 +0200 |
---|---|---|
committer | Mika Murtojarvi <mika@vaadin.com> | 2014-12-12 16:36:20 +0200 |
commit | 628a2edf50c355e6e43e1da2e32224d32651327d (patch) | |
tree | 9814351d253b08720742237cd1ea84931636d215 /server/src/com/vaadin/ui/AbstractComponent.java | |
parent | a025d511bfe4e81993d33fc424a9bed754586a52 (diff) | |
download | vaadin-framework-628a2edf50c355e6e43e1da2e32224d32651327d.tar.gz vaadin-framework-628a2edf50c355e6e43e1da2e32224d32651327d.zip |
Declarative support for split panel (#7749).
Change-Id: I96b7be150c9b6511f9fb701c5ee26afca67f1512
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractComponent.java')
-rw-r--r-- | server/src/com/vaadin/ui/AbstractComponent.java | 59 |
1 files changed, 3 insertions, 56 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 18cd1f5fa4..1cda253b01 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -16,7 +16,6 @@ package com.vaadin.ui; -import java.io.Serializable; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; @@ -28,8 +27,6 @@ import java.util.Locale; import java.util.Set; import java.util.StringTokenizer; import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.jsoup.nodes.Attribute; import org.jsoup.nodes.Attributes; @@ -46,6 +43,7 @@ import com.vaadin.server.ErrorMessage.ErrorLevel; import com.vaadin.server.Extension; import com.vaadin.server.Resource; import com.vaadin.server.Responsive; +import com.vaadin.server.SizeWithUnit; import com.vaadin.server.Sizeable; import com.vaadin.server.UserError; import com.vaadin.server.VaadinSession; @@ -100,8 +98,6 @@ public abstract class AbstractComponent extends AbstractClientConnector private float height = SIZE_UNDEFINED; private Unit widthUnit = Unit.PIXELS; private Unit heightUnit = Unit.PIXELS; - private static final Pattern sizePattern = Pattern - .compile(SharedUtil.SIZE_PATTERN); /** * Keeps track of the Actions added to this component; the actual @@ -890,7 +886,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setWidth(String width) { - Size size = parseStringSize(width); + SizeWithUnit size = SizeWithUnit.parseStringSize(width); if (size != null) { setWidth(size.getSize(), size.getUnit()); } else { @@ -905,7 +901,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setHeight(String height) { - Size size = parseStringSize(height); + SizeWithUnit size = SizeWithUnit.parseStringSize(height); if (size != null) { setHeight(size.getSize(), size.getUnit()); } else { @@ -1251,55 +1247,6 @@ public abstract class AbstractComponent extends AbstractClientConnector } /* - * Returns array with size in index 0 unit in index 1. Null or empty string - * will produce {-1,Unit#PIXELS} - */ - private static Size parseStringSize(String s) { - if (s == null) { - return null; - } - s = s.trim(); - if ("".equals(s)) { - return null; - } - float size = 0; - Unit unit = null; - Matcher matcher = sizePattern.matcher(s); - if (matcher.find()) { - size = Float.parseFloat(matcher.group(1)); - if (size < 0) { - size = -1; - unit = Unit.PIXELS; - } else { - String symbol = matcher.group(2); - unit = Unit.getUnitFromSymbol(symbol); - } - } else { - throw new IllegalArgumentException("Invalid size argument: \"" + s - + "\" (should match " + sizePattern.pattern() + ")"); - } - return new Size(size, unit); - } - - private static class Size implements Serializable { - float size; - Unit unit; - - public Size(float size, Unit unit) { - this.size = size; - this.unit = unit; - } - - public float getSize() { - return size; - } - - public Unit getUnit() { - return unit; - } - } - - /* * Actions */ |