summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/src/com/vaadin/shared/ComponentState.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/shared/src/com/vaadin/shared/ComponentState.java b/shared/src/com/vaadin/shared/ComponentState.java
index 898114e1db..06330a8604 100644
--- a/shared/src/com/vaadin/shared/ComponentState.java
+++ b/shared/src/com/vaadin/shared/ComponentState.java
@@ -90,6 +90,16 @@ public class ComponentState extends SharedState {
}
/**
+ * Returns true if the component height is relative to the parent, i.e.
+ * percentage, false if it is fixed/auto.
+ *
+ * @return true if component height is relative (percentage)
+ */
+ public boolean isRelativeHeight() {
+ return getHeight().endsWith("%");
+ }
+
+ /**
* Returns the component width as set by the server.
*
* Can be relative (containing the percent sign) or absolute, or empty
@@ -128,6 +138,16 @@ public class ComponentState extends SharedState {
}
/**
+ * Returns true if the component width is relative to the parent, i.e.
+ * percentage, false if it is fixed/auto.
+ *
+ * @return true if component width is relative (percentage)
+ */
+ public boolean isRelativeWidth() {
+ return getWidth().endsWith("%");
+ }
+
+ /**
* Returns true if the component is in read-only mode.
*
* @see com.vaadin.ui.Component#isReadOnly()