diff options
author | Artur Signell <artur@vaadin.com> | 2015-02-04 17:00:23 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-02-05 12:27:27 +0000 |
commit | b5b98e47441aa4ac587de097b22b25cc4852a4ec (patch) | |
tree | e32e7d71a2b1c2cf90d9810b075cb87cb112cdde /client | |
parent | b66c005a16b8141c14d50c2f1bed5a694e5c92c3 (diff) | |
download | vaadin-framework-b5b98e47441aa4ac587de097b22b25cc4852a4ec.tar.gz vaadin-framework-b5b98e47441aa4ac587de097b22b25cc4852a4ec.zip |
Revert "Grid now uses ObjectRenderer by default (#15417)"
This reverts commit abaec0217b3351d6f1835d7095ed2a3958fbfcdb.
Change-Id: I7f8de3ee803b6de1957ad04b5b1b3bf210783826
Diffstat (limited to 'client')
3 files changed, 14 insertions, 87 deletions
diff --git a/client/src/com/vaadin/client/connectors/ObjectRendererConnector.java b/client/src/com/vaadin/client/connectors/ObjectRendererConnector.java deleted file mode 100644 index 877eaaa569..0000000000 --- a/client/src/com/vaadin/client/connectors/ObjectRendererConnector.java +++ /dev/null @@ -1,38 +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.connectors; - -import com.vaadin.client.renderers.TextRenderer; -import com.vaadin.shared.ui.Connect; - -/** - * A connector for {@link com.vaadin.ui.renderer.ObjectRenderer the server side - * ObjectRenderer}. - * <p> - * This uses a {@link TextRenderer} to actually render the contents, as the - * object is already converted into a string server-side. - * - * @since - * @author Vaadin Ltd - */ -@Connect(com.vaadin.ui.renderer.ObjectRenderer.class) -public class ObjectRendererConnector extends AbstractRendererConnector<String> { - - @Override - public TextRenderer getRenderer() { - return (TextRenderer) super.getRenderer(); - } -} diff --git a/client/src/com/vaadin/client/renderers/ObjectRenderer.java b/client/src/com/vaadin/client/renderers/ObjectRenderer.java deleted file mode 100644 index a2c4e7bfc6..0000000000 --- a/client/src/com/vaadin/client/renderers/ObjectRenderer.java +++ /dev/null @@ -1,36 +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.renderers; - -import com.vaadin.client.widget.grid.RendererCellReference; - -/** - * A renderer for displaying an object to a string using the - * {@link Object#toString()} method. - * <p> - * If the object is <code>null</code>, then it is rendered as an empty string - * instead. - * - * @since - * @author Vaadin Ltd - */ -public class ObjectRenderer implements Renderer<Object> { - @Override - public void render(RendererCellReference cell, Object data) { - String text = (data != null) ? data.toString() : ""; - cell.getElement().setInnerText(text); - } -} diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index aee1c1fcc8..a870a732b5 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -65,7 +65,6 @@ import com.vaadin.client.WidgetUtil; import com.vaadin.client.data.DataChangeHandler; import com.vaadin.client.data.DataSource; import com.vaadin.client.renderers.ComplexRenderer; -import com.vaadin.client.renderers.ObjectRenderer; import com.vaadin.client.renderers.Renderer; import com.vaadin.client.renderers.WidgetRenderer; import com.vaadin.client.ui.SubPartAware; @@ -2693,18 +2692,13 @@ public class Grid<T> extends ResizeComposite implements public static abstract class Column<C, T> { /** - * The default renderer for grid columns. - * <p> - * The first time this renderer is called, a warning is displayed, - * informing the developer to use a manually defined renderer for their - * column. + * Default renderer for GridColumns. Renders everything into text + * through {@link Object#toString()}. */ - private final class DefaultObjectRenderer extends ObjectRenderer { + private final class DefaultTextRenderer implements Renderer<Object> { boolean warned = false; - private final String DEFAULT_RENDERER_WARNING = "This column uses " - + "a dummy default ObjectRenderer. A more suitable " - + "renderer should be set using the setRenderer() " - + "method."; + private final String DEFAULT_RENDERER_WARNING = "This column uses a dummy default TextRenderer. " + + "A more suitable renderer should be set using the setRenderer() method."; @Override public void render(RendererCellReference cell, Object data) { @@ -2715,7 +2709,14 @@ public class Grid<T> extends ResizeComposite implements warned = true; } - super.render(cell, data); + final String text; + if (data == null) { + text = ""; + } else { + text = data.toString(); + } + + cell.getElement().setInnerText(text); } } @@ -2747,7 +2748,7 @@ public class Grid<T> extends ResizeComposite implements * Constructs a new column with a simple TextRenderer. */ public Column() { - setRenderer(new DefaultObjectRenderer()); + setRenderer(new DefaultTextRenderer()); } /** |