import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.data.DataSource;
import com.vaadin.client.ui.HasRequiredIndicator;
+import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.Range;
import com.vaadin.shared.Registration;
import com.vaadin.shared.data.selection.MultiSelectServerRpc;
import com.vaadin.shared.data.selection.SelectionModel;
import com.vaadin.shared.ui.ListingJsonConstants;
-import com.vaadin.shared.ui.RequiredIndicatorState;
import elemental.json.JsonObject;
}
@Override
- public RequiredIndicatorState getState() {
- return (RequiredIndicatorState) super.getState();
+ public AbstractFieldState getState() {
+ return (AbstractFieldState) super.getState();
}
@Override
return (AbstractFieldState) super.getState();
}
- public boolean isModified() {
- return getState().modified;
- }
-
@Override
public boolean isRequiredIndicatorVisible() {
return getState().required && !isReadOnly();
}
- @Override
- public boolean isErrorIndicatorVisible() {
- return super.isErrorIndicatorVisible() && !getState().hideErrors;
- }
-
@Override
protected void updateWidgetStyleNames() {
super.updateWidgetStyleNames();
- // add / remove modified style name to Fields
- setWidgetStyleName(StyleConstants.MODIFIED, isModified());
-
// add / remove error style name to Fields
setWidgetStyleNameWithPrefix(getWidget().getStylePrimaryName(),
StyleConstants.REQUIRED_EXT, isRequiredIndicatorVisible());
import com.vaadin.server.UserError;
import com.vaadin.server.VaadinSession;
import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.ComponentConstants;
import com.vaadin.shared.ContextClickRpc;
import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.Registration;
import com.vaadin.shared.ui.ComponentStateUtil;
-import com.vaadin.shared.ui.RequiredIndicatorState;
import com.vaadin.shared.util.SharedUtil;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
* apply for all components!</strong>.
* <p>
* If the component supports the required indicator (state extends
- * {@link RequiredIndicatorState}), then expose this method and
+ * {@link AbstractFieldState}), then expose this method and
* {@link #isRequiredIndicatorVisible()} as {@code public} in the component
* and call this method.
* <p>
* This method will throw a {@link IllegalStateException} if the component
* state (returned by {@link #getState()}) does not inherit
- * {@link RequiredIndicatorState}.
+ * {@link AbstractFieldState}.
*
* @param visible
* <code>true</code> to make the required indicator visible,
* <code>false</code> if not
*/
protected void setRequiredIndicatorVisible(boolean visible) {
- if (getState(false) instanceof RequiredIndicatorState) {
- ((RequiredIndicatorState) getState()).required = visible;
+ if (getState(false) instanceof AbstractFieldState) {
+ ((AbstractFieldState) getState()).required = visible;
} else {
throw new IllegalStateException(
"This component does not support the required indicator, since state is of type "
+ getStateType().getSimpleName()
+ " and does not inherit "
- + RequiredIndicatorState.class.getSimpleName());
+ + AbstractFieldState.class.getSimpleName());
}
}
* <p>
* This method will throw a {@link IllegalStateException} if the component
* state (returned by {@link #getState()}) does not inherit
- * {@link RequiredIndicatorState}.
+ * {@link AbstractFieldState}.
*
* @return <code>true</code> if visible, <code>false</code> if not
* @see #setRequiredIndicatorVisible(boolean)
*/
protected boolean isRequiredIndicatorVisible() {
- if (getState(false) instanceof RequiredIndicatorState) {
- return ((RequiredIndicatorState) getState(false)).required;
+ if (getState(false) instanceof AbstractFieldState) {
+ return ((AbstractFieldState) getState(false)).required;
} else {
throw new IllegalStateException(
"This component does not support the required indicator, since state is of type "
+ getStateType().getSimpleName()
+ " and does not inherit "
- + RequiredIndicatorState.class.getSimpleName());
+ + AbstractFieldState.class.getSimpleName());
}
}
import com.vaadin.server.ResourceReference;
import com.vaadin.server.SerializablePredicate;
import com.vaadin.server.data.DataGenerator;
+import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.Registration;
import com.vaadin.shared.data.selection.MultiSelectServerRpc;
import com.vaadin.shared.data.selection.SelectionModel;
import com.vaadin.shared.data.selection.SelectionModel.Multi;
import com.vaadin.shared.ui.ListingJsonConstants;
-import com.vaadin.shared.ui.RequiredIndicatorState;
import com.vaadin.util.ReflectTools;
import elemental.json.JsonObject;
}
@Override
- protected RequiredIndicatorState getState() {
- return (RequiredIndicatorState) super.getState();
+ protected AbstractFieldState getState() {
+ return (AbstractFieldState) super.getState();
}
@Override
- protected RequiredIndicatorState getState(boolean markAsDirty) {
- return (RequiredIndicatorState) super.getState(markAsDirty);
+ protected AbstractFieldState getState(boolean markAsDirty) {
+ return (AbstractFieldState) super.getState(markAsDirty);
}
@Override
*/
package com.vaadin.shared;
-import com.vaadin.shared.ui.RequiredIndicatorState;
+import com.vaadin.shared.ui.TabIndexState;
/**
- * Shared state for {@link com.vaadin.ui.AbstractField}.
+ * State for components that can show the required indicator.
*
* @author Vaadin Ltd
- * @since 7.0.0
+ * @since 8.0.0
*
*/
-public class AbstractFieldState extends RequiredIndicatorState {
- public boolean hideErrors = false;
- public boolean modified = false;
+public class AbstractFieldState extends TabIndexState {
+
+ /**
+ * Is the required indicator visible or not.
+ */
+ public boolean required = false;
+
}
*/
package com.vaadin.shared.ui;
+import com.vaadin.shared.AbstractFieldState;
+
/**
* Shared state for {@code AbstractSingleSelect}.
*
*
* @since 8.0
*/
-public class AbstractSingleSelectState extends RequiredIndicatorState {
+public class AbstractSingleSelectState extends AbstractFieldState {
/**
* The key of the currently selected item or {@code null} if no item is
+++ /dev/null
-/*
- * 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;
-
-}
*/
package com.vaadin.shared.ui.listselect;
+import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.annotations.DelegateToWidget;
-import com.vaadin.shared.ui.RequiredIndicatorState;
/**
* Shared state for ListSelect component.
* @author Vaadin Ltd
*
*/
-public class ListSelectState extends RequiredIndicatorState {
+public class ListSelectState extends AbstractFieldState {
{
primaryStyleName = "v-select";
}
*/
package com.vaadin.shared.ui.optiongroup;
+import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.annotations.DelegateToWidget;
-import com.vaadin.shared.ui.RequiredIndicatorState;
/**
* Shared state for the CheckBoxGroup component.
* @author Vaadin Ltd.
* @since 8.0
*/
-public class CheckBoxGroupState extends RequiredIndicatorState {
+public class CheckBoxGroupState extends AbstractFieldState {
{
primaryStyleName = "v-select-optiongroup";
*/
package com.vaadin.shared.ui.optiongroup;
-import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.annotations.DelegateToWidget;
import com.vaadin.shared.ui.AbstractSingleSelectState;
*/
package com.vaadin.shared.ui.twincolselect;
+import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.annotations.DelegateToWidget;
-import com.vaadin.shared.ui.RequiredIndicatorState;
/**
* Shared state for the TwinColSelect component.
*
* @since 7.0
*/
-public class TwinColSelectState extends RequiredIndicatorState {
+public class TwinColSelectState extends AbstractFieldState {
{
primaryStyleName = "v-select-twincol";
}