diff options
author | Aleksi Hietanen <aleksi@vaadin.com> | 2017-05-11 08:36:04 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-05-16 15:35:17 +0300 |
commit | a053082b0ae9f6875a3093402ff4eac88b310b49 (patch) | |
tree | 879bc0134d0c7db921e2f3a0e9d803c28d7129b9 /client | |
parent | 0a3ce51e2caf597596f0426d0e59b8de33827b29 (diff) | |
download | vaadin-framework-a053082b0ae9f6875a3093402ff4eac88b310b49.tar.gz vaadin-framework-a053082b0ae9f6875a3093402ff4eac88b310b49.zip |
Make HierarchyRendererCellReferenceWrapper a nested class of HierarchyRenderer
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java | 40 | ||||
-rw-r--r-- | client/src/main/java/com/vaadin/client/widget/treegrid/HierarchyRendererCellReferenceWrapper.java | 59 |
2 files changed, 39 insertions, 60 deletions
diff --git a/client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java b/client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java index d66a86110e..ef8fdb896c 100644 --- a/client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java +++ b/client/src/main/java/com/vaadin/client/renderers/HierarchyRenderer.java @@ -19,6 +19,7 @@ import java.util.function.BiConsumer; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.TableCellElement; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.HasClickHandlers; @@ -30,8 +31,9 @@ import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.WidgetUtil; import com.vaadin.client.connectors.treegrid.TreeGridConnector; +import com.vaadin.client.widget.escalator.FlyweightCell; import com.vaadin.client.widget.grid.RendererCellReference; -import com.vaadin.client.widget.treegrid.HierarchyRendererCellReferenceWrapper; +import com.vaadin.client.widget.grid.RowReference; import com.vaadin.shared.ui.treegrid.HierarchicalDataCommunicatorConstants; import elemental.json.JsonObject; @@ -44,6 +46,42 @@ import elemental.json.JsonObject; */ public class HierarchyRenderer extends ClickableRenderer<Object, Widget> { + /** + * Wrapper for cell references. Used to get the correct inner element to + * render. + * + * @author Vaadin Ltd + * @since 8.1 + */ + private static class HierarchyRendererCellReferenceWrapper + extends RendererCellReference { + + private Element element; + + public HierarchyRendererCellReferenceWrapper(RendererCellReference cell, + Element element) { + super(getRowReference(cell)); + set(getFlyweightCell(cell), cell.getColumnIndex(), + cell.getColumn()); + this.element = element; + } + + @Override + public TableCellElement getElement() { + return (TableCellElement) element; + } + + private native static RowReference<Object> getRowReference( + RendererCellReference cell) /*-{ + return cell.@com.vaadin.client.widget.grid.CellReference::getRowReference()(); + }-*/; + + private native static FlyweightCell getFlyweightCell( + RendererCellReference cell) /*-{ + return cell.@com.vaadin.client.widget.grid.RendererCellReference::cell; + }-*/; + } + private String nodeStyleName; private String expanderStyleName; private String cellContentStyleName; diff --git a/client/src/main/java/com/vaadin/client/widget/treegrid/HierarchyRendererCellReferenceWrapper.java b/client/src/main/java/com/vaadin/client/widget/treegrid/HierarchyRendererCellReferenceWrapper.java deleted file mode 100644 index 3f20daedba..0000000000 --- a/client/src/main/java/com/vaadin/client/widget/treegrid/HierarchyRendererCellReferenceWrapper.java +++ /dev/null @@ -1,59 +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.widget.treegrid; - -import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.TableCellElement; -import com.vaadin.client.widget.escalator.FlyweightCell; -import com.vaadin.client.widget.grid.RendererCellReference; -import com.vaadin.client.widget.grid.RowReference; - -/** - * Wrapper for cell references. Used by HierarchyRenderer to get the correct - * inner element to render. - * - * @author Vaadin Ltd - * @since 8.1 - */ -public class HierarchyRendererCellReferenceWrapper - extends RendererCellReference { - - private Element element; - - public HierarchyRendererCellReferenceWrapper(RendererCellReference cell, - Element element) { - super(getRowReference(cell)); - set(getFlyweightCell(cell), cell.getColumnIndex(), cell.getColumn()); - this.element = element; - } - - @Override - public TableCellElement getElement() { - return (TableCellElement) element; - } - - private native static RowReference<Object> getRowReference( - RendererCellReference cell) - /*-{ - return cell.@com.vaadin.client.widget.grid.CellReference::getRowReference()(); - }-*/; - - private native static FlyweightCell getFlyweightCell( - RendererCellReference cell) - /*-{ - return cell.@com.vaadin.client.widget.grid.RendererCellReference::cell; - }-*/; -} |