summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorpatrik <patrik@vaadin.com>2015-04-07 13:31:32 +0300
committerVaadin Code Review <review@vaadin.com>2015-04-07 11:53:09 +0000
commit0f1dcd23a0bffae76fc312d95d7b64bf7861df88 (patch)
tree912b142a7dc7310cff55ee4781daa77b8ed9bac3 /server
parenta9a48519ef306db52be20b2d302887ee8783c398 (diff)
downloadvaadin-framework-0f1dcd23a0bffae76fc312d95d7b64bf7861df88.tar.gz
vaadin-framework-0f1dcd23a0bffae76fc312d95d7b64bf7861df88.zip
Enable setResponsive/isReponsive API for AbstractComponent (#17369)
Change-Id: I2fb48bff5e55d3d494d9fa927305447dc0c4d816
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java21
-rw-r--r--server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java37
2 files changed, 43 insertions, 15 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index ebe438b908..dae073904b 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -982,11 +982,6 @@ public abstract class AbstractComponent extends AbstractClientConnector
Integer.class));
}
- // handle responsive
- if (attr.hasKey("responsive")) {
- setResponsive(DesignAttributeHandler.getFormatter().parse(
- attr.get("responsive"), Boolean.class));
- }
// check for unsupported attributes
Set<String> supported = new HashSet<String>();
supported.addAll(getDefaultAttributes());
@@ -1032,11 +1027,11 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Toggles responsiveness of this component.
*
- * @since 7.4
+ * @since
* @param responsive
* boolean enables responsiveness, false disables
*/
- private void setResponsive(boolean responsive) {
+ public void setResponsive(boolean responsive) {
if (responsive) {
// make responsive if necessary
if (!isResponsive()) {
@@ -1057,10 +1052,10 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Returns true if the component is responsive
*
- * @since 7.4
+ * @since
* @return true if the component is responsive
*/
- private boolean isResponsive() {
+ public boolean isResponsive() {
for (Extension e : getExtensions()) {
if (e instanceof Responsive) {
return true;
@@ -1233,8 +1228,8 @@ public abstract class AbstractComponent extends AbstractClientConnector
private static final String[] customAttributes = new String[] { "width",
"height", "debug-id", "error", "width-auto", "height-auto",
- "width-full", "height-full", "size-auto", "size-full",
- "responsive", "immediate", "locale", "read-only", "_id" };
+ "width-full", "height-full", "size-auto", "size-full", "immediate",
+ "locale", "read-only", "_id" };
/*
* (non-Javadoc)
@@ -1280,10 +1275,6 @@ public abstract class AbstractComponent extends AbstractClientConnector
((Focusable) def).getTabIndex(), Integer.class);
}
- // handle responsive
- if (isResponsive()) {
- attr.put("responsive", "");
- }
}
/*
diff --git a/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java b/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java
new file mode 100644
index 0000000000..f7dbd0c97e
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.design;
+
+import org.junit.Test;
+
+import com.vaadin.tests.design.DeclarativeTestBase;
+import com.vaadin.ui.GridLayout;
+
+public class AbstractComponentSetResponsiveTest extends
+ DeclarativeTestBase<GridLayout> {
+
+ @Test
+ public void testResponsiveFlag() {
+ GridLayout gl = new GridLayout();
+ gl.setResponsive(true);
+
+ String design = "<v-grid-layout responsive='true' />";
+
+ testWrite(design, gl);
+ testRead(design, gl);
+ }
+
+}