=== modified file 'src/com/goldencode/p2j/ui/client/UiUtils.java' --- src/com/goldencode/p2j/ui/client/UiUtils.java 2016-06-14 16:44:41 +0000 +++ src/com/goldencode/p2j/ui/client/UiUtils.java 2016-06-15 06:49:50 +0000 @@ -62,7 +62,6 @@ ** 036 HC 20160406 Fixed lookupWidgetId() implementation to conform with the method's contract. ** 037 HC 20160421 Added locateRootFrame() method. ** 038 HC 20160607 GUI menus reworked to be displayed in dedicated top-level windows. -** 039 SBI 20160614 Added EMPTY_STRING. */ package com.goldencode.p2j.ui.client; @@ -81,9 +80,6 @@ */ public class UiUtils { - /** Empty string */ - public static final String EMPTY_STRING = ""; - /** Logger. */ protected static final Logger LOG = LogHelper.getLogger(UiUtils.class.getName()); === modified file 'src/com/goldencode/p2j/ui/client/driver/web/WebClientMessageTypes.java' --- src/com/goldencode/p2j/ui/client/driver/web/WebClientMessageTypes.java 2016-04-21 17:01:43 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/WebClientMessageTypes.java 2016-06-15 06:54:20 +0000 @@ -28,6 +28,7 @@ ** into the converted code (i.e. invoke external programs, procedures or ** functions). Can be used only when the P2J client runs embedded in a ** customer-specific application. +** 009 SBI 20160615 Added MSG_INVALIDATE_SELECTION. */ package com.goldencode.p2j.ui.client.driver.web; @@ -238,6 +239,9 @@ /** Open the new page or resource in the browser. */ public static final byte MSG_OPEN_URL = (byte) 0xF3; + /** Notify that the current selection is invalidated. */ + public static final byte MSG_INVALIDATE_SELECTION = (byte) 0xF4; + /** Wraps the large message from the client to the sequence of this partial type messages. */ public static final byte MSG_PARTIAL = (byte) 0xFE; === modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js' --- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js 2016-06-14 16:44:41 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js 2016-06-15 06:58:52 +0000 @@ -127,7 +127,7 @@ if (p2j.isGui) { // consume copy/cut events if the current selection is invalid - if (getSelection() === "") + if (getSelection() === null) { p2j.consumeEvent(e); return; @@ -218,8 +218,8 @@ console.debug("getSelectedText() " + text); // copy the current selection to the input hidden field to save this value - // to the system clipboard if the current selection is not empty - if (text !== "") + // to the system clipboard if the current selection is valid + if (text !== null) { setClipboardValue(text); } === modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js' --- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js 2016-05-19 13:48:01 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js 2016-06-15 06:57:29 +0000 @@ -58,6 +58,7 @@ ** functions). Can be used only when the P2J client runs embedded in a ** customer-specific application. ** 019 SBI 20160519 Safari doesn't support "const" constants declarations in JS. +** SBI 20160615 Added MSG_INVALIDATE_SELECTION. */ "use strict"; @@ -273,6 +274,9 @@ /** Open the new page or resource in the browser. */ MSG_OPEN_URL : 0xF3, + /** Notify that the current selection is invalidated. */ + MSG_INVALIDATE_SELECTION : 0xF4, + /** Wraps the large message from the client to the sequence of this partial type messages. */ MSG_PARTIAL : 0xFE, @@ -1863,6 +1867,10 @@ var text = me.readStringBinaryMessage(message, 1); p2j.clipboard.setSelection(text); break; + case types.MSG_INVALIDATE_SELECTION: + // invalidate the current selection + p2j.clipboard.setSelection(null); + break; case types.MSG_MOVE_TO_TOP: var id = me.readInt32BinaryMessage(message, 1); p2j.screen.moveToTop(id); === modified file 'src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java' --- src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java 2016-06-14 16:44:41 +0000 +++ src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java 2016-06-15 06:49:06 +0000 @@ -2800,7 +2800,7 @@ config.selectionEnd = -1; config.selectionText = null; // notify the client the selection is invalid - gd.setCurrentSelection(UiUtils.EMPTY_STRING); + gd.setCurrentSelection(null); } /** === modified file 'src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java' --- src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java 2016-06-14 16:44:41 +0000 +++ src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java 2016-06-15 06:50:01 +0000 @@ -1008,7 +1008,7 @@ protected void invalidateSelection() { super.invalidateSelection(); - gd.setCurrentSelection(UiUtils.EMPTY_STRING); + gd.setCurrentSelection(null); } /** === modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java' --- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java 2016-06-02 18:08:34 +0000 +++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java 2016-06-15 06:53:10 +0000 @@ -54,6 +54,7 @@ ** business logic might rely on them, if explicitly raised. ** 016 SBI 20160427 Added graphicsCached parameter to turn off the graphics cache for testing. ** SBI 20160523 Fixed to handle clipboard messages without contents. +** SBI 20160615 Added MSG_INVALIDATE_SELECTION. */ package com.goldencode.p2j.ui.client.gui.driver.web; @@ -2919,7 +2920,14 @@ */ public void setSelection(String text) { - sendBinaryMessage(MSG_CURRENT_SELECTION, (text == null) ? "" : text); + if (text != null) + { + sendBinaryMessage(MSG_CURRENT_SELECTION, text); + } + else + { + sendBinaryMessage(MSG_INVALIDATE_SELECTION); + } } /**