You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2014/03/20 11:06:46 UTC
svn commit: r1579579 - in /pivot/trunk:
tests/src/org/apache/pivot/tests/issues/pivot929/
wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/
Author: smartini
Date: Thu Mar 20 10:06:45 2014
New Revision: 1579579
URL: http://svn.apache.org/r1579579
Log:
merge latest fixes from 2.0.x
Added:
pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/
pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/Pivot929.java
Modified:
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Clipboard.java
Added: 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=1579579&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/Pivot929.java (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot929/Pivot929.java Thu Mar 20 10:06:45 2014
@@ -0,0 +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
+ }
+ });
+ }
+
+}
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java?rev=1579579&r1=1579578&r2=1579579&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java Thu Mar 20 10:06:45 2014
@@ -922,7 +922,7 @@ public class TerraFileBrowserSkin extend
fileTableView.getComponentTooltipListeners().add(new ComponentTooltipListener() {
@Override
- public void tooltipTriggered(Component component, int x, int y) {
+ public void tooltipTriggered(Component comp, int x, int y) {
// Check that we are on the first column.
if (fileTableView.getColumnAt(x) != 0) {
@@ -952,12 +952,12 @@ public class TerraFileBrowserSkin extend
tooltip.setContent(toolTipTextArea);
- Point location = component.getDisplay().getMouseLocation();
+ Point location = comp.getDisplay().getMouseLocation();
x = location.x;
y = location.y;
// Ensure that the tooltip stays on screen
- Display display = component.getDisplay();
+ Display display = comp.getDisplay();
int tooltipHeight = tooltip.getPreferredHeight();
if (y + tooltipHeight > display.getHeight()) {
y -= tooltipHeight;
@@ -968,7 +968,7 @@ public class TerraFileBrowserSkin extend
toolTipTextArea.setMaximumWidth(display.getWidth() - ( x + tooltipXOffset + padding) );
tooltip.setLocation(x + tooltipXOffset, y);
- tooltip.open(component.getWindow());
+ tooltip.open(comp.getWindow());
}
});
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=1579579&r1=1579578&r2=1579579&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Thu Mar 20 10:06:45 2014
@@ -266,14 +266,15 @@ public abstract class ApplicationContext
if (dropLocation != null) {
dropAction = dropTarget.userDropActionChange(dropDescendant, dragManifest,
supportedDropActions, dropLocation.x, dropLocation.y, userDropAction);
- }
- if (dropAction != null) {
- // Perform the drop
- event.acceptDrop(getNativeDropAction(dropAction));
- dropTarget.drop(dropDescendant, dragManifest, supportedDropActions,
- dropLocation.x, dropLocation.y, userDropAction);
+ if (dropAction != null) {
+ // Perform the drop
+ event.acceptDrop(getNativeDropAction(dropAction));
+ dropTarget.drop(dropDescendant, dragManifest, supportedDropActions,
+ dropLocation.x, dropLocation.y, userDropAction);
+ }
}
+
}
if (dropAction == null) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Clipboard.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Clipboard.java?rev=1579579&r1=1579578&r2=1579579&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Clipboard.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Clipboard.java Thu Mar 20 10:06:45 2014
@@ -28,6 +28,19 @@ public final class Clipboard {
private static LocalManifest content = null;
private static ClipboardContentListener clipboardContentListener = null;
+ private static final ClipboardOwner clipboardOwner = new ClipboardOwner() {
+ @Override
+ public void lostOwnership(java.awt.datatransfer.Clipboard clipboard,
+ Transferable contents) {
+ LocalManifest previousContent = Clipboard.content;
+ Clipboard.content = null;
+
+ if (Clipboard.clipboardContentListener != null) {
+ Clipboard.clipboardContentListener.contentChanged(previousContent);
+ }
+ }
+ };
+
/**
* Retrieves the contents of the clipboard.
*/
@@ -70,18 +83,7 @@ public final class Clipboard {
java.awt.datatransfer.Clipboard awtClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
LocalManifestAdapter localManifestAdapter = new LocalManifestAdapter(content);
- awtClipboard.setContents(localManifestAdapter, new ClipboardOwner() {
- @Override
- public void lostOwnership(java.awt.datatransfer.Clipboard clipboard,
- Transferable contents) {
- LocalManifest previousContent = Clipboard.content;
- Clipboard.content = null;
-
- if (Clipboard.clipboardContentListener != null) {
- Clipboard.clipboardContentListener.contentChanged(previousContent);
- }
- }
- });
+ awtClipboard.setContents(localManifestAdapter, clipboardOwner);
} catch (SecurityException exception) {
// No-op
}