You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/09/29 17:40:49 UTC
svn commit: r819988 - in
/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard:
clipboard.js clipboard.wtkx
Author: gbrown
Date: Tue Sep 29 15:40:49 2009
New Revision: 819988
URL: http://svn.apache.org/viewvc?rev=819988&view=rev
Log:
Move clipboard tutorial script into an external file.
Added:
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.js
Modified:
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.wtkx
Added: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.js
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.js?rev=819988&view=auto
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.js (added)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.js Tue Sep 29 15:40:49 2009
@@ -0,0 +1,42 @@
+/*
+ * 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(org.apache.pivot.wtk);
+
+function copy() {
+ // Copy the selected image to the clipboard
+ var selectedSourceIndex = sourceImageCardPane.getSelectedIndex();
+ var sourceImageView = sourceImageCardPane.get(selectedSourceIndex);
+ var sourceImage = sourceImageView.getImage();
+
+ var content = new LocalManifest();
+ content.putImage(sourceImage);
+
+ Clipboard.setContent(content);
+}
+
+function paste() {
+ // Paste any available image from the clipboard
+ var content = Clipboard.getContent();
+
+ if (content != null) {
+ var image = content.getImage();
+
+ if (image != null) {
+ destinationImageView.setImage(image);
+ }
+ }
+}
\ No newline at end of file
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.wtkx?rev=819988&r1=819987&r2=819988&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.wtkx (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/clipboard/clipboard.wtkx Tue Sep 29 15:40:49 2009
@@ -19,34 +19,7 @@
<Window title="Clipboard" maximized="true"
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns="org.apache.pivot.wtk">
- <wtkx:script>
- importPackage(org.apache.pivot.wtk);
-
- function copy() {
- // Copy the selected image to the clipboard
- var selectedSourceIndex = sourceImageCardPane.getSelectedIndex();
- var sourceImageView = sourceImageCardPane.get(selectedSourceIndex);
- var sourceImage = sourceImageView.getImage();
-
- var content = new LocalManifest();
- content.putImage(sourceImage);
-
- Clipboard.setContent(content);
- }
-
- function paste() {
- // Paste any available image from the clipboard
- var content = Clipboard.getContent();
-
- if (content != null) {
- var image = content.getImage();
-
- if (image != null) {
- destinationImageView.setImage(image);
- }
- }
- }
- </wtkx:script>
+ <wtkx:script src="clipboard.js"/>
<windowStateListeners>
<wtkx:script>