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 0000000..c703a57 Binary files /dev/null and b/src/main/webapp/images/icons/copy.png differ