OpenJDK / openjfx / jfx-dev / rt
changeset 4230:fc5da25527e5 8.0-b98
Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8.0/MASTER/jfx/rt
author | David Grieve<david.grieve@oracle.com> |
---|---|
date | Wed, 10 Jul 2013 06:53:57 -0400 |
parents | 8fb0ea0159d9 3a7a4276dc6c |
children | 5e4376a371f0 f2a21ec4a98d 6093296b8e08 |
files | |
diffstat | 25 files changed, 395 insertions(+), 118 deletions(-) [+] |
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableCellBehavior.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableCellBehavior.java Wed Jul 10 06:53:57 2013 -0400 @@ -97,7 +97,7 @@ /** @{@inheritDoc} */ @Override protected int getVisibleLeafIndex(TableColumnBase tc) { - return getTableControl().getVisibleLeafIndex(null); + return getTableControl().getVisibleLeafIndex((TableColumn) tc); } /** @{@inheritDoc} */
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehavior.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehavior.java Wed Jul 10 06:53:57 2013 -0400 @@ -117,7 +117,7 @@ } /** {@inheritDoc} */ - @Override protected TableSelectionModel<T, TableColumn<T, ?>> getSelectionModel() { + @Override protected TableSelectionModel<T> getSelectionModel() { return getControl().getSelectionModel(); }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehaviorBase.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TableViewBehaviorBase.java Wed Jul 10 06:53:57 2013 -0400 @@ -320,7 +320,7 @@ * Returns the selection model for the underlying UI control (which must extend * from TableSelectionModel). */ - protected abstract TableSelectionModel<T,TC> getSelectionModel(); + protected abstract TableSelectionModel<T> getSelectionModel(); /** * Returns an observable list of all cells that are currently selected in @@ -450,7 +450,7 @@ *************************************************************************/ protected void scrollUp() { - TableSelectionModel<T,TC> sm = getSelectionModel(); + TableSelectionModel<T> sm = getSelectionModel(); if (sm == null || getSelectedCells().isEmpty()) return; TablePositionBase<TC> selectedCell = getSelectedCells().get(0); @@ -465,7 +465,7 @@ } protected void scrollDown() { - TableSelectionModel<T,TC> sm = getSelectionModel(); + TableSelectionModel<T> sm = getSelectionModel(); if (sm == null || getSelectedCells().isEmpty()) return; TablePositionBase<TC> selectedCell = getSelectedCells().get(0); @@ -587,7 +587,7 @@ } protected void clearSelectionOutsideRange(int start, int end) { - TableSelectionModel<T,?> sm = getSelectionModel(); + TableSelectionModel<T> sm = getSelectionModel(); if (sm == null) return; int min = Math.min(start, end);
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeTableViewBehavior.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TreeTableViewBehavior.java Wed Jul 10 06:53:57 2013 -0400 @@ -131,7 +131,7 @@ } /** {@inheritDoc} */ - @Override protected TableSelectionModel<TreeItem<T>, TreeTableColumn<T, ?>> getSelectionModel() { + @Override protected TableSelectionModel<TreeItem<T>> getSelectionModel() { return getControl().getSelectionModel(); }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/LabeledSkinBase.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/LabeledSkinBase.java Wed Jul 10 06:53:57 2013 -0400 @@ -599,6 +599,11 @@ getChildren().setAll(graphic, text); } } + + // Fix for RT-31120 + if (graphic != null) { + graphic.impl_processCSS(false); + } } /**
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java Wed Jul 10 06:53:57 2013 -0400 @@ -55,7 +55,8 @@ */ // FIXME this should not be a StackPane private StackPane placeholderRegion; - private Label placeholderLabel; + private Node placeholderNode; +// private Label placeholderLabel; private static final String EMPTY_LIST_TEXT = ControlResources.getString("ListView.noContent"); private ObservableList<T> listViewItems; @@ -237,22 +238,19 @@ boolean visible = getItemCount() == 0; if (visible) { - if (placeholderRegion == null) { - placeholderRegion = new StackPane(); - placeholderRegion.getStyleClass().setAll("placeholder"); - getChildren().add(placeholderRegion); + placeholderNode = getSkinnable().getPlaceholder(); + if (placeholderNode == null && (EMPTY_LIST_TEXT != null && ! EMPTY_LIST_TEXT.isEmpty())) { + placeholderNode = new Label(); + ((Label)placeholderNode).setText(EMPTY_LIST_TEXT); } - - Node placeholderNode = getSkinnable().getPlaceholder(); - if (placeholderNode == null) { - if (placeholderLabel == null) { - placeholderLabel = new Label(); + if (placeholderNode != null) { + if (placeholderRegion == null) { + placeholderRegion = new StackPane(); + placeholderRegion.getStyleClass().setAll("placeholder"); + getChildren().add(placeholderRegion); } - placeholderLabel.setText(EMPTY_LIST_TEXT); - placeholderRegion.getChildren().setAll(placeholderLabel); - } else { placeholderRegion.getChildren().setAll(placeholderNode); } } @@ -320,7 +318,9 @@ if (getItemCount() == 0) { // show message overlay instead of empty listview - placeholderRegion.resizeRelocate(x, y, w, h); + if (placeholderRegion != null) { + placeholderRegion.resizeRelocate(x, y, w, h); + } } else { flow.resizeRelocate(x, y, w, h); } @@ -329,17 +329,16 @@ @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { checkState(); - double pw = 0.0; if (getItemCount() == 0) { if (placeholderRegion == null) { updatePlaceholderRegionVisibility(); } if (placeholderRegion != null) { - pw = placeholderRegion.prefWidth(height) + leftInset + rightInset; + return placeholderRegion.prefWidth(height) + leftInset + rightInset; } } - return Math.max(pw, computePrefHeight(-1, topInset, rightInset, bottomInset, leftInset) * 0.618033987); + return computePrefHeight(-1, topInset, rightInset, bottomInset, leftInset) * 0.618033987; } @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableColumnHeader.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableColumnHeader.java Wed Jul 10 06:53:57 2013 -0400 @@ -421,7 +421,6 @@ // --- label label = new Label(); - label.setAlignment(Pos.CENTER); label.setText(column.getText()); label.setGraphic(column.getGraphic()); label.setVisible(column.isVisible());
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableRowSkin.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableRowSkin.java Wed Jul 10 06:53:57 2013 -0400 @@ -66,6 +66,9 @@ private SimpleObjectProperty<ObservableList<TreeItem<T>>> itemsProperty; private TreeItem<?> treeItem; private boolean disclosureNodeDirty = true; + private Node graphic; + + private TreeTableViewSkin treeTableViewSkin; private MultiplePropertyChangeListenerHandler treeItemListener = new MultiplePropertyChangeListenerHandler(new Callback<String, Void>() { @Override public Void call(String p) { @@ -86,7 +89,9 @@ updateTreeItem(); updateDisclosureNodeRotation(false); + updateTableViewSkin(); + registerChangeListener(control.treeTableViewProperty(), "TREE_TABLE_VIEW"); registerChangeListener(control.indexProperty(), "INDEX"); registerChangeListener(control.treeItemProperty(), "TREE_ITEM"); registerChangeListener(control.getTreeTableView().treeColumnProperty(), "TREE_COLUMN"); @@ -95,7 +100,9 @@ @Override protected void handleControlPropertyChanged(String p) { super.handleControlPropertyChanged(p); - if ("INDEX".equals(p)) { + if ("TREE_ABLE_VIEW".equals(p)) { + updateTableViewSkin(); + } else if ("INDEX".equals(p)) { updateCells = true; // isDirty = true; // getSkinnable().requestLayout(); @@ -181,9 +188,17 @@ // check for graphic missing ObjectProperty<Node> graphicProperty = graphicProperty(); - Node graphic = graphicProperty == null ? null : graphicProperty.get(); - if (graphic != null && ! getChildren().contains(graphic)) { - getChildren().add(graphic); + Node newGraphic = graphicProperty == null ? null : graphicProperty.get(); + if (newGraphic != null) { + // RT-30466: remove the old graphic + if (newGraphic != graphic) { + getChildren().remove(graphic); + } + + if (! getChildren().contains(newGraphic)) { + getChildren().add(newGraphic); + graphic = newGraphic; + } } // check disclosure node @@ -302,7 +317,7 @@ } @Override protected boolean isColumnPartiallyOrFullyVisible(TableColumnBase tc) { - throw new UnsupportedOperationException("Not supported yet."); + return treeTableViewSkin == null ? false : treeTableViewSkin.isColumnPartiallyOrFullyVisible(tc); } @Override protected TreeTableColumn<T, ?> getTableColumnBase(TreeTableCell cell) { @@ -324,7 +339,13 @@ @Override protected DoubleProperty fixedCellSizeProperty() { return getSkinnable().getTreeTableView().fixedCellSizeProperty(); } - + + private void updateTableViewSkin() { + TreeTableView tableView = getSkinnable().getTreeTableView(); + if (tableView.getSkin() instanceof TreeTableViewSkin) { + treeTableViewSkin = (TreeTableViewSkin)tableView.getSkin(); + } + } /***************************************************************************
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualContainerBase.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualContainerBase.java Wed Jul 10 06:53:57 2013 -0400 @@ -46,7 +46,7 @@ public VirtualContainerBase(final C control, B behavior) { super(control, behavior); - flow = new VirtualFlow<I>(); + flow = createVirtualFlow(); control.addEventHandler(ScrollToEvent.scrollToTopIndex(), new EventHandler<ScrollToEvent<Integer>>() { @Override public void handle(ScrollToEvent<Integer> event) { @@ -79,6 +79,14 @@ public abstract I createCell(); /** + * This enables skin subclasses to provide a custom VirtualFlow implementation, + * rather than have VirtualContainerBase instantiate the default instance. + */ + protected VirtualFlow<I> createVirtualFlow() { + return new VirtualFlow<I>(); + } + + /** * Returns the total number of items in this container, including those * that are currently hidden because they are out of view. */
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java Wed Jul 10 06:53:57 2013 -0400 @@ -25,7 +25,12 @@ package com.sun.javafx.scene.control.skin; +import java.util.AbstractList; import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import com.sun.javafx.collections.annotations.ReturnsUnmodifiableCollection; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.application.ConditionalFeature; @@ -142,7 +147,6 @@ pile.clear(); sheetChildren.clear(); cells.clear(); - numCellsVisibleOnScreen = -1; lastWidth = lastHeight = maxPrefBreadth = -1; viewportBreadth = viewportLength = lastPosition = 0; hbar.setValue(0); @@ -259,6 +263,7 @@ public void setFixedCellSize(final double value) { this.fixedCellSize = value; this.fixedCellSizeEnabled = fixedCellSize > 0; + needsCellsLayout = true; layoutChildren(); } @@ -281,13 +286,6 @@ } /** - * The number of cells on the first full page. This is recomputed whenever - * the viewportLength changes, and is used for computing the visibleAmount - * of the lengthBar. - */ - private int numCellsVisibleOnScreen = -1; - - /** * The maximum preferred size in the non-virtual direction. For example, * if vertical, then this is the max pref width of all cells encountered. * <p> @@ -369,6 +367,10 @@ * This is package private ONLY FOR TESTING */ final ArrayLinkedList<T> cells = new ArrayLinkedList<T>(); + @ReturnsUnmodifiableCollection + protected List<T> getCells() { + return Collections.unmodifiableList(cells); + } /** * A structure containing cells that can be reused later. These are cells @@ -407,7 +409,7 @@ */ private VirtualScrollBar hbar = new VirtualScrollBar(this); - final VirtualScrollBar getHbar() { + protected final VirtualScrollBar getHbar() { return hbar; } /** @@ -416,7 +418,7 @@ */ private VirtualScrollBar vbar = new VirtualScrollBar(this); - final VirtualScrollBar getVbar() { + protected final VirtualScrollBar getVbar() { return vbar; } @@ -802,7 +804,6 @@ maxPrefBreadth = -1; lastWidth = -1; lastHeight = -1; - numCellsVisibleOnScreen = -1; releaseCell(accumCell); // accumCell = null; // accumCellParent.getChildren().clear(); @@ -1361,25 +1362,6 @@ double flowLength = (isVertical ? getHeight() : getWidth()) - (breadthBar.isVisible() ? breadthBar.prefHeight(-1) : 0); - // This was changed from '== -1' to '<= 0' due to RT-29390. If this needs - // to change in the future there are unit tests developed against - // ListView, TreeView, TableView and TreeTableView, so it is hoped that - // RT-29390 will not be reintroduced. - if (numCellsVisibleOnScreen <= 0) { - numCellsVisibleOnScreen = 0; - for (int i = 0, max = cells.size(); i < max; i++) { - T cell = cells.get(i); - if (cell != null && ! cell.isEmpty()) { - sumCellLength += (isVertical ? cell.getHeight() : cell.getWidth()); - if (sumCellLength > flowLength) { - break; - } - - numCellsVisibleOnScreen++; - } - } - } - // Now position and update the scroll bars if (breadthBar.isVisible()) { /* @@ -1422,8 +1404,22 @@ } if (lengthBar.isVisible()) { + // determine how many cells there are on screen so that the scrollbar + // thumb can be appropriately sized + int numCellsVisibleOnScreen = 0; + for (int i = 0, max = cells.size(); i < max; i++) { + T cell = cells.get(i); + if (cell != null && ! cell.isEmpty()) { + sumCellLength += (isVertical ? cell.getHeight() : cell.getWidth()); + if (sumCellLength > flowLength) { + break; + } + + numCellsVisibleOnScreen++; + } + } + lengthBar.setMax(1); - if (numCellsVisibleOnScreen == 0 && cellCount == 1) { // special case to help resolve RT-17701 and the case where we have // only a single row and it is bigger than the viewport @@ -2350,7 +2346,7 @@ * <p> * This class is package private solely for the sake of testing. */ - static class ArrayLinkedList<T> { + static class ArrayLinkedList<T> extends AbstractList { /** * The array list backing this class. We default the size of the array * list to be fairly large so as not to require resizing during normal
--- a/modules/controls/src/main/java/javafx/scene/control/Control.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/javafx/scene/control/Control.java Wed Jul 10 06:53:57 2013 -0400 @@ -693,7 +693,7 @@ Constructor<?> skinConstructor = null; for (Constructor<?> c : constructors) { Class<?>[] parameterTypes = c.getParameterTypes(); - if (parameterTypes.length == 1 && Control.class.isAssignableFrom(parameterTypes[0])) { + if (parameterTypes.length == 1 && Skinnable.class.isAssignableFrom(parameterTypes[0])) { skinConstructor = c; break; } @@ -703,7 +703,7 @@ final String msg = "No valid constructor defined in '" + skinClassName + "' for control " + control + ".\r\nYou must provide a constructor that accepts a single " - + "Control parameter in " + skinClassName + "."; + + "Skinnable (e.g. Control or PopupControl) parameter in " + skinClassName + "."; final List<CssError> errors = StyleManager.getErrors(); if (errors != null) { CssError error = new CssError(msg);
--- a/modules/controls/src/main/java/javafx/scene/control/DatePicker.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/javafx/scene/control/DatePicker.java Wed Jul 10 06:53:57 2013 -0400 @@ -389,6 +389,7 @@ new DateTimeFormatterBuilder().parseLenient() .appendPattern(pattern) .toFormatter() + .withChronology(chrono) .withDecimalStyle(DecimalStyle.of(locale)); TemporalAccessor temporal = df.parse(text); ChronoLocalDate cDate = chrono.date(temporal);
--- a/modules/controls/src/main/java/javafx/scene/control/TableSelectionModel.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/javafx/scene/control/TableSelectionModel.java Wed Jul 10 06:53:57 2013 -0400 @@ -33,35 +33,33 @@ * table-like controls (most notably {@link TableView} and {@link TreeTableView}. * * @param <T> The type of the underlying data model for the UI control. - * @param <TC> The concrete subclass of {@link TableColumnBase} that is used by the - * underlying UI control (e.g. {@link TableColumn} or {@link TreeTableColumn}. * @since JavaFX 8.0 */ -public abstract class TableSelectionModel<T, TC extends TableColumnBase<T,?>> extends MultipleSelectionModelBase<T> { +public abstract class TableSelectionModel<T> extends MultipleSelectionModelBase<T> { /** * Convenience function which tests whether the given row and column index * is currently selected in this table instance. */ - public abstract boolean isSelected(int row, TC column); + public abstract boolean isSelected(int row, TableColumnBase<T,?> column); /** * Selects the cell at the given row/column intersection. */ - public abstract void select(int row, TC column); + public abstract void select(int row, TableColumnBase<T,?> column); /** * Clears all selection, and then selects the cell at the given row/column * intersection. */ - public abstract void clearAndSelect(int row, TC column); + public abstract void clearAndSelect(int row, TableColumnBase<T,?> column); /** * Removes selection from the specified row/column position (in view indexes). * If this particular cell (or row if the column value is -1) is not selected, * nothing happens. */ - public abstract void clearSelection(int row, TC column); + public abstract void clearSelection(int row, TableColumnBase<T,?> column); /** * Selects the cell to the left of the currently selected cell.
--- a/modules/controls/src/main/java/javafx/scene/control/TableView.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/javafx/scene/control/TableView.java Wed Jul 10 06:53:57 2013 -0400 @@ -1512,7 +1512,7 @@ * allow for special support for TableView controls. * @since JavaFX 2.0 */ - public static abstract class TableViewSelectionModel<S> extends TableSelectionModel<S, TableColumn<S,?>> { + public static abstract class TableViewSelectionModel<S> extends TableSelectionModel<S> { /*********************************************************************** * * @@ -1564,6 +1564,65 @@ /*********************************************************************** * * + * Generic (type erasure) bridging * + * * + **********************************************************************/ + + // --- isSelected + /** {@inheritDoc} */ + @Override public boolean isSelected(int row, TableColumnBase<S, ?> column) { + return isSelected(row, (TableColumn)column); + } + + /** + * Convenience function which tests whether the given row and column index + * is currently selected in this table instance. + */ + public abstract boolean isSelected(int row, TableColumn<S, ?> column); + + + // --- select + /** {@inheritDoc} */ + @Override public void select(int row, TableColumnBase<S, ?> column) { + select(row, (TableColumn)column); + } + + /** + * Selects the cell at the given row/column intersection. + */ + public abstract void select(int row, TableColumn<S, ?> column); + + + // --- clearAndSelect + /** {@inheritDoc} */ + @Override public void clearAndSelect(int row, TableColumnBase<S,?> column) { + clearAndSelect(row, (TableColumn) column); + } + + /** + * Clears all selection, and then selects the cell at the given row/column + * intersection. + */ + public abstract void clearAndSelect(int row, TableColumn<S,?> column); + + + // --- clearSelection + /** {@inheritDoc} */ + @Override public void clearSelection(int row, TableColumnBase<S,?> column) { + clearSelection(row, (TableColumn) column); + } + + /** + * Removes selection from the specified row/column position (in view indexes). + * If this particular cell (or row if the column value is -1) is not selected, + * nothing happens. + */ + public abstract void clearSelection(int row, TableColumn<S, ?> column); + + + + /*********************************************************************** + * * * Public API * * * **********************************************************************/ @@ -1579,7 +1638,7 @@ * Convenience method that returns getTableView().getItems(). * @return The items list of the current TableView. */ - protected ObservableList<S> getTableModel() { + protected List<S> getTableModel() { return tableView.getItems(); } @@ -1796,7 +1855,7 @@ tableView.itemsProperty().addListener(weakItemsPropertyListener); // watching for changes to the items list content - ObservableList<S> items = getTableModel(); + ObservableList<S> items = getTableView().getItems();//getTableModel(); if (items != null) { items.addListener(weakItemsContentListener); }
--- a/modules/controls/src/main/java/javafx/scene/control/TreeTableView.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/javafx/scene/control/TreeTableView.java Wed Jul 10 06:53:57 2013 -0400 @@ -207,7 +207,7 @@ * normal JavaBean properties too, although there is a caveat to this, so refer * to the class documentation for more information). When this is not the case, * it is necessary to provide a custom cell value factory. More information - * about cell value factories can be found in the {@link TreeTableColumns} API + * about cell value factories can be found in the {@link TreeTableColumn} API * documentation, but briefly, here is how a TreeTableColumns could be specified: * * <pre> @@ -259,7 +259,7 @@ * * <p>You can create custom {@link TreeTableCell} instances per column by assigning * the appropriate function to the TreeTableColumns - * {@link TreeTableColumns#cellFactoryProperty() cell factory} property. + * {@link TreeTableColumn#cellFactoryProperty() cell factory} property. * * <p>See the {@link Cell} class documentation for a more complete * description of how to write custom Cells. @@ -1457,7 +1457,7 @@ * Instructs the TreeTableView to begin editing the given TreeItem, if * the TreeTableView is {@link #editableProperty() editable}. Once * this method is called, if the current - * {@link #cellFactoryProperty() cell factory} is set up to support editing, + * {@link javafx.scene.control.TreeTableColumn#cellFactoryProperty()} cell factory} is set up to support editing, * the Cell will switch its visual state to enable the user input to take place. * * @param item The TreeItem in the TreeTableView that should be edited. @@ -1916,7 +1916,7 @@ * TreeTableColumn and delta values being set and stored in this immutable * instance. * - * @param table The TreeTableView upon which the resize operation is occurring. + * @param treeTable The TreeTableView upon which the resize operation is occurring. * @param column The column upon which the resize is occurring, or null * if this ResizeFeatures instance is being created as a result of a * TreeTableView resize operation. @@ -2018,8 +2018,8 @@ * allow for special support for TableView controls. * @since JavaFX 8.0 */ - public static abstract class TreeTableViewSelectionModel<S> extends - TableSelectionModel<TreeItem<S>, TreeTableColumn<S, ?>> { + public static abstract class TreeTableViewSelectionModel<S> extends + TableSelectionModel<TreeItem<S>> { /*********************************************************************** * * @@ -2040,7 +2040,7 @@ /** * Builds a default TableViewSelectionModel instance with the provided * TableView. - * @param tableView The TableView upon which this selection model should + * @param treeTableView The TableView upon which this selection model should * operate. * @throws NullPointerException TableView can not be null. */ @@ -2451,7 +2451,7 @@ clearAndSelect(row, null); } - @Override public void clearAndSelect(int row, TreeTableColumn<S,?> column) { + @Override public void clearAndSelect(int row, TableColumnBase column) { quietClearSelection(); select(row, column); } @@ -2460,7 +2460,7 @@ select(row, null); } - @Override public void select(int row, TreeTableColumn<S,?> column) { + @Override public void select(int row, TableColumnBase column) { // TODO we need to bring in the TreeView selection stuff here... if (row < 0 || row >= getRowCount()) return; @@ -2472,7 +2472,7 @@ // // if a column is given, I return // if (! isCellSelectionEnabled() && column != null) return; - TreeTablePosition pos = new TreeTablePosition(getTreeTableView(), row, column); + TreeTablePosition pos = new TreeTablePosition(getTreeTableView(), row, (TreeTableColumn)column); if (! selectedCells.contains(pos)) { if (getSelectionMode() == SelectionMode.SINGLE) { @@ -2483,7 +2483,7 @@ // setSelectedIndex(row); updateSelectedIndex(row); - focus(row, column); + focus(row, (TreeTableColumn)column); int changeIndex = selectedCellsSeq.indexOf(pos); selectedCellsSeq.callObservers(new NonIterableChange.SimpleAddChange<TreeTablePosition<S,?>>(changeIndex, changeIndex+1, selectedCellsSeq)); @@ -2649,8 +2649,8 @@ clearSelection(index, null); } - @Override public void clearSelection(int row, TreeTableColumn<S,?> column) { - TreeTablePosition tp = new TreeTablePosition(getTreeTableView(), row, column); + @Override public void clearSelection(int row, TableColumnBase column) { + TreeTablePosition tp = new TreeTablePosition(getTreeTableView(), row, (TreeTableColumn)column); boolean csMode = isCellSelectionEnabled(); @@ -2680,7 +2680,7 @@ return isSelected(index, null); } - @Override public boolean isSelected(int row, TreeTableColumn<S,?> column) { + @Override public boolean isSelected(int row, TableColumnBase column) { // When in cell selection mode, we currently do NOT support selecting // entire rows, so a isSelected(row, null) // should always return false. @@ -2894,7 +2894,7 @@ * Creates a default TableViewFocusModel instance that will be used to * manage focus of the provided TableView control. * - * @param tableView The tableView upon which this focus model operates. + * @param treeTableView The tableView upon which this focus model operates. * @throws NullPointerException The TableView argument can not be null. */ public TreeTableViewFocusModel(final TreeTableView<S> treeTableView) {
--- a/modules/controls/src/main/java/javafx/scene/control/cell/CheckBoxTreeTableCell.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/java/javafx/scene/control/cell/CheckBoxTreeTableCell.java Wed Jul 10 06:53:57 2013 -0400 @@ -78,7 +78,7 @@ * column will be bound bidirectionally. This means that the CheckBox in * the cell will set/unset this property based on user interactions, and the * CheckBox will reflect the state of the {@code ObservableValue<Boolean>}, - * if it changes externally).</li> + * if it changes externally). * * @return A {@link Callback} that will return a {@link TreeTableCell} that is * able to work on the type of element contained within the TreeTableColumn.
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css Wed Jul 10 06:53:57 2013 -0400 @@ -2388,6 +2388,11 @@ -fx-background-insets: 1 0 -1 0, 0; } +.table-view .column-header .label, +.tree-table-view .column-header .label { + -fx-alignment: center; +} + .table-view > .column-header-background > .show-hide-columns-button, .tree-table-view > .column-header-background > .show-hide-columns-button{ -fx-background-color: -fx-body-color;
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css Wed Jul 10 06:53:57 2013 -0400 @@ -2386,6 +2386,11 @@ -fx-padding: 0.115em; -fx-background-radius: 0.115em; } +.table-view .column-header .label, +.tree-table-view .column-header .label { + -fx-alignment: center; +} + /* Plus Symbol */ .table-view .show-hide-column-image, .tree-table-view .show-hide-column-image {
--- a/modules/controls/src/test/java/javafx/scene/control/ComboBoxTest.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/test/java/javafx/scene/control/ComboBoxTest.java Wed Jul 10 06:53:57 2013 -0400 @@ -25,6 +25,7 @@ package javafx.scene.control; +import com.sun.javafx.tk.Toolkit; import javafx.css.PseudoClass; import com.sun.javafx.scene.control.infrastructure.KeyEventFirer; @@ -54,6 +55,8 @@ import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.input.KeyCode; +import javafx.scene.paint.Color; +import javafx.scene.shape.Circle; import javafx.stage.Stage; import javafx.util.Callback; import javafx.util.StringConverter; @@ -1026,4 +1029,32 @@ new KeyEventFirer(comboBox).doKeyPress(KeyCode.ENTER); } + + @Test public void test_rt31479() { + ComboBox<String> comboBox = new ComboBox<String>(); + + StageLoader stageLoader = new StageLoader(comboBox); + stageLoader.getStage().show(); + + final double widthBefore = comboBox.getWidth(); + + // add item + comboBox.getItems().add("Option 1"); + + // open and close combobox + comboBox.show(); + comboBox.hide(); + + // set a placeholder + comboBox.setPlaceholder(new Circle(12, Color.RED)); + + // remove item + comboBox.getItems().clear(); + + // fire pulse (this allows layout to cause the size to grow) + Toolkit.getToolkit().firePulse(); + + // test size + assertEquals(widthBefore, comboBox.getWidth(), 0.00); + } }
--- a/modules/controls/src/test/java/javafx/scene/control/DatePickerTest.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/test/java/javafx/scene/control/DatePickerTest.java Wed Jul 10 06:53:57 2013 -0400 @@ -27,7 +27,7 @@ import java.time.LocalDate; import java.time.chrono.*; -import java.util.Set; +import java.util.*; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; @@ -227,31 +227,6 @@ assertTrue(str == null || str.isEmpty()); } - @Ignore("Fails due to RT-29927") - @Test public void ensureImpl_getPseudoClassStateReturnsValidValue() { - Set<PseudoClass> value1 = datePicker.getPseudoClassStates(); - assertFalse(datePicker.isEditable()); - assertTrue(value1.size() >= 0); - - datePicker.setEditable(true); - Set<PseudoClass> value2 = datePicker.getPseudoClassStates(); - assertTrue(value2.contains(PseudoClass.getPseudoClass("editable"))); - - datePicker.show(); - Set<PseudoClass> value3 = datePicker.getPseudoClassStates(); - assertTrue(value3.contains(PseudoClass.getPseudoClass("showing"))); - - datePicker.arm(); - Set<PseudoClass> value4 = datePicker.getPseudoClassStates(); - assertTrue(value4.contains(PseudoClass.getPseudoClass("armed"))); - - assertFalse(value1.equals(value2)); - assertFalse(value1.equals(value3)); - assertFalse(value1.equals(value4)); - assertFalse(value2.equals(value3)); - assertFalse(value2.equals(value4)); - assertFalse(value3.equals(value4)); - } /********************************************************************* * Tests for properties * @@ -403,4 +378,22 @@ * Tests for bug reports * ********************************************************************/ + @Test public void test_rt30549() { + Locale.setDefault(Locale.forLanguageTag("en-US")); + StringConverter<LocalDate> converter = datePicker.getConverter(); + + // Set a MinguoDate from a String + datePicker.setChronology(MinguoChronology.INSTANCE); + datePicker.getEditor().setText("5/22/0102 1"); + datePicker.setValue(converter.fromString(datePicker.getEditor().getText())); + assertEquals(MinguoChronology.INSTANCE.date(MinguoEra.ROC, 102, 5, 22), + MinguoDate.from(datePicker.getValue())); + assertEquals("5/22/0102 1", datePicker.getEditor().getText()); + + // Convert from MinguoDate to LocalDate (ISO) + datePicker.setChronology(IsoChronology.INSTANCE); + assertEquals(LocalDate.of(2013, 5, 22), datePicker.getValue()); + datePicker.getEditor().setText(converter.toString(datePicker.getValue())); + assertEquals("5/22/2013", datePicker.getEditor().getText()); + } }
--- a/modules/controls/src/test/java/javafx/scene/control/ListViewTest.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/test/java/javafx/scene/control/ListViewTest.java Wed Jul 10 06:53:57 2013 -0400 @@ -646,4 +646,20 @@ assertEquals(1, listView.getEditingIndex()); assertTrue(cell.isEditing()); } + + @Test public void test_rt31471() { + final ObservableList names = FXCollections.observableArrayList("Adam", "Alex", "Alfred", "Albert"); + final ListView listView = new ListView(names); + + IndexedCell cell = VirtualFlowTestUtils.getCell(listView, 0); + assertEquals("Adam", cell.getItem()); + + listView.setFixedCellSize(50); + + VirtualFlowTestUtils.getVirtualFlow(listView).requestLayout(); + Toolkit.getToolkit().firePulse(); + + assertEquals("Adam", cell.getItem()); + assertEquals(50, cell.getHeight(), 0.00); + } }
--- a/modules/controls/src/test/java/javafx/scene/control/TableViewTest.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/test/java/javafx/scene/control/TableViewTest.java Wed Jul 10 06:53:57 2013 -0400 @@ -1365,4 +1365,28 @@ assertEquals(firstNameCol, editingCell.getTableColumn()); assertTrue(cell.isEditing()); } + + @Test public void test_rt31471() { + Person jacobSmith; + final TableView<Person> tableView = new TableView<Person>(); + tableView.setItems(FXCollections.observableArrayList( + jacobSmith = new Person("Jacob", "Smith", "jacob.smith@example.com"), + new Person("Jim", "Bob", "jim.bob@example.com") + )); + + TableColumn firstNameCol = new TableColumn("First Name"); + firstNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("firstName")); + tableView.getColumns().add(firstNameCol); + + IndexedCell cell = VirtualFlowTestUtils.getCell(tableView, 0); + assertEquals(jacobSmith, cell.getItem()); + + tableView.setFixedCellSize(50); + + VirtualFlowTestUtils.getVirtualFlow(tableView).requestLayout(); + Toolkit.getToolkit().firePulse(); + + assertEquals(jacobSmith, cell.getItem()); + assertEquals(50, cell.getHeight(), 0.00); + } }
--- a/modules/controls/src/test/java/javafx/scene/control/TreeTableViewTest.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/test/java/javafx/scene/control/TreeTableViewTest.java Wed Jul 10 06:53:57 2013 -0400 @@ -63,6 +63,8 @@ import javafx.scene.control.cell.TreeItemPropertyValueFactory; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.scene.shape.Circle; import javafx.stage.Stage; import javafx.util.Callback; @@ -2113,4 +2115,79 @@ treeTableView.setShowRoot(false); assertEquals("Child 1", cell.getText()); } + + @Test public void test_rt31471() { + installChildren(); + + TreeTableColumn<String,String> firstNameCol = new TreeTableColumn<>("First Name"); + firstNameCol.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<String, String>, ObservableValue<String>>() { + @Override public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<String, String> param) { + return new ReadOnlyStringWrapper(param.getValue().getValue()); + } + }); + + treeTableView.getColumns().add(firstNameCol); + + IndexedCell cell = VirtualFlowTestUtils.getCell(treeTableView, 0); + assertEquals("Root", cell.getItem()); + + treeTableView.setFixedCellSize(50); + + VirtualFlowTestUtils.getVirtualFlow(treeTableView).requestLayout(); + Toolkit.getToolkit().firePulse(); + + assertEquals("Root", cell.getItem()); + assertEquals(50, cell.getHeight(), 0.00); + } + + @Test public void test_rt30466() { + final Node graphic1 = new Circle(6.75, Color.RED); + final Node graphic2 = new Circle(6.75, Color.GREEN); + + installChildren(); + + TreeTableColumn<String,String> firstNameCol = new TreeTableColumn<>("First Name"); + firstNameCol.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<String, String>, ObservableValue<String>>() { + @Override public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<String, String> param) { + return new ReadOnlyStringWrapper(param.getValue().getValue()); + } + }); + + treeTableView.getColumns().add(firstNameCol); + + TreeTableRow cell = (TreeTableRow) VirtualFlowTestUtils.getCell(treeTableView, 0); + assertEquals("Root", cell.getItem()); + + // set the first graphic - which we expect to see as a child of the cell + root.setGraphic(graphic1); + cell = (TreeTableRow) VirtualFlowTestUtils.getCell(treeTableView, 0); + boolean matchGraphic1 = false; + boolean matchGraphic2 = false; + for (Node n : cell.getChildrenUnmodifiable()) { + if (n == graphic1) { + matchGraphic1 = true; + } + if (n == graphic2) { + matchGraphic2 = true; + } + } + assertTrue(matchGraphic1); + assertFalse(matchGraphic2); + + // set the second graphic - which we also expect to see - but of course graphic1 should not be a child any longer + root.setGraphic(graphic2); + cell = (TreeTableRow) VirtualFlowTestUtils.getCell(treeTableView, 0); + matchGraphic1 = false; + matchGraphic2 = false; + for (Node n : cell.getChildrenUnmodifiable()) { + if (n == graphic1) { + matchGraphic1 = true; + } + if (n == graphic2) { + matchGraphic2 = true; + } + } + assertFalse(matchGraphic1); + assertTrue(matchGraphic2); + } }
--- a/modules/controls/src/test/java/javafx/scene/control/TreeViewTest.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/controls/src/test/java/javafx/scene/control/TreeViewTest.java Wed Jul 10 06:53:57 2013 -0400 @@ -1057,4 +1057,19 @@ treeView.setShowRoot(false); assertEquals("Child 1", cell.getText()); } + + @Test public void test_rt31471() { + installChildren(); + + IndexedCell cell = VirtualFlowTestUtils.getCell(treeView, 0); + assertEquals("Root", cell.getItem()); + + treeView.setFixedCellSize(50); + + VirtualFlowTestUtils.getVirtualFlow(treeView).requestLayout(); + Toolkit.getToolkit().firePulse(); + + assertEquals("Root", cell.getItem()); + assertEquals(50, cell.getHeight(), 0.00); + } }
--- a/modules/graphics/src/main/java/com/sun/javafx/css/parser/CSSLexer.java Tue Jul 09 09:36:39 2013 -0700 +++ b/modules/graphics/src/main/java/com/sun/javafx/css/parser/CSSLexer.java Wed Jul 10 06:53:57 2013 -0400 @@ -401,6 +401,7 @@ case '/': ch = readChar(); if (ch == '*') skipComment(); + else if (ch == '/') skipEOL(); else { text.append('/').append((char)ch); int temp = offset; @@ -561,6 +562,22 @@ } } + private void skipEOL() throws IOException { + + int lastc = ch; + + while (ch != -1) { + + ch = readChar(); + + // EOL is cr, lf, or crlf + if ((ch == '\n') || (lastc == '\r' && ch != '\n')) { + break; + } + } + + } + private int pos = 0; private int offset = 0; private int line = 1; @@ -697,6 +714,14 @@ token = Token.EOF_TOKEN; return token; } + } else if (ch == '/') { + skipEOL(); + if (ch != -1) { + continue; + } else { + token = Token.EOF_TOKEN; + return token; + } } else { // not a comment - a SOLIDUS token = new Token(SOLIDUS,"/", line, offset);