Adds a v7 AbstractFieldConnector for the compatibility package Remove dependency from core to old AbstractField Change-Id: I5da665de69cf469adfa946cf18aae1a3e56c3486tags/8.0.0.alpha1
@@ -26,12 +26,12 @@ import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.HasHTML; | |||
import com.vaadin.client.communication.StateChangeEvent; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.HasErrorIndicator; | |||
import com.vaadin.client.ui.HasRequiredIndicator; | |||
import com.vaadin.client.ui.Icon; | |||
import com.vaadin.client.ui.ImageIcon; | |||
import com.vaadin.client.ui.aria.AriaHelper; | |||
import com.vaadin.shared.AbstractComponentState; | |||
import com.vaadin.shared.AbstractFieldState; | |||
import com.vaadin.shared.ComponentConstants; | |||
import com.vaadin.shared.ui.ComponentStateUtil; | |||
@@ -158,14 +158,13 @@ public class VCaption extends HTML { | |||
boolean hasIcon = owner.getState().resources | |||
.containsKey(ComponentConstants.ICON_RESOURCE); | |||
boolean showRequired = false; | |||
boolean showError = owner.getState().errorMessage != null; | |||
if (owner.getState() instanceof AbstractFieldState) { | |||
AbstractFieldState abstractFieldState = (AbstractFieldState) owner | |||
.getState(); | |||
showError = showError && !abstractFieldState.hideErrors; | |||
boolean showError = false; | |||
if (owner instanceof HasRequiredIndicator) { | |||
showRequired = ((HasRequiredIndicator) owner) | |||
.isRequiredIndicatorVisible(); | |||
} | |||
if (owner instanceof AbstractFieldConnector) { | |||
showRequired = ((AbstractFieldConnector) owner).isRequired(); | |||
if (owner instanceof HasErrorIndicator) { | |||
showError = ((HasErrorIndicator) owner).isErrorIndicatorVisible(); | |||
} | |||
if (icon != null) { | |||
@@ -454,24 +453,27 @@ public class VCaption extends HTML { | |||
} | |||
} | |||
public static boolean isNeeded(AbstractComponentState state) { | |||
public static boolean isNeeded(ComponentConnector connector) { | |||
AbstractComponentState state = connector.getState(); | |||
if (state.caption != null) { | |||
return true; | |||
} | |||
if (state.resources.containsKey(ComponentConstants.ICON_RESOURCE)) { | |||
return true; | |||
} | |||
if (state.errorMessage != null) { | |||
if (connector instanceof HasErrorIndicator | |||
&& ((HasErrorIndicator) connector).isErrorIndicatorVisible()) { | |||
return true; | |||
} | |||
if (state instanceof AbstractFieldState) { | |||
if (((AbstractFieldState) state).required) { | |||
return true; | |||
} | |||
if (connector instanceof HasRequiredIndicator | |||
&& ((HasRequiredIndicator) connector) | |||
.isRequiredIndicatorVisible()) { | |||
return true; | |||
} | |||
return false; | |||
} | |||
/** |
@@ -62,7 +62,7 @@ import com.vaadin.shared.ui.ComponentStateUtil; | |||
import com.vaadin.shared.ui.TabIndexState; | |||
public abstract class AbstractComponentConnector extends AbstractConnector | |||
implements ComponentConnector { | |||
implements ComponentConnector, HasErrorIndicator { | |||
private HandlerRegistration contextHandler = null; | |||
@@ -616,8 +616,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector | |||
* primary style name of the widget returned by {@link #getWidget()} | |||
* <p> | |||
* This method can be overridden to provide additional style names for the | |||
* component, for example see | |||
* {@link AbstractFieldConnector#updateWidgetStyleNames()} | |||
* component, for example see {@code AbstractFieldConnector} | |||
* </p> | |||
*/ | |||
protected void updateWidgetStyleNames() { | |||
@@ -809,4 +808,9 @@ public abstract class AbstractComponentConnector extends AbstractConnector | |||
public void flush() { | |||
// No generic implementation. Override if needed | |||
} | |||
@Override | |||
public boolean isErrorIndicatorVisible() { | |||
return getState().errorMessage != null; | |||
} | |||
} |
@@ -18,8 +18,8 @@ package com.vaadin.client.ui; | |||
import com.vaadin.client.StyleConstants; | |||
import com.vaadin.shared.AbstractFieldState; | |||
public abstract class AbstractFieldConnector | |||
extends AbstractComponentConnector { | |||
public abstract class AbstractFieldConnector extends AbstractComponentConnector | |||
implements HasRequiredIndicator, HasErrorIndicator { | |||
@Override | |||
public AbstractFieldState getState() { | |||
@@ -43,10 +43,16 @@ public abstract class AbstractFieldConnector | |||
* | |||
* @return true if required indicator should be shown | |||
*/ | |||
public boolean isRequired() { | |||
@Override | |||
public boolean isRequiredIndicatorVisible() { | |||
return getState().required && !isReadOnly(); | |||
} | |||
@Override | |||
public boolean isErrorIndicatorVisible() { | |||
return super.isErrorIndicatorVisible() && !getState().hideErrors; | |||
} | |||
@Override | |||
protected void updateWidgetStyleNames() { | |||
super.updateWidgetStyleNames(); | |||
@@ -56,8 +62,9 @@ public abstract class AbstractFieldConnector | |||
// add / remove error style name to Fields | |||
setWidgetStyleNameWithPrefix(getWidget().getStylePrimaryName(), | |||
StyleConstants.REQUIRED_EXT, isRequired()); | |||
StyleConstants.REQUIRED_EXT, isRequiredIndicatorVisible()); | |||
getWidget().setStyleName(StyleConstants.REQUIRED, isRequired()); | |||
getWidget().setStyleName(StyleConstants.REQUIRED, | |||
isRequiredIndicatorVisible()); | |||
} | |||
} |
@@ -13,13 +13,21 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.client.v7.ui.checkbox; | |||
package com.vaadin.client.ui; | |||
import com.vaadin.client.ui.checkbox.CheckBoxConnector; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.v7.ui.CheckBox; | |||
import com.vaadin.client.ComponentConnector; | |||
@Connect(CheckBox.class) | |||
public class LegacyCheckBoxConnector extends CheckBoxConnector { | |||
/** | |||
* Implemented by connectors supporting an error indicator. | |||
*/ | |||
public interface HasErrorIndicator extends ComponentConnector { | |||
/** | |||
* Checks if an error indicator should be shown for the given connector. | |||
* | |||
* @return <code>true</code> to show an indicator, <code>false</code> | |||
* otherwise | |||
*/ | |||
boolean isErrorIndicatorVisible(); | |||
} |
@@ -0,0 +1,33 @@ | |||
/* | |||
* 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.client.ui; | |||
import com.vaadin.client.ComponentConnector; | |||
/** | |||
* Implemented by connectors supporting a required flag. | |||
*/ | |||
public interface HasRequiredIndicator extends ComponentConnector { | |||
/** | |||
* Checks if a required indicator should be shown for the given connector. | |||
* | |||
* @return <code>true</code> to show an indicator, <code>false</code> | |||
* otherwise | |||
*/ | |||
boolean isRequiredIndicatorVisible(); | |||
} |
@@ -300,20 +300,22 @@ public class VCustomLayout extends ComplexPanel { | |||
return res; | |||
} | |||
/** Update caption for given widget */ | |||
public void updateCaption(ComponentConnector paintable) { | |||
Widget widget = paintable.getWidget(); | |||
/** | |||
* Update caption for the given child connector. | |||
*/ | |||
public void updateCaption(ComponentConnector childConnector) { | |||
Widget widget = childConnector.getWidget(); | |||
if (widget.getParent() != this) { | |||
// Widget has not been added because the location was not found | |||
return; | |||
} | |||
VCaptionWrapper wrapper = childWidgetToCaptionWrapper.get(widget); | |||
if (VCaption.isNeeded(paintable.getState())) { | |||
if (VCaption.isNeeded(childConnector)) { | |||
if (wrapper == null) { | |||
// Add a wrapper between the layout and the child widget | |||
final String loc = getLocation(widget); | |||
super.remove(widget); | |||
wrapper = new VCaptionWrapper(paintable, client); | |||
wrapper = new VCaptionWrapper(childConnector, client); | |||
super.add(wrapper, locationToElement.get(loc)); | |||
childWidgetToCaptionWrapper.put(widget, wrapper); | |||
} |
@@ -302,8 +302,8 @@ public class VFormLayout extends SimplePanel { | |||
removeStyleDependentName("hasdescription"); | |||
} | |||
boolean required = owner instanceof AbstractFieldConnector | |||
&& ((AbstractFieldConnector) owner).isRequired(); | |||
boolean required = owner instanceof HasRequiredIndicator | |||
&& ((HasRequiredIndicator) owner).isRequiredIndicatorVisible(); | |||
AriaHelper.handleInputRequired(owner.getWidget(), required); | |||
@@ -116,20 +116,21 @@ public class AbsoluteLayoutConnector extends AbstractComponentContainerConnector | |||
* .client.ComponentConnector) | |||
*/ | |||
@Override | |||
public void updateCaption(ComponentConnector component) { | |||
public void updateCaption(ComponentConnector childConnector) { | |||
VAbsoluteLayout absoluteLayoutWidget = getWidget(); | |||
boolean captionIsNeeded = VCaption.isNeeded(component.getState()); | |||
boolean captionIsNeeded = VCaption.isNeeded(childConnector); | |||
VCaption caption = absoluteLayoutWidget | |||
.getWidgetCaption(component.getWidget()); | |||
.getWidgetCaption(childConnector.getWidget()); | |||
if (captionIsNeeded) { | |||
if (caption == null) { | |||
caption = new VCaption(component, getConnection()); | |||
caption = new VCaption(childConnector, getConnection()); | |||
} | |||
absoluteLayoutWidget.setWidgetCaption(component.getWidget(), | |||
absoluteLayoutWidget.setWidgetCaption(childConnector.getWidget(), | |||
caption); | |||
} else if (caption != null) { | |||
absoluteLayoutWidget.setWidgetCaption(component.getWidget(), null); | |||
absoluteLayoutWidget.setWidgetCaption(childConnector.getWidget(), | |||
null); | |||
} | |||
} | |||
@@ -82,7 +82,7 @@ public class CheckBoxConnector extends AbstractFieldConnector | |||
getWidget().setAriaInvalid(false); | |||
} | |||
getWidget().setAriaRequired(isRequired()); | |||
getWidget().setAriaRequired(isRequiredIndicatorVisible()); | |||
if (isReadOnly()) { | |||
getWidget().setEnabled(false); | |||
} |
@@ -190,7 +190,7 @@ public class CssLayoutConnector extends AbstractLayoutConnector { | |||
String childId = child.getConnectorId(); | |||
VCaption caption = childIdToCaption.get(childId); | |||
if (VCaption.isNeeded(child.getState())) { | |||
if (VCaption.isNeeded(child)) { | |||
if (caption == null) { | |||
caption = new VCaption(child, getConnection()); | |||
childIdToCaption.put(childId, caption); |
@@ -27,8 +27,8 @@ import com.vaadin.client.TooltipInfo; | |||
import com.vaadin.client.Util; | |||
import com.vaadin.client.WidgetUtil; | |||
import com.vaadin.client.communication.StateChangeEvent; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.AbstractLayoutConnector; | |||
import com.vaadin.client.ui.HasErrorIndicator; | |||
import com.vaadin.client.ui.LayoutClickEventHandler; | |||
import com.vaadin.client.ui.PostLayoutListener; | |||
import com.vaadin.client.ui.VFormLayout; | |||
@@ -248,10 +248,9 @@ public class FormLayoutConnector extends AbstractLayoutConnector | |||
component.getState(), component.isEnabled()); | |||
boolean hideErrors = false; | |||
// FIXME This incorrectly depends on AbstractFieldConnector | |||
if (component instanceof AbstractFieldConnector) { | |||
hideErrors = ((AbstractFieldConnector) component) | |||
.getState().hideErrors; | |||
if (component instanceof HasErrorIndicator) { | |||
hideErrors = !((HasErrorIndicator) component) | |||
.isErrorIndicatorVisible(); | |||
} | |||
getWidget().table.updateError(component.getWidget(), |
@@ -170,7 +170,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector | |||
public void updateCaption(ComponentConnector childConnector) { | |||
VGridLayout layout = getWidget(); | |||
Cell cell = layout.widgetToCell.get(childConnector.getWidget()); | |||
if (VCaption.isNeeded(childConnector.getState())) { | |||
if (VCaption.isNeeded(childConnector)) { | |||
VLayoutSlot layoutSlot = cell.slot; | |||
VCaption caption = layoutSlot.getCaption(); | |||
if (caption == null) { |
@@ -33,14 +33,14 @@ import com.vaadin.client.Util; | |||
import com.vaadin.client.WidgetUtil; | |||
import com.vaadin.client.communication.StateChangeEvent; | |||
import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.AbstractLayoutConnector; | |||
import com.vaadin.client.ui.HasErrorIndicator; | |||
import com.vaadin.client.ui.HasRequiredIndicator; | |||
import com.vaadin.client.ui.Icon; | |||
import com.vaadin.client.ui.LayoutClickEventHandler; | |||
import com.vaadin.client.ui.aria.AriaHelper; | |||
import com.vaadin.client.ui.layout.ElementResizeEvent; | |||
import com.vaadin.client.ui.layout.ElementResizeListener; | |||
import com.vaadin.shared.AbstractFieldState; | |||
import com.vaadin.shared.ComponentConstants; | |||
import com.vaadin.shared.communication.URLReference; | |||
import com.vaadin.shared.ui.AlignmentInfo; | |||
@@ -260,15 +260,14 @@ public abstract class AbstractOrderedLayoutConnector | |||
List<String> styles = child.getState().styles; | |||
String error = child.getState().errorMessage; | |||
boolean showError = error != null; | |||
if (child.getState() instanceof AbstractFieldState) { | |||
AbstractFieldState abstractFieldState = (AbstractFieldState) child | |||
.getState(); | |||
showError = showError && !abstractFieldState.hideErrors; | |||
boolean showError = false; | |||
if (child instanceof HasErrorIndicator) { | |||
showError = ((HasErrorIndicator) child).isErrorIndicatorVisible(); | |||
} | |||
boolean required = false; | |||
if (child instanceof AbstractFieldConnector) { | |||
required = ((AbstractFieldConnector) child).isRequired(); | |||
if (child instanceof HasRequiredIndicator) { | |||
required = ((HasRequiredIndicator) child) | |||
.isRequiredIndicatorVisible(); | |||
} | |||
boolean enabled = child.isEnabled(); | |||
@@ -143,7 +143,7 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector | |||
getWidget().setIconUri(null, client); | |||
} | |||
getWidget().setErrorIndicatorVisible(null != getState().errorMessage); | |||
getWidget().setErrorIndicatorVisible(isErrorIndicatorVisible()); | |||
// We may have actions attached to this panel | |||
if (uidl.getChildCount() > 0) { |
@@ -63,13 +63,13 @@ public class PopupViewConnector extends AbstractHasComponentsConnector | |||
} | |||
@Override | |||
public void updateCaption(ComponentConnector component) { | |||
if (VCaption.isNeeded(component.getState())) { | |||
public void updateCaption(ComponentConnector childConnector) { | |||
if (VCaption.isNeeded(childConnector)) { | |||
if (getWidget().popup.captionWrapper != null) { | |||
getWidget().popup.captionWrapper.updateCaption(); | |||
} else { | |||
getWidget().popup.captionWrapper = new VCaptionWrapper( | |||
component, getConnection()); | |||
childConnector, getConnection()); | |||
getWidget().popup.setWidget(getWidget().popup.captionWrapper); | |||
getWidget().popup.captionWrapper.updateCaption(); | |||
} |
@@ -0,0 +1,74 @@ | |||
/* | |||
* 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.v7.client.ui; | |||
import com.vaadin.client.StyleConstants; | |||
import com.vaadin.client.ui.AbstractComponentConnector; | |||
import com.vaadin.client.ui.HasErrorIndicator; | |||
import com.vaadin.client.ui.HasRequiredIndicator; | |||
import com.vaadin.shared.AbstractFieldState; | |||
@Deprecated | |||
public abstract class AbstractFieldConnector extends AbstractComponentConnector | |||
implements HasRequiredIndicator, HasErrorIndicator { | |||
@Override | |||
public AbstractFieldState getState() { | |||
return (AbstractFieldState) super.getState(); | |||
} | |||
@Override | |||
public boolean isReadOnly() { | |||
return super.isReadOnly() || getState().propertyReadOnly; | |||
} | |||
public boolean isModified() { | |||
return getState().modified; | |||
} | |||
/** | |||
* Checks whether the required indicator should be shown for the field. | |||
* | |||
* Required indicators are hidden if the field or its data source is | |||
* read-only. | |||
* | |||
* @return true if required indicator should be shown | |||
*/ | |||
@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()); | |||
getWidget().setStyleName(StyleConstants.REQUIRED, | |||
isRequiredIndicatorVisible()); | |||
} | |||
} |
@@ -0,0 +1,155 @@ | |||
/* | |||
* 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.v7.client.ui.checkbox; | |||
import com.google.gwt.dom.client.Style.Display; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.vaadin.client.MouseEventDetailsBuilder; | |||
import com.vaadin.client.VCaption; | |||
import com.vaadin.client.VTooltip; | |||
import com.vaadin.client.annotations.OnStateChange; | |||
import com.vaadin.client.communication.StateChangeEvent; | |||
import com.vaadin.client.ui.ConnectorFocusAndBlurHandler; | |||
import com.vaadin.client.ui.Icon; | |||
import com.vaadin.client.ui.VCheckBox; | |||
import com.vaadin.shared.EventId; | |||
import com.vaadin.shared.MouseEventDetails; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.checkbox.CheckBoxServerRpc; | |||
import com.vaadin.shared.ui.checkbox.CheckBoxState; | |||
import com.vaadin.v7.client.ui.AbstractFieldConnector; | |||
import com.vaadin.v7.ui.CheckBox; | |||
@Connect(CheckBox.class) | |||
public class CheckBoxConnector extends AbstractFieldConnector | |||
implements ClickHandler { | |||
@Override | |||
public boolean delegateCaptionHandling() { | |||
return false; | |||
} | |||
@Override | |||
protected void init() { | |||
super.init(); | |||
getWidget().addClickHandler(this); | |||
getWidget().client = getConnection(); | |||
getWidget().id = getConnectorId(); | |||
ConnectorFocusAndBlurHandler.addHandlers(this); | |||
} | |||
@Override | |||
public void onStateChanged(StateChangeEvent stateChangeEvent) { | |||
super.onStateChanged(stateChangeEvent); | |||
if (null != getState().errorMessage) { | |||
getWidget().setAriaInvalid(true); | |||
if (getWidget().errorIndicatorElement == null) { | |||
getWidget().errorIndicatorElement = DOM.createSpan(); | |||
getWidget().errorIndicatorElement.setInnerHTML(" "); | |||
DOM.setElementProperty(getWidget().errorIndicatorElement, | |||
"className", "v-errorindicator"); | |||
DOM.appendChild(getWidget().getElement(), | |||
getWidget().errorIndicatorElement); | |||
DOM.sinkEvents(getWidget().errorIndicatorElement, | |||
VTooltip.TOOLTIP_EVENTS | Event.ONCLICK); | |||
} else { | |||
getWidget().errorIndicatorElement.getStyle().clearDisplay(); | |||
} | |||
} else if (getWidget().errorIndicatorElement != null) { | |||
getWidget().errorIndicatorElement.getStyle() | |||
.setDisplay(Display.NONE); | |||
getWidget().setAriaInvalid(false); | |||
} | |||
getWidget().setAriaRequired(isRequiredIndicatorVisible()); | |||
if (isReadOnly()) { | |||
getWidget().setEnabled(false); | |||
} | |||
if (getWidget().icon != null) { | |||
getWidget().getElement().removeChild(getWidget().icon.getElement()); | |||
getWidget().icon = null; | |||
} | |||
Icon icon = getIcon(); | |||
if (icon != null) { | |||
getWidget().icon = icon; | |||
DOM.insertChild(getWidget().getElement(), icon.getElement(), 1); | |||
icon.sinkEvents(VTooltip.TOOLTIP_EVENTS); | |||
icon.sinkEvents(Event.ONCLICK); | |||
} | |||
// Set text | |||
VCaption.setCaptionText(getWidget(), getState()); | |||
getWidget().setValue(getState().checked); | |||
getWidget().immediate = getState().immediate; | |||
} | |||
@Override | |||
public CheckBoxState getState() { | |||
return (CheckBoxState) super.getState(); | |||
} | |||
@Override | |||
public VCheckBox getWidget() { | |||
return (VCheckBox) super.getWidget(); | |||
} | |||
@Override | |||
public void onClick(ClickEvent event) { | |||
if (!isEnabled()) { | |||
return; | |||
} | |||
// We get click events also from the label text, which do not alter the | |||
// actual value. The server-side is only interested in real changes to | |||
// the state. | |||
if (getState().checked != getWidget().getValue()) { | |||
getState().checked = getWidget().getValue(); | |||
// Add mouse details | |||
MouseEventDetails details = MouseEventDetailsBuilder | |||
.buildMouseEventDetails(event.getNativeEvent(), | |||
getWidget().getElement()); | |||
getRpcProxy(CheckBoxServerRpc.class).setChecked(getState().checked, | |||
details); | |||
if (getState().immediate) { | |||
getConnection().sendPendingVariableChanges(); | |||
} | |||
} | |||
} | |||
private boolean contextEventSunk = false; | |||
@OnStateChange("registeredEventListeners") | |||
void sinkContextClickEvent() { | |||
if (!contextEventSunk && hasEventListener(EventId.CONTEXT_CLICK)) { | |||
// CheckBox.sinkEvents works differently than all other widgets: | |||
// "Unlike other widgets the CheckBox sinks on its inputElement, not | |||
// its wrapper" | |||
DOM.sinkEvents(getWidget().getElement(), Event.ONCONTEXTMENU); | |||
contextEventSunk = true; | |||
} | |||
} | |||
} |
@@ -25,13 +25,13 @@ import com.vaadin.client.Profiler; | |||
import com.vaadin.client.UIDL; | |||
import com.vaadin.client.communication.RpcProxy; | |||
import com.vaadin.client.communication.StateChangeEvent; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.SimpleManagedLayout; | |||
import com.vaadin.shared.EventId; | |||
import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.combobox.ComboBoxServerRpc; | |||
import com.vaadin.shared.ui.combobox.ComboBoxState; | |||
import com.vaadin.v7.client.ui.AbstractFieldConnector; | |||
import com.vaadin.v7.client.ui.VFilterSelect; | |||
import com.vaadin.v7.client.ui.VFilterSelect.DataReceivedHandler; | |||
import com.vaadin.v7.client.ui.VFilterSelect.FilterSelectSuggestion; |
@@ -22,10 +22,10 @@ import com.vaadin.client.LocaleNotLoadedException; | |||
import com.vaadin.client.Paintable; | |||
import com.vaadin.client.UIDL; | |||
import com.vaadin.client.VConsole; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.VDateField; | |||
import com.vaadin.shared.ui.datefield.DateFieldConstants; | |||
import com.vaadin.shared.ui.datefield.Resolution; | |||
import com.vaadin.v7.client.ui.AbstractFieldConnector; | |||
public class AbstractDateFieldConnector extends AbstractFieldConnector | |||
implements Paintable { |
@@ -20,11 +20,11 @@ import com.vaadin.client.ApplicationConnection; | |||
import com.vaadin.client.Paintable; | |||
import com.vaadin.client.StyleConstants; | |||
import com.vaadin.client.UIDL; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.VNativeButton; | |||
import com.vaadin.client.ui.VOptionGroupBase; | |||
import com.vaadin.client.v7.ui.VLegacyTextField; | |||
import com.vaadin.shared.ui.select.AbstractSelectState; | |||
import com.vaadin.v7.client.ui.AbstractFieldConnector; | |||
public abstract class OptionGroupBaseConnector extends AbstractFieldConnector | |||
implements Paintable { |
@@ -17,10 +17,10 @@ | |||
package com.vaadin.v7.client.ui.progressindicator; | |||
import com.vaadin.client.communication.StateChangeEvent; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.VProgressBar; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.progressindicator.ProgressBarState; | |||
import com.vaadin.v7.client.ui.AbstractFieldConnector; | |||
import com.vaadin.v7.ui.ProgressBar; | |||
/** |
@@ -20,12 +20,12 @@ import com.google.gwt.event.dom.client.BlurHandler; | |||
import com.vaadin.client.ApplicationConnection; | |||
import com.vaadin.client.Paintable; | |||
import com.vaadin.client.UIDL; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.SimpleManagedLayout; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.Connect.LoadStyle; | |||
import com.vaadin.shared.ui.textarea.RichTextAreaState; | |||
import com.vaadin.shared.util.SharedUtil; | |||
import com.vaadin.v7.client.ui.AbstractFieldConnector; | |||
import com.vaadin.v7.client.ui.VRichTextArea; | |||
import com.vaadin.v7.ui.RichTextArea; | |||
@@ -37,12 +37,12 @@ import com.vaadin.client.ServerConnector; | |||
import com.vaadin.client.TooltipInfo; | |||
import com.vaadin.client.UIDL; | |||
import com.vaadin.client.WidgetUtil; | |||
import com.vaadin.client.ui.AbstractFieldConnector; | |||
import com.vaadin.client.ui.PostLayoutListener; | |||
import com.vaadin.shared.MouseEventDetails; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.table.TableConstants; | |||
import com.vaadin.shared.ui.table.TableConstants.Section; | |||
import com.vaadin.v7.client.ui.AbstractFieldConnector; | |||
import com.vaadin.v7.client.ui.VScrollTable; | |||
import com.vaadin.v7.client.ui.VScrollTable.ContextMenuDetails; | |||
import com.vaadin.v7.client.ui.VScrollTable.FooterCell; |