1 /*
   2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene.control;
  27 
  28 import javafx.beans.NamedArg;
  29 
  30 
  31 /**
  32  * An immutable wrapper class for use by the column resize policies offered by
  33  * controls such as {@link TableView} and {@link TreeTableView}.
  34  * @since JavaFX 8.0
  35  */
  36 public class ResizeFeaturesBase<S> {
  37   private final TableColumnBase<S,?> column;
  38   private final Double delta;
  39 
  40   /**
  41    * Creates an instance of this class, with the provided TableColumnBase and
  42    * delta values being set and stored in this immutable instance.
  43    *
  44    * @param column The column upon which the resize is occurring, or null
  45    *      if this ResizeFeatures instance is being created as a result of a
  46    *      resize operation.
  47    * @param delta The amount of horizontal space added or removed in the
  48    *      resize operation.
  49    */
  50   public ResizeFeaturesBase(@NamedArg("column") TableColumnBase<S,?> column, @NamedArg("delta") Double delta) {
  51       this.column = column;
  52       this.delta = delta;
  53   }
  54 
  55   /**
  56    * Returns the column upon which the resize is occurring, or null
  57    * if this ResizeFeatures instance was created as a result of a
  58    * resize operation.
  59    */
  60   public TableColumnBase<S,?> getColumn() { return column; }
  61 
  62   /**
  63    * Returns the amount of horizontal space added or removed in the
  64    * resize operation.
  65    */
  66   public Double getDelta() { return delta; }
  67 }