aboutsummaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2016-10-27 16:13:44 +0300
committerVaadin Code Review <review@vaadin.com>2016-11-01 10:26:33 +0000
commit48c249a13ecca8c4c8bd68814850e5e3cdd37d81 (patch)
treeb1f066b2bdd48b09b38b27bd677abba1b0d5d5fc /shared
parent92d697b9886896f1dad41026ba3519563838f93e (diff)
downloadvaadin-framework-48c249a13ecca8c4c8bd68814850e5e3cdd37d81.tar.gz
vaadin-framework-48c249a13ecca8c4c8bd68814850e5e3cdd37d81.zip
Replace setRequired & HasRequired with setRequiredIndicator
Vaadin 7 compatiblity fields still use setRequired via AbstractField (legacy). Public setRequiredIndicator is added to AbstractField, AbstractMultiSelect and AbstractSingleSelect. Internally it is still handled on AbstractComponent & -Connector level. Changes the declarative syntax, required -> required-indicator-visible. Fixes vaadin/framework8-issue#419 Change-Id: I940dc66944d27584bd78e5452aee627ee3abd03a
Diffstat (limited to 'shared')
-rw-r--r--shared/src/main/java/com/vaadin/shared/AbstractFieldState.java5
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/AbstractSingleSelectState.java8
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/RequiredIndicatorState.java32
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/TabIndexState.java2
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/listselect/ListSelectState.java4
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/optiongroup/CheckBoxGroupState.java4
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java4
7 files changed, 45 insertions, 14 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/AbstractFieldState.java b/shared/src/main/java/com/vaadin/shared/AbstractFieldState.java
index 5040e91d48..e24880c3af 100644
--- a/shared/src/main/java/com/vaadin/shared/AbstractFieldState.java
+++ b/shared/src/main/java/com/vaadin/shared/AbstractFieldState.java
@@ -15,7 +15,7 @@
*/
package com.vaadin.shared;
-import com.vaadin.shared.ui.TabIndexState;
+import com.vaadin.shared.ui.RequiredIndicatorState;
/**
* Shared state for {@link com.vaadin.ui.AbstractField}.
@@ -24,8 +24,7 @@ import com.vaadin.shared.ui.TabIndexState;
* @since 7.0.0
*
*/
-public class AbstractFieldState extends TabIndexState {
+public class AbstractFieldState extends RequiredIndicatorState {
public boolean hideErrors = false;
- public boolean required = false;
public boolean modified = false;
}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/AbstractSingleSelectState.java b/shared/src/main/java/com/vaadin/shared/ui/AbstractSingleSelectState.java
index 98aad0bf37..da4510bfdb 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/AbstractSingleSelectState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/AbstractSingleSelectState.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2016 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
@@ -22,7 +22,7 @@ package com.vaadin.shared.ui;
*
* @since 8.0
*/
-public class AbstractSingleSelectState extends TabIndexState {
+public class AbstractSingleSelectState extends RequiredIndicatorState {
/**
* The key of the currently selected item or {@code null} if no item is
diff --git a/shared/src/main/java/com/vaadin/shared/ui/RequiredIndicatorState.java b/shared/src/main/java/com/vaadin/shared/ui/RequiredIndicatorState.java
new file mode 100644
index 0000000000..b26a8ceb2b
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/RequiredIndicatorState.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2016 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.shared.ui;
+
+/**
+ * State for components that can show the required indicator.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0.0
+ *
+ */
+public class RequiredIndicatorState extends TabIndexState {
+
+ /**
+ * Is the required indicator visible or not.
+ */
+ public boolean required;
+
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/TabIndexState.java b/shared/src/main/java/com/vaadin/shared/ui/TabIndexState.java
index f0c709d373..485448e758 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/TabIndexState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/TabIndexState.java
@@ -19,7 +19,7 @@ import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.annotations.NoLayout;
/**
- * Interface implemented by state classes that support tab indexes.
+ * State for components that support tab indexes.
*
* @author Vaadin Ltd
* @since 7.0.0
diff --git a/shared/src/main/java/com/vaadin/shared/ui/listselect/ListSelectState.java b/shared/src/main/java/com/vaadin/shared/ui/listselect/ListSelectState.java
index 8999f3c739..8992dc6647 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/listselect/ListSelectState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/listselect/ListSelectState.java
@@ -16,7 +16,7 @@
package com.vaadin.shared.ui.listselect;
import com.vaadin.shared.annotations.DelegateToWidget;
-import com.vaadin.shared.ui.TabIndexState;
+import com.vaadin.shared.ui.RequiredIndicatorState;
/**
* Shared state for ListSelect component.
@@ -24,7 +24,7 @@ import com.vaadin.shared.ui.TabIndexState;
* @author Vaadin Ltd
*
*/
-public class ListSelectState extends TabIndexState {
+public class ListSelectState extends RequiredIndicatorState {
{
primaryStyleName = "v-select";
}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/optiongroup/CheckBoxGroupState.java b/shared/src/main/java/com/vaadin/shared/ui/optiongroup/CheckBoxGroupState.java
index 2decfdd49c..82695a913c 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/optiongroup/CheckBoxGroupState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/optiongroup/CheckBoxGroupState.java
@@ -16,7 +16,7 @@
package com.vaadin.shared.ui.optiongroup;
import com.vaadin.shared.annotations.DelegateToWidget;
-import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ui.RequiredIndicatorState;
/**
* Shared state for the CheckBoxGroup component.
@@ -24,7 +24,7 @@ import com.vaadin.shared.AbstractFieldState;
* @author Vaadin Ltd.
* @since 8.0
*/
-public class CheckBoxGroupState extends AbstractFieldState {
+public class CheckBoxGroupState extends RequiredIndicatorState {
{
primaryStyleName = "v-select-optiongroup";
diff --git a/shared/src/main/java/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java b/shared/src/main/java/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java
index a6b09c0e91..fe1f1fab23 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java
@@ -16,14 +16,14 @@
package com.vaadin.shared.ui.twincolselect;
import com.vaadin.shared.annotations.DelegateToWidget;
-import com.vaadin.shared.ui.TabIndexState;
+import com.vaadin.shared.ui.RequiredIndicatorState;
/**
* Shared state for the TwinColSelect component.
*
* @since 7.0
*/
-public class TwinColSelectState extends TabIndexState {
+public class TwinColSelectState extends RequiredIndicatorState {
{
primaryStyleName = "v-select-twincol";
}