changeset 2131:51f27cb7e5da

RT-16061: Tooltip - Remove "folded corner" Effect
author jgiles
date Fri, 04 Jan 2013 14:28:46 +1300
parents faf337dd0958
children 0eb2889dede0
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TooltipSkin.java javafx-ui-controls/src/com/sun/javafx/scene/control/skin/caspian/caspian.css
diffstat 2 files changed, 13 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TooltipSkin.java	Fri Jan 04 14:16:42 2013 +1300
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TooltipSkin.java	Fri Jan 04 14:28:46 2013 +1300
@@ -22,35 +22,27 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 package com.sun.javafx.scene.control.skin;
 
 import javafx.scene.Node;
 import javafx.scene.control.Label;
 import javafx.scene.control.Skin;
 import javafx.scene.control.Tooltip;
-import javafx.scene.layout.StackPane;
 
 /**
- * Region/css based skin for Tooltip. It deals mostly with show hide logic for
+ * CSS based skin for Tooltip. It deals mostly with show hide logic for
  * Popup based controls, and specifically in this case for tooltip. It also
  * implements some of the Skin interface methods.
  *
  * TooltipContent class is the actual skin implementation of the tooltip.
  */
-public class TooltipSkin implements Skin<Tooltip> { //extends PopupControlSkin<Tooltip> {
-    private StackPane root;
+public class TooltipSkin implements Skin<Tooltip> { 
     private Label tipLabel;
-    private StackPane pageCorner;
 
     private Tooltip tooltip;
 
     public TooltipSkin(Tooltip t) {
         this.tooltip = t;
-//        setEffect(t.getEffect());
         tipLabel = new Label();
         tipLabel.contentDisplayProperty().bind(t.contentDisplayProperty());
         tipLabel.fontProperty().bind(t.fontProperty());
@@ -59,75 +51,31 @@
         tipLabel.textOverrunProperty().bind(t.textOverrunProperty());
         tipLabel.textProperty().bind(t.textProperty());
         tipLabel.wrapTextProperty().bind(t.wrapTextProperty());
-        pageCorner = new StackPane();
-        pageCorner.getStyleClass().setAll("page-corner");
-      
-        root = new StackPane() {
-            @Override protected void layoutChildren() {
-                tipLabel.resizeRelocate(getInsets().getLeft(), getInsets().getTop(),
-                        getWidth() - getInsets().getLeft() - getInsets().getRight(),
-                        getHeight() - getInsets().getTop() - getInsets().getBottom());
-                double pw = pageCorner.prefWidth(-1);
-                double ph = pageCorner.prefHeight(-1);
-                pageCorner.resizeRelocate((getWidth() - pw), (getHeight() - ph), pw, ph);
-            }
+        tipLabel.minWidthProperty().bind(t.minWidthProperty());
+        tipLabel.prefWidthProperty().bind(t.prefWidthProperty());
+        tipLabel.maxWidthProperty().bind(t.maxWidthProperty());
+        tipLabel.minHeightProperty().bind(t.minHeightProperty());
+        tipLabel.prefHeightProperty().bind(t.prefHeightProperty());
+        tipLabel.maxHeightProperty().bind(t.maxHeightProperty());
 
-            @Override protected double computeMinWidth(double width) {
-                return (tooltip.getMinWidth() != -1) ? tooltip.getMinWidth() : computePrefWidth(width);
-            }
-
-             @Override protected double computeMinHeight(double height) {
-                return (tooltip.getMinHeight() != -1) ? tooltip.getMinHeight() : computePrefHeight(height);
-            }
-
-            @Override protected double computePrefWidth(double width) {
-                 if(tooltip.getPrefWidth() != -1 ) {
-                    return tooltip.getPrefWidth();
-                } else {
-                     return (tooltip.isWrapText()) ? tipLabel.prefWidth(width) :
-                         getInsets().getLeft() + tipLabel.prefWidth(-1) + getInsets().getRight();
-                }
-            }
-
-            @Override protected double computePrefHeight(double height) {
-                 if (tooltip.getPrefWidth() != -1) {
-                     return getInsets().getTop() +
-                         tipLabel.prefHeight(tooltip.getPrefWidth() - getInsets().getLeft() - getInsets().getRight()) +
-                         getInsets().getBottom();
-                 } else {
-                    return getInsets().getTop() + tipLabel.prefHeight(-1) + getInsets().getBottom();
-                 }
-
-            }
-            @Override protected double computeMaxWidth(double width) {
-                return (tooltip.getMaxWidth() != -1) ? tooltip.getMaxWidth() : computePrefWidth(width);
-            }
-
-            @Override protected double computeMaxHeight(double height) {
-               return (tooltip.getMaxHeight() != -1) ? tooltip.getMaxHeight() : computePrefHeight(height);
-             }
-
-        };
-
-        root.getChildren().addAll(tipLabel, pageCorner);
         // RT-7512 - skin needs to have styleClass of the control
         // TODO - This needs to be bound together, not just set! Probably should
         // do the same for id and style as well.
-        root.getStyleClass().setAll(t.getStyleClass());
-        root.setStyle(t.getStyle());
-        root.setId(t.getId());
+        tipLabel.getStyleClass().setAll(t.getStyleClass());
+        tipLabel.setStyle(t.getStyle());
+        tipLabel.setId(t.getId());
     }
     
-    
     @Override public Tooltip getSkinnable() {
         return tooltip;
     }
 
     @Override public Node getNode() {
-        return root;
+        return tipLabel;
     }
 
     @Override public void dispose() {
         tooltip = null;
+        tipLabel = null;
     }
 }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/caspian/caspian.css	Fri Jan 04 14:16:42 2013 +1300
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/caspian/caspian.css	Fri Jan 04 14:28:46 2013 +1300
@@ -1864,18 +1864,10 @@
         linear-gradient(#fefefc, #e6dd71),
         linear-gradient(#fef592, #e5d848);
     -fx-background-insets: 0,1,2;
-    -fx-background-radius: 0 0 13 0;
     -fx-padding: 0.333333em 0.666667em 0.333333em 0.666667em; /* 4 8 4 8 */
     -fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 8, 0.0 , 0 , 0 );
 }
 
-.page-corner {
-    -fx-padding: 4.5 4.5 4.5 4.5;
-    -fx-background-color: linear-gradient( from 0% 0% to 50% 50%, #fcf7b6, #a59c31);
-    -fx-shape: "M0,0H9L0,9Z";
-    -fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 4 , 0.0 , 0 , 0 );
-}
-
 /*******************************************************************************
  *                                                                             *
  * Toolbar                                                                     *