From 08c748acfffa5c6f94933561de19fd8522ab8cad Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Fri, 20 Dec 2019 13:55:29 +0200 Subject: [PATCH] Added helper methods for setting only height or width full. (#11854) --- .../main/java/com/vaadin/server/Sizeable.java | 14 ++++++++++++ .../java/com/vaadin/ui/AbstractComponent.java | 22 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/vaadin/server/Sizeable.java b/server/src/main/java/com/vaadin/server/Sizeable.java index 19780ec375..d0a7e6da17 100644 --- a/server/src/main/java/com/vaadin/server/Sizeable.java +++ b/server/src/main/java/com/vaadin/server/Sizeable.java @@ -254,6 +254,20 @@ public interface Sizeable extends Serializable { */ public void setSizeFull(); + /** + * Sets the width to 100%. + * + * @since + */ + public void setWidthFull(); + + /** + * Sets the height to 100%. + * + * @since + */ + public void setHeightFull(); + /** * Clears any size settings. */ diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index d900f34872..17b2b8229e 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -30,8 +30,6 @@ import java.util.Objects; import java.util.Set; import java.util.StringTokenizer; -import com.vaadin.annotations.Theme; -import com.vaadin.ui.themes.ValoTheme; import org.jsoup.nodes.Attribute; import org.jsoup.nodes.Attributes; import org.jsoup.nodes.Element; @@ -837,6 +835,26 @@ public abstract class AbstractComponent extends AbstractClientConnector setHeight(100, Unit.PERCENTAGE); } + /* + * (non-Javadoc) + * + * @see com.vaadin.server.Sizeable#setWidthFull() + */ + @Override + public void setWidthFull() { + setWidth(100, Unit.PERCENTAGE); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.server.Sizeable#setHeightFull() + */ + @Override + public void setHeightFull() { + setHeight(100, Unit.PERCENTAGE); + } + /* * (non-Javadoc) * -- 2.39.5