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 19:39:17 UTC
svn commit: r832024 - in /incubator/pivot/trunk: core/test/
demos/src/org/apache/pivot/demos/clock/
demos/src/org/apache/pivot/demos/decorator/ demos/www/
tutorials/src/org/apache/pivot/tutorials/
tutorials/src/org/apache/pivot/tutorials/menus/ tutoria...
Author: gbrown
Date: Mon Nov 2 18:39:16 2009
New Revision: 832024
URL: http://svn.apache.org/viewvc?rev=832024&view=rev
Log:
Revert change 832001.
Modified:
incubator/pivot/trunk/core/test/ (props changed)
incubator/pivot/trunk/demos/src/org/apache/pivot/demos/clock/ClockDemo.java (props changed)
incubator/pivot/trunk/demos/src/org/apache/pivot/demos/clock/clock.wtkd (props changed)
incubator/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/translucent.wtkx
incubator/pivot/trunk/demos/www/component_explorer.html
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menu_section.wtkx (props changed)
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/menu_bars.wtkx
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/frame.wtkx
incubator/pivot/trunk/wtk/src/META-INF/services/org.apache.pivot.wtk.Theme (props changed)
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.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_alert_skin.wtkx
incubator/pivot/trunk/wtk/test/ (props changed)
Propchange: incubator/pivot/trunk/core/test/
('svn:mergeinfo' removed)
Propchange: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/clock/ClockDemo.java
('svn:mergeinfo' removed)
Propchange: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/clock/clock.wtkd
('svn:mergeinfo' removed)
Modified: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/translucent.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/translucent.wtkx?rev=832024&r1=832023&r2=832024&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/pivot/trunk/demos/www/component_explorer.html
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/www/component_explorer.html?rev=832024&r1=832023&r2=832024&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/www/component_explorer.html (original)
+++ incubator/pivot/trunk/demos/www/component_explorer.html Mon Nov 2 18:39:16 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 {
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menu_section.wtkx
('svn:mergeinfo' removed)
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/menu_bars.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/menu_bars.wtkx?rev=832024&r1=832023&r2=832024&view=diff
==============================================================================
Binary files - no diff available.
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/frame.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/frame.wtkx?rev=832024&r1=832023&r2=832024&view=diff
==============================================================================
Binary files - no diff available.
Propchange: incubator/pivot/trunk/wtk/src/META-INF/services/org.apache.pivot.wtk.Theme
('svn:mergeinfo' removed)
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java?rev=832024&r1=832023&r2=832024&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java Mon Nov 2 18:39:16 2009
@@ -418,14 +418,6 @@
}
/**
- * Unsupported for containers. Only leaf components can have tooltips.
- */
- @Override
- public void setTooltipText(String tooltip) {
- throw new UnsupportedOperationException("A container cannot have a tooltip.");
- }
-
- /**
* Tests if this container is an ancestor of a given component. A container
* is considered to be its own ancestor.
*
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=832024&r1=832023&r2=832024&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 18:39:16 2009
@@ -75,6 +75,8 @@
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/TerraFrameSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java?rev=832024&r1=832023&r2=832024&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java Mon Nov 2 18:39:16 2009
@@ -24,6 +24,7 @@
import java.awt.RenderingHints;
import java.awt.geom.Line2D;
+import org.apache.pivot.collections.Dictionary;
import org.apache.pivot.wtk.Bounds;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonPressListener;
@@ -226,6 +227,7 @@
private Color inactiveTitleBarBackgroundColor;
private Color inactiveTitleBarBorderColor;
private Color contentBorderColor;
+ private Insets padding;
private boolean resizable;
// Derived colors
@@ -246,6 +248,7 @@
inactiveTitleBarBackgroundColor = theme.getColor(9);
inactiveTitleBarBorderColor = theme.getColor(7);
contentBorderColor = theme.getColor(7);
+ padding = new Insets(8);
resizable = true;
// Set the derived colors
@@ -367,7 +370,7 @@
if (height != -1) {
// Subtract padding, top/bottom content borders, and content bevel
// from height constraint
- height -= 3;
+ height -= (padding.top + padding.bottom) + 3;
height = Math.max(height, 0);
}
@@ -376,7 +379,7 @@
}
// Add padding and left/right content borders
- preferredWidth += 2;
+ preferredWidth += (padding.left + padding.right) + 2;
return preferredWidth;
}
@@ -399,14 +402,17 @@
Component content = frame.getContent();
if (content != null) {
if (width != -1) {
- width = Math.max(width - 2, 0);
+ // Subtract padding and left/right content borders from constraint
+ width -= (padding.left + padding.right) + 2;
+
+ width = Math.max(width, 0);
}
preferredHeight += content.getPreferredHeight(width);
}
- // Add top/bottom content borders and content bevel
- preferredHeight += 3;
+ // Add padding, top/bottom content borders, and content bevel
+ preferredHeight += (padding.top + padding.bottom) + 3;
return preferredHeight;
}
@@ -443,8 +449,8 @@
}
// Add padding, borders, and content bevel
- preferredWidth += 2;
- preferredHeight += 3;
+ preferredWidth += (padding.left + padding.right) + 2;
+ preferredHeight += (padding.top + padding.bottom) + 3;
return new Dimensions(preferredWidth, preferredHeight);
}
@@ -495,8 +501,13 @@
// Size/position content
Component content = frame.getContent();
if (content != null) {
- content.setLocation(clientX, clientY);
- content.setSize(clientWidth, Math.max(clientHeight - clientY + 1, 0));
+ int contentX = clientX + padding.left;
+ int contentY = clientY + padding.top;
+ int contentWidth = Math.max(clientWidth - (padding.left + padding.right), 0);
+ int contentHeight = Math.max(clientHeight - (clientY + padding.top + padding.bottom) + 1, 0);
+
+ content.setLocation(contentX, contentY);
+ content.setSize(contentWidth, contentHeight);
}
} else {
titleBarTablePane.setVisible(false);
@@ -515,8 +526,9 @@
Component content = frame.getContent();
if (content != null) {
- content.setLocation(0, clientY);
- content.setSize(width, Math.max(height - clientY, 0));
+ content.setLocation(padding.left, clientY + padding.top);
+ content.setSize(Math.max(width - (padding.left + padding.right), 0),
+ Math.max(height - (clientY + padding.top + padding.bottom), 0));
}
}
}
@@ -633,6 +645,47 @@
setShowCloseButton(showWindowControls);
}
+ public Insets getPadding() {
+ return padding;
+ }
+
+ public void setPadding(Insets padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ this.padding = padding;
+ invalidateComponent();
+ }
+
+ public final void setPadding(Dictionary<String, ?> padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ setPadding(new Insets(padding));
+ }
+
+ public final void setPadding(int padding) {
+ setPadding(new Insets(padding));
+ }
+
+ public final void setPadding(Number padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ setPadding(padding.intValue());
+ }
+
+ public final void setPadding(String padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ setPadding(Insets.decode(padding));
+ }
+
public boolean isResizable() {
return resizable;
}
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=832024&r1=832023&r2=832024&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 18:39:16 2009
@@ -66,6 +66,11 @@
}
}
+ 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=832024&r1=832023&r2=832024&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 18:39:16 2009
@@ -20,6 +20,7 @@
import java.awt.Graphics2D;
import java.awt.Toolkit;
+import org.apache.pivot.collections.Dictionary;
import org.apache.pivot.util.Vote;
import org.apache.pivot.wtk.Bounds;
import org.apache.pivot.wtk.Component;
@@ -31,6 +32,7 @@
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.GraphicsUtilities;
import org.apache.pivot.wtk.ImageView;
+import org.apache.pivot.wtk.Insets;
import org.apache.pivot.wtk.Keyboard;
import org.apache.pivot.wtk.Mouse;
import org.apache.pivot.wtk.Orientation;
@@ -97,8 +99,8 @@
private Image resizeImage = new ResizeImage();
private ImageView resizeHandle = new ImageView(resizeImage);
private Point resizeOffset = null;
-
private Color borderColor;
+ private Insets padding;
private boolean resizable;
// Derived colors
@@ -187,6 +189,7 @@
setBackgroundColor(backgroundColor);
borderColor = theme.getColor(7);
+ padding = new Insets(8);
resizable = false;
// Set the derived colors
@@ -216,13 +219,13 @@
if (content != null) {
if (height != -1) {
- height = Math.max(height - 2, 0);
+ height = Math.max(height - (padding.top + padding.bottom + 2), 0);
}
preferredWidth = content.getPreferredWidth(height);
}
- preferredWidth += 2;
+ preferredWidth += (padding.left + padding.right + 2);
return preferredWidth;
}
@@ -236,13 +239,13 @@
if (content != null) {
if (width != -1) {
- width = Math.max(width - 2, 0);
+ width = Math.max(width - (padding.left + padding.right + 2), 0);
}
preferredHeight = content.getPreferredHeight(width);
}
- preferredHeight += 2;
+ preferredHeight += (padding.top + padding.bottom + 2);
preferredHeight = getEasedPreferredHeight(preferredHeight);
return preferredHeight;
@@ -262,8 +265,8 @@
preferredHeight = preferredContentSize.height;
}
- preferredWidth += 2;
- preferredHeight += 2;
+ preferredWidth += (padding.left + padding.right + 2);
+ preferredHeight += (padding.top + padding.bottom + 2);
preferredHeight = getEasedPreferredHeight(preferredHeight);
Dimensions preferredSize = new Dimensions(preferredWidth, preferredHeight);
@@ -271,6 +274,29 @@
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()) {
@@ -305,10 +331,10 @@
Component content = sheet.getContent();
if (content != null) {
- content.setLocation(1, 1);
+ content.setLocation(padding.left + 1, padding.top + 1);
- int contentWidth = Math.max(width - 2, 0);
- int contentHeight = Math.max(height - 2, 0);
+ 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);
}
@@ -476,6 +502,47 @@
setBorderColor(GraphicsUtilities.decodeColor(borderColor));
}
+ public Insets getPadding() {
+ return padding;
+ }
+
+ public void setPadding(Insets padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ this.padding = padding;
+ invalidateComponent();
+ }
+
+ public final void setPadding(Dictionary<String, ?> padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ setPadding(new Insets(padding));
+ }
+
+ public final void setPadding(int padding) {
+ setPadding(new Insets(padding));
+ }
+
+ public final void setPadding(Number padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ setPadding(padding.intValue());
+ }
+
+ public final void setPadding(String padding) {
+ if (padding == null) {
+ throw new IllegalArgumentException("padding is null.");
+ }
+
+ setPadding(Insets.decode(padding));
+ }
+
public boolean isResizable() {
return resizable;
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx?rev=832024&r1=832023&r2=832024&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/terra_alert_skin.wtkx Mon Nov 2 18:39:16 2009
@@ -16,7 +16,7 @@
limitations under the License.
-->
-<BoxPane orientation="vertical" styles="{padding:8, spacing:8, fill:true}"
+<BoxPane orientation="vertical" styles="{spacing:8, fill:true}"
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns:collections="org.apache.pivot.collections"
xmlns="org.apache.pivot.wtk">
Propchange: incubator/pivot/trunk/wtk/test/
('svn:mergeinfo' removed)