modules/controls/src/main/java/javafx/scene/control/skin/TreeTableCellSkin.java

Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization

*** 1,7 **** /* ! * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 21,69 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package com.sun.javafx.scene.control.skin; import com.sun.javafx.scene.control.behavior.TreeTableCellBehavior; import java.util.Map; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ReadOnlyDoubleProperty; import javafx.scene.Node; import javafx.scene.control.Control; import javafx.scene.control.TreeItem; import javafx.scene.control.TreeTableCell; import javafx.scene.control.TreeTableColumn; import javafx.scene.control.TreeTableRow; import javafx.scene.control.TreeTableView; /** */ ! public class TreeTableCellSkin<S,T> extends TableCellSkinBase<TreeTableCell<S,T>, TreeTableCellBehavior<S,T>> { - private final TreeTableCell<S,T> treeTableCell; - private final TreeTableColumn<S,T> tableColumn; ! public TreeTableCellSkin(TreeTableCell<S,T> treeTableCell) { ! super(treeTableCell, new TreeTableCellBehavior<S,T>(treeTableCell)); ! this.treeTableCell = treeTableCell; ! this.tableColumn = treeTableCell.getTableColumn(); ! super.init(treeTableCell); } ! @Override protected BooleanProperty columnVisibleProperty() { ! return tableColumn.visibleProperty(); } ! @Override protected ReadOnlyDoubleProperty columnWidthProperty() { ! return tableColumn.widthProperty(); } ! @Override protected double leftLabelPadding() { double leftPadding = super.leftLabelPadding(); // RT-27167: we must take into account the disclosure node and the // indentation (which is not taken into account by the LabeledSkinBase. final double height = getCellSize(); --- 21,122 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package javafx.scene.control.skin; + import com.sun.javafx.scene.control.behavior.BehaviorBase; import com.sun.javafx.scene.control.behavior.TreeTableCellBehavior; import java.util.Map; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ReadOnlyDoubleProperty; import javafx.scene.Node; + import javafx.scene.control.Button; import javafx.scene.control.Control; import javafx.scene.control.TreeItem; import javafx.scene.control.TreeTableCell; import javafx.scene.control.TreeTableColumn; import javafx.scene.control.TreeTableRow; import javafx.scene.control.TreeTableView; /** + * Default skin implementation for the {@link TreeTableCell} control. + * + * @see TreeTableCell + * @since 9 + */ + public class TreeTableCellSkin<S,T> extends TableCellSkinBase<TreeTableCell<S,T>> { + + /*************************************************************************** + * * + * Private Fields * + * * + **************************************************************************/ + + private final BehaviorBase<TreeTableCell<S,T>> behavior; + + + + /*************************************************************************** + * * + * Constructors * + * * + **************************************************************************/ + + /** + * Creates a new TreeTableCellSkin instance, installing the necessary child + * nodes into the Control {@link Control#getChildren() children} list, as + * well as the necessary input mappings for handling key, mouse, etc events. + * + * @param control The control that this skin should be installed onto. */ ! public TreeTableCellSkin(TreeTableCell<S,T> control) { ! super(control); ! ! // install default input map for the TreeTableCell control ! behavior = new TreeTableCellBehavior<>(control); ! // control.setInputMap(behavior.getInputMap()); ! } ! ! /*************************************************************************** ! * * ! * Public API * ! * * ! **************************************************************************/ ! /** {@inheritDoc} */ ! @Override public void dispose() { ! super.dispose(); ! if (behavior != null) { ! behavior.dispose(); } + } + + + + /*************************************************************************** + * * + * Private implementation * + * * + **************************************************************************/ ! /** {@inheritDoc} */ ! @Override BooleanProperty columnVisibleProperty() { ! return getSkinnable().getTableColumn().visibleProperty(); } ! /** {@inheritDoc} */ ! @Override ReadOnlyDoubleProperty columnWidthProperty() { ! return getSkinnable().getTableColumn().widthProperty(); } ! /** {@inheritDoc} */ ! @Override double leftLabelPadding() { double leftPadding = super.leftLabelPadding(); // RT-27167: we must take into account the disclosure node and the // indentation (which is not taken into account by the LabeledSkinBase. final double height = getCellSize();
*** 109,118 **** --- 162,172 ---- leftPadding += graphic == null ? 0 : graphic.prefWidth(height); return leftPadding; } + /** {@inheritDoc} */ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { if (isDeferToParentForPrefWidth) { // RT-27167: we must take into account the disclosure node and the // indentation (which is not taken into account by the LabeledSkinBase. return super.computePrefWidth(height, topInset, rightInset, bottomInset, leftInset);