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 2013/02/25 17:26:06 UTC

svn commit: r1449765 - in /pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer: CreateHighlightedXML.java FakeWindowSkin.java bxml_explorer_document.bxml

Author: smartini
Date: Mon Feb 25 16:26:05 2013
New Revision: 1449765

URL: http://svn.apache.org/r1449765
Log:
BXMLExplorer, fix (new) eclipse warnings, and fix scrollbar vertical policy for BXML Source

Modified:
    pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java
    pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java
    pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml

Modified: pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java?rev=1449765&r1=1449764&r2=1449765&view=diff
==============================================================================
--- pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java (original)
+++ pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java Mon Feb 25 16:26:05 2013
@@ -67,8 +67,8 @@ public class CreateHighlightedXML {
 
     private void prettyPrint(org.w3c.dom.Element domElement, int indent) {
         newLine();
-        indent++;
-        add(createIndent(indent));
+        int indentMutable = indent + 1;
+        add(createIndent(indentMutable));
 
         add(ELEMENT_COLOR, "<" + domElement.getNodeName());
 
@@ -96,14 +96,16 @@ public class CreateHighlightedXML {
             for (int i = 0; i < childNodes.getLength(); i++) {
                 org.w3c.dom.Node node = childNodes.item(i);
                 if (node instanceof org.w3c.dom.Element) {
-                    prettyPrint((org.w3c.dom.Element) node, indent);
+                    prettyPrint((org.w3c.dom.Element) node, indentMutable);
                 }
             }
+
             newLine();
-            add(createIndent(indent));
+            add(createIndent(indentMutable));
             add(ELEMENT_COLOR, "</" + domElement.getNodeName() + ">");
         }
-        indent--;
+
+        indentMutable--;
     }
 
     private void newLine() {

Modified: pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java?rev=1449765&r1=1449764&r2=1449765&view=diff
==============================================================================
--- pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java (original)
+++ pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java Mon Feb 25 16:26:05 2013
@@ -250,6 +250,7 @@ public class FakeWindowSkin extends Cont
     @Override
     public int getPreferredWidth(int height) {
         int preferredWidth = 0;
+        int heightMutable = height;
 
         FakeWindow frame = (FakeWindow) getComponent();
 
@@ -257,24 +258,22 @@ public class FakeWindowSkin extends Cont
         Dimensions titleBarSize = titleBarTablePane.getPreferredSize();
         preferredWidth = Math.max(titleBarSize.width + 2, preferredWidth);
 
-        if (height != -1) {
+        if (heightMutable != -1) {
             // Subtract title bar height and top/bottom title bar borders
             // from height constraint
-            height -= titleBarSize.height + 2;
+            heightMutable -= titleBarSize.height + 2;
         }
 
         Component content = frame.getContent();
         if (content != null) {
-            if (height != -1) {
+            if (heightMutable != -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);
+                // bevel from height constraint
+                heightMutable -= (padding.top + padding.bottom) + (1) + 2;
+                heightMutable = Math.max(heightMutable, 0);
             }
 
-            preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(height));
+            preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(heightMutable));
         }
 
         // Add padding and left/right content borders
@@ -286,6 +285,7 @@ public class FakeWindowSkin extends Cont
     @Override
     public int getPreferredHeight(int width) {
         int preferredHeight = 0;
+        int widthMutable = width;
 
         FakeWindow frame = (FakeWindow) getComponent();
 
@@ -294,15 +294,14 @@ public class FakeWindowSkin extends Cont
 
         Component content = frame.getContent();
         if (content != null) {
-            if (width != -1) {
+            if (widthMutable != -1) {
                 // Subtract padding and left/right content borders from
                 // constraint
-                width -= (padding.left + padding.right) + 2;
-
-                width = Math.max(width, 0);
+                widthMutable -= (padding.left + padding.right) + 2;
+                widthMutable = Math.max(widthMutable, 0);
             }
 
-            preferredHeight += content.getPreferredHeight(width);
+            preferredHeight += content.getPreferredHeight(widthMutable);
         }
 
         // Add padding, top/bottom content borders, and content bevel

Modified: pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml?rev=1449765&r1=1449764&r2=1449765&view=diff
==============================================================================
--- pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml (original)
+++ pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml Mon Feb 25 16:26:05 2013
@@ -42,7 +42,7 @@
               </ScrollPane>
             </Border>
             <Border TabPane.tabData="BXML Source">
-              <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+              <ScrollPane horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="fill_to_capacity">
                 <TextPane bxml:id="bxmlSourceTextPane" editable="false" styles="{wrapText:true}">
                 </TextPane>
               </ScrollPane>