Search in sources :

Example 1 with IClientPlugin

use of com.servoy.j2db.plugins.IClientPlugin in project servoy-client by Servoy.

the class JSApplication method js_writeTXTFile.

/**
 * @deprecated  As of release 2.x, replaced by {@link plugins.file#writeTXTFile(Object[])}.
 */
@Deprecated
public boolean js_writeTXTFile(Object[] args) {
    // $NON-NLS-1$
    IClientPlugin cp = application.getPluginManager().getPlugin(IClientPlugin.class, "file");
    if (cp != null) {
        IScriptable so = cp.getScriptObject();
        if (so != null) {
            try {
                // $NON-NLS-1$
                Method m = so.getClass().getMethod("js_writeTXTFile", getClassArrayFromObjectArgs(args));
                Boolean obj = (Boolean) m.invoke(so, args);
                if (obj != null)
                    return obj.booleanValue();
                return false;
            } catch (Exception e) {
                Debug.error(e);
            }
        }
    }
    application.reportError("Writing to text file failed", "For this operation the file plugin is needed\nNote this method is deprecated, use the plugin directly in your code");
    return false;
}
Also used : IClientPlugin(com.servoy.j2db.plugins.IClientPlugin) Method(java.lang.reflect.Method) ApplicationException(com.servoy.j2db.ApplicationException) ExitScriptException(com.servoy.j2db.ExitScriptException) ServoyException(com.servoy.j2db.util.ServoyException) JavaScriptException(org.mozilla.javascript.JavaScriptException)

Example 2 with IClientPlugin

use of com.servoy.j2db.plugins.IClientPlugin in project servoy-client by Servoy.

the class JSApplication method js_sendMail.

/**
 * @deprecated As of release 2.x, replaced by {@link plugins.mail#sendMail(Object[])}.
 */
@Deprecated
public boolean js_sendMail(Object[] args) {
    // $NON-NLS-1$
    IClientPlugin cp = application.getPluginManager().getPlugin(IClientPlugin.class, "mail");
    if (cp != null) {
        IScriptable so = cp.getScriptObject();
        if (so != null) {
            try {
                // $NON-NLS-1$
                Method m = so.getClass().getMethod("js_sendMail", getClassArrayFromObjectArgs(args));
                Boolean b = (Boolean) m.invoke(so, args);
                return b.booleanValue();
            } catch (Exception e) {
                Debug.error(e);
            }
        }
    }
    application.reportError("Send mail failed", "For sending mail the mail plugin is needed\nNote this method is deprecated, use the plugin directly in your code");
    return false;
}
Also used : IClientPlugin(com.servoy.j2db.plugins.IClientPlugin) Method(java.lang.reflect.Method) ApplicationException(com.servoy.j2db.ApplicationException) ExitScriptException(com.servoy.j2db.ExitScriptException) ServoyException(com.servoy.j2db.util.ServoyException) JavaScriptException(org.mozilla.javascript.JavaScriptException)

Example 3 with IClientPlugin

use of com.servoy.j2db.plugins.IClientPlugin in project servoy-client by Servoy.

the class JSApplication method js_showFileSaveDialog.

/**
 * @deprecated  As of release 2.x, replaced by {@link plugins.file#showFileSaveDialog(Object[])}.
 */
@Deprecated
public String js_showFileSaveDialog(Object[] args) {
    // $NON-NLS-1$
    IClientPlugin cp = application.getPluginManager().getPlugin(IClientPlugin.class, "file");
    if (cp != null) {
        IScriptable so = cp.getScriptObject();
        if (so != null) {
            try {
                // $NON-NLS-1$
                Method m = so.getClass().getMethod("js_showFileSaveDialog", getClassArrayFromObjectArgs(args));
                Object obj = m.invoke(so, args);
                if (obj != null)
                    return obj.toString();
                return null;
            } catch (Exception e) {
                Debug.error(e);
            }
        }
    }
    application.reportError("Showing file save dialog failed", "For this operation the file plugin is needed\nNote this method is deprecated, use the plugin directly in your code");
    return null;
}
Also used : IClientPlugin(com.servoy.j2db.plugins.IClientPlugin) ScriptableObject(org.mozilla.javascript.ScriptableObject) Method(java.lang.reflect.Method) ApplicationException(com.servoy.j2db.ApplicationException) ExitScriptException(com.servoy.j2db.ExitScriptException) ServoyException(com.servoy.j2db.util.ServoyException) JavaScriptException(org.mozilla.javascript.JavaScriptException)

Example 4 with IClientPlugin

use of com.servoy.j2db.plugins.IClientPlugin in project servoy-client by Servoy.

the class JSApplication method js_createTempFile.

/**
 * @deprecated  As of release 2.x, replaced by {@link plugins.file#createTempFile(String, String)}.
 */
@Deprecated
public Object js_createTempFile(String prefix, String suffix) {
    // $NON-NLS-1$
    IClientPlugin cp = application.getPluginManager().getPlugin(IClientPlugin.class, "file");
    if (cp != null) {
        IScriptable so = cp.getScriptObject();
        if (so != null) {
            try {
                // $NON-NLS-1$
                Method m = so.getClass().getMethod("js_createTempFile", new Class[] { String.class, String.class });
                Object obj = m.invoke(so, new Object[] { prefix, suffix });
                if (obj != null)
                    return obj.toString();
                return null;
            } catch (Exception e) {
                Debug.error(e);
            }
        }
    }
    application.reportError("Create temp file failed", "For this operation the file plugin is needed\nNote this method is deprecated, use the plugin directly in your code");
    return null;
}
Also used : IClientPlugin(com.servoy.j2db.plugins.IClientPlugin) ScriptableObject(org.mozilla.javascript.ScriptableObject) Method(java.lang.reflect.Method) ApplicationException(com.servoy.j2db.ApplicationException) ExitScriptException(com.servoy.j2db.ExitScriptException) ServoyException(com.servoy.j2db.util.ServoyException) JavaScriptException(org.mozilla.javascript.JavaScriptException)

Example 5 with IClientPlugin

use of com.servoy.j2db.plugins.IClientPlugin in project servoy-client by Servoy.

the class JSApplication method js_showDirectorySelectDialog.

/**
 * @deprecated  As of release 2.x, replaced by {@link plugins.file#showDirectorySelectDialog(Object[])}.
 */
@Deprecated
public String js_showDirectorySelectDialog(Object[] args) {
    // $NON-NLS-1$
    IClientPlugin cp = application.getPluginManager().getPlugin(IClientPlugin.class, "file");
    if (cp != null) {
        IScriptable so = cp.getScriptObject();
        if (so != null) {
            try {
                // $NON-NLS-1$
                Method m = so.getClass().getMethod("js_showDirectorySelectDialog", getClassArrayFromObjectArgs(args));
                Object obj = m.invoke(so, args);
                if (obj != null)
                    return obj.toString();
                return null;
            } catch (Exception e) {
                Debug.error(e);
            }
        }
    }
    application.reportError("Showing directory select dialog failed", "For this operation the file plugin is needed\nNote this method is deprecated, use the plugin directly in your code");
    return null;
}
Also used : IClientPlugin(com.servoy.j2db.plugins.IClientPlugin) ScriptableObject(org.mozilla.javascript.ScriptableObject) Method(java.lang.reflect.Method) ApplicationException(com.servoy.j2db.ApplicationException) ExitScriptException(com.servoy.j2db.ExitScriptException) ServoyException(com.servoy.j2db.util.ServoyException) JavaScriptException(org.mozilla.javascript.JavaScriptException)

Aggregations

IClientPlugin (com.servoy.j2db.plugins.IClientPlugin)13 Method (java.lang.reflect.Method)12 ApplicationException (com.servoy.j2db.ApplicationException)11 ServoyException (com.servoy.j2db.util.ServoyException)11 ExitScriptException (com.servoy.j2db.ExitScriptException)10 JavaScriptException (org.mozilla.javascript.JavaScriptException)10 ScriptableObject (org.mozilla.javascript.ScriptableObject)7 RepositoryException (com.servoy.j2db.persistence.RepositoryException)1 IScriptable (com.servoy.j2db.scripting.IScriptable)1 RemoteException (java.rmi.RemoteException)1 SQLException (java.sql.SQLException)1 NativeJavaArray (org.mozilla.javascript.NativeJavaArray)1 NativeObject (org.mozilla.javascript.NativeObject)1