You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/10/29 15:35:44 UTC
svn commit: r1028733 [3/3] - in /pivot/trunk: demos/xsl/
examples/src/org/apache/pivot/examples/svg/
tutorials/src/org/apache/pivot/tutorials/labels/ tutorials/www/
tutorials/xsl/ wtk/src/org/apache/pivot/wtk/
Added: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/svg.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/svg.bxml?rev=1028733&view=auto
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/svg.bxml (added)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/labels/svg.bxml Fri Oct 29 13:35:44 2010
@@ -0,0 +1,38 @@
+<?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="SVG Images" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns="org.apache.pivot.wtk">
+ <Border>
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="fill_to_capacity">
+ <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
+ <BoxPane orientation="vertical" styles="{horizontalAlignment:'center', spacing:10}">
+ <ImageView image="@logo.svg" preferredWidth="64" preferredHeight="64" styles="{fill:true}"/>
+ <Label text="SVG"/>
+ </BoxPane>
+
+ <BoxPane orientation="vertical" styles="{horizontalAlignment:'center', spacing:10}">
+ <ImageView image="@logo-64x64.png"/>
+ <Label text="PNG"/>
+ </BoxPane>
+ </BoxPane>
+ </ScrollPane>
+ </Border>
+</Window>
+
Modified: pivot/trunk/tutorials/www/index.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/index.xml?rev=1028733&r1=1028732&r2=1028733&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/index.xml (original)
+++ pivot/trunk/tutorials/www/index.xml Fri Oct 29 13:35:44 2010
@@ -54,7 +54,9 @@ limitations under the License.
</item-group>
<item-group name="Pivot Components">
- <document-item id="labels-and-image-views"/>
+ <document-item id="labels-and-image-views">
+ <document-item id="svg-images"/>
+ </document-item>
<document-item id="buttons">
<document-item id="push-buttons"/>
<document-item id="toggle-buttons"/>
Added: pivot/trunk/tutorials/www/svg-images.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/svg-images.xml?rev=1028733&view=auto
==============================================================================
--- pivot/trunk/tutorials/www/svg-images.xml (added)
+++ pivot/trunk/tutorials/www/svg-images.xml Fri Oct 29 13:35:44 2010
@@ -0,0 +1,84 @@
+<?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.
+-->
+
+<document id="svg-images">
+ <properties>
+ <title>SVG Images</title>
+ </properties>
+
+ <body>
+ <p>
+ In addition to common bitmapped image formats such as PNG and JPEG, Pivot also supports
+ Scalable Vector Graphic (SVG) images. For example, the following application displays
+ an SVG image containing the Pivot logo, alongside a PNG equivalent:
+ </p>
+
+ <application class="org.apache.pivot.wtk.ScriptApplication"
+ width="640" height="480">
+ <libraries>
+ <library>core</library>
+ <library>wtk</library>
+ <library>wtk-terra</library>
+ <library>tutorials</library>
+ </libraries>
+ <startup-properties>
+ <src>/org/apache/pivot/tutorials/labels/svg.bxml</src>
+ </startup-properties>
+ </application>
+
+ <p>
+ The primary advantage of using SVG images rather than bitmapped images in an application
+ is scalability (i.e. resolution independence). When a bitmapped image is scaled, it
+ becomes pixelated and grainy, whereas a vector image does not.
+ </p>
+
+ <p>
+ To see an example, try scaling the Pivot display by clicking on the application and
+ using the mouse wheel or pressing the +/- keys while holding down Control-Shift. The
+ SVG image and text scale smoothly, while the PNG image quickly becomes unreadable.
+ </p>
+
+ <p>
+ Below is the BXML source for the application:
+ </p>
+
+ <source type="xml" location="org/apache/pivot/tutorials/labels/svg.bxml">
+ <![CDATA[
+ <Window title="SVG Images" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns="org.apache.pivot.wtk">
+ <Border>
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="fill_to_capacity">
+ <BoxPane styles="{horizontalAlignment:'center', verticalAlignment:'center'}">
+ <BoxPane orientation="vertical" styles="{horizontalAlignment:'center', spacing:10}">
+ <ImageView image="@logo.svg" preferredWidth="64" preferredHeight="64" styles="{fill:true}"/>
+ <Label text="SVG"/>
+ </BoxPane>
+
+ <BoxPane orientation="vertical" styles="{horizontalAlignment:'center', spacing:10}">
+ <ImageView image="@logo-64x64.png"/>
+ <Label text="PNG"/>
+ </BoxPane>
+ </BoxPane>
+ </ScrollPane>
+ </Border>
+ </Window>
+ ]]>
+ </source>
+ </body>
+</document>
Modified: pivot/trunk/tutorials/xsl/tutorial.xsl
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/xsl/tutorial.xsl?rev=1028733&r1=1028732&r2=1028733&view=diff
==============================================================================
--- pivot/trunk/tutorials/xsl/tutorial.xsl (original)
+++ pivot/trunk/tutorials/xsl/tutorial.xsl Fri Oct 29 13:35:44 2010
@@ -114,6 +114,16 @@ limitations under the License.
<xsl:text><![CDATA[");
]]></xsl:text>
</xsl:for-each>
+
+ <xsl:choose>
+ <xsl:when test='$signed'>
+ libraries.push("lib/svgSalamander-tiny.signed.jar");
+ </xsl:when>
+ <xsl:otherwise>
+ libraries.push("lib/svgSalamander-tiny.jar");
+ </xsl:otherwise>
+ </xsl:choose>
+
attributes.archive = libraries.join(",");
<!-- Base parameters -->
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java?rev=1028733&r1=1028732&r2=1028733&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Fri Oct 29 13:35:44 2010
@@ -835,6 +835,8 @@ public abstract class ApplicationContext
try {
switch (eventID) {
case MouseEvent.MOUSE_PRESSED: {
+ requestFocusInWindow();
+
mouseOwner.mouseDown(button, x, y);
if (button == Mouse.Button.LEFT) {