Feature #19471 Please provide a simple way to get the full Context

This commit is contained in:
Massimiliano Assante 2020-07-21 18:17:03 +02:00
parent 67fc5d2187
commit e4bce60c5c
4 changed files with 30 additions and 7 deletions

View File

@ -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 <code>onModuleLoad()</code>.
@ -703,7 +704,7 @@ public class ResourceManagementPortlet implements EntryPoint {
}
//statusbar.add(new FillToolItem());
statusbar.add(new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
statusbar.add(new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
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:&nbsp;&nbsp;"));
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("&nbsp;&nbsp;Loaded Resources:&nbsp;&nbsp;"));
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");
}-*/;
}

View File

@ -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("<input type=\"text\" style=\"width: 350px; border: 1px solid gray;\" value=\""+scope+"\" id=\"contextToCopy\"></input>");
ProxyRegistry.getProxyInstance().setCurrentScope(scope, new AsyncCallback<Void>() {
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);

View File

@ -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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB