You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/09/30 15:30:22 UTC

svn commit: r1527549 - in /pivot/branches/2.0.x: tests/src/org/apache/pivot/tests/tooltip_test.bxml wtk/src/org/apache/pivot/wtk/Component.java wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java

Author: smartini
Date: Mon Sep 30 13:30:21 2013
New Revision: 1527549

URL: http://svn.apache.org/r1527549
Log:
PIVOT-910, add the new tooltipWrapText flag (to be able to disable that new mode, by default true), and updated the test application

Modified:
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/tooltip_test.bxml
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java

Modified: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/tooltip_test.bxml
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/tooltip_test.bxml?rev=1527549&r1=1527548&r2=1527549&view=diff
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/tooltip_test.bxml (original)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/tooltip_test.bxml Mon Sep 30 13:30:21 2013
@@ -63,6 +63,19 @@ limitations under the License.
                 <collections:HashMap value="Double&#xA;Line"/>
             </TableView>
         </FlowPane>
+        <Separator/>
+        <FlowPane>
+            <Label text="Multi-line&#10;Label2:"
+                tooltipText="multi-line&#10;tooltip for the Label, but with wrapText false"
+                tooltipWrapText="false"
+                styles="{wrapText:true}"
+            />
+            <PushButton buttonData="Button 2"
+                tooltipText="multi-line&#10;tooltip for the Button, but with wrapText false"
+                tooltipWrapText="false"
+            />
+        </FlowPane>
+        <Separator/>
     </BoxPane>
 
 </Window>

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java?rev=1527549&r1=1527548&r2=1527549&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java Mon Sep 30 13:30:21 2013
@@ -649,10 +649,11 @@ public abstract class Component implemen
     // The cursor that is displayed over the component
     private Cursor cursor = null;
 
-    // The tooltip text, delay, and trigger callback
+    // The tooltip text, delay, trigger callback, flag for wrapping its text
     private String tooltipText = null;
     private int tooltipDelay = 1000;
     private ApplicationContext.ScheduledCallback triggerTooltipCallback = null;
+    private boolean tooltipWrapText = true;
 
     // The component's drag source
     private DragSource dragSource = null;
@@ -2317,6 +2318,31 @@ public abstract class Component implemen
     }
 
     /**
+     * Returns the tooltip's mode for wrapping its text.
+     *
+     * @return
+     * <tt>true</tt> if the tooltip text wrap mode is enabled; </tt>false</tt> if not.
+     */
+    public boolean getTooltipWrapText() {
+        return tooltipWrapText;
+    }
+
+    /**
+     * Sets the tooltip's text wrapping mode.
+     *
+     * @param tooltipWrapText
+     * The component's tooltip text wrap mode.
+     */
+    public void setTooltipWrapText(boolean tooltipWrapText) {
+        boolean previousTooltipWrapText = this.tooltipWrapText;
+
+        if (previousTooltipWrapText != tooltipWrapText) {
+            this.tooltipWrapText = tooltipWrapText;
+            // componentListeners.tooltipTextWrapChanged(this, previousTooltipWrapText);  // verify if/when to implement it ...
+        }
+    }
+
+    /**
      * Tells whether or not this component is fully opaque when painted.
      *
      * @return

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java?rev=1527549&r1=1527548&r2=1527549&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java Mon Sep 30 13:30:21 2013
@@ -296,8 +296,8 @@ public abstract class ComponentSkin impl
 
         if (tooltipText != null) {
             Label tooltipLabel = new Label(tooltipText);
-            tooltipLabel.getStyles().put("wrapText", true);  // by default here set wrapText style to true
-// TODO: set wrapText style to false only if specified ...
+            boolean tooltipWrapText = component.getTooltipWrapText();
+            tooltipLabel.getStyles().put("wrapText", tooltipWrapText);
             Tooltip tooltip = new Tooltip(tooltipLabel);
 
             Display display = component.getDisplay();