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/10/19 22:39:55 UTC

svn commit: r826800 - in /incubator/pivot/trunk/wtk: src/org/apache/pivot/wtk/ src/org/apache/pivot/wtk/content/ test/org/apache/pivot/wtk/text/test/

Author: gbrown
Date: Mon Oct 19 20:39:55 2009
New Revision: 826800

URL: http://svn.apache.org/viewvc?rev=826800&view=rev
Log:
Ensure that Label-based renderers are validated in setSize().

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/SpinnerItemRenderer.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellRenderer.java
    incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/NodeAdapterRenderer.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java?rev=826800&r1=826799&r2=826800&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TextArea.java Mon Oct 19 20:39:55 2009
@@ -34,7 +34,6 @@
 import org.apache.pivot.wtk.text.PlainTextSerializer;
 import org.apache.pivot.wtk.text.TextNode;
 
-
 /**
  * Component that allows a user to enter and edit multiple lines of (optionally
  * formatted) text.
@@ -182,18 +181,6 @@
         super.setSkin(skin);
     }
 
-    @Override
-    protected void setParent(Container parent) {
-        if (parent != null
-            && !(parent instanceof Viewport)) {
-            throw new IllegalArgumentException(getClass().getName()
-                + " parent must be an instance of "
-                + Viewport.class.getName());
-        }
-
-        super.setParent(parent);
-    }
-
     public Document getDocument() {
         return document;
     }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/SpinnerItemRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/SpinnerItemRenderer.java?rev=826800&r1=826799&r2=826800&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/SpinnerItemRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/SpinnerItemRenderer.java Mon Oct 19 20:39:55 2009
@@ -36,6 +36,15 @@
     }
 
     @Override
+    public void setSize(int width, int height) {
+        super.setSize(width, height);
+
+        // Since this component doesn't have a parent, it won't be validated
+        // via layout; ensure that it is valid here
+        validate();
+    }
+
+    @Override
     public void render(Object item, Spinner spinner) {
         setText(item == null ? null : item.toString());
 

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellRenderer.java?rev=826800&r1=826799&r2=826800&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellRenderer.java Mon Oct 19 20:39:55 2009
@@ -38,6 +38,15 @@
         getStyles().put("padding", new Insets(2));
     }
 
+    @Override
+    public void setSize(int width, int height) {
+        super.setSize(width, height);
+
+        // Since this component doesn't have a parent, it won't be validated
+        // via layout; ensure that it is valid here
+        validate();
+    }
+
     @SuppressWarnings("unchecked")
     @Override
     public void render(Object value, int rowIndex, int columnIndex,

Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/NodeAdapterRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/NodeAdapterRenderer.java?rev=826800&r1=826799&r2=826800&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/NodeAdapterRenderer.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/NodeAdapterRenderer.java Mon Oct 19 20:39:55 2009
@@ -26,6 +26,15 @@
 
 public class NodeAdapterRenderer extends Label implements TreeView.NodeRenderer {
     @Override
+    public void setSize(int width, int height) {
+        super.setSize(width, height);
+
+        // Since this component doesn't have a parent, it won't be validated
+        // via layout; ensure that it is valid here
+        validate();
+    }
+
+    @Override
     public void render(Object node, Path path, int rowIndex, TreeView treeView, boolean expanded,
         boolean selected, NodeCheckState checkState, boolean highlighted, boolean disabled) {
         Object labelFont = treeView.getStyles().get("font");