Revision: 2316
http://sourceforge.net/p/swingme/code/2316
Author: yuranet
Date: 2014-07-05 20:11:46 +0000 (Sat, 05 Jul 2014)
Log Message:
-----------
list HORIZONTAL todo done and do not call workoutPreferredSize when component is not visible. (also lib update)
Modified Paths:
--------------
SwingME/lib/UtilME.jar
SwingME/src/net/yura/mobile/gui/components/List.java
SwingME/src/net/yura/mobile/gui/components/Panel.java
Modified: SwingME/lib/UtilME.jar
===================================================================
(Binary files differ)
Modified: SwingME/src/net/yura/mobile/gui/components/List.java
===================================================================
--- SwingME/src/net/yura/mobile/gui/components/List.java 2014-07-04 14:19:19 UTC (rev 2315)
+++ SwingME/src/net/yura/mobile/gui/components/List.java 2014-07-05 20:11:46 UTC (rev 2316)
@@ -892,25 +892,22 @@
// what if we are scrolled right already?
//scrollTo(c);
- // THIS WILL NOT WORK if list in inside a panel inside a scrollpane
- // as posX and posY will be wrong!
- // ALSO WILLNOT WORK IN BOXLAYOUT HCENTRE IF NOT THE FIRST COMPONENT
- if (layoutOrientation==HORIZONTAL) {
- scrollRectToVisible( pos, -posY, size, 1,false);
- }
+ //calc offset in relation to the viewport
+ int offset = layoutOrientation == HORIZONTAL ? posY : posX;
+ Component p = parent;
+ while (p != null) {
+ if (p instanceof ScrollPane) {
+ break;
+ }
+ offset += layoutOrientation == HORIZONTAL ? p.posY : p.posX;
+ p = p.parent;
+ } // TODO take into accountthe viewPortX and viewPortY
+
+ if (layoutOrientation == HORIZONTAL) {
+ scrollRectToVisible( pos, -offset, size, 1, false);
+ }
else {
- //calc x in relation to the viewport
- int x = posX;
- Component p = parent;
- while (p!=null) {
- if (p instanceof ScrollPane) {
- break;
- }
- x+=p.posX;
- p = p.parent;
- } // TODO take into accountthe viewPortX
-
- scrollRectToVisible( -x, pos, 1, size,false);
+ scrollRectToVisible( -offset, pos, 1, size, false);
}
ensureIndexIsVisible = i;
}
Modified: SwingME/src/net/yura/mobile/gui/components/Panel.java
===================================================================
--- SwingME/src/net/yura/mobile/gui/components/Panel.java 2014-07-04 14:19:19 UTC (rev 2315)
+++ SwingME/src/net/yura/mobile/gui/components/Panel.java 2014-07-05 20:11:46 UTC (rev 2316)
@@ -199,10 +199,10 @@
protected void workoutMinimumSize() {
for(int i = 0; i < components.size(); i++) {
-
- Component component = (Component)components.elementAt(i);
- component.workoutPreferredSize();
-
+ Component component = (Component)components.elementAt(i);
+ if (component.isVisible()) {
+ component.workoutPreferredSize();
+ }
}
if (layout!=null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|