Project

General

Profile

3075_7.txt

Sergey Ivanovskiy, 06/14/2016 12:47 PM

Download (4.2 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/UiUtils.java'
2
--- src/com/goldencode/p2j/ui/client/UiUtils.java	2016-06-07 21:53:53 +0000
3
+++ src/com/goldencode/p2j/ui/client/UiUtils.java	2016-06-14 16:42:46 +0000
4
@@ -62,6 +62,7 @@
5
 ** 036 HC  20160406 Fixed lookupWidgetId() implementation to conform with the method's contract.
6
 ** 037 HC  20160421 Added locateRootFrame() method.
7
 ** 038 HC  20160607 GUI menus reworked to be displayed in dedicated top-level windows.
8
+** 039 SBI 20160614 Added EMPTY_STRING.
9
 */
10
 
11
 package com.goldencode.p2j.ui.client;
12
@@ -80,6 +81,9 @@
13
  */
14
 public class UiUtils
15
 {
16
+   /** Empty string */
17
+   public static final String EMPTY_STRING = "";
18
+   
19
    /** Logger. */
20
    protected static final Logger LOG = LogHelper.getLogger(UiUtils.class.getName());
21
 
22

    
23
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js'
24
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js	2016-06-08 20:04:32 +0000
25
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js	2016-06-14 16:34:53 +0000
26
@@ -26,6 +26,7 @@
27
 ** 006 SBI 20160301 The CHUI editor code requires EOL's simulating.
28
 ** 007 SBI 20160523 Fixed copy/cut/paste work flow.
29
 **     SBI 20160603 Added Safari COMMAND+C processing.
30
+**     SBI 20160614 Changed to consume copy/cut events if the current selection is invalid.
31
 */
32
 
33
 "use strict";
34
@@ -122,8 +123,15 @@
35
       console.debug("copyHandler {");
36
       if (!me.enabled)
37
          return;
38
+      
39
       if (p2j.isGui)
40
       {
41
+         // consume copy/cut events if the current selection is invalid
42
+         if (getSelection() === "")
43
+         {
44
+            p2j.consumeEvent(e);
45
+            return;
46
+         }
47
          prepareCopy();
48
       }
49
       // restore value to copy
50
@@ -210,8 +218,12 @@
51
          console.debug("getSelectedText() " + text);
52
 
53
          // copy the current selection to the input hidden field to save this value
54
-         // to the system clipboard.
55
-         setClipboardValue(text);
56
+         // to the system clipboard if the current selection is not empty
57
+         if (text !== "")
58
+         {
59
+            setClipboardValue(text);
60
+         }
61
+         
62
          focusHiddenInputField();
63
       }
64
       console.debug("prepareCopy }");
65

    
66
=== modified file 'src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java'
67
--- src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java	2016-06-13 17:34:13 +0000
68
+++ src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java	2016-06-14 16:41:26 +0000
69
@@ -39,7 +39,7 @@
70
 ** 017 EVL 20160419 Adding more effects handling for editor in 3d mode.
71
 ** 018 SVL 20160412 Javadoc fix.
72
 ** 019 HC  20160607 GUI menus reworked to be displayed in dedicated top-level windows.
73
-** 020 SBI 20160613 Notify the web client about the current selection.
74
+** 020 SBI 20160614 Changed to notify the client the current selection is invalid.
75
 */
76
 
77
 package com.goldencode.p2j.ui.client.gui;
78
@@ -2799,6 +2799,8 @@
79
       config.selectionStart = -1;
80
       config.selectionEnd = -1;
81
       config.selectionText = null;
82
+      // notify the client the selection is invalid
83
+      gd.setCurrentSelection(UiUtils.EMPTY_STRING);
84
    }
85
    
86
    /**
87

    
88
=== modified file 'src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java'
89
--- src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java	2016-06-08 13:29:11 +0000
90
+++ src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java	2016-06-14 16:41:58 +0000
91
@@ -62,6 +62,7 @@
92
 ** 029 VIG 20160128 Added isRMBEntrySupported() method, added system popup support.
93
 **                  Changed showPopupMenu() call: added parameter. Fixed onFocusLost listener.
94
 ** 030 HC  20160607 GUI menus reworked to be displayed in dedicated top-level windows.
95
+** 031 SBI 20160614 Changed to notify the client the current selection is invalid.
96
 */
97
 
98
 package com.goldencode.p2j.ui.client.gui;
99
@@ -1000,6 +1001,17 @@
100
    }
101
    
102
    /**
103
+    * Invalidate the text selection state. Delegate to the base method and notify the client that
104
+    * the current selection is invalid.
105
+    */
106
+   @Override
107
+   protected void invalidateSelection()
108
+   {
109
+      super.invalidateSelection();
110
+      gd.setCurrentSelection(UiUtils.EMPTY_STRING);
111
+   }
112
+   
113
+   /**
114
     * Draws the selected part of the etry field.
115
     * 
116
     * @param    txt
117