From e4bce60c5c4a7e9a53c4480ba030ffbb0a1c1367 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Tue, 21 Jul 2020 18:17:03 +0200 Subject: [PATCH] Feature #19471 Please provide a simple way to get the full Context --- .../client/ResourceManagementPortlet.java | 26 +++++++++++++++--- .../client/utils/Commands.java | 7 +++-- src/main/webapp/ResourceManagementPortlet.css | 4 +++ src/main/webapp/images/icons/copy.png | Bin 0 -> 1184 bytes 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 src/main/webapp/images/icons/copy.png diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/ResourceManagementPortlet.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/ResourceManagementPortlet.java index 534c260..f507a95 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/ResourceManagementPortlet.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/ResourceManagementPortlet.java @@ -88,6 +88,7 @@ import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.RootPanel; +import com.liferay.portal.kernel.xml.simple.Element; /** * Entry point classes define onModuleLoad(). @@ -703,7 +704,7 @@ public class ResourceManagementPortlet implements EntryPoint { } //statusbar.add(new FillToolItem()); - statusbar.add(new Label("                   ")); + statusbar.add(new Label("     ")); ProgressBar progressStatus = new ProgressBar(); progressStatus.setWidth(200); progressStatus.updateText("Updating Infrastructure..."); @@ -713,13 +714,22 @@ public class ResourceManagementPortlet implements EntryPoint { statusbar.add(new FillToolItem()); statusbar.add(new Label("Current Scope:  ")); - Status scopeInfo = new Status(); + + Text scopeInfo = new Text(Messages.NO_SCOPE_SELECTED); scopeInfo.setWidth(350); - scopeInfo.setText(Messages.NO_SCOPE_SELECTED); - scopeInfo.setBox(true); statusbar.add(scopeInfo); WidgetsRegistry.registerWidget(UIIdentifiers.STATUS_SCOPE_INFO_ID, scopeInfo); + + Button copy2Clipboard = new Button() { + @Override + protected void onClick(final ComponentEvent ce) { + copy2Clipboard(); + } + }; + copy2Clipboard.setIconStyle("copy-clip-icon"); + copy2Clipboard.setToolTip("Copy to Clipboard"); + statusbar.add(copy2Clipboard); statusbar.add(new Label("  Loaded Resources:  ")); Status loadedResources = new Status(); loadedResources.setWidth(35); @@ -735,5 +745,13 @@ public class ResourceManagementPortlet implements EntryPoint { WidgetsRegistry.registerWidget(UIIdentifiers.GLOBAL_STATUS_BAR_ID, statusbar); } + + public static native void copy2Clipboard() /*-{ + var copyText = $wnd.document.getElementById("contextToCopy"); + copyText.select(); + copyText.setSelectionRange(0, 99999); //for mobile + $wnd.document.execCommand("copy"); + }-*/; + } diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/Commands.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/Commands.java index 4851e21..2050094 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/Commands.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/Commands.java @@ -44,6 +44,7 @@ import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.Dialog; import com.extjs.gxt.ui.client.widget.Info; import com.extjs.gxt.ui.client.widget.InfoConfig; +import com.extjs.gxt.ui.client.widget.Label; import com.extjs.gxt.ui.client.widget.MessageBox; import com.extjs.gxt.ui.client.widget.ProgressBar; import com.extjs.gxt.ui.client.widget.Status; @@ -481,8 +482,9 @@ public class Commands { */ public static void setStatusScope(final String scope) { try { - Status scopeInfo = (Status) WidgetsRegistry.getWidget(UIIdentifiers.STATUS_SCOPE_INFO_ID); - scopeInfo.setText(scope); + Text scopeInfo = (Text) WidgetsRegistry.getWidget(UIIdentifiers.STATUS_SCOPE_INFO_ID); + scopeInfo.setText(""); + ProxyRegistry.getProxyInstance().setCurrentScope(scope, new AsyncCallback() { public void onSuccess(final Void result) { @@ -498,7 +500,6 @@ public class Commands { } } - public static void setLoadedResources(final int number) { try { Status loadedResources = (Status) WidgetsRegistry.getWidget(UIIdentifiers.STATUS_LOADED_RESOURCES_ID); diff --git a/src/main/webapp/ResourceManagementPortlet.css b/src/main/webapp/ResourceManagementPortlet.css index 8e2218a..55f5ac1 100644 --- a/src/main/webapp/ResourceManagementPortlet.css +++ b/src/main/webapp/ResourceManagementPortlet.css @@ -195,6 +195,10 @@ div.x-form-field-wrap .x-form-trigger { background-image: url(images/icons/refresh.png) !important; } +.copy-clip-icon { + background-image: url(images/icons/copy.png) !important; +} + .close-icon { background-image: url(images/icons/close.png) !important; } diff --git a/src/main/webapp/images/icons/copy.png b/src/main/webapp/images/icons/copy.png new file mode 100644 index 0000000000000000000000000000000000000000..c703a57f1752492e71bda094fe07e68cac201b0d GIT binary patch literal 1184 zcmV;R1Yi4!P)>CeDN3grNiNE8^d%tgfpZER! z-qYeZj%hH0ARvk&9LGV^w1&D}nlJ+e}F$@Ex6y5O4UqmnkE2JN^ILEm&-9ZImx|y_t^9PUdrY2;- z<&V)@HWEeKa9tO}FgSd8ilax5CCm$j0@toxBa_KsSr(n0ohYTqWHJVPN#g;ON@dQS zJIAftckq25BM1VbSi{LSqiGtc6$6-V56c{f_?J`ozK`d5Y}&MmTrT%8NeNxov2B~a zzCPBjU7L&$fa&RJDiv8p8$}V>tV>=LkWzB@(g7;hPvWoaCk#i>G!4@`X0w>4$+~qt z?A^O3VIGEIg2i=R!Z4(#rx)M%tBv?@h8mitA*3Lvq^l(@8A7dk5zq6m?U|(gySlpQ z?(W96?V6KSN}1SM2!Rmd5f{ZVPPQ4tFt~qtg1eVKrFqQ=>GTc?g#x8gi8E(TbN1{v zi?9@n#l+6z{j>G4iZ8#=nI9#l&=vSRQP>}9J7e)+8>=SXDPRuYMV`b8EGUE_{w{+cn+tZ!Go3_G7Dej+kgEleiM1mJgH3yoP0208CAN z!KqWH7hzc#ex*{0v9VD`N5>Wm*sF$N;Ge~)5)(TeSo4y6K2Hz?^!Bc2e0(vMIF6GG z?eE`My8^3y7^{7F@k=&$1f>*F6frnB$k5PGLs%Mqa4MAwnM{U}k&(Js{+Gap4KI*R zr-|dZE|z++fJ