diff options
author | Artur Signell <artur@vaadin.com> | 2016-08-18 21:51:13 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-20 00:08:46 +0300 |
commit | 34852cdb88c6c27b1341684204d78db0fdd061a6 (patch) | |
tree | f55c6f9d900167a57c7eb2c96c25e1dfe0451dd8 /client | |
parent | 6e0f2efe996cfd3b38c960e04cbced0a91215cf0 (diff) | |
download | vaadin-framework-34852cdb88c6c27b1341684204d78db0fdd061a6.tar.gz vaadin-framework-34852cdb88c6c27b1341684204d78db0fdd061a6.zip |
Move selects to compatibility package
Change-Id: I7ee02d34b230e8752174a7f19824f81cbb616c33
Diffstat (limited to 'client')
5 files changed, 0 insertions, 342 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/listselect/ListSelectConnector.java b/client/src/main/java/com/vaadin/client/ui/listselect/ListSelectConnector.java deleted file mode 100644 index a69043548b..0000000000 --- a/client/src/main/java/com/vaadin/client/ui/listselect/ListSelectConnector.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.listselect; - -import com.vaadin.client.ui.VListSelect; -import com.vaadin.client.ui.optiongroup.OptionGroupBaseConnector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.ui.ListSelect; - -@Connect(ListSelect.class) -public class ListSelectConnector extends OptionGroupBaseConnector { - - @Override - public VListSelect getWidget() { - return (VListSelect) super.getWidget(); - } -} diff --git a/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java b/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java deleted file mode 100644 index 1780d20c69..0000000000 --- a/client/src/main/java/com/vaadin/client/ui/nativeselect/NativeSelectConnector.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.nativeselect; - -import com.vaadin.client.ui.ConnectorFocusAndBlurHandler; -import com.vaadin.client.ui.VNativeSelect; -import com.vaadin.client.ui.optiongroup.OptionGroupBaseConnector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.ui.NativeSelect; - -@Connect(NativeSelect.class) -public class NativeSelectConnector extends OptionGroupBaseConnector { - - @Override - protected void init() { - super.init(); - ConnectorFocusAndBlurHandler.addHandlers(this, getWidget().getSelect()); - } - - @Override - public VNativeSelect getWidget() { - return (VNativeSelect) super.getWidget(); - } -} diff --git a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java deleted file mode 100644 index 24454c833d..0000000000 --- a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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.optiongroup; - -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; - -public abstract class OptionGroupBaseConnector extends AbstractFieldConnector - implements Paintable { - - @Override - public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - - // Save details - getWidget().client = client; - getWidget().paintableId = uidl.getId(); - - if (!isRealUpdate(uidl)) { - return; - } - - getWidget().selectedKeys = uidl.getStringArrayVariableAsSet("selected"); - - getWidget().setReadonly(isReadOnly()); - getWidget().multiselect = getState().multiSelect; - getWidget().immediate = getState().immediate; - getWidget().nullSelectionAllowed = uidl - .getBooleanAttribute("nullselect"); - getWidget().nullSelectionItemAvailable = uidl - .getBooleanAttribute("nullselectitem"); - - if (uidl.hasAttribute("rows")) { - getWidget().rows = uidl.getIntAttribute("rows"); - } - - final UIDL ops = uidl.getChildUIDL(0); - - getWidget().buildOptions(ops); - - if (uidl.getBooleanAttribute("allownewitem")) { - if (getWidget().newItemField == null) { - getWidget().newItemButton = new VNativeButton(); - getWidget().newItemButton.setText("+"); - getWidget().newItemButton.addClickHandler(getWidget()); - getWidget().newItemButton - .addStyleName(StyleConstants.UI_WIDGET); - getWidget().newItemField = new VLegacyTextField(); - getWidget().newItemField.client = getConnection(); - getWidget().newItemField.paintableId = getConnectorId(); - getWidget().newItemField.addKeyPressHandler(getWidget()); - getWidget().newItemField.addStyleName(StyleConstants.UI_WIDGET); - - } - getWidget().newItemField.setEnabled( - getWidget().isEnabled() && !getWidget().isReadonly()); - getWidget().newItemButton.setEnabled( - getWidget().isEnabled() && !getWidget().isReadonly()); - - if (getWidget().newItemField == null || getWidget().newItemField - .getParent() != getWidget().container) { - getWidget().container.add(getWidget().newItemField); - getWidget().container.add(getWidget().newItemButton); - final int w = getWidget().container.getOffsetWidth() - - getWidget().newItemButton.getOffsetWidth(); - getWidget().newItemField.setWidth(Math.max(w, 0) + "px"); - } - } else if (getWidget().newItemField != null) { - getWidget().container.remove(getWidget().newItemField); - getWidget().container.remove(getWidget().newItemButton); - } - - getWidget().setTabIndex(getState().tabIndex); - - } - - @Override - public VOptionGroupBase getWidget() { - return (VOptionGroupBase) super.getWidget(); - } - - @Override - public AbstractSelectState getState() { - return (AbstractSelectState) super.getState(); - } -} diff --git a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupConnector.java b/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupConnector.java deleted file mode 100644 index 3dd3b897a5..0000000000 --- a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupConnector.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.optiongroup; - -import java.util.ArrayList; - -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.ui.CheckBox; -import com.google.gwt.user.client.ui.Widget; -import com.vaadin.client.ApplicationConnection; -import com.vaadin.client.UIDL; -import com.vaadin.client.ui.VOptionGroup; -import com.vaadin.shared.EventId; -import com.vaadin.shared.ui.Connect; -import com.vaadin.shared.ui.optiongroup.OptionGroupState; -import com.vaadin.ui.OptionGroup; - -@Connect(OptionGroup.class) -public class OptionGroupConnector extends OptionGroupBaseConnector { - - @Override - public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - super.updateFromUIDL(uidl, client); - - getWidget().sendFocusEvents = client.hasEventListeners(this, - EventId.FOCUS); - getWidget().sendBlurEvents = client.hasEventListeners(this, - EventId.BLUR); - - if (getWidget().focusHandlers != null) { - for (HandlerRegistration reg : getWidget().focusHandlers) { - reg.removeHandler(); - } - getWidget().focusHandlers.clear(); - getWidget().focusHandlers = null; - - for (HandlerRegistration reg : getWidget().blurHandlers) { - reg.removeHandler(); - } - getWidget().blurHandlers.clear(); - getWidget().blurHandlers = null; - } - - if (getWidget().sendFocusEvents || getWidget().sendBlurEvents) { - getWidget().focusHandlers = new ArrayList<HandlerRegistration>(); - getWidget().blurHandlers = new ArrayList<HandlerRegistration>(); - - // add focus and blur handlers to checkboxes / radio buttons - for (Widget wid : getWidget().panel) { - if (wid instanceof CheckBox) { - getWidget().focusHandlers - .add(((CheckBox) wid).addFocusHandler(getWidget())); - getWidget().blurHandlers - .add(((CheckBox) wid).addBlurHandler(getWidget())); - } - } - } - } - - @Override - public VOptionGroup getWidget() { - return (VOptionGroup) super.getWidget(); - } - - @Override - public OptionGroupState getState() { - return (OptionGroupState) super.getState(); - } -} diff --git a/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java b/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java deleted file mode 100644 index 81e32e5711..0000000000 --- a/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.twincolselect; - -import com.vaadin.client.ApplicationConnection; -import com.vaadin.client.DirectionalManagedLayout; -import com.vaadin.client.UIDL; -import com.vaadin.client.ui.VTwinColSelect; -import com.vaadin.client.ui.optiongroup.OptionGroupBaseConnector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.shared.ui.twincolselect.TwinColSelectState; -import com.vaadin.ui.TwinColSelect; - -@Connect(TwinColSelect.class) -public class TwinColSelectConnector extends OptionGroupBaseConnector - implements DirectionalManagedLayout { - - @Override - public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - // Captions are updated before super call to ensure the widths are set - // correctly - if (isRealUpdate(uidl)) { - getWidget().updateCaptions(uidl); - getLayoutManager().setNeedsHorizontalLayout(this); - } - - super.updateFromUIDL(uidl, client); - } - - @Override - protected void init() { - super.init(); - getLayoutManager().registerDependency(this, - getWidget().captionWrapper.getElement()); - } - - @Override - public void onUnregister() { - getLayoutManager().unregisterDependency(this, - getWidget().captionWrapper.getElement()); - } - - @Override - public VTwinColSelect getWidget() { - return (VTwinColSelect) super.getWidget(); - } - - @Override - public TwinColSelectState getState() { - return (TwinColSelectState) super.getState(); - } - - @Override - public void layoutVertically() { - if (isUndefinedHeight()) { - getWidget().clearInternalHeights(); - } else { - getWidget().setInternalHeights(); - } - } - - @Override - public void layoutHorizontally() { - if (isUndefinedWidth()) { - getWidget().clearInternalWidths(); - } else { - getWidget().setInternalWidths(); - } - } -} |