You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/12/02 13:12:05 UTC
svn commit: r886129 - in /incubator/pivot/trunk: ./ charts/ core/
core/test/org/apache/pivot/xml/test/ demos/src/org/apache/pivot/demos/rss/
tutorials/src/org/apache/pivot/tutorials/layout/
tutorials/src/org/apache/pivot/tutorials/text/ web/ wtk-terra/...
Author: tvolkert
Date: Wed Dec 2 12:12:03 2009
New Revision: 886129
URL: http://svn.apache.org/viewvc?rev=886129&view=rev
Log:
Added missing SVN props - no content changes were made
Modified:
incubator/pivot/trunk/charts/pom.xml (props changed)
incubator/pivot/trunk/core/pom.xml (props changed)
incubator/pivot/trunk/core/test/org/apache/pivot/xml/test/XMLSerializerTest.java (props changed)
incubator/pivot/trunk/core/test/org/apache/pivot/xml/test/sample.xml (props changed)
incubator/pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSItemRenderer.java (props changed)
incubator/pivot/trunk/pom.xml (props changed)
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/GridPanes.java (contents, props changed)
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/SimpleGridPanes.java (contents, props changed)
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/grid_panes.wtkx (contents, props changed)
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/simple_grid_panes.wtkx (contents, props changed)
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/sample1.txt (props changed)
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/sample2.txt (props changed)
incubator/pivot/trunk/web/pom.xml (props changed)
incubator/pivot/trunk/wtk-terra/pom.xml (props changed)
incubator/pivot/trunk/wtk/pom.xml (props changed)
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java (contents, props changed)
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TableViewTest2.java (contents, props changed)
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_view_test2.wtkx (contents, props changed)
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/unconstrained_text_area_test.wtkx (props changed)
Propchange: incubator/pivot/trunk/charts/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/charts/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: incubator/pivot/trunk/core/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/core/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: incubator/pivot/trunk/core/test/org/apache/pivot/xml/test/XMLSerializerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/core/test/org/apache/pivot/xml/test/sample.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/core/test/org/apache/pivot/xml/test/sample.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/rss/RSSItemRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/GridPanes.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/GridPanes.java?rev=886129&r1=886128&r2=886129&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/GridPanes.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/GridPanes.java Wed Dec 2 12:12:03 2009
@@ -1,200 +1,200 @@
-/*
- * 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.layout;
-
-import org.apache.pivot.collections.ArrayList;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.wtk.Action;
-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.GridPane;
-import org.apache.pivot.wtk.Label;
-import org.apache.pivot.wtk.Menu;
-import org.apache.pivot.wtk.MenuHandler;
-import org.apache.pivot.wtk.MessageType;
-import org.apache.pivot.wtk.Panel;
-import org.apache.pivot.wtk.Prompt;
-import org.apache.pivot.wtk.Sheet;
-import org.apache.pivot.wtk.SheetCloseListener;
-import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtkx.WTKXSerializer;
-
-public class GridPanes implements Application {
- private class ContextMenuHandler extends MenuHandler.Adapter {
- private int x = -1;
- private int y = -1;
-
- @Override
- public boolean configureContextMenu(Component component, Menu menu, int x, int y) {
- this.x = x;
- this.y = y;
-
- // Add our menu sections
- menu.getSections().add(rowSection);
- menu.getSections().add(columnSection);
-
- return false;
- }
-
- public int getX() {
- return x;
- }
-
- public int getY() {
- return y;
- }
- }
-
- private Window window = null;
- private GridPane gridPane = null;
-
- private Menu.Section rowSection = null;
- private Menu.Section columnSection = null;
-
- private ContextMenuHandler contextMenuHandler = new ContextMenuHandler();
-
- public GridPanes() {
- Action.NamedActionDictionary namedActions = Action.getNamedActions();
-
- namedActions.put("insertRow", new Action() {
- @Override
- public void perform() {
- // Create and insert a new row
- GridPane.Row row = new GridPane.Row();
-
- // Populate the row with the expected content
- for (int i = 0, n = gridPane.getColumns().getLength(); i < n; i++) {
- Panel panel = new Panel();
- panel.getStyles().put("backgroundColor", "#dddcd5");
- row.add(panel);
- }
-
- int rowIndex = gridPane.getRowAt(contextMenuHandler.getY());
- gridPane.getRows().insert(row, rowIndex);
- }
- });
-
- namedActions.put("removeRow", new Action() {
- @Override
- public void perform() {
- ArrayList<String> options = new ArrayList<String>("OK", "Cancel");
- String message = "Remove Row?";
- Label body = new Label("Are you sure you want to remove the row?");
- body.getStyles().put("wrapText", true);
-
- final Prompt prompt = new Prompt(MessageType.QUESTION, message, options, body);
- prompt.setSelectedOption(0);
-
- prompt.open(window, new SheetCloseListener() {
- @Override
- public void sheetClosed(Sheet sheet) {
- if (prompt.getResult() && prompt.getSelectedOption() == 0) {
- int rowIndex = gridPane.getRowAt(contextMenuHandler.getY());
- gridPane.getRows().remove(rowIndex, 1);
- }
- }
- });
- }
- });
-
- namedActions.put("insertColumn", new Action() {
- @Override
- public void perform() {
- // Create and insert a new column
- GridPane.Column column = new GridPane.Column();
- int columnIndex = gridPane.getColumnAt(contextMenuHandler.getX());
- gridPane.getColumns().insert(column, columnIndex);
-
- // Populate the column with the expected content
- GridPane.RowSequence rows = gridPane.getRows();
- for (int i = 0, n = rows.getLength(); i < n; i++) {
- Panel panel = new Panel();
- panel.getStyles().put("backgroundColor", "#dddcd5");
- rows.get(i).insert(panel, columnIndex);
- }
- }
- });
-
- namedActions.put("removeColumn", new Action() {
- @Override
- public void perform() {
- ArrayList<String> options = new ArrayList<String>("OK", "Cancel");
- String message = "Remove Column?";
- Label body = new Label("Are you sure you want to remove the column?");
- body.getStyles().put("wrapText", true);
-
- final Prompt prompt = new Prompt(MessageType.QUESTION, message, options, body);
- prompt.setSelectedOption(0);
-
- prompt.open(window, new SheetCloseListener() {
- @Override
- public void sheetClosed(Sheet sheet) {
- if (prompt.getResult() && prompt.getSelectedOption() == 0) {
- int columnIndex = gridPane.getColumnAt(contextMenuHandler.getX());
-
- // Remove the component at that index from each row
- for (GridPane.Row row : gridPane.getRows()) {
- row.remove(columnIndex, 1);
- }
-
- gridPane.getColumns().remove(columnIndex, 1);
- }
- }
- });
- }
- });
- }
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "grid_panes.wtkx");
-
- gridPane = (GridPane)wtkxSerializer.get("gridPane");
- rowSection = (Menu.Section)wtkxSerializer.get("rowSection");
- columnSection = (Menu.Section)wtkxSerializer.get("columnSection");
-
- gridPane.setMenuHandler(contextMenuHandler);
-
- window.open(display);
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- if (window != null) {
- window.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- // No-op
- }
-
- @Override
- public void resume() {
- // No-op
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(GridPanes.class, args);
- }
-}
+/*
+ * 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.layout;
+
+import org.apache.pivot.collections.ArrayList;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Action;
+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.GridPane;
+import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.Menu;
+import org.apache.pivot.wtk.MenuHandler;
+import org.apache.pivot.wtk.MessageType;
+import org.apache.pivot.wtk.Panel;
+import org.apache.pivot.wtk.Prompt;
+import org.apache.pivot.wtk.Sheet;
+import org.apache.pivot.wtk.SheetCloseListener;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtkx.WTKXSerializer;
+
+public class GridPanes implements Application {
+ private class ContextMenuHandler extends MenuHandler.Adapter {
+ private int x = -1;
+ private int y = -1;
+
+ @Override
+ public boolean configureContextMenu(Component component, Menu menu, int x, int y) {
+ this.x = x;
+ this.y = y;
+
+ // Add our menu sections
+ menu.getSections().add(rowSection);
+ menu.getSections().add(columnSection);
+
+ return false;
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ public int getY() {
+ return y;
+ }
+ }
+
+ private Window window = null;
+ private GridPane gridPane = null;
+
+ private Menu.Section rowSection = null;
+ private Menu.Section columnSection = null;
+
+ private ContextMenuHandler contextMenuHandler = new ContextMenuHandler();
+
+ public GridPanes() {
+ Action.NamedActionDictionary namedActions = Action.getNamedActions();
+
+ namedActions.put("insertRow", new Action() {
+ @Override
+ public void perform() {
+ // Create and insert a new row
+ GridPane.Row row = new GridPane.Row();
+
+ // Populate the row with the expected content
+ for (int i = 0, n = gridPane.getColumns().getLength(); i < n; i++) {
+ Panel panel = new Panel();
+ panel.getStyles().put("backgroundColor", "#dddcd5");
+ row.add(panel);
+ }
+
+ int rowIndex = gridPane.getRowAt(contextMenuHandler.getY());
+ gridPane.getRows().insert(row, rowIndex);
+ }
+ });
+
+ namedActions.put("removeRow", new Action() {
+ @Override
+ public void perform() {
+ ArrayList<String> options = new ArrayList<String>("OK", "Cancel");
+ String message = "Remove Row?";
+ Label body = new Label("Are you sure you want to remove the row?");
+ body.getStyles().put("wrapText", true);
+
+ final Prompt prompt = new Prompt(MessageType.QUESTION, message, options, body);
+ prompt.setSelectedOption(0);
+
+ prompt.open(window, new SheetCloseListener() {
+ @Override
+ public void sheetClosed(Sheet sheet) {
+ if (prompt.getResult() && prompt.getSelectedOption() == 0) {
+ int rowIndex = gridPane.getRowAt(contextMenuHandler.getY());
+ gridPane.getRows().remove(rowIndex, 1);
+ }
+ }
+ });
+ }
+ });
+
+ namedActions.put("insertColumn", new Action() {
+ @Override
+ public void perform() {
+ // Create and insert a new column
+ GridPane.Column column = new GridPane.Column();
+ int columnIndex = gridPane.getColumnAt(contextMenuHandler.getX());
+ gridPane.getColumns().insert(column, columnIndex);
+
+ // Populate the column with the expected content
+ GridPane.RowSequence rows = gridPane.getRows();
+ for (int i = 0, n = rows.getLength(); i < n; i++) {
+ Panel panel = new Panel();
+ panel.getStyles().put("backgroundColor", "#dddcd5");
+ rows.get(i).insert(panel, columnIndex);
+ }
+ }
+ });
+
+ namedActions.put("removeColumn", new Action() {
+ @Override
+ public void perform() {
+ ArrayList<String> options = new ArrayList<String>("OK", "Cancel");
+ String message = "Remove Column?";
+ Label body = new Label("Are you sure you want to remove the column?");
+ body.getStyles().put("wrapText", true);
+
+ final Prompt prompt = new Prompt(MessageType.QUESTION, message, options, body);
+ prompt.setSelectedOption(0);
+
+ prompt.open(window, new SheetCloseListener() {
+ @Override
+ public void sheetClosed(Sheet sheet) {
+ if (prompt.getResult() && prompt.getSelectedOption() == 0) {
+ int columnIndex = gridPane.getColumnAt(contextMenuHandler.getX());
+
+ // Remove the component at that index from each row
+ for (GridPane.Row row : gridPane.getRows()) {
+ row.remove(columnIndex, 1);
+ }
+
+ gridPane.getColumns().remove(columnIndex, 1);
+ }
+ }
+ });
+ }
+ });
+ }
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ window = (Window)wtkxSerializer.readObject(this, "grid_panes.wtkx");
+
+ gridPane = (GridPane)wtkxSerializer.get("gridPane");
+ rowSection = (Menu.Section)wtkxSerializer.get("rowSection");
+ columnSection = (Menu.Section)wtkxSerializer.get("columnSection");
+
+ gridPane.setMenuHandler(contextMenuHandler);
+
+ window.open(display);
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ // No-op
+ }
+
+ @Override
+ public void resume() {
+ // No-op
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(GridPanes.class, args);
+ }
+}
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/GridPanes.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/SimpleGridPanes.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/SimpleGridPanes.java?rev=886129&r1=886128&r2=886129&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/SimpleGridPanes.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/SimpleGridPanes.java Wed Dec 2 12:12:03 2009
@@ -1,101 +1,101 @@
-/*
- * 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.layout;
-
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.BoxPane;
-import org.apache.pivot.wtk.Component;
-import org.apache.pivot.wtk.ComponentMouseButtonListener;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Dimensions;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.GridPane;
-import org.apache.pivot.wtk.Label;
-import org.apache.pivot.wtk.MessageType;
-import org.apache.pivot.wtk.Mouse;
-import org.apache.pivot.wtk.Orientation;
-import org.apache.pivot.wtk.Prompt;
-import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtkx.WTKXSerializer;
-
-public class SimpleGridPanes implements Application {
- private Window window = null;
- private GridPane gridPane = null;
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "simple_grid_panes.wtkx");
- gridPane = (GridPane)wtkxSerializer.get("gridPane");
-
- gridPane.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener.Adapter() {
- @Override
- public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
- int rowIndex = gridPane.getRowAt(y);
- int columnIndex = gridPane.getColumnAt(x);
-
- if (rowIndex >= 0
- && columnIndex >= 0) {
- Dimensions d = gridPane.getCellComponent(rowIndex, columnIndex).getSize();
- int rowHeight = d.height;
- int columnWidth = d.width;
-
- String message = "Registered Click At " + rowIndex + "," + columnIndex;
-
- Label heightLabel = new Label(String.format("The row's height is %d",
- rowHeight));
- Label widthLabel = new Label(String.format("The column's width is %d",
- columnWidth));
-
- BoxPane body = new BoxPane(Orientation.VERTICAL);
- body.add(heightLabel);
- body.add(widthLabel);
-
- Prompt.prompt(MessageType.INFO, message, body, window);
- }
-
- return false;
- }
- });
-
- window.open(display);
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- if (window != null) {
- window.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- // No-op
- }
-
- @Override
- public void resume() {
- // No-op
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(SimpleGridPanes.class, args);
- }
-}
+/*
+ * 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.layout;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.BoxPane;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.ComponentMouseButtonListener;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Dimensions;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.GridPane;
+import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.MessageType;
+import org.apache.pivot.wtk.Mouse;
+import org.apache.pivot.wtk.Orientation;
+import org.apache.pivot.wtk.Prompt;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtkx.WTKXSerializer;
+
+public class SimpleGridPanes implements Application {
+ private Window window = null;
+ private GridPane gridPane = null;
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ window = (Window)wtkxSerializer.readObject(this, "simple_grid_panes.wtkx");
+ gridPane = (GridPane)wtkxSerializer.get("gridPane");
+
+ gridPane.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener.Adapter() {
+ @Override
+ public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
+ int rowIndex = gridPane.getRowAt(y);
+ int columnIndex = gridPane.getColumnAt(x);
+
+ if (rowIndex >= 0
+ && columnIndex >= 0) {
+ Dimensions d = gridPane.getCellComponent(rowIndex, columnIndex).getSize();
+ int rowHeight = d.height;
+ int columnWidth = d.width;
+
+ String message = "Registered Click At " + rowIndex + "," + columnIndex;
+
+ Label heightLabel = new Label(String.format("The row's height is %d",
+ rowHeight));
+ Label widthLabel = new Label(String.format("The column's width is %d",
+ columnWidth));
+
+ BoxPane body = new BoxPane(Orientation.VERTICAL);
+ body.add(heightLabel);
+ body.add(widthLabel);
+
+ Prompt.prompt(MessageType.INFO, message, body, window);
+ }
+
+ return false;
+ }
+ });
+
+ window.open(display);
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ // No-op
+ }
+
+ @Override
+ public void resume() {
+ // No-op
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(SimpleGridPanes.class, args);
+ }
+}
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/SimpleGridPanes.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/grid_panes.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/grid_panes.wtkx?rev=886129&r1=886128&r2=886129&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/grid_panes.wtkx (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/grid_panes.wtkx Wed Dec 2 12:12:03 2009
@@ -1,164 +1,164 @@
-<?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.
--->
-
-<Window title="Grid Panes" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns:content="org.apache.pivot.wtk.content"
- xmlns="org.apache.pivot.wtk">
- <wtkx:define>
- <Menu.Section wtkx:id="rowSection">
- <Menu.Item action="insertRow" buttonData="Insert Row"/>
- <Menu.Item action="removeRow" buttonData="Remove Row"/>
- </Menu.Section>
- <Menu.Section wtkx:id="columnSection">
- <Menu.Item action="insertColumn" buttonData="Insert Column"/>
- <Menu.Item action="removeColumn" buttonData="Remove Column"/>
- </Menu.Section>
- </wtkx:define>
-
- <content>
- <SplitPane splitRatio="0.6">
- <left>
- <Border>
- <content>
- <GridPane wtkx:id="gridPane" styles="{verticalSpacing:21, showHorizontalGridLines:true,
- horizontalSpacing:21, showVerticalGridLines:true, padding:10}">
- <columns>
- <GridPane.Column />
- <GridPane.Column />
- <GridPane.Column />
- <GridPane.Column />
- </columns>
-
- <rows>
- <GridPane.Row>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- </GridPane.Row>
- <GridPane.Row>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- </GridPane.Row>
- <GridPane.Row>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- </GridPane.Row>
- <GridPane.Row>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- <Panel styles="{backgroundColor:'#dddcd5'}"/>
- </GridPane.Row>
- </rows>
- </GridPane>
- </content>
- </Border>
- </left>
- <right>
- <Border styles="{padding:10}">
- <content>
- <Form>
- <sections>
- <Form.Section>
- <Checkbox Form.label="Show horizontal grid lines" selected="true">
- <buttonStateListeners>
- <wtkx:script>
- <![CDATA[
- function stateChanged(button, previousState) {
- gridPane.getStyles().put("showHorizontalGridLines",
- button.isSelected());
- }
- ]]>
- </wtkx:script>
- </buttonStateListeners>
- </Checkbox>
- <Checkbox Form.label="Show vertical grid lines" selected="true">
- <buttonStateListeners>
- <wtkx:script>
- <![CDATA[
- function stateChanged(button, previousState) {
- gridPane.getStyles().put("showVerticalGridLines",
- button.isSelected());
- }
- ]]>
- </wtkx:script>
- </buttonStateListeners>
- </Checkbox>
- <Spinner Form.label="Horizontal spacing" selectedIndex="21"
- styles="{sizeToContent:true}">
- <spinnerData>
- <content:NumericSpinnerData lowerBound="0" upperBound="50"/>
- </spinnerData>
- <spinnerSelectionListeners>
- <wtkx:script>
- <![CDATA[
- function selectedIndexChanged(spinner, previousSelectedIndex) {
- gridPane.getStyles().put("horizontalSpacing",
- spinner.getSelectedItem());
- }
- ]]>
- </wtkx:script>
- </spinnerSelectionListeners>
- </Spinner>
- <Spinner Form.label="Vertical spacing" selectedIndex="21"
- styles="{sizeToContent:true}">
- <spinnerData>
- <content:NumericSpinnerData lowerBound="0" upperBound="50"/>
- </spinnerData>
- <spinnerSelectionListeners>
- <wtkx:script>
- <![CDATA[
- function selectedIndexChanged(spinner, previousSelectedIndex) {
- gridPane.getStyles().put("verticalSpacing",
- spinner.getSelectedItem());
- }
- ]]>
- </wtkx:script>
- </spinnerSelectionListeners>
- </Spinner>
- <Spinner Form.label="Padding" selectedIndex="10"
- styles="{sizeToContent:true}">
- <spinnerData>
- <content:NumericSpinnerData lowerBound="0" upperBound="25"/>
- </spinnerData>
- <spinnerSelectionListeners>
- <wtkx:script>
- <![CDATA[
- function selectedIndexChanged(spinner, previousSelectedIndex) {
- gridPane.getStyles().put("padding",
- spinner.getSelectedItem());
- }
- ]]>
- </wtkx:script>
- </spinnerSelectionListeners>
- </Spinner>
- </Form.Section>
- </sections>
- </Form>
- </content>
- </Border>
- </right>
- </SplitPane>
- </content>
-</Window>
+<?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.
+-->
+
+<Window title="Grid Panes" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk">
+ <wtkx:define>
+ <Menu.Section wtkx:id="rowSection">
+ <Menu.Item action="insertRow" buttonData="Insert Row"/>
+ <Menu.Item action="removeRow" buttonData="Remove Row"/>
+ </Menu.Section>
+ <Menu.Section wtkx:id="columnSection">
+ <Menu.Item action="insertColumn" buttonData="Insert Column"/>
+ <Menu.Item action="removeColumn" buttonData="Remove Column"/>
+ </Menu.Section>
+ </wtkx:define>
+
+ <content>
+ <SplitPane splitRatio="0.6">
+ <left>
+ <Border>
+ <content>
+ <GridPane wtkx:id="gridPane" styles="{verticalSpacing:21, showHorizontalGridLines:true,
+ horizontalSpacing:21, showVerticalGridLines:true, padding:10}">
+ <columns>
+ <GridPane.Column />
+ <GridPane.Column />
+ <GridPane.Column />
+ <GridPane.Column />
+ </columns>
+
+ <rows>
+ <GridPane.Row>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ </GridPane.Row>
+ <GridPane.Row>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ </GridPane.Row>
+ <GridPane.Row>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ </GridPane.Row>
+ <GridPane.Row>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ <Panel styles="{backgroundColor:'#dddcd5'}"/>
+ </GridPane.Row>
+ </rows>
+ </GridPane>
+ </content>
+ </Border>
+ </left>
+ <right>
+ <Border styles="{padding:10}">
+ <content>
+ <Form>
+ <sections>
+ <Form.Section>
+ <Checkbox Form.label="Show horizontal grid lines" selected="true">
+ <buttonStateListeners>
+ <wtkx:script>
+ <![CDATA[
+ function stateChanged(button, previousState) {
+ gridPane.getStyles().put("showHorizontalGridLines",
+ button.isSelected());
+ }
+ ]]>
+ </wtkx:script>
+ </buttonStateListeners>
+ </Checkbox>
+ <Checkbox Form.label="Show vertical grid lines" selected="true">
+ <buttonStateListeners>
+ <wtkx:script>
+ <![CDATA[
+ function stateChanged(button, previousState) {
+ gridPane.getStyles().put("showVerticalGridLines",
+ button.isSelected());
+ }
+ ]]>
+ </wtkx:script>
+ </buttonStateListeners>
+ </Checkbox>
+ <Spinner Form.label="Horizontal spacing" selectedIndex="21"
+ styles="{sizeToContent:true}">
+ <spinnerData>
+ <content:NumericSpinnerData lowerBound="0" upperBound="50"/>
+ </spinnerData>
+ <spinnerSelectionListeners>
+ <wtkx:script>
+ <![CDATA[
+ function selectedIndexChanged(spinner, previousSelectedIndex) {
+ gridPane.getStyles().put("horizontalSpacing",
+ spinner.getSelectedItem());
+ }
+ ]]>
+ </wtkx:script>
+ </spinnerSelectionListeners>
+ </Spinner>
+ <Spinner Form.label="Vertical spacing" selectedIndex="21"
+ styles="{sizeToContent:true}">
+ <spinnerData>
+ <content:NumericSpinnerData lowerBound="0" upperBound="50"/>
+ </spinnerData>
+ <spinnerSelectionListeners>
+ <wtkx:script>
+ <![CDATA[
+ function selectedIndexChanged(spinner, previousSelectedIndex) {
+ gridPane.getStyles().put("verticalSpacing",
+ spinner.getSelectedItem());
+ }
+ ]]>
+ </wtkx:script>
+ </spinnerSelectionListeners>
+ </Spinner>
+ <Spinner Form.label="Padding" selectedIndex="10"
+ styles="{sizeToContent:true}">
+ <spinnerData>
+ <content:NumericSpinnerData lowerBound="0" upperBound="25"/>
+ </spinnerData>
+ <spinnerSelectionListeners>
+ <wtkx:script>
+ <![CDATA[
+ function selectedIndexChanged(spinner, previousSelectedIndex) {
+ gridPane.getStyles().put("padding",
+ spinner.getSelectedItem());
+ }
+ ]]>
+ </wtkx:script>
+ </spinnerSelectionListeners>
+ </Spinner>
+ </Form.Section>
+ </sections>
+ </Form>
+ </content>
+ </Border>
+ </right>
+ </SplitPane>
+ </content>
+</Window>
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/grid_panes.wtkx
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/grid_panes.wtkx
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/simple_grid_panes.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/simple_grid_panes.wtkx?rev=886129&r1=886128&r2=886129&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/simple_grid_panes.wtkx (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/simple_grid_panes.wtkx Wed Dec 2 12:12:03 2009
@@ -1,60 +1,60 @@
-<?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.
--->
-
-<Window wtkx:id="window" title="Grid Panes" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns="org.apache.pivot.wtk">
- <content>
- <Border>
- <content>
- <GridPane wtkx:id="gridPane" styles="{verticalSpacing:1, showHorizontalGridLines:true,
- horizontalSpacing:1, showVerticalGridLines:true}">
- <columns>
- <GridPane.Column />
- <GridPane.Column />
- <GridPane.Column />
- <GridPane.Column />
- <GridPane.Column />
- </columns>
-
- <rows>
- <GridPane.Row>
- <GridPane.Filler/>
- <Label text="50" styles="{horizontalAlignment:'center'}"/>
- <Label text="-1" styles="{horizontalAlignment:'center'}"/>
- <Label text="1*" styles="{horizontalAlignment:'center'}"/>
- <Label text="2*" styles="{horizontalAlignment:'center'}"/>
- </GridPane.Row>
- <GridPane.Row>
- <Label text="50" styles="{verticalAlignment:'center'}"/>
- </GridPane.Row>
- <GridPane.Row>
- <Label text="-1" styles="{verticalAlignment:'center'}"/>
- </GridPane.Row>
- <GridPane.Row>
- <Label text="1*" styles="{verticalAlignment:'center'}"/>
- </GridPane.Row>
- <GridPane.Row>
- <Label text="2*" styles="{verticalAlignment:'center'}"/>
- </GridPane.Row>
- </rows>
- </GridPane>
- </content>
- </Border>
- </content>
-</Window>
+<?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.
+-->
+
+<Window wtkx:id="window" title="Grid Panes" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <Border>
+ <content>
+ <GridPane wtkx:id="gridPane" styles="{verticalSpacing:1, showHorizontalGridLines:true,
+ horizontalSpacing:1, showVerticalGridLines:true}">
+ <columns>
+ <GridPane.Column />
+ <GridPane.Column />
+ <GridPane.Column />
+ <GridPane.Column />
+ <GridPane.Column />
+ </columns>
+
+ <rows>
+ <GridPane.Row>
+ <GridPane.Filler/>
+ <Label text="50" styles="{horizontalAlignment:'center'}"/>
+ <Label text="-1" styles="{horizontalAlignment:'center'}"/>
+ <Label text="1*" styles="{horizontalAlignment:'center'}"/>
+ <Label text="2*" styles="{horizontalAlignment:'center'}"/>
+ </GridPane.Row>
+ <GridPane.Row>
+ <Label text="50" styles="{verticalAlignment:'center'}"/>
+ </GridPane.Row>
+ <GridPane.Row>
+ <Label text="-1" styles="{verticalAlignment:'center'}"/>
+ </GridPane.Row>
+ <GridPane.Row>
+ <Label text="1*" styles="{verticalAlignment:'center'}"/>
+ </GridPane.Row>
+ <GridPane.Row>
+ <Label text="2*" styles="{verticalAlignment:'center'}"/>
+ </GridPane.Row>
+ </rows>
+ </GridPane>
+ </content>
+ </Border>
+ </content>
+</Window>
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/simple_grid_panes.wtkx
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/simple_grid_panes.wtkx
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/sample1.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/sample2.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/web/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/web/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: incubator/pivot/trunk/wtk-terra/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/wtk-terra/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: incubator/pivot/trunk/wtk/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/wtk/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java?rev=886129&r1=886128&r2=886129&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java Wed Dec 2 12:12:03 2009
@@ -1,98 +1,98 @@
-/*
- * 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.content;
-
-import java.awt.Color;
-import java.awt.Font;
-
-import org.apache.pivot.beans.BeanDictionary;
-import org.apache.pivot.collections.Dictionary;
-import org.apache.pivot.wtk.Component;
-import org.apache.pivot.wtk.Insets;
-import org.apache.pivot.wtk.TableView;
-import org.apache.pivot.wtk.TextArea;
-
-
-/**
- * Renders cell contents as a string using TextArea. Only really useful when the TableView is using the variableRowHeight style.
- */
-public class TableViewTextAreaCellRenderer extends TextArea
- implements TableView.CellRenderer {
- public TableViewTextAreaCellRenderer() {
- getStyles().put("margin", 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,
- TableView tableView, String columnName,
- boolean rowSelected, boolean rowHighlighted, boolean rowDisabled) {
- renderStyles(tableView, rowSelected, rowDisabled);
-
- if (value != null) {
- Object cellData = null;
-
- // Get the row and cell data
- if (columnName != null) {
- Dictionary<String, Object> rowData;
- if (value instanceof Dictionary<?, ?>) {
- rowData = (Dictionary<String, Object>)value;
- } else {
- rowData = new BeanDictionary(value);
- }
-
- cellData = rowData.get(columnName);
- }
-
- setText(cellData == null ? null : cellData.toString());
- }
- }
-
- protected void renderStyles(TableView tableView, boolean rowSelected, boolean rowDisabled) {
- Component.StyleDictionary tableViewStyles = tableView.getStyles();
- Component.StyleDictionary styles = getStyles();
-
- Font font = (Font)tableViewStyles.get("font");
- styles.put("font", font);
-
- Color color;
- if (tableView.isEnabled() && !rowDisabled) {
- if (rowSelected) {
- if (tableView.isFocused()) {
- color = (Color)tableViewStyles.get("selectionColor");
- } else {
- color = (Color)tableViewStyles.get("inactiveSelectionColor");
- }
- } else {
- color = (Color)tableViewStyles.get("color");
- }
- } else {
- color = (Color)tableViewStyles.get("disabledColor");
- }
-
- styles.put("color", color);
- }
-}
+/*
+ * 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.content;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import org.apache.pivot.beans.BeanDictionary;
+import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.Insets;
+import org.apache.pivot.wtk.TableView;
+import org.apache.pivot.wtk.TextArea;
+
+
+/**
+ * Renders cell contents as a string using TextArea. Only really useful when the TableView is using the variableRowHeight style.
+ */
+public class TableViewTextAreaCellRenderer extends TextArea
+ implements TableView.CellRenderer {
+ public TableViewTextAreaCellRenderer() {
+ getStyles().put("margin", 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,
+ TableView tableView, String columnName,
+ boolean rowSelected, boolean rowHighlighted, boolean rowDisabled) {
+ renderStyles(tableView, rowSelected, rowDisabled);
+
+ if (value != null) {
+ Object cellData = null;
+
+ // Get the row and cell data
+ if (columnName != null) {
+ Dictionary<String, Object> rowData;
+ if (value instanceof Dictionary<?, ?>) {
+ rowData = (Dictionary<String, Object>)value;
+ } else {
+ rowData = new BeanDictionary(value);
+ }
+
+ cellData = rowData.get(columnName);
+ }
+
+ setText(cellData == null ? null : cellData.toString());
+ }
+ }
+
+ protected void renderStyles(TableView tableView, boolean rowSelected, boolean rowDisabled) {
+ Component.StyleDictionary tableViewStyles = tableView.getStyles();
+ Component.StyleDictionary styles = getStyles();
+
+ Font font = (Font)tableViewStyles.get("font");
+ styles.put("font", font);
+
+ Color color;
+ if (tableView.isEnabled() && !rowDisabled) {
+ if (rowSelected) {
+ if (tableView.isFocused()) {
+ color = (Color)tableViewStyles.get("selectionColor");
+ } else {
+ color = (Color)tableViewStyles.get("inactiveSelectionColor");
+ }
+ } else {
+ color = (Color)tableViewStyles.get("color");
+ }
+ } else {
+ color = (Color)tableViewStyles.get("disabledColor");
+ }
+
+ styles.put("color", color);
+ }
+}
Propchange: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TableViewTest2.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TableViewTest2.java?rev=886129&r1=886128&r2=886129&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TableViewTest2.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TableViewTest2.java Wed Dec 2 12:12:03 2009
@@ -1,72 +1,72 @@
-/*
- * 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.test;
-
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.TableView;
-import org.apache.pivot.wtk.TextArea;
-import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtk.content.TableViewRowEditor;
-import org.apache.pivot.wtk.skin.CardPaneSkin;
-import org.apache.pivot.wtkx.WTKXSerializer;
-
-public class TableViewTest2 implements Application {
- private Window window = null;
- private TableView tableView = null;
-
- @Override
- public void startup(Display display, Map<String, String> properties)
- throws Exception {
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
- window = (Window)wtkxSerializer.readObject(this, "table_view_test2.wtkx");
- tableView = (TableView)wtkxSerializer.get("tableView");
-
- TableViewRowEditor tableViewRowEditor = new TableViewRowEditor();
- tableViewRowEditor.setEditEffect(CardPaneSkin.SelectionChangeEffect.HORIZONTAL_SLIDE);
- tableView.setRowEditor(tableViewRowEditor);
-
- TextArea textArea = new TextArea();
- textArea.setTextKey("value");
- tableViewRowEditor.getCellEditors().put("value", textArea);
-
- window.open(display);
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- if (window != null) {
- window.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(TableViewTest2.class, args);
- }
-}
+/*
+ * 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.test;
+
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.TableView;
+import org.apache.pivot.wtk.TextArea;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtk.content.TableViewRowEditor;
+import org.apache.pivot.wtk.skin.CardPaneSkin;
+import org.apache.pivot.wtkx.WTKXSerializer;
+
+public class TableViewTest2 implements Application {
+ private Window window = null;
+ private TableView tableView = null;
+
+ @Override
+ public void startup(Display display, Map<String, String> properties)
+ throws Exception {
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+ window = (Window)wtkxSerializer.readObject(this, "table_view_test2.wtkx");
+ tableView = (TableView)wtkxSerializer.get("tableView");
+
+ TableViewRowEditor tableViewRowEditor = new TableViewRowEditor();
+ tableViewRowEditor.setEditEffect(CardPaneSkin.SelectionChangeEffect.HORIZONTAL_SLIDE);
+ tableView.setRowEditor(tableViewRowEditor);
+
+ TextArea textArea = new TextArea();
+ textArea.setTextKey("value");
+ tableViewRowEditor.getCellEditors().put("value", textArea);
+
+ window.open(display);
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(TableViewTest2.class, args);
+ }
+}
Propchange: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/TableViewTest2.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_view_test2.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_view_test2.wtkx?rev=886129&r1=886128&r2=886129&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_view_test2.wtkx (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_view_test2.wtkx Wed Dec 2 12:12:03 2009
@@ -1,45 +1,45 @@
-<?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.
--->
-
-<Window title="Table View Test2" maximized="true"
- xmlns:wtkx="http://pivot.apache.org/wtkx"
- xmlns:collections="org.apache.pivot.collections"
- xmlns:content="org.apache.pivot.wtk.content"
- xmlns="org.apache.pivot.wtk">
- <content>
- <TableView wtkx:id="tableView" styles="{variableRowHeight:true}">
- <columns>
- <TableView.Column name="value" width="100">
- <cellRenderer>
- <content:TableViewTextAreaCellRenderer />
- </cellRenderer>
- </TableView.Column>
-
- <TableView.Column width="1*"/>
- </columns>
- <tableData>
- <collections:ArrayList>
- <collections:HashMap value="Single Line"/>
- <collections:HashMap value="Double
Line"/>
- <collections:HashMap value="Single Line"/>
- <collections:HashMap value="Double
Line"/>
- </collections:ArrayList>
- </tableData>
- </TableView>
- </content>
-</Window>
+<?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.
+-->
+
+<Window title="Table View Test2" maximized="true"
+ xmlns:wtkx="http://pivot.apache.org/wtkx"
+ xmlns:collections="org.apache.pivot.collections"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk">
+ <content>
+ <TableView wtkx:id="tableView" styles="{variableRowHeight:true}">
+ <columns>
+ <TableView.Column name="value" width="100">
+ <cellRenderer>
+ <content:TableViewTextAreaCellRenderer />
+ </cellRenderer>
+ </TableView.Column>
+
+ <TableView.Column width="1*"/>
+ </columns>
+ <tableData>
+ <collections:ArrayList>
+ <collections:HashMap value="Single Line"/>
+ <collections:HashMap value="Double
Line"/>
+ <collections:HashMap value="Single Line"/>
+ <collections:HashMap value="Double
Line"/>
+ </collections:ArrayList>
+ </tableData>
+ </TableView>
+ </content>
+</Window>
Propchange: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_view_test2.wtkx
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/table_view_test2.wtkx
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/unconstrained_text_area_test.wtkx
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/text/test/unconstrained_text_area_test.wtkx
------------------------------------------------------------------------------
svn:mime-type = text/xml