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 2009/09/23 23:03:10 UTC
svn commit: r818260 - in /incubator/pivot/trunk:
tutorials/src/org/apache/pivot/tutorials/filebrowsing/FileBrowsers.java
wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
Author: gbrown
Date: Wed Sep 23 21:03:09 2009
New Revision: 818260
URL: http://svn.apache.org/viewvc?rev=818260&view=rev
Log:
Minor tweaks to file browser tutorial; ensure that tab buttons are visible when the tab is selected.
Modified:
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/filebrowsing/FileBrowsers.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/filebrowsing/FileBrowsers.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/filebrowsing/FileBrowsers.java?rev=818260&r1=818259&r2=818260&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/filebrowsing/FileBrowsers.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/filebrowsing/FileBrowsers.java Wed Sep 23 21:03:09 2009
@@ -16,6 +16,7 @@
*/
package org.apache.pivot.tutorials.filebrowsing;
+import java.awt.Color;
import java.io.File;
import org.apache.pivot.collections.Map;
@@ -28,9 +29,11 @@
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.FileBrowser;
import org.apache.pivot.wtk.FileBrowserListener;
-import org.apache.pivot.wtk.Panel;
+import org.apache.pivot.wtk.HorizontalAlignment;
+import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.TabPane;
+import org.apache.pivot.wtk.VerticalAlignment;
import org.apache.pivot.wtk.Window;
import org.apache.pivot.wtkx.WTKX;
import org.apache.pivot.wtkx.WTKXSerializer;
@@ -73,10 +76,16 @@
File selectedFile = fileBrowser.getSelectedFile();
String fileName = selectedFile.getName();
- Panel panel = new Panel();
- tabPane.getTabs().add(panel);
+ Label label = new Label();
+ label.setText("(content of " + fileName + ")");
+ label.getStyles().put("backgroundColor", Color.WHITE);
+ label.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
+ label.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
- TabPane.setLabel(panel, fileName);
+ tabPane.getTabs().add(label);
+ TabPane.setLabel(label, fileName);
+
+ tabPane.setSelectedIndex(tabPane.getTabs().getLength() - 1);
cardPane.setSelectedIndex(0);
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java?rev=818260&r1=818259&r2=818260&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java Wed Sep 23 21:03:09 2009
@@ -24,6 +24,7 @@
import org.apache.pivot.collections.Dictionary;
import org.apache.pivot.collections.Sequence;
import org.apache.pivot.util.Vote;
+import org.apache.pivot.wtk.ApplicationContext;
import org.apache.pivot.wtk.Bounds;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.Component;
@@ -1307,12 +1308,19 @@
button.setSelected(false);
}
} else {
- Button button = (Button)buttonBoxPane.get(selectedIndex);
+ final Button button = (Button)buttonBoxPane.get(selectedIndex);
button.setSelected(true);
Component selectedTab = tabPane.getTabs().get(selectedIndex);
selectedTab.setVisible(true);
selectedTab.requestFocus();
+
+ ApplicationContext.queueCallback(new Runnable(){
+ @Override
+ public void run() {
+ button.scrollAreaToVisible(0, 0, button.getWidth(), button.getHeight());
+ }
+ });
}
if (previousSelectedIndex != -1) {