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/11/02 20:43:06 UTC
svn commit: r832078 - in /incubator/pivot/trunk: demos/www/
wtk/src/org/apache/pivot/wtk/skin/terra/
Author: gbrown
Date: Mon Nov 2 19:43:06 2009
New Revision: 832078
URL: http://svn.apache.org/viewvc?rev=832078&view=rev
Log:
Use a translation decorator to align sheet content to bottom during open/close transitions.
Modified:
incubator/pivot/trunk/demos/www/component_explorer.html
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_file_browser_sheet_skin.wtkx
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_prompt_skin.wtkx
Modified: incubator/pivot/trunk/demos/www/component_explorer.html
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/www/component_explorer.html?rev=832078&r1=832077&r2=832078&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/www/component_explorer.html (original)
+++ incubator/pivot/trunk/demos/www/component_explorer.html Mon Nov 2 19:43:06 2009
@@ -21,8 +21,8 @@
<link rel="stylesheet" href="demo.css">
<style type="text/css">
* {
- padding: 0;
- margin: 0;
+ padding: 0;
+ margin: 0;
}
html, body {
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java?rev=832078&r1=832077&r2=832078&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java Mon Nov 2 19:43:06 2009
@@ -75,8 +75,6 @@
public void install(Component component) {
super.install(component);
- setPadding(0);
-
final FileBrowserSheet fileBrowserSheet = (FileBrowserSheet)component;
final FileBrowserSheet.Mode mode = fileBrowserSheet.getMode();
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java?rev=832078&r1=832077&r2=832078&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java Mon Nov 2 19:43:06 2009
@@ -66,11 +66,6 @@
}
}
- public TerraPromptSkin() {
- setResizable(false);
- setPadding(0);
- }
-
@Override
public void install(Component component) {
super.install(component);
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java?rev=832078&r1=832077&r2=832078&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java Mon Nov 2 19:43:06 2009
@@ -45,6 +45,7 @@
import org.apache.pivot.wtk.effects.DropShadowDecorator;
import org.apache.pivot.wtk.effects.Transition;
import org.apache.pivot.wtk.effects.TransitionListener;
+import org.apache.pivot.wtk.effects.TranslationDecorator;
import org.apache.pivot.wtk.effects.easing.Quadratic;
import org.apache.pivot.wtk.media.Image;
import org.apache.pivot.wtk.skin.WindowSkin;
@@ -59,6 +60,28 @@
}
@Override
+ public void start(TransitionListener transitionListener) {
+ Sheet sheet = (Sheet)getComponent();
+ Component content = sheet.getContent();
+ if (content != null) {
+ content.getDecorators().add(translationDecorator);
+ }
+
+ super.start(transitionListener);
+ }
+
+ @Override
+ public void stop() {
+ Sheet sheet = (Sheet)getComponent();
+ Component content = sheet.getContent();
+ if (content != null) {
+ content.getDecorators().remove(translationDecorator);
+ }
+
+ super.stop();
+ }
+
+ @Override
public void update() {
invalidateComponent();
}
@@ -103,12 +126,13 @@
private Insets padding;
private boolean resizable;
- // Derived colors
private Color bevelColor;
private OpenTransition openTransition = null;
private Quadratic easing = new Quadratic();
+ private TranslationDecorator translationDecorator = new TranslationDecorator(true);
+
private ComponentListener ownerListener = new ComponentListener.Adapter() {
@Override
public void locationChanged(Component component, int previousX, int previousY) {
@@ -274,29 +298,6 @@
return preferredSize;
}
- @Override
- public int getBaseline(int width) {
- int baseline = -1;
-
- Sheet sheet = (Sheet)getComponent();
- Component content = sheet.getContent();
-
- if (content != null
- && content.isVisible()) {
- if (width != -1) {
- width = Math.max(width - (padding.left + padding.right + 2), 0);
- }
-
- baseline = content.getPreferredHeight(width);
- }
-
- if (baseline != -1) {
- baseline += padding.top + 1;
- }
-
- return baseline;
- }
-
public int getEasedPreferredHeight(int preferredHeight) {
if (openTransition != null
&& openTransition.isRunning()) {
@@ -333,10 +334,17 @@
if (content != null) {
content.setLocation(padding.left + 1, padding.top + 1);
- int contentWidth = Math.max(width - (padding.left + padding.right + 2), 0);
- int contentHeight = Math.max(height - (padding.top + padding.bottom + 2), 0);
-
- content.setSize(contentWidth, contentHeight);
+ if (openTransition != null
+ && openTransition.isRunning()) {
+ content.setSize(Math.max(width - (padding.left + padding.right + 2), 0),
+ content.getPreferredHeight());
+ translationDecorator.setY(height - (padding.bottom + padding.top + 2
+ + content.getHeight()));
+ } else {
+ int contentWidth = Math.max(width - (padding.left + padding.right + 2), 0);
+ int contentHeight = Math.max(height - (padding.top + padding.bottom + 2), 0);
+ content.setSize(contentWidth, contentHeight);
+ }
}
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_file_browser_sheet_skin.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_file_browser_sheet_skin.wtkx?rev=832078&r1=832077&r2=832078&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_file_browser_sheet_skin.wtkx (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_file_browser_sheet_skin.wtkx Mon Nov 2 19:43:06 2009
@@ -16,39 +16,37 @@
limitations under the License.
-->
-<BoxPane styles="{verticalAlignment:'bottom', padding:8}"
+<Border styles="{padding:10}"
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns="org.apache.pivot.wtk">
- <Border styles="{padding:10}">
- <content>
- <TablePane wtkx:id="tablePane" styles="{verticalSpacing:8}">
- <columns>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="-1">
- <BoxPane wtkx:id="saveAsBoxPane" orientation="vertical" styles="{fill:true}">
- <BoxPane styles="{verticalAlignment:'center'}">
- <Label text="%saveAs"/>
- <TextInput wtkx:id="saveAsTextInput" textSize="32"/>
- </BoxPane>
- <Separator styles="{padding:2}"/>
+ <content>
+ <TablePane wtkx:id="tablePane" styles="{verticalSpacing:8}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="-1">
+ <BoxPane wtkx:id="saveAsBoxPane" orientation="vertical" styles="{fill:true}">
+ <BoxPane styles="{verticalAlignment:'center'}">
+ <Label text="%saveAs"/>
+ <TextInput wtkx:id="saveAsTextInput" textSize="32"/>
</BoxPane>
- </TablePane.Row>
- <TablePane.Row height="1*">
- <FileBrowser wtkx:id="fileBrowser"
- preferredWidth="480" preferredHeight="240"/>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <BoxPane styles="{horizontalAlignment:'right', verticalAlignment:'center'}">
- <PushButton wtkx:id="okButton" buttonData="%ok"
- styles="@command_button.json"/>
- <PushButton wtkx:id="cancelButton" buttonData="%cancel"
- styles="@command_button.json"/>
- </BoxPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Border>
-</BoxPane>
+ <Separator styles="{padding:2}"/>
+ </BoxPane>
+ </TablePane.Row>
+ <TablePane.Row height="1*">
+ <FileBrowser wtkx:id="fileBrowser"
+ preferredWidth="480" preferredHeight="240"/>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <BoxPane styles="{horizontalAlignment:'right', verticalAlignment:'center'}">
+ <PushButton wtkx:id="okButton" buttonData="%ok"
+ styles="@command_button.json"/>
+ <PushButton wtkx:id="cancelButton" buttonData="%cancel"
+ styles="@command_button.json"/>
+ </BoxPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+</Border>
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_prompt_skin.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_prompt_skin.wtkx?rev=832078&r1=832077&r2=832078&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_prompt_skin.wtkx (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_prompt_skin.wtkx Mon Nov 2 19:43:06 2009
@@ -16,33 +16,41 @@
limitations under the License.
-->
-<BoxPane orientation="vertical" styles="{padding:8, spacing:8, fill:true,
- verticalAlignment:'bottom'}"
+<TablePane styles="{verticalSpacing:8}"
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns:collections="org.apache.pivot.collections"
xmlns="org.apache.pivot.wtk">
- <Border styles="{padding:12, backgroundColor:4, color:7}">
- <content>
- <TablePane preferredWidth="280"
- styles="{horizontalSpacing:12, verticalSpacing:12}">
- <columns>
- <TablePane.Column width="-1"/>
- <TablePane.Column width="1*"/>
- </columns>
- <rows>
- <TablePane.Row height="-1">
- <BoxPane styles="{verticalAlignment:'top'}">
- <ImageView wtkx:id="typeImageView"/>
- </BoxPane>
- <BoxPane wtkx:id="messageBoxPane" orientation="vertical"
- styles="{spacing:10, fill:true}">
- <Label wtkx:id="messageLabel" styles="{font:{bold:true}, wrapText:true}"/>
- </BoxPane>
- </TablePane.Row>
- </rows>
- </TablePane>
- </content>
- </Border>
- <BoxPane wtkx:id="buttonBoxPane"
- styles="{horizontalAlignment:'right', fill:true}"/>
-</BoxPane>
+ <columns>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="1*">
+ <Border styles="{padding:12, backgroundColor:4, color:7}">
+ <content>
+ <TablePane preferredWidth="280"
+ styles="{horizontalSpacing:12, verticalSpacing:12}">
+ <columns>
+ <TablePane.Column width="-1"/>
+ <TablePane.Column width="1*"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="-1">
+ <BoxPane styles="{verticalAlignment:'top'}">
+ <ImageView wtkx:id="typeImageView"/>
+ </BoxPane>
+ <BoxPane wtkx:id="messageBoxPane" orientation="vertical"
+ styles="{spacing:10, fill:true}">
+ <Label wtkx:id="messageLabel" styles="{font:{bold:true}, wrapText:true}"/>
+ </BoxPane>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+ </Border>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <BoxPane wtkx:id="buttonBoxPane"
+ styles="{horizontalAlignment:'right', fill:true}"/>
+ </TablePane.Row>
+ </rows>
+</TablePane>