Search in sources :

Example 1 with JavaScriptExecutor

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);
    }
}
Also used : JavaScriptExecutor(org.eclipse.rap.rwt.client.service.JavaScriptExecutor)

Example 2 with JavaScriptExecutor

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());
}
Also used : JavaScriptExecutor(org.eclipse.rap.rwt.client.service.JavaScriptExecutor)

Example 3 with JavaScriptExecutor

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());
    }
}
Also used : JavaScriptExecutor(org.eclipse.rap.rwt.client.service.JavaScriptExecutor)

Example 4 with JavaScriptExecutor

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());
}
Also used : JavaScriptExecutor(org.eclipse.rap.rwt.client.service.JavaScriptExecutor)

Example 5 with JavaScriptExecutor

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());
    }
}
Also used : JavaScriptExecutor(org.eclipse.rap.rwt.client.service.JavaScriptExecutor)

Aggregations

JavaScriptExecutor (org.eclipse.rap.rwt.client.service.JavaScriptExecutor)17 File (java.io.File)3 IOException (java.io.IOException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NXCSession (org.netxms.client.NXCSession)2 RandomAccessFile (java.io.RandomAccessFile)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Properties (java.util.Properties)1 UUID (java.util.UUID)1 NotDefinedException (org.eclipse.core.commands.common.NotDefinedException)1 IStatus (org.eclipse.core.runtime.IStatus)1 BindingManager (org.eclipse.jface.bindings.BindingManager)1 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Window (org.eclipse.jface.window.Window)1 CBanner (org.eclipse.swt.custom.CBanner)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseListener (org.eclipse.swt.events.MouseListener)1 GridData (org.eclipse.swt.layout.GridData)1