Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2012, 2013, 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
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* 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.BehaviorBase;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.MapChangeListener;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionModel;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.util.Callback;
import javafx.collections.WeakListChangeListener;
import com.sun.javafx.scene.control.skin.resources.ControlResources;
import java.util.List;
import javafx.beans.WeakInvalidationListener;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.value.WeakChangeListener;
import javafx.collections.ObservableMap;
import javafx.event.EventHandler;
import javafx.geometry.HPos;
import javafx.geometry.VPos;
import javafx.scene.control.Control;
import javafx.scene.control.IndexedCell;
import javafx.scene.control.ResizeFeaturesBase;
import javafx.scene.control.ScrollToEvent;
import javafx.scene.control.TableColumnBase;
import javafx.scene.control.TableFocusModel;
import javafx.scene.control.TablePositionBase;
import javafx.scene.control.TableSelectionModel;
public abstract class TableViewSkinBase, I extends IndexedCell> extends VirtualContainerBase {
public static final String REFRESH = "tableRefreshKey";
public static final String RECREATE = "tableRecreateKey";
// protected abstract void requestControlFocus(); // tableView.requestFocus();
protected abstract TableSelectionModel getSelectionModel(); // tableView.getSelectionModel()
protected abstract TableFocusModel getFocusModel(); // tableView.getSelectionModel()
protected abstract TablePositionBase getFocusedCell();
protected abstract ObservableList*/> getVisibleLeafColumns();
protected abstract int getVisibleLeafIndex(TableColumnBase tc);
protected abstract TableColumnBase getVisibleLeafColumn(int col);
protected abstract ObservableList*/> getColumns();
// protected abstract ObservableList getItems();
protected abstract ObservableList*/> getSortOrder();
protected abstract ObjectProperty> itemsProperty();
protected abstract ObjectProperty> rowFactoryProperty();
protected abstract ObjectProperty placeholderProperty(); // tableView.getPlaceholder();
// protected abstract BooleanProperty focusTraversableProperty();
protected abstract BooleanProperty tableMenuButtonVisibleProperty();
protected abstract ObjectProperty> columnResizePolicyProperty();
protected abstract boolean resizeColumn(TableColumnBase tc, double delta);
protected abstract void resizeColumnToFitContent(TableColumnBase tc, int maxRows);
public TableViewSkinBase(final C control, final B behavior) {
super(control, behavior);
// init(control) should not be called here - it should be called by the
// subclass after initialising itself. This is to prevent NPEs (for
// example, getVisibleLeafColumns() throws a NPE as the control itself
// is not yet set in subclasses).
}
protected void init(final C control) {
// init the VirtualFlow
flow.setPannable(false);
flow.setFocusTraversable(control.isFocusTraversable());
flow.setCreateCell(new Callback() {
@Override public I call(VirtualFlow flow) {
return TableViewSkinBase.this.createCell();
}
});
/*
* Listening for scrolling along the X axis, but we need to be careful
* to handle the situation appropriately when the hbar is invisible.
*/
final InvalidationListener hbarValueListener = new InvalidationListener() {
@Override public void invalidated(Observable valueModel) {
horizontalScroll();
}
};
flow.getHbar().valueProperty().addListener(hbarValueListener);
columnReorderLine = new Region();
columnReorderLine.getStyleClass().setAll("column-resize-line");
columnReorderLine.setManaged(false);
columnReorderLine.setVisible(false);
columnReorderOverlay = new Region();
columnReorderOverlay.getStyleClass().setAll("column-overlay");
columnReorderOverlay.setVisible(false);
columnReorderOverlay.setManaged(false);
tableHeaderRow = createTableHeaderRow();
tableHeaderRow.setColumnReorderLine(columnReorderLine);
tableHeaderRow.setTablePadding(getSkinnable().getInsets());
tableHeaderRow.setFocusTraversable(false);
control.paddingProperty().addListener(new InvalidationListener() {
@Override public void invalidated(Observable valueModel) {
C c = getSkinnable();
tableHeaderRow.setTablePadding(c == null ? Insets.EMPTY : c.getInsets());
}
});
getChildren().addAll(tableHeaderRow, flow, columnReorderOverlay, columnReorderLine);
updateVisibleColumnCount();
updateVisibleLeafColumnWidthListeners(getVisibleLeafColumns(), FXCollections.>emptyObservableList());
tableHeaderRow.reorderingProperty().addListener(new InvalidationListener() {
@Override public void invalidated(Observable valueModel) {
getSkinnable().requestLayout();
}
});
getVisibleLeafColumns().addListener(weakVisibleLeafColumnsListener);
updateTableItems(null, itemsProperty().get());
itemsProperty().addListener(weakItemsChangeListener);
control.getProperties().addListener(new MapChangeListener