Package org.jboss.arquillian.graphene.spi.javascript

Examples of org.jboss.arquillian.graphene.spi.javascript.JavaScript


        if (dependency != null) {
            if (dependency.sources().length == 0 && dependency.interfaces().length != 0) {
                throw new IllegalArgumentException("The JavaScript page extension can't have any interface dependencies when it has no source dependencies. Can't create page extension for " + clazz + ".");
            }
            // load javascript sources
            JavaScript dependencyScript = null;
            for (String source: dependency.sources()) {
                if (dependencyScript == null) {
                    dependencyScript = JavaScript.fromResource(source);
                } else {
                    dependencyScript = dependencyScript.join(JavaScript.fromResource(source));
                }
            }
            // load install() method
            if (target.isInstallable()) {
                JSMethod installMethod = target.getJSMethod(InstallableJavaScript.INSTALL_METHOD);
                String functionCall = target.getName() + "." + installMethod.getName() + "();";
                dependencyScript = dependencyScript.join(JavaScript.fromString(functionCall));
            }
            this.extensionScript = dependencyScript;
            // installation detection
            JavaScript jsInstallationDetection = null;
            StringBuilder builder = new StringBuilder();
            for (String object: target.getName().split("\\.")) {
                if (jsInstallationDetection == null) {
                    jsInstallationDetection = JavaScript.fromString("return (typeof " + object + " != 'undefined')");
                } else {
                    jsInstallationDetection = jsInstallationDetection.append(" && (typeof " + builder.toString() + object + " != 'undefined')");
                }
                builder.append(object).append(".");
            }
            installationDetectionScript = jsInstallationDetection;
            // load dependencies
View Full Code Here


        if (dependency != null) {
            if (dependency.sources().length == 0 && dependency.interfaces().length != 0) {
                throw new IllegalArgumentException("The JavaScript page extension can't have any interface dependencies when it has no source dependencies. Can't create page extension for " + clazz + ".");
            }
            // load javascript sources
            JavaScript dependencyScript = null;
            for (String source: dependency.sources()) {
                if (dependencyScript == null) {
                    dependencyScript = JavaScript.fromResource(source);
                } else {
                    dependencyScript = dependencyScript.join(JavaScript.fromResource(source));
                }
            }
            // load install() method
            if (target.isInstallable()) {
                JSMethod installMethod = target.getJSMethod(InstallableJavaScript.INSTALL_METHOD);
                String functionCall = target.getName() + "." + installMethod.getName() + "();";
                dependencyScript = dependencyScript.join(JavaScript.fromString(functionCall));
            }
            this.extensionScript = dependencyScript;
            // installation detection
            JavaScript jsInstallationDetection = null;
            StringBuilder builder = new StringBuilder();
            for (String object: target.getName().split("\\.")) {
                if (jsInstallationDetection == null) {
                    jsInstallationDetection = JavaScript.fromString("return (typeof " + object + " != 'undefined')");
                } else {
                    jsInstallationDetection = jsInstallationDetection.append(" && (typeof " + builder.toString() + object + " != 'undefined')");
                }
                builder.append(object).append(".");
            }
            installationDetectionScript = jsInstallationDetection;
            // load dependencies
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.graphene.spi.javascript.JavaScript

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.