Modified: pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java (original) +++ pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java Tue Oct 31 19:15:47 2023 @@ -1,136 +1,136 @@ -/* - * 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.demos.colors; - -import java.awt.Color; -import java.awt.Font; -import java.util.Set; -import org.apache.pivot.collections.Map; -import org.apache.pivot.util.StringUtils; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.Border; -import org.apache.pivot.wtk.BoxPane; -import org.apache.pivot.wtk.CSSColor; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.FontUtilities; -import org.apache.pivot.wtk.GridPane; -import org.apache.pivot.wtk.HorizontalAlignment; -import org.apache.pivot.wtk.Label; -import org.apache.pivot.wtk.Orientation; -import org.apache.pivot.wtk.ScrollPane; -import org.apache.pivot.wtk.Style; -import org.apache.pivot.wtk.Window; - -public final class Colors implements Application { - private static final int CELLS_PER_ROW = 5; - - private Window mainWindow; - - private Label makeLabel(final String text) { - Label label = new Label(text); - label.putStyle(Style.horizontalAlignment, HorizontalAlignment.CENTER); - return label; - } - - @Override - public void startup(final Display display, final Map<String, String> properties) { - GridPane gridPane = new GridPane(CELLS_PER_ROW); - gridPane.putStyle(Style.padding, 6); - - Font fontBold = FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.BOLD, 13); - Font fontRegular = FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.PLAIN, 12); - Font fontItalic = FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.ITALIC, 11); - - int cell = 0; - GridPane.Row row = null; - - int numColors = CSSColor.numberOfColors(); - - for (CSSColor color : CSSColor.values()) { - if (cell % CELLS_PER_ROW == 0) { - row = new GridPane.Row(gridPane); - } - - BoxPane container = new BoxPane(Orientation.VERTICAL); - container.putStyle(Style.padding, 4); - container.putStyle(Style.fill, true); - - BoxPane colorFill = new BoxPane(Orientation.VERTICAL); - - Color fillColor = color.getColor(); - String colorName = color.toString(); - int r = fillColor.getRed(); - int g = fillColor.getGreen(); - int b = fillColor.getBlue(); - - colorFill.putStyle(Style.backgroundColor, fillColor); - colorFill.setPreferredWidth(372); - colorFill.setPreferredHeight(100); - Set<CSSColor> matchingColors = CSSColor.getMatchingColors(color); - String matches = matchingColors.size() == 0 - ? "No matches." - : "Matches: " + StringUtils.toString(matchingColors); - colorFill.setTooltipText(matches); - - Label nameLabel = makeLabel(color.toString()); - nameLabel.putStyle(Style.font, fontBold); - - String rgbText = String.format("R=%1$3d, G=%2$3d, B=%3$3d", r, g, b); - Label rgbLabel = makeLabel(rgbText); - rgbLabel.putStyle(Style.font, fontRegular); - - float[] hsbValues = Color.RGBtoHSB(r, g, b, null); - String hsbText = String.format("H=%1$5.3f, S=%2$5.3f, V=%3$5.3f", - hsbValues[0], hsbValues[1], hsbValues[2]); - Label hsbLabel = makeLabel(hsbText); - hsbLabel.putStyle(Style.font, fontRegular); - - String seqText = String.format("%1$d / %2$d", cell + 1, numColors); - Label seqLabel = makeLabel(seqText); - seqLabel.putStyle(Style.font, fontItalic); - - container.add(colorFill); - container.add(nameLabel); - container.add(rgbLabel); - container.add(hsbLabel); - container.add(seqLabel); - - row.add(new Border(container)); - cell++; - } - ScrollPane scrollPane = new ScrollPane(ScrollPane.ScrollBarPolicy.FILL, - ScrollPane.ScrollBarPolicy.AUTO); - scrollPane.setView(gridPane); - mainWindow = new Window(scrollPane); - mainWindow.setMaximized(true); - mainWindow.open(display); - } - - @Override - public boolean shutdown(final boolean optional) { - if (mainWindow != null) { - mainWindow.close(); - mainWindow = null; - } - return false; - } - - public static void main(final String[] args) { - DesktopApplicationContext.main(Colors.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.demos.colors; + +import java.awt.Color; +import java.awt.Font; +import java.util.Set; +import org.apache.pivot.collections.Map; +import org.apache.pivot.util.StringUtils; +import org.apache.pivot.wtk.Application; +import org.apache.pivot.wtk.Border; +import org.apache.pivot.wtk.BoxPane; +import org.apache.pivot.wtk.CSSColor; +import org.apache.pivot.wtk.DesktopApplicationContext; +import org.apache.pivot.wtk.Display; +import org.apache.pivot.wtk.FontUtilities; +import org.apache.pivot.wtk.GridPane; +import org.apache.pivot.wtk.HorizontalAlignment; +import org.apache.pivot.wtk.Label; +import org.apache.pivot.wtk.Orientation; +import org.apache.pivot.wtk.ScrollPane; +import org.apache.pivot.wtk.Style; +import org.apache.pivot.wtk.Window; + +public final class Colors implements Application { + private static final int CELLS_PER_ROW = 5; + + private Window mainWindow; + + private Label makeLabel(final String text) { + Label label = new Label(text); + label.putStyle(Style.horizontalAlignment, HorizontalAlignment.CENTER); + return label; + } + + @Override + public void startup(final Display display, final Map<String, String> properties) { + GridPane gridPane = new GridPane(CELLS_PER_ROW); + gridPane.putStyle(Style.padding, 6); + + Font fontBold = FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.BOLD, 13); + Font fontRegular = FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.PLAIN, 12); + Font fontItalic = FontUtilities.getFont(FontUtilities.SANS_SERIF_FONTS, Font.ITALIC, 11); + + int cell = 0; + GridPane.Row row = null; + + int numColors = CSSColor.numberOfColors(); + + for (CSSColor color : CSSColor.values()) { + if (cell % CELLS_PER_ROW == 0) { + row = new GridPane.Row(gridPane); + } + + BoxPane container = new BoxPane(Orientation.VERTICAL); + container.putStyle(Style.padding, 4); + container.putStyle(Style.fill, true); + + BoxPane colorFill = new BoxPane(Orientation.VERTICAL); + + Color fillColor = color.getColor(); + String colorName = color.toString(); + int r = fillColor.getRed(); + int g = fillColor.getGreen(); + int b = fillColor.getBlue(); + + colorFill.putStyle(Style.backgroundColor, fillColor); + colorFill.setPreferredWidth(372); + colorFill.setPreferredHeight(100); + Set<CSSColor> matchingColors = CSSColor.getMatchingColors(color); + String matches = matchingColors.size() == 0 + ? "No matches." + : "Matches: " + StringUtils.toString(matchingColors); + colorFill.setTooltipText(matches); + + Label nameLabel = makeLabel(color.toString()); + nameLabel.putStyle(Style.font, fontBold); + + String rgbText = String.format("R=%1$3d, G=%2$3d, B=%3$3d", r, g, b); + Label rgbLabel = makeLabel(rgbText); + rgbLabel.putStyle(Style.font, fontRegular); + + float[] hsbValues = Color.RGBtoHSB(r, g, b, null); + String hsbText = String.format("H=%1$5.3f, S=%2$5.3f, V=%3$5.3f", + hsbValues[0], hsbValues[1], hsbValues[2]); + Label hsbLabel = makeLabel(hsbText); + hsbLabel.putStyle(Style.font, fontRegular); + + String seqText = String.format("%1$d / %2$d", cell + 1, numColors); + Label seqLabel = makeLabel(seqText); + seqLabel.putStyle(Style.font, fontItalic); + + container.add(colorFill); + container.add(nameLabel); + container.add(rgbLabel); + container.add(hsbLabel); + container.add(seqLabel); + + row.add(new Border(container)); + cell++; + } + ScrollPane scrollPane = new ScrollPane(ScrollPane.ScrollBarPolicy.FILL, + ScrollPane.ScrollBarPolicy.AUTO); + scrollPane.setView(gridPane); + mainWindow = new Window(scrollPane); + mainWindow.setMaximized(true); + mainWindow.open(display); + } + + @Override + public boolean shutdown(final boolean optional) { + if (mainWindow != null) { + mainWindow.close(); + mainWindow = null; + } + return false; + } + + public static void main(final String[] args) { + DesktopApplicationContext.main(Colors.class, args); + } +}
Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/colors/Colors.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/demos/src/org/apache/pivot/demos/decorator/ScaleDecoratorDemo.java URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/ScaleDecoratorDemo.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/demos/decorator/ScaleDecoratorDemo.java (original) +++ pivot/trunk/demos/src/org/apache/pivot/demos/decorator/ScaleDecoratorDemo.java Tue Oct 31 19:15:47 2023 @@ -1,78 +1,78 @@ -/* - * 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.demos.decorator; - -import org.apache.pivot.beans.BXML; -import org.apache.pivot.beans.BXMLSerializer; -import org.apache.pivot.collections.Map; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.Component; -import org.apache.pivot.wtk.ComponentMouseWheelListener; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.ImageView; -import org.apache.pivot.wtk.Mouse; -import org.apache.pivot.wtk.Window; -import org.apache.pivot.wtk.effects.ScaleDecorator; - -public class ScaleDecoratorDemo implements Application { - private Window scaleWindow; - @BXML private ImageView imageView; - @BXML private ScaleDecorator scaleDecorator; - - @Override - public void startup(Display display, Map<String, String> properties) throws Exception { - BXMLSerializer bxmlSerializer = new BXMLSerializer(); - scaleWindow = (Window) bxmlSerializer.readObject(DecoratorDemo.class, - "scale_window.bxml"); - bxmlSerializer.bind(this); - - imageView.getComponentMouseWheelListeners().add(new ComponentMouseWheelListener() { - @Override - public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, - int wheelRotation, int x, int y) { - // Note: both scale values are the same - float currentScale = scaleDecorator.getScaleX(); - if (wheelRotation < 0) { - // UP == zoom in, make scale larger - scaleDecorator.setScale(currentScale * 2.0f); - } else { - // DOWN == zoom out, make scale smaller - scaleDecorator.setScale(currentScale / 2.0f); - } - component.repaint(); - return true; - } - }); - - scaleWindow.open(display); - } - - @Override - public boolean shutdown(boolean optional) { - if (scaleWindow != null) { - scaleWindow.close(); - } - - return false; - } - - public static void main(String[] args) { - DesktopApplicationContext.main(ScaleDecoratorDemo.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.demos.decorator; + +import org.apache.pivot.beans.BXML; +import org.apache.pivot.beans.BXMLSerializer; +import org.apache.pivot.collections.Map; +import org.apache.pivot.wtk.Application; +import org.apache.pivot.wtk.Component; +import org.apache.pivot.wtk.ComponentMouseWheelListener; +import org.apache.pivot.wtk.DesktopApplicationContext; +import org.apache.pivot.wtk.Display; +import org.apache.pivot.wtk.ImageView; +import org.apache.pivot.wtk.Mouse; +import org.apache.pivot.wtk.Window; +import org.apache.pivot.wtk.effects.ScaleDecorator; + +public class ScaleDecoratorDemo implements Application { + private Window scaleWindow; + @BXML private ImageView imageView; + @BXML private ScaleDecorator scaleDecorator; + + @Override + public void startup(Display display, Map<String, String> properties) throws Exception { + BXMLSerializer bxmlSerializer = new BXMLSerializer(); + scaleWindow = (Window) bxmlSerializer.readObject(DecoratorDemo.class, + "scale_window.bxml"); + bxmlSerializer.bind(this); + + imageView.getComponentMouseWheelListeners().add(new ComponentMouseWheelListener() { + @Override + public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, + int wheelRotation, int x, int y) { + // Note: both scale values are the same + float currentScale = scaleDecorator.getScaleX(); + if (wheelRotation < 0) { + // UP == zoom in, make scale larger + scaleDecorator.setScale(currentScale * 2.0f); + } else { + // DOWN == zoom out, make scale smaller + scaleDecorator.setScale(currentScale / 2.0f); + } + component.repaint(); + return true; + } + }); + + scaleWindow.open(display); + } + + @Override + public boolean shutdown(boolean optional) { + if (scaleWindow != null) { + scaleWindow.close(); + } + + return false; + } + + public static void main(String[] args) { + DesktopApplicationContext.main(ScaleDecoratorDemo.class, args); + } + +} Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/decorator/ScaleDecoratorDemo.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/demos/src/org/apache/pivot/demos/decorator/scale_window.bxml URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/scale_window.bxml?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/demos/decorator/scale_window.bxml (original) +++ pivot/trunk/demos/src/org/apache/pivot/demos/decorator/scale_window.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="Scale Window" x="20" y="20" - xmlns:bxml="http://pivot.apache.org/bxml" - xmlns:effects="org.apache.pivot.wtk.effects" - xmlns="org.apache.pivot.wtk"> - - <BoxPane orientation="vertical" styles="{horizontalAlignment:'center'}"> - <Label text="Use the mouse wheel over the image to zoom in and out."/> - <Border> - <ImageView image="@IMG_0767_2.jpg" bxml:id="imageView"> - <decorators> - <effects:ScaleDecorator bxml:id="scaleDecorator"/> - </decorators> - </ImageView> - </Border> - </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="Scale Window" x="20" y="20" + xmlns:bxml="http://pivot.apache.org/bxml" + xmlns:effects="org.apache.pivot.wtk.effects" + xmlns="org.apache.pivot.wtk"> + + <BoxPane orientation="vertical" styles="{horizontalAlignment:'center'}"> + <Label text="Use the mouse wheel over the image to zoom in and out."/> + <Border> + <ImageView image="@IMG_0767_2.jpg" bxml:id="imageView"> + <decorators> + <effects:ScaleDecorator bxml:id="scaleDecorator"/> + </decorators> + </ImageView> + </Border> + </BoxPane> +</Window> + Propchange: pivot/trunk/demos/src/org/apache/pivot/demos/decorator/scale_window.bxml ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_osx.json URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_osx.json?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_osx.json (original) +++ pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_osx.json Tue Oct 31 19:15:47 2023 @@ -1,45 +1,45 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ font: "Verdana 11", - - colorMultiplier: 0.1, - - colors: [ - "#000000", - "#ffffff", - "#919191", - "#dadada", - "#2f5aa5", - "#616161", - "#ffe480", - "#eb0000" - ], - - messageIcons: { - error: "message_type-error-32x32.png", - warning: "message_type-warning-32x32.png", - question: "message_type-question-32x32.png", - info: "message_type-info-32x32.png" - }, - - smallMessageIcons: { - error: "message_type-error-16x16.png", - warning: "message_type-warning-16x16.png", - question: "message_type-question-16x16.png", - info: "message_type-info-16x16.png" - } -} +/* + * 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. + */ +{ font: "Verdana 11", + + colorMultiplier: 0.1, + + colors: [ + "#000000", + "#ffffff", + "#919191", + "#dadada", + "#2f5aa5", + "#616161", + "#ffe480", + "#eb0000" + ], + + messageIcons: { + error: "message_type-error-32x32.png", + warning: "message_type-warning-32x32.png", + question: "message_type-question-32x32.png", + info: "message_type-info-32x32.png" + }, + + smallMessageIcons: { + error: "message_type-error-16x16.png", + warning: "message_type-warning-16x16.png", + question: "message_type-question-16x16.png", + info: "message_type-info-16x16.png" + } +} Propchange: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_osx.json ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_swing.json URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_swing.json?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_swing.json (original) +++ pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_swing.json Tue Oct 31 19:15:47 2023 @@ -1,45 +1,45 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ font: "Verdana 11", - - colorMultiplier: 0.1, - - colors: [ - "#000000", - "#eeeeee", - "#8ea1b2", - "#ffffff", - "#7a8a99", - "#7a8a99", - "#ffff00", - "#ff0000" - ], - - messageIcons: { - error: "message_type-error-32x32.png", - warning: "message_type-warning-32x32.png", - question: "message_type-question-32x32.png", - info: "message_type-info-32x32.png" - }, - - smallMessageIcons: { - error: "message_type-error-16x16.png", - warning: "message_type-warning-16x16.png", - question: "message_type-question-16x16.png", - info: "message_type-info-16x16.png" - } -} +/* + * 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. + */ +{ font: "Verdana 11", + + colorMultiplier: 0.1, + + colors: [ + "#000000", + "#eeeeee", + "#8ea1b2", + "#ffffff", + "#7a8a99", + "#7a8a99", + "#ffff00", + "#ff0000" + ], + + messageIcons: { + error: "message_type-error-32x32.png", + warning: "message_type-warning-32x32.png", + question: "message_type-question-32x32.png", + info: "message_type-info-32x32.png" + }, + + smallMessageIcons: { + error: "message_type-error-16x16.png", + warning: "message_type-warning-16x16.png", + question: "message_type-question-16x16.png", + info: "message_type-info-16x16.png" + } +} Propchange: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_swing.json ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_ubuntu.json URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_ubuntu.json?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_ubuntu.json (original) +++ pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_ubuntu.json Tue Oct 31 19:15:47 2023 @@ -1,45 +1,45 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ font: "Verdana 11", - - colorMultiplier: 0.1, - - colors: [ - "#3c3b37", - "#f0ebe2", - "#ccbfa9", - "#ffffff", - "#3b3b3b", - "#ab9c85", - "#fad26c", - "#f0583d" - ], - - messageIcons: { - error: "message_type-error-32x32.png", - warning: "message_type-warning-32x32.png", - question: "message_type-question-32x32.png", - info: "message_type-info-32x32.png" - }, - - smallMessageIcons: { - error: "message_type-error-16x16.png", - warning: "message_type-warning-16x16.png", - question: "message_type-question-16x16.png", - info: "message_type-info-16x16.png" - } -} +/* + * 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. + */ +{ font: "Verdana 11", + + colorMultiplier: 0.1, + + colors: [ + "#3c3b37", + "#f0ebe2", + "#ccbfa9", + "#ffffff", + "#3b3b3b", + "#ab9c85", + "#fad26c", + "#f0583d" + ], + + messageIcons: { + error: "message_type-error-32x32.png", + warning: "message_type-warning-32x32.png", + question: "message_type-question-32x32.png", + info: "message_type-info-32x32.png" + }, + + smallMessageIcons: { + error: "message_type-error-16x16.png", + warning: "message_type-warning-16x16.png", + question: "message_type-question-16x16.png", + info: "message_type-info-16x16.png" + } +} Propchange: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_ubuntu.json ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_win2k.json URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_win2k.json?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_win2k.json (original) +++ pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_win2k.json Tue Oct 31 19:15:47 2023 @@ -1,45 +1,45 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ font: "Verdana 11", - - colorMultiplier: 0.1, - - colors: [ - "#000000", - "#D2CFC8", - "#C0C0C0", - "#E6E6E6", - "#316AC5", - "#0055EA", - "#FFFFE0", - "#F5001C" - ], - - messageIcons: { - error: "message_type-error-32x32.png", - warning: "message_type-warning-32x32.png", - question: "message_type-question-32x32.png", - info: "message_type-info-32x32.png" - }, - - smallMessageIcons: { - error: "message_type-error-16x16.png", - warning: "message_type-warning-16x16.png", - question: "message_type-question-16x16.png", - info: "message_type-info-16x16.png" - } -} +/* + * 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. + */ +{ font: "Verdana 11", + + colorMultiplier: 0.1, + + colors: [ + "#000000", + "#D2CFC8", + "#C0C0C0", + "#E6E6E6", + "#316AC5", + "#0055EA", + "#FFFFE0", + "#F5001C" + ], + + messageIcons: { + error: "message_type-error-32x32.png", + warning: "message_type-warning-32x32.png", + question: "message_type-question-32x32.png", + info: "message_type-info-32x32.png" + }, + + smallMessageIcons: { + error: "message_type-error-16x16.png", + warning: "message_type-warning-16x16.png", + question: "message_type-question-16x16.png", + info: "message_type-info-16x16.png" + } +} Propchange: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_win2k.json ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp1.json URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp1.json?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp1.json (original) +++ pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp1.json Tue Oct 31 19:15:47 2023 @@ -1,45 +1,45 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ font: "Verdana 11", - - colorMultiplier: 0.1, - - colors: [ - "#000000", - "#ffffff", - "#999999", - "#f0f0ea", - "#2f64b9", - "#1a961a", - "#ffe480", - "#eb0000" - ], - - messageIcons: { - error: "message_type-error-32x32.png", - warning: "message_type-warning-32x32.png", - question: "message_type-question-32x32.png", - info: "message_type-info-32x32.png" - }, - - smallMessageIcons: { - error: "message_type-error-16x16.png", - warning: "message_type-warning-16x16.png", - question: "message_type-question-16x16.png", - info: "message_type-info-16x16.png" - } -} +/* + * 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. + */ +{ font: "Verdana 11", + + colorMultiplier: 0.1, + + colors: [ + "#000000", + "#ffffff", + "#999999", + "#f0f0ea", + "#2f64b9", + "#1a961a", + "#ffe480", + "#eb0000" + ], + + messageIcons: { + error: "message_type-error-32x32.png", + warning: "message_type-warning-32x32.png", + question: "message_type-question-32x32.png", + info: "message_type-info-32x32.png" + }, + + smallMessageIcons: { + error: "message_type-error-16x16.png", + warning: "message_type-warning-16x16.png", + question: "message_type-question-16x16.png", + info: "message_type-info-16x16.png" + } +} Propchange: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp1.json ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp2.json URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp2.json?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp2.json (original) +++ pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp2.json Tue Oct 31 19:15:47 2023 @@ -1,45 +1,45 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -{ font: "Verdana 11", - - colorMultiplier: 0.1, - - colors: [ - "#000000", - "#F4F4F4", - "#C0C0C0", - "#E6E6E6", - "#316AC5", - "#0055EA", - "#FFFFE0", - "#F5001C" - ], - - messageIcons: { - error: "message_type-error-32x32.png", - warning: "message_type-warning-32x32.png", - question: "message_type-question-32x32.png", - info: "message_type-info-32x32.png" - }, - - smallMessageIcons: { - error: "message_type-error-16x16.png", - warning: "message_type-warning-16x16.png", - question: "message_type-question-16x16.png", - info: "message_type-info-16x16.png" - } -} +/* + * 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. + */ +{ font: "Verdana 11", + + colorMultiplier: 0.1, + + colors: [ + "#000000", + "#F4F4F4", + "#C0C0C0", + "#E6E6E6", + "#316AC5", + "#0055EA", + "#FFFFE0", + "#F5001C" + ], + + messageIcons: { + error: "message_type-error-32x32.png", + warning: "message_type-warning-32x32.png", + question: "message_type-question-32x32.png", + info: "message_type-info-32x32.png" + }, + + smallMessageIcons: { + error: "message_type-error-16x16.png", + warning: "message_type-warning-16x16.png", + question: "message_type-question-16x16.png", + info: "message_type-info-16x16.png" + } +} Propchange: pivot/trunk/demos/src/org/apache/pivot/wtk/skin/terra/TerraTheme_winxp2.json ------------------------------------------------------------------------------ svn:eol-style = native Propchange: pivot/trunk/demos/www/favicon.ico ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type Tue Oct 31 19:15:47 2023 @@ -1 +1 @@ -image/x-ico +image/vnd.microsoft.icon Propchange: pivot/trunk/examples/src/org/apache/pivot/examples/deployment/logo-notext-256x256.icns ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type Tue Oct 31 19:15:47 2023 @@ -1 +1 @@ -application/octet-stream +image/x-icns Propchange: pivot/trunk/examples/src/org/apache/pivot/examples/deployment/logo-notext-256x256.ico ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type Tue Oct 31 19:15:47 2023 @@ -1 +1 @@ -image/x-ico +image/vnd.microsoft.icon Modified: pivot/trunk/examples/src/org/apache/pivot/examples/scripting/README.txt URL: http://svn.apache.org/viewvc/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/README.txt?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/examples/src/org/apache/pivot/examples/scripting/README.txt (original) +++ pivot/trunk/examples/src/org/apache/pivot/examples/scripting/README.txt Tue Oct 31 19:15:47 2023 @@ -1,9 +1,9 @@ -// -// README for org.apache.pivot.examples.scripting Samples -// - -In this package there are some Groovy sources and even some Scala sources, but in our ant builds they are not compiled. -To run those examples from an IDE (like Eclipse), you must enable support for those languages for the project containing them (examples). - -Note that in case of problems, for example a configured Nature for that project but the related Plugin is not installed, -it will not be possible to run even Java examples because nothing in that project will be compiled. +// +// README for org.apache.pivot.examples.scripting Samples +// + +In this package there are some Groovy sources and even some Scala sources, but in our ant builds they are not compiled. +To run those examples from an IDE (like Eclipse), you must enable support for those languages for the project containing them (examples). + +Note that in case of problems, for example a configured Nature for that project but the related Plugin is not installed, +it will not be possible to run even Java examples because nothing in that project will be compiled. Propchange: pivot/trunk/examples/src/org/apache/pivot/examples/scripting/README.txt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: pivot/trunk/examples/src/org/apache/pivot/examples/svg/logo-64x64.png ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type Tue Oct 31 19:15:47 2023 @@ -1 +1 @@ -application/octet-stream +image/png Propchange: pivot/trunk/examples/src/org/apache/pivot/examples/svg/tiger.svg ------------------------------------------------------------------------------ --- svn:mime-type (original) +++ svn:mime-type Tue Oct 31 19:15:47 2023 @@ -1 +1 @@ -text/xml +image/svg+xml Propchange: pivot/trunk/package-info.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: pivot/trunk/pivot.css ------------------------------------------------------------------------------ svn:eol-style = native Propchange: pivot/trunk/pivot_style_checks.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: pivot/trunk/script ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/script.bat URL: http://svn.apache.org/viewvc/pivot/trunk/script.bat?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/script.bat (original) +++ pivot/trunk/script.bat Tue Oct 31 19:15:47 2023 @@ -1,23 +1,23 @@ -@echo off -:: -:: 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. -:: -if "%1" == "" ( - echo Usage: %0 path_to_bxml_file - exit /b 1 -) -java org.apache.pivot.wtk.ScriptApplication "--src=%1" 2>nul -if errorlevel 1 (call setenv.bat) & (java org.apache.pivot.wtk.ScriptApplication "--src=%1") & (call unsetenv.bat) +@echo off +:: +:: 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. +:: +if "%1" == "" ( + echo Usage: %0 path_to_bxml_file + exit /b 1 +) +java org.apache.pivot.wtk.ScriptApplication "--src=%1" 2>nul +if errorlevel 1 (call setenv.bat) & (java org.apache.pivot.wtk.ScriptApplication "--src=%1") & (call unsetenv.bat) Propchange: pivot/trunk/script.bat ------------------------------------------------------------------------------ svn:eol-style = native Propchange: pivot/trunk/setenv ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/setenv.bat URL: http://svn.apache.org/viewvc/pivot/trunk/setenv.bat?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/setenv.bat (original) +++ pivot/trunk/setenv.bat Tue Oct 31 19:15:47 2023 @@ -1,21 +1,21 @@ -@echo off -:: -:: 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. -:: -set CLASSPATH_OLD=%CLASSPATH% -for %%F in (%CD%\lib\pivot*.jar) do call addclass %%F -for %%F in (%CD%\wtk\lib\*.jar) do call addclass %%F -echo CLASSPATH=%CLASSPATH% +@echo off +:: +:: 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. +:: +set CLASSPATH_OLD=%CLASSPATH% +for %%F in (%CD%\lib\pivot*.jar) do call addclass %%F +for %%F in (%CD%\wtk\lib\*.jar) do call addclass %%F +echo CLASSPATH=%CLASSPATH% Propchange: pivot/trunk/setenv.bat ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/ApplicationWithPropertiesTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/ApplicationWithPropertiesTest.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/ApplicationWithPropertiesTest.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/ApplicationWithPropertiesTest.java Tue Oct 31 19:15:47 2023 @@ -1,106 +1,106 @@ -/* - * 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; - -import org.apache.pivot.beans.BXMLSerializer; -import org.apache.pivot.collections.Map; -import org.apache.pivot.wtk.ApplicationWithProperties; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.Label; -import org.apache.pivot.wtk.Window; - -public class ApplicationWithPropertiesTest extends ApplicationWithProperties.Adapter { - public static final String SAMPLE_PROP_KEY = "sample_object_from_external_env"; - public static final String SAMPLE_CLASSLOADER_PROP_KEY = "sample_classloader_from_external_env"; - - private Window window = null; - private Label sampleLabel = null; - - @Override - public void startup(final Display display, final Map<String, String> properties) - throws Exception { - System.out.println("application startup(...)"); - - // initializeProperties(properties); - - BXMLSerializer bxmlSerializer = new BXMLSerializer(); - window = (Window) bxmlSerializer.readObject(ApplicationWithPropertiesTest.class, - "application_with_properties_test.bxml"); - initializeFields(bxmlSerializer); - window.open(display); - } - - @Override - public boolean shutdown(boolean optional) { - System.out.println("application shutdown(" + optional + ")"); - - if (window != null) { - window.close(); - } - - return false; - } - - private void initializeFields(BXMLSerializer serializer) { - System.out.println("initializeFields: start"); - - sampleLabel = (Label) serializer.getNamespace().get("label"); - System.out.println("label, original text (from bxml) = \"" + sampleLabel.getText() + "\""); - - updateLabel((String) this.getProperties().get(SAMPLE_PROP_KEY)); - setClassLoaderFromExternalProperty((ClassLoader) this.getProperties().get(SAMPLE_CLASSLOADER_PROP_KEY)); - - System.out.println("initializeFields: end"); - } - - private void updateLabel(String text) { - System.out.println("updateLabel with text = \"" + text + "\""); - sampleLabel.setText(text); - } - - private void setClassLoaderFromExternalProperty(ClassLoader classLoader) { - System.out.println("setClassLoaderFromExternalProperty with value = " + classLoader); - // this.classLoader = classLoader; - } - - public static void main(String[] args) { - System.out.println("main(...)"); - - String sample = "Hello from external environment."; - - // instead of the usual call, here I create an instance of my - // application, and then set some properties (from this "external" - // environment) in it. Last, I set that instance in usual launcher, but - // using a new execution method. - ApplicationWithProperties application = new ApplicationWithPropertiesTest(); - System.out.println("application instance = " + application); - - application.getProperties().put(SAMPLE_PROP_KEY, sample); - System.out.println("application sample external property \"" - + SAMPLE_PROP_KEY + "\" = \"" - + application.getProperties().get(SAMPLE_PROP_KEY) + "\""); - final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - application.getProperties().put(SAMPLE_CLASSLOADER_PROP_KEY, classLoader); - System.out.println("application sample external classloader property \"" - + SAMPLE_CLASSLOADER_PROP_KEY + "\" = \"" - + application.getProperties().get(SAMPLE_CLASSLOADER_PROP_KEY) + "\""); - - System.out.println("Executing application ..."); - DesktopApplicationContext.main(application, 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; + +import org.apache.pivot.beans.BXMLSerializer; +import org.apache.pivot.collections.Map; +import org.apache.pivot.wtk.ApplicationWithProperties; +import org.apache.pivot.wtk.DesktopApplicationContext; +import org.apache.pivot.wtk.Display; +import org.apache.pivot.wtk.Label; +import org.apache.pivot.wtk.Window; + +public class ApplicationWithPropertiesTest extends ApplicationWithProperties.Adapter { + public static final String SAMPLE_PROP_KEY = "sample_object_from_external_env"; + public static final String SAMPLE_CLASSLOADER_PROP_KEY = "sample_classloader_from_external_env"; + + private Window window = null; + private Label sampleLabel = null; + + @Override + public void startup(final Display display, final Map<String, String> properties) + throws Exception { + System.out.println("application startup(...)"); + + // initializeProperties(properties); + + BXMLSerializer bxmlSerializer = new BXMLSerializer(); + window = (Window) bxmlSerializer.readObject(ApplicationWithPropertiesTest.class, + "application_with_properties_test.bxml"); + initializeFields(bxmlSerializer); + window.open(display); + } + + @Override + public boolean shutdown(boolean optional) { + System.out.println("application shutdown(" + optional + ")"); + + if (window != null) { + window.close(); + } + + return false; + } + + private void initializeFields(BXMLSerializer serializer) { + System.out.println("initializeFields: start"); + + sampleLabel = (Label) serializer.getNamespace().get("label"); + System.out.println("label, original text (from bxml) = \"" + sampleLabel.getText() + "\""); + + updateLabel((String) this.getProperties().get(SAMPLE_PROP_KEY)); + setClassLoaderFromExternalProperty((ClassLoader) this.getProperties().get(SAMPLE_CLASSLOADER_PROP_KEY)); + + System.out.println("initializeFields: end"); + } + + private void updateLabel(String text) { + System.out.println("updateLabel with text = \"" + text + "\""); + sampleLabel.setText(text); + } + + private void setClassLoaderFromExternalProperty(ClassLoader classLoader) { + System.out.println("setClassLoaderFromExternalProperty with value = " + classLoader); + // this.classLoader = classLoader; + } + + public static void main(String[] args) { + System.out.println("main(...)"); + + String sample = "Hello from external environment."; + + // instead of the usual call, here I create an instance of my + // application, and then set some properties (from this "external" + // environment) in it. Last, I set that instance in usual launcher, but + // using a new execution method. + ApplicationWithProperties application = new ApplicationWithPropertiesTest(); + System.out.println("application instance = " + application); + + application.getProperties().put(SAMPLE_PROP_KEY, sample); + System.out.println("application sample external property \"" + + SAMPLE_PROP_KEY + "\" = \"" + + application.getProperties().get(SAMPLE_PROP_KEY) + "\""); + final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + application.getProperties().put(SAMPLE_CLASSLOADER_PROP_KEY, classLoader); + System.out.println("application sample external classloader property \"" + + SAMPLE_CLASSLOADER_PROP_KEY + "\" = \"" + + application.getProperties().get(SAMPLE_CLASSLOADER_PROP_KEY) + "\""); + + System.out.println("Executing application ..."); + DesktopApplicationContext.main(application, args); + } +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/ApplicationWithPropertiesTest.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java Tue Oct 31 19:15:47 2023 @@ -1,115 +1,115 @@ -/* - * 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; - -import java.awt.Color; - -import org.apache.pivot.beans.BXMLSerializer; -import org.apache.pivot.collections.Map; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.ApplicationContext; -import org.apache.pivot.wtk.Button; -import org.apache.pivot.wtk.Checkbox; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.Gauge; -import org.apache.pivot.wtk.PushButton; -import org.apache.pivot.wtk.Style; -import org.apache.pivot.wtk.Theme; -import org.apache.pivot.wtk.Window; - -public final class GaugeTest implements Application { - private Window window; - private PushButton gasPedal; - private PushButton brakePedal; - private Gauge<Integer> speedGauge; - private Checkbox maxCheck; - private int speed; - private Color textColor; - private Color warningColor; - private Color criticalColor; - - private int randomInt(final int bound) { - double variant = Math.random(); - int value; - if (variant >= 0.5) { - value = (int) Math.floor((variant - 0.5) * (double) bound); - } else { - value = (int) Math.ceil((variant * -1.0) * (double) bound); - } - return value; - } - - private void setSpeed(final int value) { - speed = Math.min(value, speedGauge.getMaxValue()); - speed = Math.max(speed, speedGauge.getMinValue()); - speedGauge.setValue(speed); - Color color = textColor; - if (speed >= speedGauge.getCriticalLevel()) { - color = criticalColor; - } else if (speed > speedGauge.getWarningLevel()) { - color = warningColor; - } - speedGauge.putStyle(Style.textColor, color); - speedGauge.setText(Integer.toString(speed) + " MpH"); - } - - private void hitTheGas() { - setSpeed(speed + 5 + randomInt(2)); - System.out.println("Gas pedal -> " + speed); - } - - private void hitTheBrakes() { - setSpeed(speed - (10 + randomInt(3))); - System.out.println("Brake pedal -> " + speed); - } - - private void varyTheSpeed() { - if (speed > 0) { - setSpeed(speed + randomInt(5)); - System.out.println("Varying speed -> " + speed); - } - } - - private void toggleMax(final Button.State state) { - speedGauge.putStyle(Style.onlyMaxColor, state == Button.State.SELECTED); - } - - @Override - @SuppressWarnings("unchecked") - public void startup(final Display display, final Map<String, String> properties) throws Exception { - BXMLSerializer bxmlSerializer = new BXMLSerializer(); - window = (Window) bxmlSerializer.readObject(getClass().getResource("gauge_test.bxml")); - gasPedal = (PushButton) bxmlSerializer.getNamespace().get("gasPedal"); - brakePedal = (PushButton) bxmlSerializer.getNamespace().get("brakePedal"); - speedGauge = (Gauge<Integer>) bxmlSerializer.getNamespace().get("speedGauge"); - maxCheck = (Checkbox) bxmlSerializer.getNamespace().get("maxCheck"); - warningColor = speedGauge.getStyleColor(Style.warningColor); - criticalColor = speedGauge.getStyleColor(Style.criticalColor); - textColor = Theme.getTheme().getColor(6); - setSpeed(speedGauge.getValue()); - gasPedal.getButtonPressListeners().add((button) -> hitTheGas()); - brakePedal.getButtonPressListeners().add((button) -> hitTheBrakes()); - maxCheck.getButtonStateListeners().add((button, previous) -> toggleMax(button.getState())); - ApplicationContext.scheduleRecurringCallback(() -> varyTheSpeed(), 500L); - window.open(display); - } - - public static void main(final String[] args) { - DesktopApplicationContext.main(GaugeTest.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; + +import java.awt.Color; + +import org.apache.pivot.beans.BXMLSerializer; +import org.apache.pivot.collections.Map; +import org.apache.pivot.wtk.Application; +import org.apache.pivot.wtk.ApplicationContext; +import org.apache.pivot.wtk.Button; +import org.apache.pivot.wtk.Checkbox; +import org.apache.pivot.wtk.DesktopApplicationContext; +import org.apache.pivot.wtk.Display; +import org.apache.pivot.wtk.Gauge; +import org.apache.pivot.wtk.PushButton; +import org.apache.pivot.wtk.Style; +import org.apache.pivot.wtk.Theme; +import org.apache.pivot.wtk.Window; + +public final class GaugeTest implements Application { + private Window window; + private PushButton gasPedal; + private PushButton brakePedal; + private Gauge<Integer> speedGauge; + private Checkbox maxCheck; + private int speed; + private Color textColor; + private Color warningColor; + private Color criticalColor; + + private int randomInt(final int bound) { + double variant = Math.random(); + int value; + if (variant >= 0.5) { + value = (int) Math.floor((variant - 0.5) * (double) bound); + } else { + value = (int) Math.ceil((variant * -1.0) * (double) bound); + } + return value; + } + + private void setSpeed(final int value) { + speed = Math.min(value, speedGauge.getMaxValue()); + speed = Math.max(speed, speedGauge.getMinValue()); + speedGauge.setValue(speed); + Color color = textColor; + if (speed >= speedGauge.getCriticalLevel()) { + color = criticalColor; + } else if (speed > speedGauge.getWarningLevel()) { + color = warningColor; + } + speedGauge.putStyle(Style.textColor, color); + speedGauge.setText(Integer.toString(speed) + " MpH"); + } + + private void hitTheGas() { + setSpeed(speed + 5 + randomInt(2)); + System.out.println("Gas pedal -> " + speed); + } + + private void hitTheBrakes() { + setSpeed(speed - (10 + randomInt(3))); + System.out.println("Brake pedal -> " + speed); + } + + private void varyTheSpeed() { + if (speed > 0) { + setSpeed(speed + randomInt(5)); + System.out.println("Varying speed -> " + speed); + } + } + + private void toggleMax(final Button.State state) { + speedGauge.putStyle(Style.onlyMaxColor, state == Button.State.SELECTED); + } + + @Override + @SuppressWarnings("unchecked") + public void startup(final Display display, final Map<String, String> properties) throws Exception { + BXMLSerializer bxmlSerializer = new BXMLSerializer(); + window = (Window) bxmlSerializer.readObject(getClass().getResource("gauge_test.bxml")); + gasPedal = (PushButton) bxmlSerializer.getNamespace().get("gasPedal"); + brakePedal = (PushButton) bxmlSerializer.getNamespace().get("brakePedal"); + speedGauge = (Gauge<Integer>) bxmlSerializer.getNamespace().get("speedGauge"); + maxCheck = (Checkbox) bxmlSerializer.getNamespace().get("maxCheck"); + warningColor = speedGauge.getStyleColor(Style.warningColor); + criticalColor = speedGauge.getStyleColor(Style.criticalColor); + textColor = Theme.getTheme().getColor(6); + setSpeed(speedGauge.getValue()); + gasPedal.getButtonPressListeners().add((button) -> hitTheGas()); + brakePedal.getButtonPressListeners().add((button) -> hitTheBrakes()); + maxCheck.getButtonStateListeners().add((button, previous) -> toggleMax(button.getState())); + ApplicationContext.scheduleRecurringCallback(() -> varyTheSpeed(), 500L); + window.open(display); + } + + public static void main(final String[] args) { + DesktopApplicationContext.main(GaugeTest.class, args); + } +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/GaugeTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/HyperlinkButtonTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/HyperlinkButtonTest2.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: pivot/trunk/tests/src/org/apache/pivot/tests/LabelAntialiasTest.java URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/LabelAntialiasTest.java?rev=1913470&r1=1913469&r2=1913470&view=diff ============================================================================== --- pivot/trunk/tests/src/org/apache/pivot/tests/LabelAntialiasTest.java (original) +++ pivot/trunk/tests/src/org/apache/pivot/tests/LabelAntialiasTest.java Tue Oct 31 19:15:47 2023 @@ -1,154 +1,154 @@ -/* - * 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; - -import java.awt.Color; -import java.awt.Font; -import java.awt.GraphicsEnvironment; -import java.awt.Toolkit; -import java.awt.geom.AffineTransform; - -import org.apache.pivot.collections.Map; -import org.apache.pivot.wtk.Application; -import org.apache.pivot.wtk.BoxPane; -import org.apache.pivot.wtk.DesktopApplicationContext; -import org.apache.pivot.wtk.Display; -import org.apache.pivot.wtk.FontUtilities; -import org.apache.pivot.wtk.HorizontalAlignment; -import org.apache.pivot.wtk.Label; -import org.apache.pivot.wtk.Orientation; -import org.apache.pivot.wtk.Spinner; -import org.apache.pivot.wtk.SpinnerSelectionListener; -import org.apache.pivot.wtk.Style; -import org.apache.pivot.wtk.TablePane; -import org.apache.pivot.wtk.VerticalAlignment; -import org.apache.pivot.wtk.Window; -import org.apache.pivot.wtk.content.NumericSpinnerData; - -public final class LabelAntialiasTest implements Application { - private Window window = null; - private TablePane.Row labelRow = null; - private Spinner rotationAngleSpinner = null; - private int currentRotationAngle = 0; - - private Label buildLabel(final double rotation) { - Label label = new Label(); - - Font font = new Font(FontUtilities.ARIAL, Font.BOLD, 64); - - AffineTransform fontAT = new AffineTransform(); - // Derive a new font using a rotation transform - fontAT.rotate(rotation * java.lang.Math.PI / 180.0d); - Font fontDerived = font.deriveFont(fontAT); - - label.setText("Hello at " + rotation + " degrees."); - label.putStyle(Style.color, Color.RED); - label.putStyle(Style.font, fontDerived); - label.putStyle(Style.horizontalAlignment, HorizontalAlignment.CENTER); - label.putStyle(Style.verticalAlignment, VerticalAlignment.CENTER); - - return label; - } - - /** - * Write to console some details of Desktop Hints, for Font Rendering. - * - * @see org.apache.pivot.wtk.Platform#initializeFontRenderContext - */ - private void showFontDesktopHints() { - System.out.println("Show Font Desktop Hints:"); - - Toolkit toolkit = Toolkit.getDefaultToolkit(); - java.util.Map<?, ?> fontDesktopHints = - (java.util.Map<?, ?>) toolkit.getDesktopProperty("awt.font.desktophints"); - - System.out.println(fontDesktopHints); - } - - /** - * Write to console the list of Font families found in the System. - */ - private void showFontFamilies() { - System.out.println("Show Font Families:"); - - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - String[] fontFamilies = ge.getAvailableFontFamilyNames(); - int fontFamiliesNumber = fontFamilies.length; - StringBuffer fontFamilyNames = new StringBuffer(1024); - for (int i = 0; i < fontFamiliesNumber; i++) { - if (i > 0) { - fontFamilyNames.append(", "); - } - fontFamilyNames.append(fontFamilies[i]); - } - System.out.println(fontFamilyNames); - } - - @Override - public void startup(final Display display, final Map<String, String> properties) { - window = new Window(); - - showFontDesktopHints(); - showFontFamilies(); - - TablePane content = new TablePane(); - new TablePane.Column(content, 1, true); - BoxPane topBox = new BoxPane(Orientation.HORIZONTAL); - topBox.putStyle(Style.verticalAlignment, VerticalAlignment.CENTER); - topBox.add(new Label("Rotation angle:")); - rotationAngleSpinner = new Spinner(new NumericSpinnerData(0, 359)); - rotationAngleSpinner.setCircular(true); - rotationAngleSpinner.setPreferredWidth(40); - topBox.add(rotationAngleSpinner); - TablePane.Row topRow = new TablePane.Row(content, -1); - topRow.add(topBox); - labelRow = new TablePane.Row(content, 1, true); - - window.setContent(content); - - window.setTitle("Label Antialiasing Test"); - window.setMaximized(true); - - rotationAngleSpinner.getSpinnerSelectionListeners().add(new SpinnerSelectionListener() { - @Override - public void selectedItemChanged(final Spinner spinner, final Object previousSelectedItem) { - currentRotationAngle = (Integer) spinner.getSelectedItem(); - if (labelRow.getLength() > 0) { - labelRow.remove(0, labelRow.getLength()); - } - labelRow.add(buildLabel(currentRotationAngle)); - } - }); - rotationAngleSpinner.setSelectedItem(45); - - window.open(display); - } - - @Override - public boolean shutdown(final boolean optional) { - if (window != null) { - window.close(); - } - - return false; - } - - public static void main(final String[] args) { - DesktopApplicationContext.main(LabelAntialiasTest.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; + +import java.awt.Color; +import java.awt.Font; +import java.awt.GraphicsEnvironment; +import java.awt.Toolkit; +import java.awt.geom.AffineTransform; + +import org.apache.pivot.collections.Map; +import org.apache.pivot.wtk.Application; +import org.apache.pivot.wtk.BoxPane; +import org.apache.pivot.wtk.DesktopApplicationContext; +import org.apache.pivot.wtk.Display; +import org.apache.pivot.wtk.FontUtilities; +import org.apache.pivot.wtk.HorizontalAlignment; +import org.apache.pivot.wtk.Label; +import org.apache.pivot.wtk.Orientation; +import org.apache.pivot.wtk.Spinner; +import org.apache.pivot.wtk.SpinnerSelectionListener; +import org.apache.pivot.wtk.Style; +import org.apache.pivot.wtk.TablePane; +import org.apache.pivot.wtk.VerticalAlignment; +import org.apache.pivot.wtk.Window; +import org.apache.pivot.wtk.content.NumericSpinnerData; + +public final class LabelAntialiasTest implements Application { + private Window window = null; + private TablePane.Row labelRow = null; + private Spinner rotationAngleSpinner = null; + private int currentRotationAngle = 0; + + private Label buildLabel(final double rotation) { + Label label = new Label(); + + Font font = new Font(FontUtilities.ARIAL, Font.BOLD, 64); + + AffineTransform fontAT = new AffineTransform(); + // Derive a new font using a rotation transform + fontAT.rotate(rotation * java.lang.Math.PI / 180.0d); + Font fontDerived = font.deriveFont(fontAT); + + label.setText("Hello at " + rotation + " degrees."); + label.putStyle(Style.color, Color.RED); + label.putStyle(Style.font, fontDerived); + label.putStyle(Style.horizontalAlignment, HorizontalAlignment.CENTER); + label.putStyle(Style.verticalAlignment, VerticalAlignment.CENTER); + + return label; + } + + /** + * Write to console some details of Desktop Hints, for Font Rendering. + * + * @see org.apache.pivot.wtk.Platform#initializeFontRenderContext + */ + private void showFontDesktopHints() { + System.out.println("Show Font Desktop Hints:"); + + Toolkit toolkit = Toolkit.getDefaultToolkit(); + java.util.Map<?, ?> fontDesktopHints = + (java.util.Map<?, ?>) toolkit.getDesktopProperty("awt.font.desktophints"); + + System.out.println(fontDesktopHints); + } + + /** + * Write to console the list of Font families found in the System. + */ + private void showFontFamilies() { + System.out.println("Show Font Families:"); + + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + String[] fontFamilies = ge.getAvailableFontFamilyNames(); + int fontFamiliesNumber = fontFamilies.length; + StringBuffer fontFamilyNames = new StringBuffer(1024); + for (int i = 0; i < fontFamiliesNumber; i++) { + if (i > 0) { + fontFamilyNames.append(", "); + } + fontFamilyNames.append(fontFamilies[i]); + } + System.out.println(fontFamilyNames); + } + + @Override + public void startup(final Display display, final Map<String, String> properties) { + window = new Window(); + + showFontDesktopHints(); + showFontFamilies(); + + TablePane content = new TablePane(); + new TablePane.Column(content, 1, true); + BoxPane topBox = new BoxPane(Orientation.HORIZONTAL); + topBox.putStyle(Style.verticalAlignment, VerticalAlignment.CENTER); + topBox.add(new Label("Rotation angle:")); + rotationAngleSpinner = new Spinner(new NumericSpinnerData(0, 359)); + rotationAngleSpinner.setCircular(true); + rotationAngleSpinner.setPreferredWidth(40); + topBox.add(rotationAngleSpinner); + TablePane.Row topRow = new TablePane.Row(content, -1); + topRow.add(topBox); + labelRow = new TablePane.Row(content, 1, true); + + window.setContent(content); + + window.setTitle("Label Antialiasing Test"); + window.setMaximized(true); + + rotationAngleSpinner.getSpinnerSelectionListeners().add(new SpinnerSelectionListener() { + @Override + public void selectedItemChanged(final Spinner spinner, final Object previousSelectedItem) { + currentRotationAngle = (Integer) spinner.getSelectedItem(); + if (labelRow.getLength() > 0) { + labelRow.remove(0, labelRow.getLength()); + } + labelRow.add(buildLabel(currentRotationAngle)); + } + }); + rotationAngleSpinner.setSelectedItem(45); + + window.open(display); + } + + @Override + public boolean shutdown(final boolean optional) { + if (window != null) { + window.close(); + } + + return false; + } + + public static void main(final String[] args) { + DesktopApplicationContext.main(LabelAntialiasTest.class, args); + } + +} Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/LabelAntialiasTest.java ------------------------------------------------------------------------------ svn:eol-style = native