summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-03-09 09:29:51 +0200
committerPekka Hyvönen <pekka@vaadin.com>2017-03-09 09:29:51 +0200
commit761c94ab2e1019f7d83d4e8d63254de1ee591d75 (patch)
treebd167811a86c0c666d321bdbfdb57dea980cb942 /client
parent264ee7696568827815604f1e22ce7e330775b3ce (diff)
downloadvaadin-framework-761c94ab2e1019f7d83d4e8d63254de1ee591d75.tar.gz
vaadin-framework-761c94ab2e1019f7d83d4e8d63254de1ee591d75.zip
Initial implementation of ComponentRenderer for Grid (#8743)
Fixes #8622 Fixes #8623
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/ComponentRendererConnector.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/ComponentRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/ComponentRendererConnector.java
new file mode 100644
index 0000000000..ef14c5024e
--- /dev/null
+++ b/client/src/main/java/com/vaadin/client/connectors/ComponentRendererConnector.java
@@ -0,0 +1,63 @@
+/*
+ * 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.connectors;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.vaadin.client.ComponentConnector;
+import com.vaadin.client.ConnectorMap;
+import com.vaadin.client.renderers.Renderer;
+import com.vaadin.client.renderers.WidgetRenderer;
+import com.vaadin.client.widget.grid.RendererCellReference;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.grid.renderers.ComponentRendererState;
+import com.vaadin.ui.renderers.ComponentRenderer;
+
+/**
+ * Connector for {@link ComponentRenderer}. The renderer wraps the component
+ * into a {@link SimplePanel} to allow handling events correctly.
+ *
+ * @author Vaadin Ltd
+ * @since 8.1
+ */
+@Connect(ComponentRenderer.class)
+public class ComponentRendererConnector
+ extends AbstractRendererConnector<String> {
+
+ @Override
+ protected Renderer<String> createRenderer() {
+ return new WidgetRenderer<String, SimplePanel>() {
+
+ @Override
+ public SimplePanel createWidget() {
+ return GWT.create(SimplePanel.class);
+ }
+
+ @Override
+ public void render(RendererCellReference cell, String connectorId,
+ SimplePanel widget) {
+ ComponentConnector connector = (ComponentConnector) ConnectorMap
+ .get(getConnection()).getConnector(connectorId);
+ widget.setWidget(connector.getWidget());
+ }
+ };
+ }
+
+ @Override
+ public ComponentRendererState getState() {
+ return (ComponentRendererState) super.getState();
+ }
+}