changeset 9350:35b74894be20 9-b91

Merge
author kcr
date Mon, 02 Nov 2015 09:29:33 -0800
parents 09e2d7e4771d fab5c1df0430
children c68b21b26373 67a83054f43b 62c29c900ba6
files
diffstat 8 files changed, 40 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/EmbeddedTextContextMenuContent.java	Fri Oct 30 02:05:25 2015 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/EmbeddedTextContextMenuContent.java	Mon Nov 02 09:29:33 2015 -0800
@@ -184,9 +184,7 @@
 
         @Override public void fire() {
             Event.fireEvent(item, new ActionEvent());
-            if (Boolean.TRUE.equals((Boolean)item.getProperties().get("refreshMenu"))) {
-                //refreshMenu();
-            } else {
+            if (!Boolean.TRUE.equals((Boolean)item.getProperties().get("refreshMenu"))) {
                 hideAllMenus(item);
             }
         }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/PasswordFieldBehavior.java	Fri Oct 30 02:05:25 2015 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/PasswordFieldBehavior.java	Mon Nov 02 09:29:33 2015 -0800
@@ -46,7 +46,7 @@
     protected void previousWord() { }
     protected void nextWord() { }
     protected void selectWord() {
-        getNode().selectAll();
+        selectAll();
     }
     protected void mouseDoubleClick(TextPosInfo hit) {
         getNode().selectAll();
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java	Fri Oct 30 02:05:25 2015 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java	Mon Nov 02 09:29:33 2015 -0800
@@ -133,7 +133,6 @@
 //    }
 //
     private TextAreaSkin skin;
-    private ContextMenu contextMenu;
     private TwoLevelFocusBehavior tlFocus;
 
     /**************************************************************************
@@ -143,7 +142,6 @@
     public TextAreaBehavior(final TextArea c) {
         super(c);
 
-        contextMenu = new ContextMenu();
         if (Properties.IS_TOUCH_SUPPORTED) {
             contextMenu.getStyleClass().add("text-input-context-menu");
         }
@@ -461,7 +459,7 @@
                 }
             }
 
-            populateContextMenu(contextMenu);
+            populateContextMenu();
             double menuWidth = contextMenu.prefWidth(-1);
             double menuX = screenX - (Properties.IS_TOUCH_SUPPORTED ? (menuWidth / 2) : 0);
             Screen currentScreen = com.sun.javafx.util.Utils.getScreenForPoint(screenX, 0);
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextFieldBehavior.java	Fri Oct 30 02:05:25 2015 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextFieldBehavior.java	Mon Nov 02 09:29:33 2015 -0800
@@ -56,7 +56,6 @@
  */
 public class TextFieldBehavior extends TextInputControlBehavior<TextField> {
     private TextFieldSkin skin;
-    private ContextMenu contextMenu;
     private TwoLevelFocusBehavior tlFocus;
     private ChangeListener<Scene> sceneListener;
     private ChangeListener<Node> focusOwnerListener;
@@ -64,7 +63,6 @@
     public TextFieldBehavior(final TextField textField) {
         super(textField);
 
-        contextMenu = new ContextMenu();
         if (Properties.IS_TOUCH_SUPPORTED) {
             contextMenu.getStyleClass().add("text-input-context-menu");
         }
@@ -373,7 +371,7 @@
                 }
             }
 
-            populateContextMenu(contextMenu);
+            populateContextMenu();
             double menuWidth = contextMenu.prefWidth(-1);
             double menuX = screenX - (Properties.IS_TOUCH_SUPPORTED ? (menuWidth / 2) : 0);
             Screen currentScreen = com.sun.javafx.util.Utils.getScreenForPoint(screenX, 0);
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java	Fri Oct 30 02:05:25 2015 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java	Mon Nov 02 09:29:33 2015 -0800
@@ -88,6 +88,8 @@
 
     final T textInputControl;
 
+    protected ContextMenu contextMenu;
+
     /**
      * Used to keep track of the most recent key event. This is used when
      * handling InputCharacter actions.
@@ -266,7 +268,9 @@
         addKeyPadMappings(inputMap);
 
         textInputControl.textProperty().addListener(textListener);
-    }
+
+        contextMenu = new ContextMenu();
+}
 
     @Override public InputMap<T> getInputMap() {
         return inputMap;
@@ -580,6 +584,16 @@
         } else {
             textInputControl.selectEndOfNextWord();
         }
+        if (SHOW_HANDLES && contextMenu.isShowing()) {
+            populateContextMenu();
+        }
+    }
+
+    protected void selectAll() {
+        getNode().selectAll();
+        if (SHOW_HANDLES && contextMenu.isShowing()) {
+            populateContextMenu();
+        }
     }
 
     protected void previousWord() {
@@ -645,11 +659,12 @@
         return editing;
     }
 
-    protected void populateContextMenu(ContextMenu contextMenu) {
+    protected void populateContextMenu() {
         TextInputControl textInputControl = getNode();
         boolean editable = textInputControl.isEditable();
         boolean hasText = (textInputControl.getLength() > 0);
         boolean hasSelection = (textInputControl.getSelection().getLength() > 0);
+        boolean allSelected = (textInputControl.getSelection().getLength() == textInputControl.getLength());
         boolean maskText = (textInputControl instanceof PasswordField); // (maskText("A") != "A");
         ObservableList<MenuItem> items = contextMenu.getItems();
 
@@ -664,8 +679,8 @@
             if (editable && Clipboard.getSystemClipboard().hasString()) {
                 items.add(pasteMI);
             }
-            if (hasText) {
-                if (!hasSelection) {
+            if (hasText && !allSelected) {
+                if (!hasSelection && !(textInputControl instanceof PasswordField)) {
                     items.add(selectWordMI);
                 }
                 items.add(selectAllMI);
@@ -702,7 +717,7 @@
     private final MenuItem pasteMI  = new ContextMenuItem("Paste", e -> paste());
     private final MenuItem deleteMI = new ContextMenuItem("DeleteSelection", e -> deleteSelection());
     private final MenuItem selectWordMI = new ContextMenuItem("SelectWord", e -> selectWord());
-    private final MenuItem selectAllMI = new ContextMenuItem("SelectAll", e -> getNode().selectAll());
+    private final MenuItem selectAllMI = new ContextMenuItem("SelectAll", e -> selectAll());
     private final MenuItem separatorMI = new SeparatorMenuItem();
 
 }
--- a/modules/controls/src/main/java/javafx/scene/control/skin/PaginationSkin.java	Fri Oct 30 02:05:25 2015 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/skin/PaginationSkin.java	Mon Nov 02 09:29:33 2015 -0800
@@ -883,11 +883,13 @@
 
         private void initializeNavigationHandlers() {
             leftArrowButton.setOnAction(arg0 -> {
+                getNode().requestFocus();
                 selectPrevious();
                 requestLayout();
             });
 
             rightArrowButton.setOnAction(arg0 -> {
+                getNode().requestFocus();
                 selectNext();
                 requestLayout();
             });
@@ -1286,15 +1288,14 @@
 
             getSkinnable().getStyleClass().addListener(updateSkinIndicatorType);
 
-            setOnAction(new EventHandler<ActionEvent>() {
-                @Override public void handle(ActionEvent arg0) {
+            setOnAction(arg0 -> {
+                    getNode().requestFocus();
                     int selected = getCurrentPageIndex();
                     // We do not need to update the selection if it has not changed.
                     if (selected != IndicatorButton.this.pageNumber) {
                         pagination.setCurrentPageIndex(IndicatorButton.this.pageNumber);
                         requestLayout();
                     }
-                }
             });
 
             tooltipVisibleProperty().addListener(updateTooltipVisibility);
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css	Fri Oct 30 02:05:25 2015 -0700
+++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/caspian/caspian.css	Mon Nov 02 09:29:33 2015 -0800
@@ -3790,6 +3790,9 @@
 }
 
 .pagination > .pagination-control > .control-box > .bullet-button:selected {   
+    -fx-base: -fx-selection-bar-text;
+}
+.pagination:focused > .pagination-control > .control-box > .bullet-button:selected {   
     -fx-base: -fx-accent;
 }
 
@@ -3805,6 +3808,9 @@
 }
 
 .pagination > .pagination-control > .control-box > .number-button:selected {   
+    -fx-base: -fx-selection-bar-text;
+}
+.pagination:focused > .pagination-control > .control-box > .number-button:selected {   
     -fx-base: -fx-accent;
 }
 .pagination > .pagination-control > .page-information {   
--- a/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css	Fri Oct 30 02:05:25 2015 -0700
+++ b/modules/controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css	Mon Nov 02 09:29:33 2015 -0800
@@ -2190,6 +2190,9 @@
    -fx-background-insets: 0, 5,  6,  7;
 }
 .pagination > .pagination-control > .control-box > .bullet-button:selected {   
+    -fx-base: -fx-selection-bar-non-focused;
+}
+.pagination:focused > .pagination-control > .control-box > .bullet-button:selected {   
     -fx-base: -fx-accent;
 }
 .pagination.bullet > .pagination-control > .control-box {
@@ -2212,6 +2215,9 @@
     -fx-background-color: -fx-shadow-highlight-color, -fx-outer-border, -fx-inner-border, -fx-body-color;
 }
 .pagination > .pagination-control > .control-box > .number-button:selected {   
+    -fx-base: -fx-selection-bar-non-focused;
+}
+.pagination:focused > .pagination-control > .control-box > .number-button:selected {   
     -fx-base: -fx-accent;
 }
 .pagination > .pagination-control > .page-information {