use of org.eclipse.rap.rwt.client.service.JavaScriptExecutor in project rap by entirej.
the class EJRwtSpringAuthUtil method logout.
public static void logout(String url) {
String browserText = MessageFormat.format("parent.window.location.href = \"{0}\";", url);
JavaScriptExecutor executor = RWT.getClient().getService(JavaScriptExecutor.class);
if (executor != null) {
executor.execute(browserText);
}
}
use of org.eclipse.rap.rwt.client.service.JavaScriptExecutor in project rap by entirej.
the class EJ_RWT method exec.
private static void exec(String... strings) {
StringBuilder builder = new StringBuilder();
builder.append("try{");
for (String str : strings) {
builder.append(str);
}
builder.append("}catch(e){}");
JavaScriptExecutor executor = RWT.getClient().getService(JavaScriptExecutor.class);
executor.execute(builder.toString());
}
use of org.eclipse.rap.rwt.client.service.JavaScriptExecutor in project netxms by netxms.
the class Chart method saveAsImage.
/**
* Sava chart as image
*/
public void saveAsImage() {
JavaScriptExecutor executor = RWT.getClient().getService(JavaScriptExecutor.class);
if (executor != null) {
int r = getBackground().getRed();
int g = getBackground().getGreen();
int b = getBackground().getBlue();
StringBuilder js = new StringBuilder();
js.append("canvas2image_convert('");
js.append(getRwtId());
js.append("', 'canvas', '#");
js.append(String.format("%02x%02x%02x", r, g, b));
// $NON-NLS-1$
js.append("');");
executor.execute(js.toString());
}
}
use of org.eclipse.rap.rwt.client.service.JavaScriptExecutor in project polymap4-core by Polymap4.
the class UIUtils method exec.
public static void exec(String... jscode) {
StringBuilder buf = new StringBuilder(256).append("try{").append(String.join("", jscode)).append("}catch(e){}");
JavaScriptExecutor executor = RWT.getClient().getService(JavaScriptExecutor.class);
executor.execute(buf.toString());
}
use of org.eclipse.rap.rwt.client.service.JavaScriptExecutor in project netxms by netxms.
the class ScreenshotView method saveImage.
/**
* Save image to file
*/
private void saveImage() {
String id = Long.toString(System.currentTimeMillis());
// $NON-NLS-1$ //$NON-NLS-2$
DownloadServiceHandler.addDownload(id, session.getObjectName(nodeId) + "-screenshot.png", byteImage, "application/octet-stream");
JavaScriptExecutor executor = RWT.getClient().getService(JavaScriptExecutor.class);
if (executor != null) {
StringBuilder js = new StringBuilder();
// $NON-NLS-1$
js.append("var hiddenIFrameID = 'hiddenDownloader',");
// $NON-NLS-1$
js.append(" iframe = document.getElementById(hiddenIFrameID);");
// $NON-NLS-1$
js.append("if (iframe === null) {");
// $NON-NLS-1$
js.append(" iframe = document.createElement('iframe');");
// $NON-NLS-1$
js.append(" iframe.id = hiddenIFrameID;");
// $NON-NLS-1$
js.append(" iframe.style.display = 'none';");
// $NON-NLS-1$
js.append(" document.body.appendChild(iframe);");
// $NON-NLS-1$
js.append("}");
// $NON-NLS-1$
js.append("iframe.src = '");
js.append(DownloadServiceHandler.createDownloadUrl(id));
// $NON-NLS-1$
js.append("';");
executor.execute(js.toString());
}
}
Aggregations