You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2011/12/24 17:07:40 UTC
svn commit: r1222994 [7/11] - in /pivot/trunk:
core/test/org/apache/pivot/beans/test/
demos/src/org/apache/pivot/demos/memorygame/
demos/src/org/apache/pivot/demos/memorygame/img/
demos/src/org/apache/pivot/demos/roweditor/ demos/www/ etc/ examples/src...
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java Sat Dec 24 16:07:37 2011
@@ -1,435 +1,435 @@
-package org.apache.pivot.tutorials.bxmlexplorer;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.GradientPaint;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Line2D;
-
-import org.apache.pivot.collections.Sequence;
-import org.apache.pivot.wtk.Bounds;
-import org.apache.pivot.wtk.BoxPane;
-import org.apache.pivot.wtk.Component;
-import org.apache.pivot.wtk.Dimensions;
-import org.apache.pivot.wtk.GraphicsUtilities;
-import org.apache.pivot.wtk.HorizontalAlignment;
-import org.apache.pivot.wtk.ImageView;
-import org.apache.pivot.wtk.Insets;
-import org.apache.pivot.wtk.Label;
-import org.apache.pivot.wtk.Orientation;
-import org.apache.pivot.wtk.TablePane;
-import org.apache.pivot.wtk.Theme;
-import org.apache.pivot.wtk.VerticalAlignment;
-import org.apache.pivot.wtk.effects.DropShadowDecorator;
-import org.apache.pivot.wtk.media.Image;
-import org.apache.pivot.wtk.skin.ContainerSkin;
-import org.apache.pivot.wtk.skin.terra.TerraFrameSkin.FrameButton;
-import org.apache.pivot.wtk.skin.terra.TerraTheme;
-
-public class FakeWindowSkin extends ContainerSkin implements FakeWindowListener {
-
- /**
- * Abstract base class for frame button images.
- */
- protected abstract class ButtonImage extends Image {
- @Override
- public int getWidth() {
- return 8;
- }
-
- @Override
- public int getHeight() {
- return 8;
- }
- }
-
- /**
- * Minimize button image.
- */
- protected class MinimizeImage extends ButtonImage {
- @Override
- public void paint(Graphics2D graphics) {
- graphics.setPaint(titleBarColor);
- graphics.fillRect(0, 6, 8, 2);
- }
- }
-
- /**
- * Maximize button image.
- */
- protected class MaximizeImage extends ButtonImage {
- @Override
- public void paint(Graphics2D graphics) {
- graphics.setPaint(titleBarColor);
- graphics.fillRect(0, 0, 8, 8);
-
- graphics.setPaint(titleBarBackgroundColor);
- graphics.fillRect(2, 2, 4, 4);
- }
- }
-
- /**
- * Restore button image.
- */
- protected class RestoreImage extends ButtonImage {
- @Override
- public void paint(Graphics2D graphics) {
- graphics.setPaint(titleBarColor);
- graphics.fillRect(1, 1, 6, 6);
-
- graphics.setPaint(titleBarBackgroundColor);
- graphics.fillRect(3, 3, 2, 2);
- }
- }
-
- /**
- * Close button image.
- */
- protected class CloseImage extends ButtonImage {
- @Override
- public void paint(Graphics2D graphics) {
- graphics.setPaint(titleBarColor);
- graphics.setStroke(new BasicStroke(2));
-
- graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
-
- graphics.draw(new Line2D.Double(0.5, 0.5, 7.5, 7.5));
- graphics.draw(new Line2D.Double(0.5, 7.5, 7.5, 0.5));
- }
- }
-
- /**
- * Resize button image.
- */
- protected class ResizeImage extends Image {
- public static final int ALPHA = 64;
-
- @Override
- public int getWidth() {
- return 5;
- }
-
- @Override
- public int getHeight() {
- return 5;
- }
-
- @Override
- public void paint(Graphics2D graphics) {
- graphics.setPaint(new Color(0, 0, 0, ALPHA));
- graphics.fillRect(3, 0, 2, 1);
- graphics.fillRect(0, 3, 2, 1);
- graphics.fillRect(3, 3, 2, 1);
-
- graphics.setPaint(new Color(contentBorderColor.getRed(), contentBorderColor.getGreen(),
- contentBorderColor.getBlue(), ALPHA));
- graphics.fillRect(3, 1, 2, 1);
- graphics.fillRect(0, 4, 2, 1);
- graphics.fillRect(3, 4, 2, 1);
- }
- }
-
- private Image minimizeImage = new MinimizeImage();
- private Image maximizeImage = new MaximizeImage();
- private Image closeImage = new CloseImage();
-
- private TablePane titleBarTablePane = new TablePane();
- private BoxPane titleBoxPane = new BoxPane();
- private BoxPane buttonBoxPane = new BoxPane();
-
- private ImageView iconImageView = new ImageView();
- private Label titleLabel = new Label();
-
- private FrameButton minimizeButton = null;
- private FrameButton maximizeButton = null;
- private FrameButton closeButton = null;
-
- private DropShadowDecorator dropShadowDecorator = null;
-
- private Color titleBarColor;
- private Color titleBarBackgroundColor;
- private Color titleBarBorderColor;
- private Color contentBorderColor;
- private Insets padding;
-
- // Derived colors
- private Color titleBarBevelColor;
- // private Color contentBevelColor; // TODO: future use
-
- public FakeWindowSkin() {
- TerraTheme theme = (TerraTheme) Theme.getTheme();
- setBackgroundColor(theme.getColor(10));
-
- titleBarColor = theme.getColor(4);
- titleBarBackgroundColor = theme.getColor(14);
- titleBarBorderColor = theme.getColor(12);
- contentBorderColor = theme.getColor(7);
- padding = new Insets(8);
-
- // Set the derived colors
- titleBarBevelColor = TerraTheme.brighten(titleBarBackgroundColor);
-
- // The title bar table pane contains two nested box panes: one for
- // the title contents and the other for the buttons
- titleBarTablePane.getColumns().add(new TablePane.Column(1, true));
- titleBarTablePane.getColumns().add(new TablePane.Column(-1));
-
- TablePane.Row titleRow = new TablePane.Row(-1);
- titleBarTablePane.getRows().add(titleRow);
-
- titleRow.add(titleBoxPane);
- titleRow.add(buttonBoxPane);
-
- titleBarTablePane.getStyles().put("padding", new Insets(2));
-
- // Initialize the title box pane
- titleBoxPane.add(iconImageView);
- titleBoxPane.add(titleLabel);
- titleBoxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
- titleBoxPane.getStyles().put("padding", new Insets(0, 0, 0, 2));
-
- Font titleFont = theme.getFont().deriveFont(Font.BOLD);
- titleLabel.getStyles().put("font", titleFont);
-
- iconImageView.setPreferredSize(16, 16);
- iconImageView.getStyles().put("fill", true);
- iconImageView.getStyles().put("backgroundColor", null);
-
- // Initialize the button box pane
- buttonBoxPane.getStyles().put("horizontalAlignment", HorizontalAlignment.RIGHT);
- buttonBoxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
- }
-
- @Override
- public void install(Component component) {
- super.install(component);
-
- FakeWindow window = (FakeWindow) component;
- window.getWindowListeners().add(this);
-
- FakeWindow frame = (FakeWindow) getComponent();
-
- // Attach the drop-shadow decorator
- dropShadowDecorator = new DropShadowDecorator();
- frame.getDecorators().add(dropShadowDecorator);
-
- frame.add(titleBarTablePane);
-
- // Create the frame buttons
- minimizeButton = new FrameButton(minimizeImage);
- maximizeButton = new FrameButton(maximizeImage);
- closeButton = new FrameButton(closeImage);
-
- buttonBoxPane.add(minimizeButton);
- buttonBoxPane.add(maximizeButton);
- buttonBoxPane.add(closeButton);
-
- iconAdded(frame, null);
- titleChanged(frame, null);
- }
-
- @Override
- public int getPreferredWidth(int height) {
- int preferredWidth = 0;
-
- FakeWindow frame = (FakeWindow) getComponent();
-
- // Include title bar width plus left/right title bar borders
- Dimensions titleBarSize = titleBarTablePane.getPreferredSize();
- preferredWidth = Math.max(titleBarSize.width + 2, preferredWidth);
-
- if (height != -1) {
- // Subtract title bar height and top/bottom title bar borders
- // from height constraint
- height -= titleBarSize.height + 2;
- }
-
- Component content = frame.getContent();
- if (content != null) {
- if (height != -1) {
- // Subtract padding, top/bottom content borders, and content
- // bevel
- // from height constraint
- height -= (padding.top + padding.bottom) + (1) + 2;
-
- height = Math.max(height, 0);
- }
-
- preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(height));
- }
-
- // Add padding and left/right content borders
- preferredWidth += (padding.left + padding.right) + 2;
-
- return preferredWidth;
- }
-
- @Override
- public int getPreferredHeight(int width) {
- int preferredHeight = 0;
-
- FakeWindow frame = (FakeWindow) getComponent();
-
- // Include title bar height plus top/bottom title bar borders
- preferredHeight += titleBarTablePane.getPreferredHeight() + 2;
-
- Component content = frame.getContent();
- if (content != null) {
- if (width != -1) {
- // 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 padding, top/bottom content borders, and content bevel
- preferredHeight += (padding.top + padding.bottom) + (1) + 2;
-
- return preferredHeight;
- }
-
- @Override
- public Dimensions getPreferredSize() {
- int preferredWidth = 0;
- int preferredHeight = 0;
-
- FakeWindow frame = (FakeWindow) getComponent();
-
- // Include title bar width plus left/right title bar borders
- Dimensions titleBarSize = titleBarTablePane.getPreferredSize();
- preferredWidth = Math.max(preferredWidth, titleBarSize.width + 2);
-
- // Include title bar height plus top/bottom title bar borders
- preferredHeight += titleBarSize.height + 2;
-
- Component content = frame.getContent();
- if (content != null) {
- Dimensions preferredContentSize = content.getPreferredSize();
-
- preferredWidth = Math.max(preferredWidth, preferredContentSize.width);
- preferredHeight += preferredContentSize.height;
- }
-
- // Add padding, borders, and content bevel
- preferredWidth += (padding.left + padding.right) + 2;
- preferredHeight += (padding.top + padding.bottom) + (1) + 2;
-
- return new Dimensions(preferredWidth, preferredHeight);
- }
-
- @Override
- public void layout() {
- FakeWindow frame = (FakeWindow) getComponent();
-
- int width = getWidth();
- int height = getHeight();
-
- int clientX = 1;
- int clientY = 1;
- int clientWidth = Math.max(width - 2, 0);
- int clientHeight = Math.max(height - 2, 0);
-
- // Size/position title bar
- titleBarTablePane.setLocation(clientX, clientY);
- titleBarTablePane.setSize(clientWidth, titleBarTablePane.getPreferredHeight());
- titleBarTablePane.setVisible(true);
-
- // Add bottom title bar border, top content border, and content bevel
- clientY += titleBarTablePane.getHeight() + (1) + 2;
-
- // Size/position content
- Component content = frame.getContent();
- if (content != null) {
- 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);
- }
- }
-
- @Override
- public void paint(Graphics2D graphics) {
- // Call the base class to paint the background
- super.paint(graphics);
-
- int width = getWidth();
- int height = getHeight();
-
- int titleBarHeight = titleBarTablePane.getHeight();
-
- // Draw the title area
- Color titleBarBackgroundColor = this.titleBarBackgroundColor;
- Color titleBarBorderColor = this.titleBarBorderColor;
- Color titleBarBevelColor = this.titleBarBevelColor;
-
- graphics.setPaint(new GradientPaint(width / 2f, 0, titleBarBevelColor, width / 2f,
- titleBarHeight + 1, titleBarBackgroundColor));
- graphics.fillRect(0, 0, width, titleBarHeight + 1);
-
- // Draw the border
- graphics.setPaint(titleBarBorderColor);
- GraphicsUtilities.drawRect(graphics, 0, 0, width, titleBarHeight + 2);
-
- // Draw the content area
- Bounds contentAreaRectangle = new Bounds(0, titleBarHeight + 2, width, height
- - (titleBarHeight + 2));
- graphics.setPaint(contentBorderColor);
- GraphicsUtilities.drawRect(graphics, contentAreaRectangle.x, contentAreaRectangle.y,
- contentAreaRectangle.width, contentAreaRectangle.height);
-
- // graphics.setPaint(contentBevelColor);
- GraphicsUtilities.drawLine(graphics, contentAreaRectangle.x + 1,
- contentAreaRectangle.y + 1, contentAreaRectangle.width - 2, Orientation.HORIZONTAL);
- }
-
- @Override
- public void titleChanged(FakeWindow window, String previousTitle) {
- String title = window.getTitle();
- titleLabel.setVisible(title != null);
- titleLabel.setText(title);
- }
-
- @Override
- public void iconInserted(FakeWindow window, Image addedIcon, int index) {
- // No-op
- }
-
- @Override
- public void iconAdded(FakeWindow window, Image addedIcon) {
- if (window.getIcons().getLength() > 0) {
- iconImageView.setVisible(true);
- iconImageView.setImage(window.getIcons().get(0));
- } else {
- iconImageView.setVisible(false);
- iconImageView.setImage((Image) null);
- }
- }
-
- @Override
- public void iconsRemoved(FakeWindow window, int index, Sequence<Image> removed) {
- if (window.getIcons().getLength() > 0) {
- iconImageView.setVisible(true);
- iconImageView.setImage(window.getIcons().get(0));
- } else {
- iconImageView.setVisible(false);
- iconImageView.setImage((Image) null);
- }
- }
-
- @Override
- public void contentChanged(FakeWindow window, Component previousContent) {
- invalidateComponent();
- }
-
-}
+package org.apache.pivot.tutorials.bxmlexplorer;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Line2D;
+
+import org.apache.pivot.collections.Sequence;
+import org.apache.pivot.wtk.Bounds;
+import org.apache.pivot.wtk.BoxPane;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.Dimensions;
+import org.apache.pivot.wtk.GraphicsUtilities;
+import org.apache.pivot.wtk.HorizontalAlignment;
+import org.apache.pivot.wtk.ImageView;
+import org.apache.pivot.wtk.Insets;
+import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.Orientation;
+import org.apache.pivot.wtk.TablePane;
+import org.apache.pivot.wtk.Theme;
+import org.apache.pivot.wtk.VerticalAlignment;
+import org.apache.pivot.wtk.effects.DropShadowDecorator;
+import org.apache.pivot.wtk.media.Image;
+import org.apache.pivot.wtk.skin.ContainerSkin;
+import org.apache.pivot.wtk.skin.terra.TerraFrameSkin.FrameButton;
+import org.apache.pivot.wtk.skin.terra.TerraTheme;
+
+public class FakeWindowSkin extends ContainerSkin implements FakeWindowListener {
+
+ /**
+ * Abstract base class for frame button images.
+ */
+ protected abstract class ButtonImage extends Image {
+ @Override
+ public int getWidth() {
+ return 8;
+ }
+
+ @Override
+ public int getHeight() {
+ return 8;
+ }
+ }
+
+ /**
+ * Minimize button image.
+ */
+ protected class MinimizeImage extends ButtonImage {
+ @Override
+ public void paint(Graphics2D graphics) {
+ graphics.setPaint(titleBarColor);
+ graphics.fillRect(0, 6, 8, 2);
+ }
+ }
+
+ /**
+ * Maximize button image.
+ */
+ protected class MaximizeImage extends ButtonImage {
+ @Override
+ public void paint(Graphics2D graphics) {
+ graphics.setPaint(titleBarColor);
+ graphics.fillRect(0, 0, 8, 8);
+
+ graphics.setPaint(titleBarBackgroundColor);
+ graphics.fillRect(2, 2, 4, 4);
+ }
+ }
+
+ /**
+ * Restore button image.
+ */
+ protected class RestoreImage extends ButtonImage {
+ @Override
+ public void paint(Graphics2D graphics) {
+ graphics.setPaint(titleBarColor);
+ graphics.fillRect(1, 1, 6, 6);
+
+ graphics.setPaint(titleBarBackgroundColor);
+ graphics.fillRect(3, 3, 2, 2);
+ }
+ }
+
+ /**
+ * Close button image.
+ */
+ protected class CloseImage extends ButtonImage {
+ @Override
+ public void paint(Graphics2D graphics) {
+ graphics.setPaint(titleBarColor);
+ graphics.setStroke(new BasicStroke(2));
+
+ graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ graphics.draw(new Line2D.Double(0.5, 0.5, 7.5, 7.5));
+ graphics.draw(new Line2D.Double(0.5, 7.5, 7.5, 0.5));
+ }
+ }
+
+ /**
+ * Resize button image.
+ */
+ protected class ResizeImage extends Image {
+ public static final int ALPHA = 64;
+
+ @Override
+ public int getWidth() {
+ return 5;
+ }
+
+ @Override
+ public int getHeight() {
+ return 5;
+ }
+
+ @Override
+ public void paint(Graphics2D graphics) {
+ graphics.setPaint(new Color(0, 0, 0, ALPHA));
+ graphics.fillRect(3, 0, 2, 1);
+ graphics.fillRect(0, 3, 2, 1);
+ graphics.fillRect(3, 3, 2, 1);
+
+ graphics.setPaint(new Color(contentBorderColor.getRed(), contentBorderColor.getGreen(),
+ contentBorderColor.getBlue(), ALPHA));
+ graphics.fillRect(3, 1, 2, 1);
+ graphics.fillRect(0, 4, 2, 1);
+ graphics.fillRect(3, 4, 2, 1);
+ }
+ }
+
+ private Image minimizeImage = new MinimizeImage();
+ private Image maximizeImage = new MaximizeImage();
+ private Image closeImage = new CloseImage();
+
+ private TablePane titleBarTablePane = new TablePane();
+ private BoxPane titleBoxPane = new BoxPane();
+ private BoxPane buttonBoxPane = new BoxPane();
+
+ private ImageView iconImageView = new ImageView();
+ private Label titleLabel = new Label();
+
+ private FrameButton minimizeButton = null;
+ private FrameButton maximizeButton = null;
+ private FrameButton closeButton = null;
+
+ private DropShadowDecorator dropShadowDecorator = null;
+
+ private Color titleBarColor;
+ private Color titleBarBackgroundColor;
+ private Color titleBarBorderColor;
+ private Color contentBorderColor;
+ private Insets padding;
+
+ // Derived colors
+ private Color titleBarBevelColor;
+ // private Color contentBevelColor; // TODO: future use
+
+ public FakeWindowSkin() {
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
+ setBackgroundColor(theme.getColor(10));
+
+ titleBarColor = theme.getColor(4);
+ titleBarBackgroundColor = theme.getColor(14);
+ titleBarBorderColor = theme.getColor(12);
+ contentBorderColor = theme.getColor(7);
+ padding = new Insets(8);
+
+ // Set the derived colors
+ titleBarBevelColor = TerraTheme.brighten(titleBarBackgroundColor);
+
+ // The title bar table pane contains two nested box panes: one for
+ // the title contents and the other for the buttons
+ titleBarTablePane.getColumns().add(new TablePane.Column(1, true));
+ titleBarTablePane.getColumns().add(new TablePane.Column(-1));
+
+ TablePane.Row titleRow = new TablePane.Row(-1);
+ titleBarTablePane.getRows().add(titleRow);
+
+ titleRow.add(titleBoxPane);
+ titleRow.add(buttonBoxPane);
+
+ titleBarTablePane.getStyles().put("padding", new Insets(2));
+
+ // Initialize the title box pane
+ titleBoxPane.add(iconImageView);
+ titleBoxPane.add(titleLabel);
+ titleBoxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
+ titleBoxPane.getStyles().put("padding", new Insets(0, 0, 0, 2));
+
+ Font titleFont = theme.getFont().deriveFont(Font.BOLD);
+ titleLabel.getStyles().put("font", titleFont);
+
+ iconImageView.setPreferredSize(16, 16);
+ iconImageView.getStyles().put("fill", true);
+ iconImageView.getStyles().put("backgroundColor", null);
+
+ // Initialize the button box pane
+ buttonBoxPane.getStyles().put("horizontalAlignment", HorizontalAlignment.RIGHT);
+ buttonBoxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
+ }
+
+ @Override
+ public void install(Component component) {
+ super.install(component);
+
+ FakeWindow window = (FakeWindow) component;
+ window.getWindowListeners().add(this);
+
+ FakeWindow frame = (FakeWindow) getComponent();
+
+ // Attach the drop-shadow decorator
+ dropShadowDecorator = new DropShadowDecorator();
+ frame.getDecorators().add(dropShadowDecorator);
+
+ frame.add(titleBarTablePane);
+
+ // Create the frame buttons
+ minimizeButton = new FrameButton(minimizeImage);
+ maximizeButton = new FrameButton(maximizeImage);
+ closeButton = new FrameButton(closeImage);
+
+ buttonBoxPane.add(minimizeButton);
+ buttonBoxPane.add(maximizeButton);
+ buttonBoxPane.add(closeButton);
+
+ iconAdded(frame, null);
+ titleChanged(frame, null);
+ }
+
+ @Override
+ public int getPreferredWidth(int height) {
+ int preferredWidth = 0;
+
+ FakeWindow frame = (FakeWindow) getComponent();
+
+ // Include title bar width plus left/right title bar borders
+ Dimensions titleBarSize = titleBarTablePane.getPreferredSize();
+ preferredWidth = Math.max(titleBarSize.width + 2, preferredWidth);
+
+ if (height != -1) {
+ // Subtract title bar height and top/bottom title bar borders
+ // from height constraint
+ height -= titleBarSize.height + 2;
+ }
+
+ Component content = frame.getContent();
+ if (content != null) {
+ if (height != -1) {
+ // Subtract padding, top/bottom content borders, and content
+ // bevel
+ // from height constraint
+ height -= (padding.top + padding.bottom) + (1) + 2;
+
+ height = Math.max(height, 0);
+ }
+
+ preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(height));
+ }
+
+ // Add padding and left/right content borders
+ preferredWidth += (padding.left + padding.right) + 2;
+
+ return preferredWidth;
+ }
+
+ @Override
+ public int getPreferredHeight(int width) {
+ int preferredHeight = 0;
+
+ FakeWindow frame = (FakeWindow) getComponent();
+
+ // Include title bar height plus top/bottom title bar borders
+ preferredHeight += titleBarTablePane.getPreferredHeight() + 2;
+
+ Component content = frame.getContent();
+ if (content != null) {
+ if (width != -1) {
+ // 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 padding, top/bottom content borders, and content bevel
+ preferredHeight += (padding.top + padding.bottom) + (1) + 2;
+
+ return preferredHeight;
+ }
+
+ @Override
+ public Dimensions getPreferredSize() {
+ int preferredWidth = 0;
+ int preferredHeight = 0;
+
+ FakeWindow frame = (FakeWindow) getComponent();
+
+ // Include title bar width plus left/right title bar borders
+ Dimensions titleBarSize = titleBarTablePane.getPreferredSize();
+ preferredWidth = Math.max(preferredWidth, titleBarSize.width + 2);
+
+ // Include title bar height plus top/bottom title bar borders
+ preferredHeight += titleBarSize.height + 2;
+
+ Component content = frame.getContent();
+ if (content != null) {
+ Dimensions preferredContentSize = content.getPreferredSize();
+
+ preferredWidth = Math.max(preferredWidth, preferredContentSize.width);
+ preferredHeight += preferredContentSize.height;
+ }
+
+ // Add padding, borders, and content bevel
+ preferredWidth += (padding.left + padding.right) + 2;
+ preferredHeight += (padding.top + padding.bottom) + (1) + 2;
+
+ return new Dimensions(preferredWidth, preferredHeight);
+ }
+
+ @Override
+ public void layout() {
+ FakeWindow frame = (FakeWindow) getComponent();
+
+ int width = getWidth();
+ int height = getHeight();
+
+ int clientX = 1;
+ int clientY = 1;
+ int clientWidth = Math.max(width - 2, 0);
+ int clientHeight = Math.max(height - 2, 0);
+
+ // Size/position title bar
+ titleBarTablePane.setLocation(clientX, clientY);
+ titleBarTablePane.setSize(clientWidth, titleBarTablePane.getPreferredHeight());
+ titleBarTablePane.setVisible(true);
+
+ // Add bottom title bar border, top content border, and content bevel
+ clientY += titleBarTablePane.getHeight() + (1) + 2;
+
+ // Size/position content
+ Component content = frame.getContent();
+ if (content != null) {
+ 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);
+ }
+ }
+
+ @Override
+ public void paint(Graphics2D graphics) {
+ // Call the base class to paint the background
+ super.paint(graphics);
+
+ int width = getWidth();
+ int height = getHeight();
+
+ int titleBarHeight = titleBarTablePane.getHeight();
+
+ // Draw the title area
+ Color titleBarBackgroundColor = this.titleBarBackgroundColor;
+ Color titleBarBorderColor = this.titleBarBorderColor;
+ Color titleBarBevelColor = this.titleBarBevelColor;
+
+ graphics.setPaint(new GradientPaint(width / 2f, 0, titleBarBevelColor, width / 2f,
+ titleBarHeight + 1, titleBarBackgroundColor));
+ graphics.fillRect(0, 0, width, titleBarHeight + 1);
+
+ // Draw the border
+ graphics.setPaint(titleBarBorderColor);
+ GraphicsUtilities.drawRect(graphics, 0, 0, width, titleBarHeight + 2);
+
+ // Draw the content area
+ Bounds contentAreaRectangle = new Bounds(0, titleBarHeight + 2, width, height
+ - (titleBarHeight + 2));
+ graphics.setPaint(contentBorderColor);
+ GraphicsUtilities.drawRect(graphics, contentAreaRectangle.x, contentAreaRectangle.y,
+ contentAreaRectangle.width, contentAreaRectangle.height);
+
+ // graphics.setPaint(contentBevelColor);
+ GraphicsUtilities.drawLine(graphics, contentAreaRectangle.x + 1,
+ contentAreaRectangle.y + 1, contentAreaRectangle.width - 2, Orientation.HORIZONTAL);
+ }
+
+ @Override
+ public void titleChanged(FakeWindow window, String previousTitle) {
+ String title = window.getTitle();
+ titleLabel.setVisible(title != null);
+ titleLabel.setText(title);
+ }
+
+ @Override
+ public void iconInserted(FakeWindow window, Image addedIcon, int index) {
+ // No-op
+ }
+
+ @Override
+ public void iconAdded(FakeWindow window, Image addedIcon) {
+ if (window.getIcons().getLength() > 0) {
+ iconImageView.setVisible(true);
+ iconImageView.setImage(window.getIcons().get(0));
+ } else {
+ iconImageView.setVisible(false);
+ iconImageView.setImage((Image) null);
+ }
+ }
+
+ @Override
+ public void iconsRemoved(FakeWindow window, int index, Sequence<Image> removed) {
+ if (window.getIcons().getLength() > 0) {
+ iconImageView.setVisible(true);
+ iconImageView.setImage(window.getIcons().get(0));
+ } else {
+ iconImageView.setVisible(false);
+ iconImageView.setImage((Image) null);
+ }
+ }
+
+ @Override
+ public void contentChanged(FakeWindow window, Component previousContent) {
+ invalidateComponent();
+ }
+
+}
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/builder-test1.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/builder-test1.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/builder-test1.bxml (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/builder-test1.bxml Sat Dec 24 16:07:37 2011
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<TablePane xmlns:bxml="http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk" bxml:id="tablepane1"
- styles="{verticalSpacing:1, showHorizontalGridLines:true, horizontalSpacing:1, showVerticalGridLines:true, horizontalGridColor:'#ff0000', verticalGridColor:'#ff0000', backgroundColor:'#ffffff'}">
- <columns>
- <TablePane.Column width="1*" />
- <TablePane.Column width="1*" />
- </columns>
- <TablePane.Row height="60">
- <TablePane bxml:id="tablepane2"
- styles="{verticalSpacing:1, showHorizontalGridLines:true, horizontalSpacing:1, showVerticalGridLines:true, horizontalGridColor:'#00ff00', verticalGridColor:'#00ff00'}">
- <columns>
- <TablePane.Column width="60" />
- <TablePane.Column width="1*" />
- </columns>
- <TablePane.Row>
- <ImageView image="@test1.jpg" styles="{fill:true}" />
- </TablePane.Row>
- </TablePane>
- <ImageView image="@test1.jpg" styles="{fill:true}" />
- </TablePane.Row>
- <TablePane.Row height="60">
- <TablePane
- styles="{verticalSpacing:1, showHorizontalGridLines:true, horizontalSpacing:1, showVerticalGridLines:true, horizontalGridColor:'#0000ff', verticalGridColor:'#0000ff'}">
- <columns>
- <TablePane.Column width="60" />
- <TablePane.Column width="1*" />
- </columns>
- <TablePane.Row>
- <ImageView image="@test2.jpg" styles="{fill:true}" />
- </TablePane.Row>
- </TablePane>
- <ImageView image="@test2.jpg" styles="{fill:true}" />
- </TablePane.Row>
- <TablePane.Row>
- <Label TablePane.columnSpan="2" text="The bottom" />
- </TablePane.Row>
-</TablePane>
+<?xml version="1.0" encoding="UTF-8"?>
+<TablePane xmlns:bxml="http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk" bxml:id="tablepane1"
+ styles="{verticalSpacing:1, showHorizontalGridLines:true, horizontalSpacing:1, showVerticalGridLines:true, horizontalGridColor:'#ff0000', verticalGridColor:'#ff0000', backgroundColor:'#ffffff'}">
+ <columns>
+ <TablePane.Column width="1*" />
+ <TablePane.Column width="1*" />
+ </columns>
+ <TablePane.Row height="60">
+ <TablePane bxml:id="tablepane2"
+ styles="{verticalSpacing:1, showHorizontalGridLines:true, horizontalSpacing:1, showVerticalGridLines:true, horizontalGridColor:'#00ff00', verticalGridColor:'#00ff00'}">
+ <columns>
+ <TablePane.Column width="60" />
+ <TablePane.Column width="1*" />
+ </columns>
+ <TablePane.Row>
+ <ImageView image="@test1.jpg" styles="{fill:true}" />
+ </TablePane.Row>
+ </TablePane>
+ <ImageView image="@test1.jpg" styles="{fill:true}" />
+ </TablePane.Row>
+ <TablePane.Row height="60">
+ <TablePane
+ styles="{verticalSpacing:1, showHorizontalGridLines:true, horizontalSpacing:1, showVerticalGridLines:true, horizontalGridColor:'#0000ff', verticalGridColor:'#0000ff'}">
+ <columns>
+ <TablePane.Column width="60" />
+ <TablePane.Column width="1*" />
+ </columns>
+ <TablePane.Row>
+ <ImageView image="@test2.jpg" styles="{fill:true}" />
+ </TablePane.Row>
+ </TablePane>
+ <ImageView image="@test2.jpg" styles="{fill:true}" />
+ </TablePane.Row>
+ <TablePane.Row>
+ <Label TablePane.columnSpan="2" text="The bottom" />
+ </TablePane.Row>
+</TablePane>
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/builder-test1.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/builder-test1.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml Sat Dec 24 16:07:37 2011
@@ -1,78 +1,78 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<explorer:BXMLExplorerDocument xmlns:bxml="http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk"
- xmlns:content="org.apache.pivot.wtk.content" xmlns:tools="org.apache.pivot.tutorials.bxmlexplorer.tools" xmlns:explorer="org.apache.pivot.tutorials.bxmlexplorer">
- <SplitPane orientation="horizontal" splitRatio="0.25">
- <left>
- <TabPane>
- <ScrollPane TabPane.tabData="Component Hierarchy" horizontalScrollBarPolicy="fill_to_capacity">
- <TreeView bxml:id="treeView">
- <nodeRenderer>
- <content:TreeViewNodeRenderer styles="{padding:1}" />
- </nodeRenderer>
-
- <treeData>
- <!-- FIXME -->
- <content:TreeBranch>
- <content:TreeBranch text="TreeBranch1" icon="@../folder.png">
- <content:TreeNode text="TreeNode1" />
- <content:TreeNode text="TreeNode1" />
- </content:TreeBranch>
- </content:TreeBranch>
- </treeData>
- </TreeView>
- </ScrollPane>
- </TabPane>
- </left>
- <right>
- <SplitPane orientation="horizontal" splitRatio="0.6">
- <left>
- <TabPane>
- <Border TabPane.tabData="Visualization">
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <CardPane bxml:id="playgroundCardPane" styles="{padding:10}">
- </CardPane>
- </ScrollPane>
- </Border>
- <Border TabPane.tabData="BXML Source">
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <TextPane bxml:id="bxmlSourceTextPane" editable="false" styles="{wrapText:true}">
- </TextPane>
- </ScrollPane>
- </Border>
- <corner>
- <BoxPane styles="{padding:{right:6, bottom:2}, horizontalAlignment:'right', fill:true}">
- <PushButton bxml:id="reloadButton" buttonData="Reload"/>
- </BoxPane>
- </corner>
- </TabPane>
- </left>
- <right>
- <TabPane>
- <Border TabPane.tabData="Properties">
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <CardPane styles="{padding:10}">
- <tools:ComponentPropertyInspector bxml:id="componentPropertyInspector" />
- </CardPane>
- </ScrollPane>
- </Border>
- <Border TabPane.tabData="Styles">
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <CardPane styles="{padding:10}">
- <tools:ComponentStyleInspector bxml:id="componentStyleInspector" />
- </CardPane>
- </ScrollPane>
- </Border>
- </TabPane>
- </right>
- </SplitPane>
- </right>
- </SplitPane>
-</explorer:BXMLExplorerDocument>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<explorer:BXMLExplorerDocument xmlns:bxml="http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk"
+ xmlns:content="org.apache.pivot.wtk.content" xmlns:tools="org.apache.pivot.tutorials.bxmlexplorer.tools" xmlns:explorer="org.apache.pivot.tutorials.bxmlexplorer">
+ <SplitPane orientation="horizontal" splitRatio="0.25">
+ <left>
+ <TabPane>
+ <ScrollPane TabPane.tabData="Component Hierarchy" horizontalScrollBarPolicy="fill_to_capacity">
+ <TreeView bxml:id="treeView">
+ <nodeRenderer>
+ <content:TreeViewNodeRenderer styles="{padding:1}" />
+ </nodeRenderer>
+
+ <treeData>
+ <!-- FIXME -->
+ <content:TreeBranch>
+ <content:TreeBranch text="TreeBranch1" icon="@../folder.png">
+ <content:TreeNode text="TreeNode1" />
+ <content:TreeNode text="TreeNode1" />
+ </content:TreeBranch>
+ </content:TreeBranch>
+ </treeData>
+ </TreeView>
+ </ScrollPane>
+ </TabPane>
+ </left>
+ <right>
+ <SplitPane orientation="horizontal" splitRatio="0.6">
+ <left>
+ <TabPane>
+ <Border TabPane.tabData="Visualization">
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <CardPane bxml:id="playgroundCardPane" styles="{padding:10}">
+ </CardPane>
+ </ScrollPane>
+ </Border>
+ <Border TabPane.tabData="BXML Source">
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <TextPane bxml:id="bxmlSourceTextPane" editable="false" styles="{wrapText:true}">
+ </TextPane>
+ </ScrollPane>
+ </Border>
+ <corner>
+ <BoxPane styles="{padding:{right:6, bottom:2}, horizontalAlignment:'right', fill:true}">
+ <PushButton bxml:id="reloadButton" buttonData="Reload"/>
+ </BoxPane>
+ </corner>
+ </TabPane>
+ </left>
+ <right>
+ <TabPane>
+ <Border TabPane.tabData="Properties">
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <CardPane styles="{padding:10}">
+ <tools:ComponentPropertyInspector bxml:id="componentPropertyInspector" />
+ </CardPane>
+ </ScrollPane>
+ </Border>
+ <Border TabPane.tabData="Styles">
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <CardPane styles="{padding:10}">
+ <tools:ComponentStyleInspector bxml:id="componentStyleInspector" />
+ </CardPane>
+ </ScrollPane>
+ </Border>
+ </TabPane>
+ </right>
+ </SplitPane>
+ </right>
+ </SplitPane>
+</explorer:BXMLExplorerDocument>
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_window.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_window.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_window.bxml (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_window.bxml Sat Dec 24 16:07:37 2011
@@ -1,207 +1,207 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<explorer:BXMLExplorerWindow title="BXML Preview" maximized="true"
- xmlns:bxml="http://pivot.apache.org/bxml" xmlns:content="org.apache.pivot.wtk.content" xmlns:explorer="org.apache.pivot.tutorials.bxmlexplorer"
- xmlns="org.apache.pivot.wtk">
-
- <bxml:define>
- <FileBrowserSheet bxml:id="fileBrowserSheet" styles="{hideDisabledFiles:true}"/>
- </bxml:define>
-
- <actionMappings>
- <Window.ActionMapping action="fileNew" keyStroke="CMD-N" />
- <Window.ActionMapping action="fileOpen" keyStroke="CMD-O" />
- </actionMappings>
-
- <TablePane>
- <columns>
- <TablePane.Column width="1*" />
- </columns>
- <TablePane.Row height="-1">
- <MenuBar>
- <MenuBar.Item buttonData="File">
- <Menu>
- <Menu.Section bxml:id="fileMenuSection">
- <Menu.Item bxml:id="fileNewMenuItem" action="fileNew">
- <buttonData>
- <content:MenuItemData text="New" keyboardShortcut="CMD-N" />
- </buttonData>
- </Menu.Item>
- <Menu.Item action="fileOpen">
- <buttonData>
- <content:MenuItemData text="Open" keyboardShortcut="CMD-O" />
- </buttonData>
- </Menu.Item>
- </Menu.Section>
- </Menu>
- </MenuBar.Item>
-
- <MenuBar.Item buttonData="Edit">
- <Menu>
- <Menu.Section>
- <Menu.Item action="cut">
- <buttonData>
- <content:MenuItemData text="Cut" keyboardShortcut="CMD-X" />
- </buttonData>
- </Menu.Item>
- <Menu.Item action="copy">
- <buttonData>
- <content:MenuItemData text="Copy" keyboardShortcut="CMD-C" />
- </buttonData>
- </Menu.Item>
- <Menu.Item action="paste">
- <buttonData>
- <content:MenuItemData text="Paste" keyboardShortcut="CMD-V" />
- </buttonData>
- </Menu.Item>
- </Menu.Section>
- </Menu>
- </MenuBar.Item>
- </MenuBar>
- </TablePane.Row>
- <TablePane.Row height="1*">
-
- <Border styles="{backgroundColor:null, padding:2}">
- <SplitPane bxml:id="splitPane" orientation="horizontal" splitRatio="0.25">
- <left>
- <TabPane bxml:id="paletteTabPane">
- <ScrollPane bxml:id="paletteTreeViewScrollPane" TabPane.tabData="Palette" horizontalScrollBarPolicy="fill_to_capacity">
- <TreeView bxml:id="paletteTreeView">
- <nodeRenderer>
- <content:TreeViewNodeRenderer styles="{padding:1}" />
- </nodeRenderer>
-
- <treeData>
- <content:TreeBranch>
- <content:TreeBranch text="Labels & Image Views" icon="@../folder.png">
- <explorer:ComponentNode text="Label" src="@label.bxml" />
- <explorer:ComponentNode text="ImageView" src="@image_view.bxml" />
- </content:TreeBranch>
- <content:TreeBranch text="Buttons" icon="@../folder.png">
- <explorer:ComponentNode text="PushButton" src="@push_button.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="RadioButton" src="@radio_button.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="Checkbox" src="@checkbox.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="LinkButton" src="@link_button.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Lists" icon="@../folder.png">
- <explorer:ComponentNode text="ListView" src="@list_view.bxml"
- horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="ListButton" src="@list_button.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Text" icon="@../folder.png">
- <explorer:ComponentNode text="TextInput" src="@text_input.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="TextArea" src="@text_area.bxml"
- horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fill_to_capacity" />
- <explorer:ComponentNode text="TextPane" src="@text_pane.bxml"
- horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fill_to_capacity" />
- </content:TreeBranch>
- <content:TreeBranch text="Separators" icon="@../folder.png">
- <explorer:ComponentNode text="Separator" src="@separator.bxml"
- horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Layout Containers" icon="@../folder.png">
- <explorer:ComponentNode text="FlowPane" src="@flow_pane.bxml" />
- <explorer:ComponentNode text="BoxPane" src="@box_pane.bxml" />
- <explorer:ComponentNode text="FillPane" src="@fill_pane.bxml" />
- <explorer:ComponentNode text="TablePane" src="@table_pane.bxml" />
- <explorer:ComponentNode text="GridPane" src="@grid_pane.bxml" />
- <explorer:ComponentNode text="Border" src="@border.bxml" />
- <explorer:ComponentNode text="StackPane" src="@stack_pane.bxml" />
- <explorer:ComponentNode text="SplitPane" src="@split_pane.bxml" />
- <explorer:ComponentNode text="Form" src="@form.bxml"
- horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="Panel" src="@panel.bxml" />
- </content:TreeBranch>
- <content:TreeBranch text="Navigation Containers" icon="@../folder.png">
- <explorer:ComponentNode text="CardPane" src="@card_pane.bxml"
- horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fill" />
- <explorer:ComponentNode text="TabPane" src="@tab_pane.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="Accordion" src="@accordion.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="Expander" src="@expander.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="Rollup" src="@rollup.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <content:TreeBranch text="Viewports" icon="@../folder.png">
- <explorer:ComponentNode text="ScrollPane" src="@scroll_pane.bxml" />
- <explorer:ComponentNode text="Panorama" src="@panorama.bxml" />
- </content:TreeBranch>
- </content:TreeBranch>
- <content:TreeBranch text="Progress Indicators" icon="@../folder.png">
- <explorer:ComponentNode text="Meter" src="@meter.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="ActivityIndicator" icon="@../page_white.png"
- src="@activity_indicator.bxml" horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Bounded Range Components" icon="@../folder.png">
- <explorer:ComponentNode text="ScrollBar" src="@scroll_bar.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="Slider" src="@slider.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="Spinner" src="@spinner.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Calendars" icon="@../folder.png">
- <explorer:ComponentNode text="Calendar" src="@calendar.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="CalendarButton" src="@calendar_button.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Color Choosers" icon="@../folder.png">
- <explorer:ComponentNode text="ColorChooser" src="@color_chooser.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="ColorChooserButton" icon="@../page_white.png"
- src="@color_chooser_button.bxml" horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Menus" icon="@../folder.png">
- <explorer:ComponentNode text="MenuBar" src="@menu_bar.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- <explorer:ComponentNode text="MenuButton" src="@menu_button.bxml"
- horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Tables" icon="@../folder.png">
- <explorer:ComponentNode text="TableView" src="@table_view.bxml"
- horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="Trees" icon="@../folder.png">
- <explorer:ComponentNode text="TreeView" src="@tree_view.bxml"
- horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- <content:TreeBranch text="File Browsing" icon="@../folder.png">
- <explorer:ComponentNode text="FileBrowser" src="@file_browser.bxml"
- horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="auto" />
- </content:TreeBranch>
- </content:TreeBranch>
- </treeData>
- </TreeView>
- </ScrollPane>
- </TabPane>
- </left>
- <right>
- <TabPane bxml:id="tabPane" >
- <corner>
- <BoxPane styles="{padding:{right:6, bottom:2}, horizontalAlignment:'right', fill:true}">
- <PushButton bxml:id="closeButton" buttonData="Close Tab"/>
- </BoxPane>
- </corner>
- </TabPane>
- </right>
- </SplitPane>
- </Border>
- </TablePane.Row>
- </TablePane>
-</explorer:BXMLExplorerWindow>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<explorer:BXMLExplorerWindow title="BXML Preview" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml" xmlns:content="org.apache.pivot.wtk.content" xmlns:explorer="org.apache.pivot.tutorials.bxmlexplorer"
+ xmlns="org.apache.pivot.wtk">
+
+ <bxml:define>
+ <FileBrowserSheet bxml:id="fileBrowserSheet" styles="{hideDisabledFiles:true}"/>
+ </bxml:define>
+
+ <actionMappings>
+ <Window.ActionMapping action="fileNew" keyStroke="CMD-N" />
+ <Window.ActionMapping action="fileOpen" keyStroke="CMD-O" />
+ </actionMappings>
+
+ <TablePane>
+ <columns>
+ <TablePane.Column width="1*" />
+ </columns>
+ <TablePane.Row height="-1">
+ <MenuBar>
+ <MenuBar.Item buttonData="File">
+ <Menu>
+ <Menu.Section bxml:id="fileMenuSection">
+ <Menu.Item bxml:id="fileNewMenuItem" action="fileNew">
+ <buttonData>
+ <content:MenuItemData text="New" keyboardShortcut="CMD-N" />
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item action="fileOpen">
+ <buttonData>
+ <content:MenuItemData text="Open" keyboardShortcut="CMD-O" />
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ </Menu>
+ </MenuBar.Item>
+
+ <MenuBar.Item buttonData="Edit">
+ <Menu>
+ <Menu.Section>
+ <Menu.Item action="cut">
+ <buttonData>
+ <content:MenuItemData text="Cut" keyboardShortcut="CMD-X" />
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item action="copy">
+ <buttonData>
+ <content:MenuItemData text="Copy" keyboardShortcut="CMD-C" />
+ </buttonData>
+ </Menu.Item>
+ <Menu.Item action="paste">
+ <buttonData>
+ <content:MenuItemData text="Paste" keyboardShortcut="CMD-V" />
+ </buttonData>
+ </Menu.Item>
+ </Menu.Section>
+ </Menu>
+ </MenuBar.Item>
+ </MenuBar>
+ </TablePane.Row>
+ <TablePane.Row height="1*">
+
+ <Border styles="{backgroundColor:null, padding:2}">
+ <SplitPane bxml:id="splitPane" orientation="horizontal" splitRatio="0.25">
+ <left>
+ <TabPane bxml:id="paletteTabPane">
+ <ScrollPane bxml:id="paletteTreeViewScrollPane" TabPane.tabData="Palette" horizontalScrollBarPolicy="fill_to_capacity">
+ <TreeView bxml:id="paletteTreeView">
+ <nodeRenderer>
+ <content:TreeViewNodeRenderer styles="{padding:1}" />
+ </nodeRenderer>
+
+ <treeData>
+ <content:TreeBranch>
+ <content:TreeBranch text="Labels & Image Views" icon="@../folder.png">
+ <explorer:ComponentNode text="Label" src="@label.bxml" />
+ <explorer:ComponentNode text="ImageView" src="@image_view.bxml" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Buttons" icon="@../folder.png">
+ <explorer:ComponentNode text="PushButton" src="@push_button.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="RadioButton" src="@radio_button.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="Checkbox" src="@checkbox.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="LinkButton" src="@link_button.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Lists" icon="@../folder.png">
+ <explorer:ComponentNode text="ListView" src="@list_view.bxml"
+ horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="ListButton" src="@list_button.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Text" icon="@../folder.png">
+ <explorer:ComponentNode text="TextInput" src="@text_input.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="TextArea" src="@text_area.bxml"
+ horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fill_to_capacity" />
+ <explorer:ComponentNode text="TextPane" src="@text_pane.bxml"
+ horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fill_to_capacity" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Separators" icon="@../folder.png">
+ <explorer:ComponentNode text="Separator" src="@separator.bxml"
+ horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Layout Containers" icon="@../folder.png">
+ <explorer:ComponentNode text="FlowPane" src="@flow_pane.bxml" />
+ <explorer:ComponentNode text="BoxPane" src="@box_pane.bxml" />
+ <explorer:ComponentNode text="FillPane" src="@fill_pane.bxml" />
+ <explorer:ComponentNode text="TablePane" src="@table_pane.bxml" />
+ <explorer:ComponentNode text="GridPane" src="@grid_pane.bxml" />
+ <explorer:ComponentNode text="Border" src="@border.bxml" />
+ <explorer:ComponentNode text="StackPane" src="@stack_pane.bxml" />
+ <explorer:ComponentNode text="SplitPane" src="@split_pane.bxml" />
+ <explorer:ComponentNode text="Form" src="@form.bxml"
+ horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="Panel" src="@panel.bxml" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Navigation Containers" icon="@../folder.png">
+ <explorer:ComponentNode text="CardPane" src="@card_pane.bxml"
+ horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fill" />
+ <explorer:ComponentNode text="TabPane" src="@tab_pane.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="Accordion" src="@accordion.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="Expander" src="@expander.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="Rollup" src="@rollup.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <content:TreeBranch text="Viewports" icon="@../folder.png">
+ <explorer:ComponentNode text="ScrollPane" src="@scroll_pane.bxml" />
+ <explorer:ComponentNode text="Panorama" src="@panorama.bxml" />
+ </content:TreeBranch>
+ </content:TreeBranch>
+ <content:TreeBranch text="Progress Indicators" icon="@../folder.png">
+ <explorer:ComponentNode text="Meter" src="@meter.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="ActivityIndicator" icon="@../page_white.png"
+ src="@activity_indicator.bxml" horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Bounded Range Components" icon="@../folder.png">
+ <explorer:ComponentNode text="ScrollBar" src="@scroll_bar.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="Slider" src="@slider.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="Spinner" src="@spinner.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Calendars" icon="@../folder.png">
+ <explorer:ComponentNode text="Calendar" src="@calendar.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="CalendarButton" src="@calendar_button.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Color Choosers" icon="@../folder.png">
+ <explorer:ComponentNode text="ColorChooser" src="@color_chooser.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="ColorChooserButton" icon="@../page_white.png"
+ src="@color_chooser_button.bxml" horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Menus" icon="@../folder.png">
+ <explorer:ComponentNode text="MenuBar" src="@menu_bar.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ <explorer:ComponentNode text="MenuButton" src="@menu_button.bxml"
+ horizontalScrollBarPolicy="auto" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Tables" icon="@../folder.png">
+ <explorer:ComponentNode text="TableView" src="@table_view.bxml"
+ horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Trees" icon="@../folder.png">
+ <explorer:ComponentNode text="TreeView" src="@tree_view.bxml"
+ horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ <content:TreeBranch text="File Browsing" icon="@../folder.png">
+ <explorer:ComponentNode text="FileBrowser" src="@file_browser.bxml"
+ horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="auto" />
+ </content:TreeBranch>
+ </content:TreeBranch>
+ </treeData>
+ </TreeView>
+ </ScrollPane>
+ </TabPane>
+ </left>
+ <right>
+ <TabPane bxml:id="tabPane" >
+ <corner>
+ <BoxPane styles="{padding:{right:6, bottom:2}, horizontalAlignment:'right', fill:true}">
+ <PushButton bxml:id="closeButton" buttonData="Close Tab"/>
+ </BoxPane>
+ </corner>
+ </TabPane>
+ </right>
+ </SplitPane>
+ </Border>
+ </TablePane.Row>
+ </TablePane>
+</explorer:BXMLExplorerWindow>
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_window.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_window.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/checkbox.png
------------------------------------------------------------------------------
origination-name = image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/checkbox.png
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Sat Dec 24 16:07:37 2011
@@ -1 +1 @@
-application/octet-stream
+image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/label.png
------------------------------------------------------------------------------
origination-name = image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/label.png
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Sat Dec 24 16:07:37 2011
@@ -1 +1 @@
-application/octet-stream
+image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/linkbutton.png
------------------------------------------------------------------------------
origination-name = image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/linkbutton.png
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Sat Dec 24 16:07:37 2011
@@ -1 +1 @@
-application/octet-stream
+image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/pushbutton.png
------------------------------------------------------------------------------
origination-name = image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/pushbutton.png
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Sat Dec 24 16:07:37 2011
@@ -1 +1 @@
-application/octet-stream
+image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/radiobutton.png
------------------------------------------------------------------------------
origination-name = image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/radiobutton.png
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Sat Dec 24 16:07:37 2011
@@ -1 +1 @@
-application/octet-stream
+image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tablepane.png
------------------------------------------------------------------------------
origination-name = image/png
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tablepane.png
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Sat Dec 24 16:07:37 2011
@@ -1 +1 @@
-application/octet-stream
+image/png
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspector.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspector.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspector.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspector.java Sat Dec 24 16:07:37 2011
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pivot.tutorials.bxmlexplorer.tools;
-
-import org.apache.pivot.util.ListenerList;
-import org.apache.pivot.wtk.Component;
-import org.apache.pivot.wtk.Container;
-
-/**
- * Abstract base class for a component that is designed to inspect another
- * component (its "source").
- */
-public abstract class ComponentInspector extends Container {
- private static class ComponentInspectorListenerList
- extends ListenerList<ComponentInspectorListener> implements ComponentInspectorListener {
- @Override
- public void sourceChanged(ComponentInspector componentInspector, Component previousSource) {
- for (ComponentInspectorListener listener : this) {
- listener.sourceChanged(componentInspector, previousSource);
- }
- }
- }
-
- private Component source = null;
-
- private ComponentInspectorListenerList componentInspectorListeners =
- new ComponentInspectorListenerList();
-
- public Component getSource() {
- return source;
- }
-
- public void setSource(Component source) {
- Component previousSource = this.source;
-
- if (source != previousSource) {
- this.source = source;
- componentInspectorListeners.sourceChanged(this, previousSource);
- }
- }
-
- public ListenerList<ComponentInspectorListener> getComponentInspectorListeners() {
- return componentInspectorListeners;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.tutorials.bxmlexplorer.tools;
+
+import org.apache.pivot.util.ListenerList;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.Container;
+
+/**
+ * Abstract base class for a component that is designed to inspect another
+ * component (its "source").
+ */
+public abstract class ComponentInspector extends Container {
+ private static class ComponentInspectorListenerList
+ extends ListenerList<ComponentInspectorListener> implements ComponentInspectorListener {
+ @Override
+ public void sourceChanged(ComponentInspector componentInspector, Component previousSource) {
+ for (ComponentInspectorListener listener : this) {
+ listener.sourceChanged(componentInspector, previousSource);
+ }
+ }
+ }
+
+ private Component source = null;
+
+ private ComponentInspectorListenerList componentInspectorListeners =
+ new ComponentInspectorListenerList();
+
+ public Component getSource() {
+ return source;
+ }
+
+ public void setSource(Component source) {
+ Component previousSource = this.source;
+
+ if (source != previousSource) {
+ this.source = source;
+ componentInspectorListeners.sourceChanged(this, previousSource);
+ }
+ }
+
+ public ListenerList<ComponentInspectorListener> getComponentInspectorListeners() {
+ return componentInspectorListeners;
+ }
+}
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspectorListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspectorListener.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspectorListener.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspectorListener.java Sat Dec 24 16:07:37 2011
@@ -1,32 +1,32 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pivot.tutorials.bxmlexplorer.tools;
-
-import org.apache.pivot.wtk.Component;
-
-/**
- * Component inspector listener interface.
- */
-public interface ComponentInspectorListener {
- /**
- * Called when an component inspector's source component has changed.
- *
- * @param componentInspector
- * @param previousSource
- */
- public void sourceChanged(ComponentInspector componentInspector, Component previousSource);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.tutorials.bxmlexplorer.tools;
+
+import org.apache.pivot.wtk.Component;
+
+/**
+ * Component inspector listener interface.
+ */
+public interface ComponentInspectorListener {
+ /**
+ * Called when an component inspector's source component has changed.
+ *
+ * @param componentInspector
+ * @param previousSource
+ */
+ public void sourceChanged(ComponentInspector componentInspector, Component previousSource);
+}
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/tools/ComponentInspectorListener.java
------------------------------------------------------------------------------
svn:eol-style = native