You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2018/04/02 22:01:16 UTC

svn commit: r1828188 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java

Author: rwhitcomb
Date: Mon Apr  2 22:01:16 2018
New Revision: 1828188

URL: http://svn.apache.org/viewvc?rev=1828188&view=rev
Log:
It was noticed that SuggestionPopup (or rather the skin) was always setting the
ListView it creates to be variable item height, which is rarely the case.  This
causes extra processing for no reason.  But it may, in fact, be required for
some renderers, so leave it the default, but add a new style to set it to false.

Modified:
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java?rev=1828188&r1=1828187&r2=1828188&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java Mon Apr  2 22:01:16 2018
@@ -69,6 +69,7 @@ public class TerraSuggestionPopupSkin ex
 
     private int closeTransitionDuration = DEFAULT_CLOSE_TRANSITION_DURATION;
     private int closeTransitionRate = DEFAULT_CLOSE_TRANSITION_RATE;
+    private boolean variableItemHeight = true;    // This is the historical default
 
     private ContainerMouseListener displayMouseListener = new ContainerMouseListener() {
         @Override
@@ -183,7 +184,7 @@ public class TerraSuggestionPopupSkin ex
     private static final int DEFAULT_CLOSE_TRANSITION_RATE = 30;
 
     public TerraSuggestionPopupSkin() {
-        listView.getStyles().put(Style.variableItemHeight, true);
+        listView.getStyles().put(Style.variableItemHeight, variableItemHeight);
         listView.getListViewSelectionListeners().add(listViewSelectionListener);
         listView.getComponentKeyListeners().add(listViewKeyListener);
 
@@ -272,6 +273,15 @@ public class TerraSuggestionPopupSkin ex
         this.closeTransitionRate = closeTransitionRate;
     }
 
+    public boolean isVariableItemHeight() {
+        return variableItemHeight;
+    }
+
+    public void setVariableItemHeight(boolean variableItemHeight) {
+        this.variableItemHeight = variableItemHeight;
+        listView.getStyles().put(Style.variableItemHeight, variableItemHeight);
+    }
+
     @Override
     public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
         SuggestionPopup suggestionPopup = (SuggestionPopup) getComponent();