OpenJDK / openjfx / jfx-dev / rt
changeset 1046:0f8df2a08440
Automated merge with ssh://jfxsrc.us.oracle.com//javafx/2.2/scrum/controls/jfx/rt
author | jgiles |
---|---|
date | Tue, 15 May 2012 18:37:32 +1200 |
parents | 4f116c069488 9abbdefc6864 |
children | 1639f29f5266 b0a2ae45a139 |
files | |
diffstat | 5 files changed, 57 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ListCellBehavior.java Mon May 14 22:12:51 2012 -0700 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ListCellBehavior.java Tue May 15 18:37:32 2012 +1200 @@ -25,6 +25,7 @@ package com.sun.javafx.scene.control.behavior; +import com.sun.javafx.PlatformUtil; import com.sun.javafx.logging.PlatformLogger; import com.sun.javafx.scene.control.Logging; import java.util.WeakHashMap; @@ -69,20 +70,31 @@ // the best feel: // - when you click on a not-selected item, you can select immediately on press // - when you click on a selected item, you need to wait whether DragDetected or Release comes first - private boolean selected = false; + // + // To support touch devices, we have to slightly modify this behavior, such + // that selection only happens on mouse release, if only minimal dragging + // has occurred. private boolean latePress = false; + private final boolean isEmbedded = PlatformUtil.isEmbedded(); + private boolean wasSelected = false; public ListCellBehavior(ListCell control) { super(control); } @Override public void mousePressed(MouseEvent event) { - if (selected) { + boolean selectedBefore = getControl().isSelected(); + + if (getControl().isSelected()) { latePress = true; return; } + + doSelect(event); - doSelect(event); + if (isEmbedded && selectedBefore) { + wasSelected = getControl().isSelected(); + } } @Override public void mouseReleased(MouseEvent event) { @@ -90,10 +102,19 @@ latePress = false; doSelect(event); } + + wasSelected = false; } @Override public void mouseDragged(MouseEvent event) { latePress = false; + + // the mouse has now been dragged on a touch device, we should + // remove the selection if we just added it in the last mouse press + // event + if (isEmbedded && ! wasSelected && getControl().isSelected()) { + getControl().getListView().getSelectionModel().clearSelection(getControl().getIndex()); + } } private void doSelect(MouseEvent e) {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java Mon May 14 22:12:51 2012 -0700 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java Tue May 15 18:37:32 2012 +1200 @@ -72,6 +72,11 @@ this.comboBox = comboBox; this.listView = createListView(); + // Fix for RT-21207. Additional code related to this bug is further below. + this.listView.setManaged(false); + getChildren().add(listView); + // -- end of fix + updateListViewItems(); updateCellFactory(); @@ -174,6 +179,17 @@ new WeakListChangeListener(listViewItemsListener); @Override protected void handleControlPropertyChanged(String p) { + // Fix for RT-21207 + if (p == "SHOWING") { + if (getSkinnable().isShowing()) { + this.listView.setManaged(true); + this.listView.impl_processCSS(true); + } else { + this.listView.setManaged(false); + } + } + // -- end of fix + super.handleControlPropertyChanged(p); if (p == "ITEMS") {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableHeaderRow.java Mon May 14 22:12:51 2012 -0700 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableHeaderRow.java Tue May 15 18:37:32 2012 +1200 @@ -226,7 +226,6 @@ // the header lives inside a NestedTableColumnHeader header = new NestedTableColumnHeader(table, null); - getChildren().add(0, header); header.setFocusTraversable(false); header.setTableHeaderRow(this); @@ -278,7 +277,7 @@ // the region that is anchored above the vertical scrollbar // a 'ghost' of the header being dragged by the user to force column // reordering - getChildren().addAll(filler, cornerRegion, dragHeader); + getChildren().addAll(filler, header, cornerRegion, dragHeader); }
--- a/javafx-ui-controls/src/javafx/scene/control/cell/CheckBoxTableCell.java Mon May 14 22:12:51 2012 -0700 +++ b/javafx-ui-controls/src/javafx/scene/control/cell/CheckBoxTableCell.java Tue May 15 18:37:32 2012 +1200 @@ -24,6 +24,7 @@ */ package javafx.scene.control.cell; +import com.sun.javafx.css.StyleableProperty; import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; @@ -243,10 +244,14 @@ this.showLabel = converter != null; this.checkBox = new CheckBox(); -// this.checkBox.setAlignment(Pos.TOP_CENTER); + setGraphic(checkBox); -// setAlignment(Pos.CENTER); - setGraphic(checkBox); + // alignment is styleable through css. Calling setAlignment + // makes it look to css like the user set the value and css will not + // override. Initializing alignment by calling set on the + // StyleableProperty ensures that css will be able to override the value. + final StyleableProperty prop = StyleableProperty.getStyleableProperty(alignmentProperty()); + prop.set(this, Pos.CENTER); if (showLabel) { this.checkBox.setAlignment(Pos.CENTER_LEFT);
--- a/javafx-ui-controls/src/javafx/scene/control/cell/MapValueFactory.java Mon May 14 22:12:51 2012 -0700 +++ b/javafx-ui-controls/src/javafx/scene/control/cell/MapValueFactory.java Tue May 15 18:37:32 2012 +1200 @@ -71,6 +71,14 @@ private final Object key; + /** + * Creates a default MapValueFactory, which will use the provided key to + * lookup the value for cells in the {@link TableColumn} in which this + * MapValueFactory is installed (via the + * {@link TableColumn#cellValueFactoryProperty() cell value factory} property. + * + * @param key The key to use to lookup the value in the {@code Map}. + */ public MapValueFactory(final Object key) { this.key = key; }