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/08/06 15:03:34 UTC
svn commit: r801636 - in /incubator/pivot/trunk:
core/src/org/apache/pivot/util/ core/test/org/apache/pivot/util/test/
wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/skin/
wtk/test/org/apache/pivot/wtk/test/
Author: gbrown
Date: Thu Aug 6 13:03:33 2009
New Revision: 801636
URL: http://svn.apache.org/viewvc?rev=801636&view=rev
Log:
Add a TablePane.Filler component; trim whitespace from Resources.java and resource test cases.
Added:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneFillerSkin.java
Modified:
incubator/pivot/trunk/core/src/org/apache/pivot/util/Resources.java
incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java
incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTestParent.json
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TablePaneTest.java
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_pane_test.wtkx
Modified: incubator/pivot/trunk/core/src/org/apache/pivot/util/Resources.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/util/Resources.java?rev=801636&r1=801635&r2=801636&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/util/Resources.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/util/Resources.java Thu Aug 6 13:03:33 2009
@@ -37,9 +37,9 @@
* applies a country specified resource over-writing the values in the base
* using the country specified. It then does the same for country/language
* specific.
- *
+ *
* @see java.util.ResourceBundle
- *
+ *
* @author brindy
* @author gbrown
*/
@@ -124,29 +124,29 @@
/**
* Creates a new resource bundle.
- *
+ *
* @param parent
* The parent resource defer to if a resource cannot be found in this
* instance or null.
- *
+ *
* @param baseName
* The base name of this resource as a fully qualified class name.
- *
+ *
* @param locale
* The locale to use when reading this resource.
- *
+ *
* @param charset
* The character encoding to use when reading this resource.
- *
+ *
* @throws IOException
* If there is a problem when reading the resource.
- *
+ *
* @throws SerializationException
* If there is a problem deserializing the resource from its JSON format.
- *
+ *
* @throws IllegalArgumentException
* If baseName or locale is null.
- *
+ *
* @throws MissingResourceException
* If no resource for the specified base name can be found.
*/
@@ -322,12 +322,12 @@
@SuppressWarnings( { "unchecked" })
private void applyOverrides(Map<String, Object> sourceMap,
Map<String, Object> overridesMap) {
-
+
for (String key : overridesMap) {
if (sourceMap.containsKey(key)) {
Object source = sourceMap.get(key);
Object override = overridesMap.get(key);
-
+
if (source instanceof Map<?, ?>
&& override instanceof Map<?, ?>) {
applyOverrides((Map<String, Object>) source,
@@ -337,7 +337,7 @@
}
}
}
-
+
}
@SuppressWarnings("unchecked")
@@ -347,7 +347,7 @@
if (in == null) {
return null;
}
-
+
JSONSerializer serializer = new JSONSerializer(charset);
Map<String, Object> resourceMap = null;
try {
@@ -355,7 +355,7 @@
} finally {
in.close();
}
-
+
return resourceMap;
}
}
Modified: incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java?rev=801636&r1=801635&r2=801636&view=diff
==============================================================================
--- incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java (original)
+++ incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java Thu Aug 6 13:03:33 2009
@@ -140,7 +140,7 @@
assertEquals("Language in parent",
"This is not a specific language and is in the parent.", parent
.getString("languageKey"));
-
+
}
@Test
Modified: incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTestParent.json
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTestParent.json?rev=801636&r1=801635&r2=801636&view=diff
==============================================================================
--- incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTestParent.json (original)
+++ incubator/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTestParent.json Thu Aug 6 13:03:33 2009
@@ -5,16 +5,16 @@
someMagicNumber: 100,
mainKeyBoolean: true,
someMagicBoolean: false,
-
+
myMap : {
-
+
x: 75,
y: 90
-
+
},
-
+
languageKey: "This is not a specific language and is in the parent.",
-
+
aList: [1, 2, 3, 4, 5, 6]
-
+
}
\ No newline at end of file
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java?rev=801636&r1=801635&r2=801636&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java Thu Aug 6 13:03:33 2009
@@ -640,6 +640,17 @@
}
}
+ /**
+ * Component that can be used as filler for empty cells.
+ *
+ * @author gbrown
+ */
+ public static class Filler extends Component {
+ public Filler() {
+ installSkin(Filler.class);
+ }
+ }
+
private static class Attributes {
public int rowSpan = 1;
public int columnSpan = 1;
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java?rev=801636&r1=801635&r2=801636&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java Thu Aug 6 13:03:33 2009
@@ -34,6 +34,7 @@
import org.apache.pivot.wtk.skin.ScrollPaneSkin;
import org.apache.pivot.wtk.skin.SeparatorSkin;
import org.apache.pivot.wtk.skin.StackPaneSkin;
+import org.apache.pivot.wtk.skin.TablePaneFillerSkin;
import org.apache.pivot.wtk.skin.TablePaneSkin;
import org.apache.pivot.wtk.skin.TextAreaSkin;
import org.apache.pivot.wtk.skin.WindowSkin;
@@ -82,6 +83,7 @@
componentSkinMap.put(Separator.class, SeparatorSkin.class);
componentSkinMap.put(StackPane.class, StackPaneSkin.class);
componentSkinMap.put(TablePane.class, TablePaneSkin.class);
+ componentSkinMap.put(TablePane.Filler.class, TablePaneFillerSkin.class);
componentSkinMap.put(TextArea.class, TextAreaSkin.class);
componentSkinMap.put(Window.class, WindowSkin.class);
}
Added: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneFillerSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneFillerSkin.java?rev=801636&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneFillerSkin.java (added)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneFillerSkin.java Thu Aug 6 13:03:33 2009
@@ -0,0 +1,45 @@
+/*
+ * 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.wtk.skin;
+
+import java.awt.Graphics2D;
+
+/**
+ * Table pane filler skin.
+ *
+ * @author gbrown
+ */
+public class TablePaneFillerSkin extends ComponentSkin {
+ @Override
+ public void layout() {
+ // No-op
+ }
+
+ @Override
+ public int getPreferredHeight(int width) {
+ return 0;
+ }
+
+ @Override
+ public int getPreferredWidth(int height) {
+ return 0;
+ }
+
+ @Override
+ public void paint(Graphics2D graphics) {
+ }
+}
Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TablePaneTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TablePaneTest.java?rev=801636&r1=801635&r2=801636&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TablePaneTest.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TablePaneTest.java Thu Aug 6 13:03:33 2009
@@ -18,28 +18,18 @@
import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Window;
import org.apache.pivot.wtkx.WTKXSerializer;
-/**
- * Demonstrates a layout issue with TablePane. A one-row, two-column table is
- * created. The row height is set to 1* so it fills the vertical space. Column
- * 0 is given a default width (-1), and the width of column 1 is set to 1* so
- * it occupies the remaining horizontal space after column 0 is accounted for.
- *
- * When the program is run, column 0 is not visible. If given an explicit width,
- * column 0 appears, and the other cell is sized appropriately.
- */
public class TablePaneTest implements Application {
private Window window = null;
public void startup(Display display, Map<String, String> properties)
throws Exception {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("table_pane_test.wtkx")));
- window.setTitle("TablePane Test");
+ window = (Window)wtkxSerializer.readObject(this, "table_pane_test.wtkx");
window.open(display);
}
@@ -56,4 +46,8 @@
public void resume() {
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(TablePaneTest.class, args);
+ }
}
Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_pane_test.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_pane_test.wtkx?rev=801636&r1=801635&r2=801636&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_pane_test.wtkx (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_pane_test.wtkx Thu Aug 6 13:03:33 2009
@@ -16,25 +16,28 @@
limitations under the License.
-->
-<TablePane styles="{padding:6, verticalSpacing:8}"
+<Window title="TablePane Test" maximized="true"
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns="org.apache.pivot.wtk">
- <columns>
- <TablePane.Column width="-1"/>
- </columns>
- <rows>
- <TablePane.Row height="-1">
- <PushButton buttonData="One"/>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <PushButton buttonData="Two"/>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <PushButton buttonData="Three" displayable="false"/>
- </TablePane.Row>
- <TablePane.Row height="-1">
- <PushButton buttonData="Four"/>
- </TablePane.Row>
- </rows>
-</TablePane>
-
+ <content>
+ <TablePane styles="{padding:6, verticalSpacing:8}">
+ <columns>
+ <TablePane.Column width="-1"/>
+ </columns>
+ <rows>
+ <TablePane.Row height="-1">
+ <PushButton buttonData="One"/>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <TablePane.Filler preferredHeight="60"/>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <PushButton buttonData="Three" displayable="false"/>
+ </TablePane.Row>
+ <TablePane.Row height="-1">
+ <PushButton buttonData="Four"/>
+ </TablePane.Row>
+ </rows>
+ </TablePane>
+ </content>
+</Window>