You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/09/30 23:02:37 UTC
svn commit: r1003263 -
/pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
Author: gbrown
Date: Thu Sep 30 21:02:37 2010
New Revision: 1003263
URL: http://svn.apache.org/viewvc?rev=1003263&view=rev
Log:
Ensure that suggestion popup content remains within the display bounds.
Modified:
pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
Modified: pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java?rev=1003263&r1=1003262&r2=1003263&view=diff
==============================================================================
--- pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java (original)
+++ pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java Thu Sep 30 21:02:37 2010
@@ -36,6 +36,7 @@ import org.apache.pivot.wtk.Keyboard;
import org.apache.pivot.wtk.ListView;
import org.apache.pivot.wtk.ListViewSelectionListener;
import org.apache.pivot.wtk.Mouse;
+import org.apache.pivot.wtk.Panorama;
import org.apache.pivot.wtk.Point;
import org.apache.pivot.wtk.Span;
import org.apache.pivot.wtk.SuggestionPopup;
@@ -54,7 +55,9 @@ import org.apache.pivot.wtk.skin.WindowS
*/
public class TerraSuggestionPopupSkin extends WindowSkin
implements SuggestionPopupListener, SuggestionPopupStateListener {
- private Border suggestionListViewBorder = new Border();
+ private Panorama suggestionListViewPanorama;
+ private Border suggestionListViewBorder;
+
private ListView suggestionListView = new ListView();
private DropShadowDecorator dropShadowDecorator = null;
@@ -137,7 +140,9 @@ public class TerraSuggestionPopupSkin ex
public TerraSuggestionPopupSkin () {
suggestionListView.getStyles().put("variableItemHeight", true);
suggestionListView.getListViewSelectionListeners().add(listViewSelectionListener);
- suggestionListViewBorder.setContent(suggestionListView);
+
+ suggestionListViewPanorama = new Panorama(suggestionListView);
+ suggestionListViewBorder = new Border(suggestionListViewPanorama);
}
@Override
@@ -261,15 +266,16 @@ public class TerraSuggestionPopupSkin ex
dropShadowDecorator.setShadowOpacity(DropShadowDecorator.DEFAULT_SHADOW_OPACITY);
- SuggestionPopup suggestionPopup = (SuggestionPopup)getComponent();
+ SuggestionPopup suggestionPopup = (SuggestionPopup)window;
TextInput textInput = suggestionPopup.getTextInput();
textInput.getComponentStateListeners().add(textInputStateListener);
textInput.getComponentKeyListeners().add(textInputKeyListener);
- // Reposition under text input
+ // Size and position the popup
Point location = textInput.mapPointToAncestor(textInput.getDisplay(), 0, 0);
- suggestionPopup.setLocation(location.x, location.y + textInput.getHeight() - 1);
- suggestionPopup.setMinimumPreferredWidth(textInput.getWidth());
+ window.setLocation(location.x, location.y + textInput.getHeight() - 1);
+ window.setMinimumPreferredWidth(textInput.getWidth());
+ window.setMaximumPreferredHeight(display.getHeight() - window.getY());
}
@Override