Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java Tue Oct 31 19:15:47 2023 @@ -1,155 +1,155 @@ -/* - * 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.tests.issues.pivot894; - -import java.awt.EventQueue; -import java.io.File; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.pivot.beans.BXMLSerializer; -import org.apache.pivot.collections.Map; -import org.apache.pivot.util.concurrent.TaskExecutionException; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.ApplicationContext; -import org.apache.pivot.wtk.CardPane; -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.GridPane.Row; -import org.apache.pivot.wtk.PushButton; -import org.apache.pivot.wtk.Style; -import org.apache.pivot.wtk.Window; -import org.apache.pivot.wtk.content.ButtonData; -import org.apache.pivot.wtk.media.Image; -import org.apache.pivot.wtk.skin.CardPaneSkin; - -public class Pivot894 implements Application { - // global counter, just to know how many iterations the application is doing - static int num = 0; - - @Override - public void startup(Display display, Map<String, String> properties) throws Exception { - System.out.println("public startup(...)"); - System.out.println("\n" - + "Attention: now the application will go in an infinite loop, to be able to see the memory leak.\n" - + "Note that probably you'll have to kill the application from outside (kill the Java process).\n" - + "\n"); - - // add some sleep to let users see the warning messages in console ... - Thread.sleep(2000); - - final CardPane cardPane = new CardPane(); - cardPane.putStyle(Style.selectionChangeEffect, - CardPaneSkin.SelectionChangeEffect.HORIZONTAL_SLIDE); - - final Window window = new Window(cardPane); - window.open(display); - - ApplicationContext.scheduleRecurringCallback(new Runnable() { - @Override - public void run() { - Thread.currentThread().setName("switcher-thread"); - - System.out.println("Run num " + num++); // temp - - /* - * // // method 1: // // Seems to be working just fine final - * GridPane grid = new GridPane(3); - * grid.getRows().add(createGridRow()); - * grid.getRows().add(createGridRow()); - * grid.getRows().add(createGridRow()); - */ - - // - // method 2: - // - try { - // Before the fixes for PIVOT-861 (part two) it was causing - // out of memory ... - // - // Note that this has been moved to another issue, but the - // problem is due to the usage - // of dataRenderer tags (and then instancing - // ButtonDataRenderer) in the loaded bxml, - // so probably even this test will be updated ... - // - final GridPane grid = (GridPane) new BXMLSerializer().readObject( - Pivot894.class, "btn_grid.bxml"); - - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - Iterator<Component> iterator = cardPane.iterator(); - List<Component> componentList = new ArrayList<>(); - while (iterator.hasNext()) { - Component card = iterator.next(); - if (!card.isShowing()) { - componentList.add(card); - } - } - - for (Component card : componentList) { - cardPane.remove(card); - } - - cardPane.setSelectedIndex(cardPane.add(grid)); - - System.out.println(cardPane.getSelectedIndex()); - } - }); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - @SuppressWarnings("unused") - private Row createGridRow() { - Row row = new Row(); - try { - // note that this method doesn't use ApplicationContext - // cache for images ... - row.add(new PushButton(new ButtonData( - Image.load(new File("clock_icon.png").toURI().toURL()), "Clock"))); - row.add(new PushButton(new ButtonData( - Image.load(new File("clock_icon.png").toURI().toURL()), "Clock"))); - row.add(new PushButton(new ButtonData( - Image.load(new File("clock_icon.png").toURI().toURL()), "Clock"))); - } catch (MalformedURLException e) { - e.printStackTrace(); - } catch (TaskExecutionException e) { - e.printStackTrace(); - } - return row; - } - }, 100); - } - - @Override - public boolean shutdown(boolean optional) throws Exception { - return false; - } - - public static void main(String[] args) { - DesktopApplicationContext.main(Pivot894.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.tests.issues.pivot894; + +import java.awt.EventQueue; +import java.io.File; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.pivot.beans.BXMLSerializer; +import org.apache.pivot.collections.Map; +import org.apache.pivot.util.concurrent.TaskExecutionException; +import org.apache.pivot.wtk.Application; +import org.apache.pivot.wtk.ApplicationContext; +import org.apache.pivot.wtk.CardPane; +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.GridPane.Row; +import org.apache.pivot.wtk.PushButton; +import org.apache.pivot.wtk.Style; +import org.apache.pivot.wtk.Window; +import org.apache.pivot.wtk.content.ButtonData; +import org.apache.pivot.wtk.media.Image; +import org.apache.pivot.wtk.skin.CardPaneSkin; + +public class Pivot894 implements Application { + // global counter, just to know how many iterations the application is doing + static int num = 0; + + @Override + public void startup(Display display, Map<String, String> properties) throws Exception { + System.out.println("public startup(...)"); + System.out.println("\n" + + "Attention: now the application will go in an infinite loop, to be able to see the memory leak.\n" + + "Note that probably you'll have to kill the application from outside (kill the Java process).\n" + + "\n"); + + // add some sleep to let users see the warning messages in console ... + Thread.sleep(2000); + + final CardPane cardPane = new CardPane(); + cardPane.putStyle(Style.selectionChangeEffect, + CardPaneSkin.SelectionChangeEffect.HORIZONTAL_SLIDE); + + final Window window = new Window(cardPane); + window.open(display); + + ApplicationContext.scheduleRecurringCallback(new Runnable() { + @Override + public void run() { + Thread.currentThread().setName("switcher-thread"); + + System.out.println("Run num " + num++); // temp + + /* + * // // method 1: // // Seems to be working just fine final + * GridPane grid = new GridPane(3); + * grid.getRows().add(createGridRow()); + * grid.getRows().add(createGridRow()); + * grid.getRows().add(createGridRow()); + */ + + // + // method 2: + // + try { + // Before the fixes for PIVOT-861 (part two) it was causing + // out of memory ... + // + // Note that this has been moved to another issue, but the + // problem is due to the usage + // of dataRenderer tags (and then instancing + // ButtonDataRenderer) in the loaded bxml, + // so probably even this test will be updated ... + // + final GridPane grid = (GridPane) new BXMLSerializer().readObject( + Pivot894.class, "btn_grid.bxml"); + + EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + Iterator<Component> iterator = cardPane.iterator(); + List<Component> componentList = new ArrayList<>(); + while (iterator.hasNext()) { + Component card = iterator.next(); + if (!card.isShowing()) { + componentList.add(card); + } + } + + for (Component card : componentList) { + cardPane.remove(card); + } + + cardPane.setSelectedIndex(cardPane.add(grid)); + + System.out.println(cardPane.getSelectedIndex()); + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + @SuppressWarnings("unused") + private Row createGridRow() { + Row row = new Row(); + try { + // note that this method doesn't use ApplicationContext + // cache for images ... + row.add(new PushButton(new ButtonData( + Image.load(new File("clock_icon.png").toURI().toURL()), "Clock"))); + row.add(new PushButton(new ButtonData( + Image.load(new File("clock_icon.png").toURI().toURL()), "Clock"))); + row.add(new PushButton(new ButtonData( + Image.load(new File("clock_icon.png").toURI().toURL()), "Clock"))); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (TaskExecutionException e) { + e.printStackTrace(); + } + return row; + } + }, 100); + } + + @Override + public boolean shutdown(boolean optional) throws Exception { + return false; + } + + public static void main(String[] args) { + DesktopApplicationContext.main(Pivot894.class, args); + } + +}
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml Tue Oct 31 19:15:47 2023 @@ -1,87 +1,87 @@ -<?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. ---> - -<GridPane - xmlns:bxml="http://pivot.apache.org/bxml" - xmlns:content="org.apache.pivot.wtk.content" - xmlns="org.apache.pivot.wtk" - columnCount="3" - styles="{horizontalSpacing:1, verticalSpacing:1, - showHorizontalGridLines:true, showVerticalGridLines:true}" -> - <GridPane.Row> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - </GridPane.Row> - <GridPane.Row> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - </GridPane.Row> - <GridPane.Row> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - <PushButton > - <dataRenderer> - <content:ButtonDataRenderer/> - </dataRenderer> - <content:ButtonData text="BXML" icon="@../../clock.png" /> - </PushButton> - </GridPane.Row> -</GridPane> +<?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. +--> + +<GridPane + xmlns:bxml="http://pivot.apache.org/bxml" + xmlns:content="org.apache.pivot.wtk.content" + xmlns="org.apache.pivot.wtk" + columnCount="3" + styles="{horizontalSpacing:1, verticalSpacing:1, + showHorizontalGridLines:true, showVerticalGridLines:true}" +> + <GridPane.Row> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + </GridPane.Row> + <GridPane.Row> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + </GridPane.Row> + <GridPane.Row> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + <PushButton > + <dataRenderer> + <content:ButtonDataRenderer/> + </dataRenderer> + <content:ButtonData text="BXML" icon="@../../clock.png" /> + </PushButton> + </GridPane.Row> +</GridPane> Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/Pivot929.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/Pivot929.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/Pivot929.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/Pivot929.java Tue Oct 31 19:15:47 2023 @@ -1,55 +1,55 @@ -/* - * 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.tests.issues.pivot929; - -import static org.junit.Assert.assertNotNull; - -import java.awt.EventQueue; - -import org.apache.pivot.wtk.Clipboard; -import org.apache.pivot.wtk.LocalManifest; -import org.junit.Test; - -public class Pivot929 { - - @Test - public void testClipboard() throws Exception { - setClipboardContent(); - waitForEvents(); - assertNotNull(Clipboard.getContent().getValue("A")); - setClipboardContent(); - waitForEvents(); - assertNotNull(Clipboard.getContent().getValue("A")); - } - - private void setClipboardContent() { - LocalManifest manifest = new LocalManifest(); - manifest.putValue("A", new Object()); - manifest.putText("A"); - Clipboard.setContent(manifest); - } - - private void waitForEvents() throws Exception { - EventQueue.invokeAndWait(new Runnable() { - @Override - public void run() { - // No-op - } - }); - } - -} +/* + * 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.tests.issues.pivot929; + +import static org.junit.Assert.assertNotNull; + +import java.awt.EventQueue; + +import org.apache.pivot.wtk.Clipboard; +import org.apache.pivot.wtk.LocalManifest; +import org.junit.Test; + +public class Pivot929 { + + @Test + public void testClipboard() throws Exception { + setClipboardContent(); + waitForEvents(); + assertNotNull(Clipboard.getContent().getValue("A")); + setClipboardContent(); + waitForEvents(); + assertNotNull(Clipboard.getContent().getValue("A")); + } + + private void setClipboardContent() { + LocalManifest manifest = new LocalManifest(); + manifest.putValue("A", new Object()); + manifest.putText("A"); + Clipboard.setContent(manifest); + } + + private void waitForEvents() throws Exception { + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + // No-op + } + }); + } + +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/Pivot929.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/Pivot948.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/Pivot948.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/Pivot948.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/Pivot948.java Tue Oct 31 19:15:47 2023 @@ -1,128 +1,128 @@ -/* - * 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.tests.issues.pivot948; - -import org.apache.pivot.beans.BXML; -import org.apache.pivot.beans.BXMLSerializer; -import org.apache.pivot.collections.List; -import org.apache.pivot.collections.Map; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.BindType; -import org.apache.pivot.wtk.Button; -import org.apache.pivot.wtk.ButtonPressListener; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.ListButton; -import org.apache.pivot.wtk.ListView; -import org.apache.pivot.wtk.PushButton; -import org.apache.pivot.wtk.TextInput; -import org.apache.pivot.wtk.Window; - -public class Pivot948 implements Application, ButtonPressListener, ListView.ItemBindMapping { - private Window window = null; - @BXML private ListButton inputList; - @BXML private PushButton loadButton; - @BXML private PushButton storeButton; - @BXML private TextInput outputResult; - private Integer listIndex = null; - - /** Method of the {@link Application.Adapter} interface. */ - @Override - public void startup(Display display, Map<String, String> properties) throws Exception { - BXMLSerializer bxmlSerializer = new BXMLSerializer(); - window = (Window) bxmlSerializer.readObject(this.getClass(), "pivot_948.bxml"); - bxmlSerializer.bind(this); - - loadButton.getButtonPressListeners().add(this); - storeButton.getButtonPressListeners().add(this); - - // Establish a "selected item binding" between the "listIndex" integer and the - // "inputList" selected item index. A null integer implies no selection - // (index of -1). - inputList.setSelectedItemBindMapping(this); - inputList.setSelectedItemBindType(BindType.BOTH); - inputList.setSelectedItemKey("listIndex"); - - buttonPressed(storeButton); - - window.open(display); - } - - /** Method of the {@link Application.Adapter} interface. */ - @Override - public boolean shutdown(boolean optional) { - if (window != null) { - window.close(); - } - - return false; - } - - /** - * @return The list index as an integer (call be {@code null}). - */ - public Integer getListIndex() { - return listIndex; - } - - /** - * Set the current list index to the new value. - * @param newIndex The new index value (which can be {@code null}). - */ - public void setListIndex(Integer newIndex) { - listIndex = newIndex; - } - - /** Method of the {@link ListView.ItemBindMapping} interface, called during "store". */ - @Override - public Object get(List<?> listData, int index) { - return Integer.valueOf(index); - } - - /** Method of the {@link ListView.ItemBindMapping} interface, called during "load". */ - @Override - public int indexOf(List<?> listData, Object value) { - if (value != null) { - Integer iVal = (Integer) value; - return iVal.intValue(); - } - // Null item implies nothing selected, so return -1 as the index - return -1; - } - - /** Method of the {@link ButtonPressListener} interface. */ - @Override - public void buttonPressed(Button button) { - if (button == loadButton) { - String text = outputResult.getText(); - if (text == null || text.trim().isEmpty()) { - listIndex = null; - } else { - listIndex = Integer.valueOf(text); - } - inputList.load(this); - } else if (button == storeButton) { - inputList.store(this); - outputResult.setText(listIndex == null ? "" : listIndex.toString()); - } - } - - public static void main(String[] args) { - DesktopApplicationContext.main(Pivot948.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.tests.issues.pivot948; + +import org.apache.pivot.beans.BXML; +import org.apache.pivot.beans.BXMLSerializer; +import org.apache.pivot.collections.List; +import org.apache.pivot.collections.Map; +import org.apache.pivot.wtk.Application; +import org.apache.pivot.wtk.BindType; +import org.apache.pivot.wtk.Button; +import org.apache.pivot.wtk.ButtonPressListener; +import org.apache.pivot.wtk.DesktopApplicationContext; +import org.apache.pivot.wtk.Display; +import org.apache.pivot.wtk.ListButton; +import org.apache.pivot.wtk.ListView; +import org.apache.pivot.wtk.PushButton; +import org.apache.pivot.wtk.TextInput; +import org.apache.pivot.wtk.Window; + +public class Pivot948 implements Application, ButtonPressListener, ListView.ItemBindMapping { + private Window window = null; + @BXML private ListButton inputList; + @BXML private PushButton loadButton; + @BXML private PushButton storeButton; + @BXML private TextInput outputResult; + private Integer listIndex = null; + + /** Method of the {@link Application.Adapter} interface. */ + @Override + public void startup(Display display, Map<String, String> properties) throws Exception { + BXMLSerializer bxmlSerializer = new BXMLSerializer(); + window = (Window) bxmlSerializer.readObject(this.getClass(), "pivot_948.bxml"); + bxmlSerializer.bind(this); + + loadButton.getButtonPressListeners().add(this); + storeButton.getButtonPressListeners().add(this); + + // Establish a "selected item binding" between the "listIndex" integer and the + // "inputList" selected item index. A null integer implies no selection + // (index of -1). + inputList.setSelectedItemBindMapping(this); + inputList.setSelectedItemBindType(BindType.BOTH); + inputList.setSelectedItemKey("listIndex"); + + buttonPressed(storeButton); + + window.open(display); + } + + /** Method of the {@link Application.Adapter} interface. */ + @Override + public boolean shutdown(boolean optional) { + if (window != null) { + window.close(); + } + + return false; + } + + /** + * @return The list index as an integer (call be {@code null}). + */ + public Integer getListIndex() { + return listIndex; + } + + /** + * Set the current list index to the new value. + * @param newIndex The new index value (which can be {@code null}). + */ + public void setListIndex(Integer newIndex) { + listIndex = newIndex; + } + + /** Method of the {@link ListView.ItemBindMapping} interface, called during "store". */ + @Override + public Object get(List<?> listData, int index) { + return Integer.valueOf(index); + } + + /** Method of the {@link ListView.ItemBindMapping} interface, called during "load". */ + @Override + public int indexOf(List<?> listData, Object value) { + if (value != null) { + Integer iVal = (Integer) value; + return iVal.intValue(); + } + // Null item implies nothing selected, so return -1 as the index + return -1; + } + + /** Method of the {@link ButtonPressListener} interface. */ + @Override + public void buttonPressed(Button button) { + if (button == loadButton) { + String text = outputResult.getText(); + if (text == null || text.trim().isEmpty()) { + listIndex = null; + } else { + listIndex = Integer.valueOf(text); + } + inputList.load(this); + } else if (button == storeButton) { + inputList.store(this); + outputResult.setText(listIndex == null ? "" : listIndex.toString()); + } + } + + public static void main(String[] args) { + DesktopApplicationContext.main(Pivot948.class, args); + } + +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/Pivot948.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/pivot_948.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/pivot_948.bxml?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/pivot_948.bxml (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/pivot_948.bxml Tue Oct 31 19:15:47 2023 @@ -1,35 +1,35 @@ -<?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="Pivot 948" maximized="true" - xmlns:bxml="http://pivot.apache.org/bxml" - xmlns="org.apache.pivot.wtk" -> - - <BoxPane styles="{padding:4, verticalAlignment:'center'}"> - <Label text="Input List:"/> - <ListButton bxml:id="inputList" listData="[1, 2, 3, 4, 5]" selectedIndex="-1" /> - <BoxPane orientation="vertical" styles="{padding:6}"> - <PushButton bxml:id="loadButton" buttonData="<-- Click to Load List Value" preferredWidth="180" styles="{padding:4}"/> - <PushButton bxml:id="storeButton" buttonData="Click to Store List Value -->" preferredWidth="180" styles="{padding:4}"/> - </BoxPane> - <Label text="List item index:"/> - <TextInput bxml:id="outputResult" text=""/> - </BoxPane> - -</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="Pivot 948" maximized="true" + xmlns:bxml="http://pivot.apache.org/bxml" + xmlns="org.apache.pivot.wtk" +> + + <BoxPane styles="{padding:4, verticalAlignment:'center'}"> + <Label text="Input List:"/> + <ListButton bxml:id="inputList" listData="[1, 2, 3, 4, 5]" selectedIndex="-1" /> + <BoxPane orientation="vertical" styles="{padding:6}"> + <PushButton bxml:id="loadButton" buttonData="<-- Click to Load List Value" preferredWidth="180" styles="{padding:4}"/> + <PushButton bxml:id="storeButton" buttonData="Click to Store List Value -->" preferredWidth="180" styles="{padding:4}"/> + </BoxPane> + <Label text="List item index:"/> + <TextInput bxml:id="outputResult" text=""/> + </BoxPane> + +</Window> Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot948/pivot_948.bxml ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/Pivot949.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/Pivot949.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/Pivot949.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/Pivot949.java Tue Oct 31 19:15:47 2023 @@ -1,58 +1,58 @@ -/* - * 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.tests.issues.pivot949; - -import org.apache.pivot.beans.BXMLSerializer; -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.Window; - -public class Pivot949 implements Application { - - private Window window = null; - - @Override - public void startup(Display display, Map<String, String> properties) throws Exception { - System.out.println("Pivot949 startup(...)"); - System.out.println("\n" - + "Note that this issue is related to include scripts (with absolute path) " - + "from a bxml file.\n" - + "Here we'll test both relative and absolute scripts.\n" - + "\n"); - - BXMLSerializer bxmlSerializer = new BXMLSerializer(); - window = (Window) bxmlSerializer.readObject(Pivot949.class, "pivot_949.bxml"); - System.out.println("got window = " + window); - window.open(display); - } - - @Override - public boolean shutdown(boolean b) throws Exception { - if (window != null) { - window.close(); - } - - return false; - } - - public static void main(String[] args) { - DesktopApplicationContext.main(Pivot949.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.tests.issues.pivot949; + +import org.apache.pivot.beans.BXMLSerializer; +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.Window; + +public class Pivot949 implements Application { + + private Window window = null; + + @Override + public void startup(Display display, Map<String, String> properties) throws Exception { + System.out.println("Pivot949 startup(...)"); + System.out.println("\n" + + "Note that this issue is related to include scripts (with absolute path) " + + "from a bxml file.\n" + + "Here we'll test both relative and absolute scripts.\n" + + "\n"); + + BXMLSerializer bxmlSerializer = new BXMLSerializer(); + window = (Window) bxmlSerializer.readObject(Pivot949.class, "pivot_949.bxml"); + System.out.println("got window = " + window); + window.open(display); + } + + @Override + public boolean shutdown(boolean b) throws Exception { + if (window != null) { + window.close(); + } + + return false; + } + + public static void main(String[] args) { + DesktopApplicationContext.main(Pivot949.class, args); + } + +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/Pivot949.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml Tue Oct 31 19:15:47 2023 @@ -1,57 +1,57 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- -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="Pivot-949" maximized="true" - bxml:id="window" - xmlns:bxml="http://pivot.apache.org/bxml" - xmlns:app="org.apache.pivot.tests.issues" - xmlns:content="org.apache.pivot.wtk.content" - xmlns="org.apache.pivot.wtk" -> - - <!-- <bxml:script src="utilities_script.js"/> // ok if it's in the same package/folder --> - <!-- <bxml:script src="../../utilities_script.js"/> // ok with a relative package/folder --> - <bxml:script src="../../utilities_script.js"/> - - <bxml:script> - <![CDATA[ - // just as a sample, to use the JavaScript just defined in the included file ... - log("inline script 1 - just loaded a script with a relative URI"); - - var nextURI = '/pivot_949.js'; - log("inline script 1 - now try to load another script, but with an absolute URI '" - + nextURI + "' ..."); - ]]> - </bxml:script> - - - <!-- <bxml:script src="pivot_949.js"/> // ok if it's in the same package/folder --> - <!-- <bxml:script src="./pivot_949.js"/> // ok if it's in the same package/folder --> - <!-- <bxml:script src="/pivot_949.js"/> // ok with PIVOT-949, first part of the fix --> - <bxml:script src="$nextURI"/> <!-- // ok with PIVOT-949, second part of the fix --> - - <Label text="$foo"/> - - <bxml:script> - <![CDATA[ - // just as a sample, to use the JavaScript just defined in the included file ... - log("inline script 2 - all is ok"); - ]]> - </bxml:script> - -</Window> +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- +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="Pivot-949" maximized="true" + bxml:id="window" + xmlns:bxml="http://pivot.apache.org/bxml" + xmlns:app="org.apache.pivot.tests.issues" + xmlns:content="org.apache.pivot.wtk.content" + xmlns="org.apache.pivot.wtk" +> + + <!-- <bxml:script src="utilities_script.js"/> // ok if it's in the same package/folder --> + <!-- <bxml:script src="../../utilities_script.js"/> // ok with a relative package/folder --> + <bxml:script src="../../utilities_script.js"/> + + <bxml:script> + <![CDATA[ + // just as a sample, to use the JavaScript just defined in the included file ... + log("inline script 1 - just loaded a script with a relative URI"); + + var nextURI = '/pivot_949.js'; + log("inline script 1 - now try to load another script, but with an absolute URI '" + + nextURI + "' ..."); + ]]> + </bxml:script> + + + <!-- <bxml:script src="pivot_949.js"/> // ok if it's in the same package/folder --> + <!-- <bxml:script src="./pivot_949.js"/> // ok if it's in the same package/folder --> + <!-- <bxml:script src="/pivot_949.js"/> // ok with PIVOT-949, first part of the fix --> + <bxml:script src="$nextURI"/> <!-- // ok with PIVOT-949, second part of the fix --> + + <Label text="$foo"/> + + <bxml:script> + <![CDATA[ + // just as a sample, to use the JavaScript just defined in the included file ... + log("inline script 2 - all is ok"); + ]]> + </bxml:script> + +</Window> Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.bxml ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.js URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.js?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.js (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.js Tue Oct 31 19:15:47 2023 @@ -1,23 +1,23 @@ -/* - * 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. - */ -importPackage(java.lang); // required to use System.out and System.err -importPackage(org.apache.pivot.collections); // required to use Pivot class ArrayList and other collections -importPackage(org.apache.pivot.util); // required to use Pivot Utility class Console -importPackage(org.apache.pivot.wtk); // required to use Pivot WTK classes - - -var foo = 'Hello from JavaScript in the JVM'; +/* + * 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. + */ +importPackage(java.lang); // required to use System.out and System.err +importPackage(org.apache.pivot.collections); // required to use Pivot class ArrayList and other collections +importPackage(org.apache.pivot.util); // required to use Pivot Utility class Console +importPackage(org.apache.pivot.wtk); // required to use Pivot WTK classes + + +var foo = 'Hello from JavaScript in the JVM'; Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot949/pivot_949.js ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Pivot.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Pivot.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Pivot.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Pivot.java Tue Oct 31 19:15:47 2023 @@ -1,205 +1,205 @@ -/* - * 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.tests.issues.pivot964; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.apache.pivot.collections.Map; -import org.apache.pivot.collections.adapter.ListAdapter; -import org.apache.pivot.serialization.SerializationException; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.BoxPane; -import org.apache.pivot.wtk.Button; -import org.apache.pivot.wtk.ButtonPressListener; -import org.apache.pivot.wtk.Component; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.ImageView; -import org.apache.pivot.wtk.Label; -import org.apache.pivot.wtk.PushButton; -import org.apache.pivot.wtk.Spinner; -import org.apache.pivot.wtk.TablePane; -import org.apache.pivot.wtk.Window; -import org.apache.pivot.wtk.media.Drawing; -import org.apache.pivot.wtk.media.SVGDiagramSerializer; - -import com.kitfox.svg.SVGDiagram; -import com.kitfox.svg.SVGElement; -import com.kitfox.svg.SVGElementException; -import com.kitfox.svg.SVGException; -import com.kitfox.svg.animation.AnimationElement; - -/** - * Test application with Pivot components. - */ -public class Pivot964Pivot implements Application { - - // Display stuff - protected SVGDiagram diagram; - protected SVGElement root; - protected Window window; - String[] spinnerData = { - "0", "100", "200", "210", "220", "230", "240", "250", - "260", "261", "262", "263", "264", "265", "266", "267", "268", "269", - "270", "280", "290", "300", "400", - "500", "501", "502", "503", "504", "505", "506", "507", "508", "509", "510", - "600", "700", "800", "900", "1000", "1500", "2000" - }; - - public static void main(String[] args) { - DesktopApplicationContext.main(Pivot964Pivot.class, args); - } - - private void setStyles(Component comp, String styles) { - try { - comp.setStyles(styles); - } catch (SerializationException se) { - throw new RuntimeException(se); - } - } - - @Override - public void startup(Display display, Map<String, String> properties) { - display.getHostWindow().setSize(1028, 600); // force dimensions for host frame - - window = new Window(); - - prepareSVG(); - - final ImageView image = new ImageView(new Drawing(diagram)); - - BoxPane bp = new BoxPane(); - - TablePane tp = new TablePane(); - setStyles(tp, "{padding: 4}"); - TablePane.Column c1 = new TablePane.Column(-1); - TablePane.Column c2 = new TablePane.Column(-1); - tp.getColumns().add(c1); - tp.getColumns().add(c2); - TablePane.Row r1 = new TablePane.Row(-1); - TablePane.Row r2 = new TablePane.Row(-1); - TablePane.Row r3 = new TablePane.Row(-1); - - PushButton pb1 = new PushButton("Visible"); - PushButton pb2 = new PushButton("Invisible (bug)"); - r1.add(pb1); - r1.add(pb2); - final Spinner sp1 = new Spinner(new ListAdapter<>(spinnerData)); - sp1.setPreferredWidth(80); - sp1.setSelectedIndex(0); - final Spinner sp2 = new Spinner(new ListAdapter<>(spinnerData)); - sp2.setPreferredWidth(80); - sp2.setSelectedIndex(0); - BoxPane bp1 = new BoxPane(); - setStyles(bp1, "{verticalAlignment:'center', padding: 4, spacing: 2}"); - bp1.add(new Label("X:")); - bp1.add(sp1); - r2.add(bp1); - BoxPane bp2 = new BoxPane(); - setStyles(bp2, "{verticalAlignment:'center', padding: 4, spacing: 2}"); - bp2.add(new Label("Y:")); - bp2.add(sp2); - r2.add(bp2); - tp.getRows().add(r1); - tp.getRows().add(r2); - r3.add(new Label(" Max X=507")); - r3.add(new Label(" Max Y=269")); - tp.getRows().add(r3); - - bp.add(image); - bp.add(tp); - - pb1.getButtonPressListeners().add(new ButtonPressListener() { - - @Override - public void buttonPressed(Button arg0) { - try { - root.setAttribute("viewBox", AnimationElement.AT_XML, "0 0 2368 1652"); - root.updateTime(0f); - image.repaint(); - } catch (SVGElementException e) { - e.printStackTrace(); - } catch (SVGException e) { - e.printStackTrace(); - } - } - - }); - - pb2.getButtonPressListeners().add(new ButtonPressListener() { - - @Override - public void buttonPressed(Button arg0) { - try { - String xOffset = (String) sp1.getSelectedItem(); - String yOffset = (String) sp2.getSelectedItem(); - String viewBox = String.format("%1$s %2$s 2368 1652", xOffset, yOffset); - root.setAttribute("viewBox", AnimationElement.AT_XML, viewBox); - root.updateTime(0f); - image.repaint(); - } catch (SVGElementException e) { - e.printStackTrace(); - } catch (SVGException e) { - e.printStackTrace(); - } - } - - }); - - window.setContent(bp); - window.setMaximized(true); - window.open(display); - } - - @Override - public boolean shutdown(boolean optional) { - if (window != null) { - window.close(); - } - - return false; - } - - protected void prepareSVG() { - SVGDiagramSerializer s = new SVGDiagramSerializer(); - - try { - diagram = s.readObject(new ByteArrayInputStream(makeDynamicSVG().getBytes())); - root = diagram.getRoot(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private String makeDynamicSVG() { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - pw.println( - "<svg width=\"800\" height=\"600\" style=\"fill:none;stroke-width:20\" viewBox=\"0 0 2368 1652\">"); - pw.println( - "<rect x=\"0\" y=\"0\" width=\"2000\" height=\"1000\" style=\"stroke:blue;fill:cyan\"/>"); - pw.println("</svg>"); - - pw.close(); - return sw.toString(); - } - -} +/* + * 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.tests.issues.pivot964; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.apache.pivot.collections.Map; +import org.apache.pivot.collections.adapter.ListAdapter; +import org.apache.pivot.serialization.SerializationException; +import org.apache.pivot.wtk.Application; +import org.apache.pivot.wtk.BoxPane; +import org.apache.pivot.wtk.Button; +import org.apache.pivot.wtk.ButtonPressListener; +import org.apache.pivot.wtk.Component; +import org.apache.pivot.wtk.DesktopApplicationContext; +import org.apache.pivot.wtk.Display; +import org.apache.pivot.wtk.ImageView; +import org.apache.pivot.wtk.Label; +import org.apache.pivot.wtk.PushButton; +import org.apache.pivot.wtk.Spinner; +import org.apache.pivot.wtk.TablePane; +import org.apache.pivot.wtk.Window; +import org.apache.pivot.wtk.media.Drawing; +import org.apache.pivot.wtk.media.SVGDiagramSerializer; + +import com.kitfox.svg.SVGDiagram; +import com.kitfox.svg.SVGElement; +import com.kitfox.svg.SVGElementException; +import com.kitfox.svg.SVGException; +import com.kitfox.svg.animation.AnimationElement; + +/** + * Test application with Pivot components. + */ +public class Pivot964Pivot implements Application { + + // Display stuff + protected SVGDiagram diagram; + protected SVGElement root; + protected Window window; + String[] spinnerData = { + "0", "100", "200", "210", "220", "230", "240", "250", + "260", "261", "262", "263", "264", "265", "266", "267", "268", "269", + "270", "280", "290", "300", "400", + "500", "501", "502", "503", "504", "505", "506", "507", "508", "509", "510", + "600", "700", "800", "900", "1000", "1500", "2000" + }; + + public static void main(String[] args) { + DesktopApplicationContext.main(Pivot964Pivot.class, args); + } + + private void setStyles(Component comp, String styles) { + try { + comp.setStyles(styles); + } catch (SerializationException se) { + throw new RuntimeException(se); + } + } + + @Override + public void startup(Display display, Map<String, String> properties) { + display.getHostWindow().setSize(1028, 600); // force dimensions for host frame + + window = new Window(); + + prepareSVG(); + + final ImageView image = new ImageView(new Drawing(diagram)); + + BoxPane bp = new BoxPane(); + + TablePane tp = new TablePane(); + setStyles(tp, "{padding: 4}"); + TablePane.Column c1 = new TablePane.Column(-1); + TablePane.Column c2 = new TablePane.Column(-1); + tp.getColumns().add(c1); + tp.getColumns().add(c2); + TablePane.Row r1 = new TablePane.Row(-1); + TablePane.Row r2 = new TablePane.Row(-1); + TablePane.Row r3 = new TablePane.Row(-1); + + PushButton pb1 = new PushButton("Visible"); + PushButton pb2 = new PushButton("Invisible (bug)"); + r1.add(pb1); + r1.add(pb2); + final Spinner sp1 = new Spinner(new ListAdapter<>(spinnerData)); + sp1.setPreferredWidth(80); + sp1.setSelectedIndex(0); + final Spinner sp2 = new Spinner(new ListAdapter<>(spinnerData)); + sp2.setPreferredWidth(80); + sp2.setSelectedIndex(0); + BoxPane bp1 = new BoxPane(); + setStyles(bp1, "{verticalAlignment:'center', padding: 4, spacing: 2}"); + bp1.add(new Label("X:")); + bp1.add(sp1); + r2.add(bp1); + BoxPane bp2 = new BoxPane(); + setStyles(bp2, "{verticalAlignment:'center', padding: 4, spacing: 2}"); + bp2.add(new Label("Y:")); + bp2.add(sp2); + r2.add(bp2); + tp.getRows().add(r1); + tp.getRows().add(r2); + r3.add(new Label(" Max X=507")); + r3.add(new Label(" Max Y=269")); + tp.getRows().add(r3); + + bp.add(image); + bp.add(tp); + + pb1.getButtonPressListeners().add(new ButtonPressListener() { + + @Override + public void buttonPressed(Button arg0) { + try { + root.setAttribute("viewBox", AnimationElement.AT_XML, "0 0 2368 1652"); + root.updateTime(0f); + image.repaint(); + } catch (SVGElementException e) { + e.printStackTrace(); + } catch (SVGException e) { + e.printStackTrace(); + } + } + + }); + + pb2.getButtonPressListeners().add(new ButtonPressListener() { + + @Override + public void buttonPressed(Button arg0) { + try { + String xOffset = (String) sp1.getSelectedItem(); + String yOffset = (String) sp2.getSelectedItem(); + String viewBox = String.format("%1$s %2$s 2368 1652", xOffset, yOffset); + root.setAttribute("viewBox", AnimationElement.AT_XML, viewBox); + root.updateTime(0f); + image.repaint(); + } catch (SVGElementException e) { + e.printStackTrace(); + } catch (SVGException e) { + e.printStackTrace(); + } + } + + }); + + window.setContent(bp); + window.setMaximized(true); + window.open(display); + } + + @Override + public boolean shutdown(boolean optional) { + if (window != null) { + window.close(); + } + + return false; + } + + protected void prepareSVG() { + SVGDiagramSerializer s = new SVGDiagramSerializer(); + + try { + diagram = s.readObject(new ByteArrayInputStream(makeDynamicSVG().getBytes())); + root = diagram.getRoot(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private String makeDynamicSVG() { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + + pw.println( + "<svg width=\"800\" height=\"600\" style=\"fill:none;stroke-width:20\" viewBox=\"0 0 2368 1652\">"); + pw.println( + "<rect x=\"0\" y=\"0\" width=\"2000\" height=\"1000\" style=\"stroke:blue;fill:cyan\"/>"); + pw.println("</svg>"); + + pw.close(); + return sw.toString(); + } + +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Pivot.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java Tue Oct 31 19:15:47 2023 @@ -1,168 +1,168 @@ -/* - * 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.tests.issues.pivot964; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Graphics; -import java.io.PrintWriter; -import java.io.StringReader; -import java.io.StringWriter; -import java.net.URI; - -import javax.swing.JPanel; - -import com.kitfox.svg.SVGCache; -import com.kitfox.svg.SVGElement; -import com.kitfox.svg.SVGElementException; -import com.kitfox.svg.SVGException; -import com.kitfox.svg.animation.AnimationElement; -import com.kitfox.svg.app.beans.SVGIcon; - -/** - * Test using a Swing JFrame. - * In this case all is good. - */ -public class Pivot964Swing extends javax.swing.JFrame { - public static final long serialVersionUID = 0; - - TestPanel panel = new TestPanel(); - - /** Creates new form SVGIconDemo. */ - public Pivot964Swing() { - initComponents(); - panelDisplay.add(panel, BorderLayout.CENTER); - pack(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - // <editor-fold defaultstate="collapsed" desc=" Generated Code "> - private void initComponents() { - panelDisplay = new javax.swing.JPanel(); - button1 = new javax.swing.JButton(); - button2 = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - panelDisplay.setLayout(new java.awt.BorderLayout()); - - getContentPane().add(panelDisplay, java.awt.BorderLayout.CENTER); - - button1.setText("Visible"); - button1.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - SVGElement root = Pivot964Swing.this.panel.root; - try { - root.setAttribute("viewBox", AnimationElement.AT_XML, "0 0 2368 1652"); - root.updateTime(0f); - repaint(); - } catch (SVGElementException e) { - e.printStackTrace(); - } catch (SVGException e) { - e.printStackTrace(); - } - } - }); - - button2.setText("Invisible"); - button2.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - SVGElement root = Pivot964Swing.this.panel.root; - try { - root.setAttribute("viewBox", AnimationElement.AT_XML, "800 0 2368 1652"); - root.updateTime(0f); - repaint(); - } catch (SVGElementException e) { - e.printStackTrace(); - } catch (SVGException e) { - e.printStackTrace(); - } - } - }); - - panelDisplay.add(button1, java.awt.BorderLayout.EAST); - panelDisplay.add(button2, java.awt.BorderLayout.WEST); - - pack(); - } // </editor-fold> - - public static void main(String[] args) { - java.awt.EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - new Pivot964Swing().setVisible(true); - } - }); - } - - // Variables declaration - do not modify - private javax.swing.JButton button1; - private javax.swing.JButton button2; - private javax.swing.JPanel panelDisplay; - // End of variables declaration - -} - -class TestPanel extends JPanel { - public static final long serialVersionUID = 0; - - final SVGIcon icon; - URI uri; - SVGElement root; - - public TestPanel() { - StringReader reader = new StringReader(makeDynamicSVG()); - uri = SVGCache.getSVGUniverse().loadSVG(reader, "myImage"); - icon = new SVGIcon(); - icon.setAntiAlias(true); - icon.setSvgURI(uri); - root = icon.getSvgUniverse().getDiagram(uri).getRoot(); - - setPreferredSize(new Dimension(400, 400)); - } - - @Override - public void paintComponent(Graphics g) { - final int width = getWidth(); - final int height = getHeight(); - - g.setColor(getBackground()); - g.fillRect(0, 0, width, height); - - icon.paintIcon(this, g, 0, 0); - } - - private String makeDynamicSVG() { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - - pw.println( - "<svg width=\"400\" height=\"400\" style=\"fill:none;stroke-width:16\" viewBox=\"781 -391 1177 826\">"); - pw.println( - "<rect x=\"0\" y=\"0\" width=\"2000\" height=\"1000\" style=\"stroke:blue;fill:white\"/>"); - pw.println("</svg>"); - - pw.close(); - return sw.toString(); - } - -} +/* + * 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.tests.issues.pivot964; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Graphics; +import java.io.PrintWriter; +import java.io.StringReader; +import java.io.StringWriter; +import java.net.URI; + +import javax.swing.JPanel; + +import com.kitfox.svg.SVGCache; +import com.kitfox.svg.SVGElement; +import com.kitfox.svg.SVGElementException; +import com.kitfox.svg.SVGException; +import com.kitfox.svg.animation.AnimationElement; +import com.kitfox.svg.app.beans.SVGIcon; + +/** + * Test using a Swing JFrame. + * In this case all is good. + */ +public class Pivot964Swing extends javax.swing.JFrame { + public static final long serialVersionUID = 0; + + TestPanel panel = new TestPanel(); + + /** Creates new form SVGIconDemo. */ + public Pivot964Swing() { + initComponents(); + panelDisplay.add(panel, BorderLayout.CENTER); + pack(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + // <editor-fold defaultstate="collapsed" desc=" Generated Code "> + private void initComponents() { + panelDisplay = new javax.swing.JPanel(); + button1 = new javax.swing.JButton(); + button2 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + panelDisplay.setLayout(new java.awt.BorderLayout()); + + getContentPane().add(panelDisplay, java.awt.BorderLayout.CENTER); + + button1.setText("Visible"); + button1.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { + SVGElement root = Pivot964Swing.this.panel.root; + try { + root.setAttribute("viewBox", AnimationElement.AT_XML, "0 0 2368 1652"); + root.updateTime(0f); + repaint(); + } catch (SVGElementException e) { + e.printStackTrace(); + } catch (SVGException e) { + e.printStackTrace(); + } + } + }); + + button2.setText("Invisible"); + button2.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { + SVGElement root = Pivot964Swing.this.panel.root; + try { + root.setAttribute("viewBox", AnimationElement.AT_XML, "800 0 2368 1652"); + root.updateTime(0f); + repaint(); + } catch (SVGElementException e) { + e.printStackTrace(); + } catch (SVGException e) { + e.printStackTrace(); + } + } + }); + + panelDisplay.add(button1, java.awt.BorderLayout.EAST); + panelDisplay.add(button2, java.awt.BorderLayout.WEST); + + pack(); + } // </editor-fold> + + public static void main(String[] args) { + java.awt.EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + new Pivot964Swing().setVisible(true); + } + }); + } + + // Variables declaration - do not modify + private javax.swing.JButton button1; + private javax.swing.JButton button2; + private javax.swing.JPanel panelDisplay; + // End of variables declaration + +} + +class TestPanel extends JPanel { + public static final long serialVersionUID = 0; + + final SVGIcon icon; + URI uri; + SVGElement root; + + public TestPanel() { + StringReader reader = new StringReader(makeDynamicSVG()); + uri = SVGCache.getSVGUniverse().loadSVG(reader, "myImage"); + icon = new SVGIcon(); + icon.setAntiAlias(true); + icon.setSvgURI(uri); + root = icon.getSvgUniverse().getDiagram(uri).getRoot(); + + setPreferredSize(new Dimension(400, 400)); + } + + @Override + public void paintComponent(Graphics g) { + final int width = getWidth(); + final int height = getHeight(); + + g.setColor(getBackground()); + g.fillRect(0, 0, width, height); + + icon.paintIcon(this, g, 0, 0); + } + + private String makeDynamicSVG() { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + + pw.println( + "<svg width=\"400\" height=\"400\" style=\"fill:none;stroke-width:16\" viewBox=\"781 -391 1177 826\">"); + pw.println( + "<rect x=\"0\" y=\"0\" width=\"2000\" height=\"1000\" style=\"stroke:blue;fill:white\"/>"); + pw.println("</svg>"); + + pw.close(); + return sw.toString(); + } + +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot964/Pivot964Swing.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/IncludedSection965.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/IncludedSection965.bxml?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/IncludedSection965.bxml (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/IncludedSection965.bxml Tue Oct 31 19:15:47 2023 @@ -1,30 +1,30 @@ -<?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. ---> - -<Form.Section - xmlns="org.apache.pivot.wtk" - xmlns:bxml="http://pivot.apache.org/bxml" - heading="Included Section"> - - <bxml:script> - function concateText(value) { - return value+value; - } - </bxml:script> - <Label Form.label="Concatenated Text" text="${concateText:textInput.text}"/> -</Form.Section> +<?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. +--> + +<Form.Section + xmlns="org.apache.pivot.wtk" + xmlns:bxml="http://pivot.apache.org/bxml" + heading="Included Section"> + + <bxml:script> + function concateText(value) { + return value+value; + } + </bxml:script> + <Label Form.label="Concatenated Text" text="${concateText:textInput.text}"/> +</Form.Section> Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/IncludedSection965.bxml ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Pivot965Main.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Pivot965Main.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Pivot965Main.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot965/Pivot965Main.java Tue Oct 31 19:15:47 2023 @@ -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.tests.issues.pivot965; - -import org.apache.pivot.beans.BXMLSerializer; -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.TextInput; -import org.apache.pivot.wtk.Window; - - -public class Pivot965Main implements Application { - private Window window = null; - - @Override - public void startup(Display display, Map<String, String> properties) throws Exception { - BXMLSerializer bxmlSerializer = new BXMLSerializer(); - window = (Window) bxmlSerializer.readObject(Window.class, - "/org/apache/pivot/tests/issues/pivot965/Window965.bxml"); - window.open(display); - TextInput textInput = (TextInput) bxmlSerializer.getNamespace().get("textInput"); - textInput.requestFocus(); - } - - public static String myMappingFunction(String value) { - return value.toUpperCase(); - } - - @Override - public boolean shutdown(boolean optional) { - if (this.window != null) { - this.window.close(); - } - - return false; - } - - // useful to run this as a Java Application in a simpler way (directly) - public static void main(String[] args) { - DesktopApplicationContext.main(Pivot965Main.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.tests.issues.pivot965; + +import org.apache.pivot.beans.BXMLSerializer; +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.TextInput; +import org.apache.pivot.wtk.Window; + + +public class Pivot965Main implements Application { + private Window window = null; + + @Override + public void startup(Display display, Map<String, String> properties) throws Exception { + BXMLSerializer bxmlSerializer = new BXMLSerializer(); + window = (Window) bxmlSerializer.readObject(Window.class, + "/org/apache/pivot/tests/issues/pivot965/Window965.bxml"); + window.open(display); + TextInput textInput = (TextInput) bxmlSerializer.getNamespace().get("textInput"); + textInput.requestFocus(); + } + + public static String myMappingFunction(String value) { + return value.toUpperCase(); + } + + @Override + public boolean shutdown(boolean optional) { + if (this.window != null) { + this.window.close(); + } + + return false; + } + + // useful to run this as a Java Application in a simpler way (directly) + public static void main(String[] args) { + DesktopApplicationContext.main(Pivot965Main.class, args); + } + +}