summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-17 09:24:32 +0300
committerVaadin Code Review <review@vaadin.com>2016-08-17 10:18:19 +0000
commit9661839707a76de888a4ede6da4ab9a12d3c023a (patch)
treec1d82df95a70599d7d925a485f13645c2562b6d0 /client
parentecde311474591931b8457f0b653aefa14350f0a6 (diff)
downloadvaadin-framework-9661839707a76de888a4ede6da4ab9a12d3c023a.tar.gz
vaadin-framework-9661839707a76de888a4ede6da4ab9a12d3c023a.zip
Remove Form and FormFieldFactory
Form was deprecated in Vaadin 7 when FieldGroup was introduced. In Vaadin 8, FieldGroup is deprecated in favor of Binder. Having three different "forms" would be very confusing. Change-Id: I17775c922940edc5df7dd5bdc80bfe9652588270
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VForm.java139
-rw-r--r--client/src/main/java/com/vaadin/client/ui/form/FormConnector.java236
2 files changed, 0 insertions, 375 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VForm.java b/client/src/main/java/com/vaadin/client/ui/VForm.java
deleted file mode 100644
index ca38ea070b..0000000000
--- a/client/src/main/java/com/vaadin/client/ui/VForm.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.client.ui;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.KeyDownEvent;
-import com.google.gwt.event.dom.client.KeyDownHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.ComplexPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.client.ApplicationConnection;
-import com.vaadin.client.VErrorMessage;
-
-public class VForm extends ComplexPanel implements KeyDownHandler {
-
- public static final String CLASSNAME = "v-form";
-
- /** For internal use only. May be removed or replaced in the future. */
- public String id;
-
- /** For internal use only. May be removed or replaced in the future. */
- public Widget lo;
-
- /** For internal use only. May be removed or replaced in the future. */
- public Element legend = DOM.createLegend();
-
- /** For internal use only. May be removed or replaced in the future. */
- public Element caption = DOM.createSpan();
-
- /** For internal use only. May be removed or replaced in the future. */
- public Element desc = DOM.createDiv();
-
- /** For internal use only. May be removed or replaced in the future. */
- public Icon icon;
-
- /** For internal use only. May be removed or replaced in the future. */
- public VErrorMessage errorMessage = new VErrorMessage();
-
- /** For internal use only. May be removed or replaced in the future. */
- public Element fieldContainer = DOM.createDiv();
-
- /** For internal use only. May be removed or replaced in the future. */
- public Element footerContainer = DOM.createDiv();
-
- /** For internal use only. May be removed or replaced in the future. */
- public Element fieldSet = DOM.createFieldSet();
-
- /** For internal use only. May be removed or replaced in the future. */
- public Widget footer;
-
- /** For internal use only. May be removed or replaced in the future. */
- public ApplicationConnection client;
-
- /** For internal use only. May be removed or replaced in the future. */
- public ShortcutActionHandler shortcutHandler;
-
- /** For internal use only. May be removed or replaced in the future. */
- public HandlerRegistration keyDownRegistration;
-
- public VForm() {
- setElement(DOM.createDiv());
- getElement().appendChild(fieldSet);
- setStyleName(CLASSNAME);
- fieldSet.appendChild(legend);
- legend.appendChild(caption);
-
- fieldSet.appendChild(desc); // Adding description for initial padding
- // measurements, removed later if no
- // description is set
-
- fieldSet.appendChild(fieldContainer);
- errorMessage.setVisible(false);
-
- fieldSet.appendChild(errorMessage.getElement());
- fieldSet.appendChild(footerContainer);
-
- errorMessage.setOwner(this);
- }
-
- @Override
- public void setStyleName(String style) {
- super.setStyleName(style);
- updateStyleNames();
- }
-
- @Override
- public void setStylePrimaryName(String style) {
- super.setStylePrimaryName(style);
- updateStyleNames();
- }
-
- protected void updateStyleNames() {
- fieldContainer.setClassName(getStylePrimaryName() + "-content");
- errorMessage.setStyleName(getStylePrimaryName() + "-errormessage");
- desc.setClassName(getStylePrimaryName() + "-description");
- footerContainer.setClassName(getStylePrimaryName() + "-footer");
- }
-
- @Override
- public void onKeyDown(KeyDownEvent event) {
- shortcutHandler.handleKeyboardEvent(Event.as(event.getNativeEvent()));
- }
-
- public void setFooterWidget(Widget footerWidget) {
- if (footer != null) {
- remove(footer);
- }
- if (footerWidget != null) {
- super.add(footerWidget, footerContainer);
- }
- footer = footerWidget;
- }
-
- public void setLayoutWidget(Widget newLayoutWidget) {
- if (lo != null) {
- remove(lo);
- }
- if (newLayoutWidget != null) {
- super.add(newLayoutWidget, fieldContainer);
- }
- lo = newLayoutWidget;
- }
-}
diff --git a/client/src/main/java/com/vaadin/client/ui/form/FormConnector.java b/client/src/main/java/com/vaadin/client/ui/form/FormConnector.java
deleted file mode 100644
index 857c2bd40e..0000000000
--- a/client/src/main/java/com/vaadin/client/ui/form/FormConnector.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * 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.client.ui.form;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.dom.client.KeyDownEvent;
-import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.client.ApplicationConnection;
-import com.vaadin.client.ComponentConnector;
-import com.vaadin.client.ConnectorHierarchyChangeEvent;
-import com.vaadin.client.LayoutManager;
-import com.vaadin.client.Paintable;
-import com.vaadin.client.TooltipInfo;
-import com.vaadin.client.UIDL;
-import com.vaadin.client.VCaption;
-import com.vaadin.client.ui.AbstractComponentContainerConnector;
-import com.vaadin.client.ui.ShortcutActionHandler;
-import com.vaadin.client.ui.VForm;
-import com.vaadin.client.ui.layout.ElementResizeEvent;
-import com.vaadin.client.ui.layout.ElementResizeListener;
-import com.vaadin.client.ui.layout.MayScrollChildren;
-import com.vaadin.shared.ui.ComponentStateUtil;
-import com.vaadin.shared.ui.Connect;
-import com.vaadin.shared.ui.form.FormState;
-import com.vaadin.ui.Form;
-
-@Connect(Form.class)
-public class FormConnector extends AbstractComponentContainerConnector
- implements Paintable, MayScrollChildren {
-
- private final ElementResizeListener footerResizeListener = new ElementResizeListener() {
- @Override
- public void onElementResize(ElementResizeEvent e) {
- VForm form = getWidget();
-
- LayoutManager lm = getLayoutManager();
- int footerHeight = 0;
- if (form.footer != null) {
- footerHeight += lm.getOuterHeight(form.footer.getElement());
- }
-
- if (form.errorMessage.isVisible()) {
- footerHeight += lm.getOuterHeight(form.errorMessage
- .getElement());
- footerHeight -= lm.getMarginTop(form.errorMessage.getElement());
- form.errorMessage.getElement().getStyle()
- .setMarginTop(-footerHeight, Unit.PX);
- form.footerContainer.getStyle().clearMarginTop();
- } else {
- form.footerContainer.getStyle().setMarginTop(-footerHeight,
- Unit.PX);
- }
-
- form.fieldContainer.getStyle().setPaddingBottom(footerHeight,
- Unit.PX);
- }
- };
-
- @Override
- protected void init() {
- getLayoutManager().addElementResizeListener(
- getWidget().errorMessage.getElement(), footerResizeListener);
- }
-
- @Override
- public void onUnregister() {
- VForm form = getWidget();
- getLayoutManager().removeElementResizeListener(
- form.errorMessage.getElement(), footerResizeListener);
- if (form.footer != null) {
- getLayoutManager().removeElementResizeListener(
- form.footer.getElement(), footerResizeListener);
- }
- }
-
- @Override
- public boolean delegateCaptionHandling() {
- return false;
- }
-
- @Override
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- getWidget().client = client;
- getWidget().id = uidl.getId();
-
- if (!isRealUpdate(uidl)) {
- return;
- }
-
- boolean legendEmpty = true;
- if (getState().caption != null) {
- VCaption.setCaptionText(getWidget().caption, getState());
- legendEmpty = false;
- } else {
- getWidget().caption.setInnerText("");
- }
- if (getWidget().icon != null) {
- getWidget().legend.removeChild(getWidget().icon.getElement());
- }
- if (getIconUri() != null) {
- getWidget().icon = client.getIcon(getIconUri());
- getWidget().legend.insertFirst(getWidget().icon.getElement());
-
- legendEmpty = false;
- }
- if (legendEmpty) {
- getWidget().addStyleDependentName("nocaption");
- } else {
- getWidget().removeStyleDependentName("nocaption");
- }
-
- if (null != getState().errorMessage) {
- getWidget().errorMessage.updateMessage(getState().errorMessage);
- getWidget().errorMessage.setVisible(true);
- } else {
- getWidget().errorMessage.setVisible(false);
- }
-
- if (ComponentStateUtil.hasDescription(getState())) {
- getWidget().desc.setInnerHTML(getState().description);
- if (getWidget().desc.getParentElement() == null) {
- getWidget().fieldSet.insertAfter(getWidget().desc,
- getWidget().legend);
- }
- } else {
- getWidget().desc.setInnerHTML("");
- if (getWidget().desc.getParentElement() != null) {
- getWidget().fieldSet.removeChild(getWidget().desc);
- }
- }
-
- // also recalculates size of the footer if undefined size form - see
- // #3710
- client.runDescendentsLayout(getWidget());
-
- // We may have actions attached
- if (uidl.getChildCount() >= 1) {
- UIDL childUidl = uidl.getChildByTagName("actions");
- if (childUidl != null) {
- if (getWidget().shortcutHandler == null) {
- getWidget().shortcutHandler = new ShortcutActionHandler(
- getConnectorId(), client);
- getWidget().keyDownRegistration = getWidget()
- .addDomHandler(getWidget(), KeyDownEvent.getType());
- }
- getWidget().shortcutHandler.updateActionMap(childUidl);
- }
- } else if (getWidget().shortcutHandler != null) {
- getWidget().keyDownRegistration.removeHandler();
- getWidget().shortcutHandler = null;
- getWidget().keyDownRegistration = null;
- }
- }
-
- @Override
- public void updateCaption(ComponentConnector component) {
- // NOP form don't render caption for neither field layout nor footer
- // layout
- }
-
- @Override
- public VForm getWidget() {
- return (VForm) super.getWidget();
- }
-
- @Override
- public boolean isReadOnly() {
- return super.isReadOnly() || getState().propertyReadOnly;
- }
-
- @Override
- public FormState getState() {
- return (FormState) super.getState();
- }
-
- private ComponentConnector getFooter() {
- return (ComponentConnector) getState().footer;
- }
-
- private ComponentConnector getLayout() {
- return (ComponentConnector) getState().layout;
- }
-
- @Override
- public void onConnectorHierarchyChange(
- ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent) {
- Widget newFooterWidget = null;
- ComponentConnector footer = getFooter();
-
- if (footer != null) {
- newFooterWidget = footer.getWidget();
- Widget currentFooter = getWidget().footer;
- if (currentFooter != null) {
- // Remove old listener
- getLayoutManager().removeElementResizeListener(
- currentFooter.getElement(), footerResizeListener);
- }
- getLayoutManager().addElementResizeListener(
- newFooterWidget.getElement(), footerResizeListener);
- }
- getWidget().setFooterWidget(newFooterWidget);
-
- Widget newLayoutWidget = null;
- ComponentConnector newLayout = getLayout();
- if (newLayout != null) {
- newLayoutWidget = newLayout.getWidget();
- }
- getWidget().setLayoutWidget(newLayoutWidget);
- }
-
- @Override
- public TooltipInfo getTooltipInfo(Element element) {
- // Form shows its description and error message
- // as a part of the actual layout
- return null;
- }
-
- @Override
- public boolean hasTooltip() {
- return false;
- }
-}