Tabnine Logo
JavaScript
Code IndexAdd Tabnine to your IDE (free)

How to use
JavaScript
in
org.jboss.arquillian.graphene.spi.javascript

Best Java code snippets using org.jboss.arquillian.graphene.spi.javascript.JavaScript (Showing top 20 results out of 315)

origin: arquillian/arquillian-graphene

/**
 * Append the JavaScript part to end of the this JavaScript
 *
 * @param sourceCodeToAppend JavaScript source code to append on the end of this JavaScript
 * @return this JavaScript with javaScriptPartToAppend appended
 */
public JavaScript append(String sourceCodeToAppend) {
  return fromString(this.source + sourceCodeToAppend);
}
origin: arquillian/arquillian-graphene

@Override
public String toString() {
  return getSourceCode();
}
origin: arquillian/arquillian-graphene

/**
 * The factory method for JavaScript object
 *
 * @param source the JavaScript source code
 * @return the new JavaScript object with predefined JavaScript code
 */
public static JavaScript fromString(String source) {
  return new JavaScript(source);
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

@Override
public JavaScript getExtensionScript() {
  return JavaScript.fromResource("com/jquery/jquery-1.7.2.min.js").append("window.Graphene = window.Graphene || {}; window.Graphene.jQuery = jQuery.noConflict(true);");
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * Loads the JavaScript from file.
 *
 * @param sourceFile the source file
 * @return the JavaScript object loaded from file
 * @throws RuntimeException when failed to load a script
 */
public static JavaScript fromFile(File sourceFile) {
  String sourceCode;
  try {
    sourceCode = inputStreamToString(new FileInputStream(sourceFile));
  } catch (FileNotFoundException e) {
    throw new IllegalStateException("Unable to find JavaScript source file '" + sourceFile + "'", e);
  } catch (IOException e) {
    throw new RuntimeException("Unable to load JavaScript from file '" + sourceFile + "'", e);
  }
  return fromString(sourceCode);
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

for (String source: dependency.sources()) {
  if (dependencyScript == null) {
    dependencyScript = JavaScript.fromResource(source);
  } else {
    dependencyScript = dependencyScript.join(JavaScript.fromResource(source));
  JSMethod installMethod = target.getJSMethod(InstallableJavaScript.INSTALL_METHOD);
  String functionCall = target.getName() + "." + installMethod.getName() + "();";
  dependencyScript = dependencyScript.join(JavaScript.fromString(functionCall));
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')");
this.installationDetectionScript = JavaScript.fromString("return true;");
this.extensionScript = JavaScript.fromString("return true;");
this.required = Collections.unmodifiableCollection(Collections.EMPTY_LIST);
origin: arquillian/arquillian-graphene

/**
 * Loads the JavaScript from file.
 *
 * @param sourceFile the source file
 * @return the JavaScript object loaded from file
 * @throws RuntimeException when failed to load a script
 */
public static JavaScript fromFile(File sourceFile) {
  String sourceCode;
  try {
    sourceCode = inputStreamToString(new FileInputStream(sourceFile));
  } catch (FileNotFoundException e) {
    throw new IllegalStateException("Unable to find JavaScript source file '" + sourceFile + "'", e);
  } catch (IOException e) {
    throw new RuntimeException("Unable to load JavaScript from file '" + sourceFile + "'", e);
  }
  return fromString(sourceCode);
}
origin: arquillian/arquillian-graphene

for (String source: dependency.sources()) {
  if (dependencyScript == null) {
    dependencyScript = JavaScript.fromResource(source);
  } else {
    dependencyScript = dependencyScript.join(JavaScript.fromResource(source));
  JSMethod installMethod = target.getJSMethod(InstallableJavaScript.INSTALL_METHOD);
  String functionCall = target.getName() + "." + installMethod.getName() + "();";
  dependencyScript = dependencyScript.join(JavaScript.fromString(functionCall));
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')");
this.installationDetectionScript = JavaScript.fromString("return true;");
this.extensionScript = JavaScript.fromString("return true;");
this.required = Collections.unmodifiableCollection(Collections.EMPTY_LIST);
origin: arquillian/arquillian-graphene

@Override
public JavaScript getExtensionScript() {
  return JavaScript.fromResource("com/jquery/jquery-1.7.2.min.js").append("window.Graphene = window.Graphene || {}; window.Graphene.jQuery = jQuery.noConflict(true);");
}
origin: arquillian/arquillian-graphene

/**
 * Joins this JavaScript object with another JavaScript object to single JavaScript.
 *
 * @param javaScriptToJoin the JavaScript object we want to join with
 * @return the joined JavaScript object
 */
public JavaScript join(JavaScript javaScriptToJoin) {
  return fromString(this.source + '\n' + javaScriptToJoin.source);
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * Loads the JavaScript from classpath resource.
 *
 * @param resourceName the resource name, e.g. "org/jboss/test/..."
 * @return the JavaScript object loaded from classpath resource
 * @throws RuntimeException when failed to load a script
 */
public static JavaScript fromResource(String resourceName) {
  InputStream inputStream = JavaScript.class.getResourceAsStream("/" + resourceName);
  if (inputStream == null) {
    throw new IllegalStateException("Can't open the '" + resourceName + "' resource.");
  }
  String sourceCode;
  try {
    sourceCode = inputStreamToString(inputStream);
  } catch (IOException e) {
    throw new RuntimeException("Unable to load JavaScript from resource with name '" + resourceName + "'", e);
  }
  return fromString(sourceCode);
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

@Override
public String toString() {
  return getSourceCode();
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * The factory method for JavaScript object
 *
 * @param source the JavaScript source code
 * @return the new JavaScript object with predefined JavaScript code
 */
public static JavaScript fromString(String source) {
  return new JavaScript(source);
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * Joins this JavaScript object with another JavaScript object to single JavaScript.
 *
 * @param javaScriptToJoin the JavaScript object we want to join with
 * @return the joined JavaScript object
 */
public JavaScript join(JavaScript javaScriptToJoin) {
  return fromString(this.source + '\n' + javaScriptToJoin.source);
}
origin: arquillian/arquillian-graphene

/**
 * Loads the JavaScript from classpath resource.
 *
 * @param resourceName the resource name, e.g. "org/jboss/test/..."
 * @return the JavaScript object loaded from classpath resource
 * @throws RuntimeException when failed to load a script
 */
public static JavaScript fromResource(String resourceName) {
  InputStream inputStream = JavaScript.class.getResourceAsStream("/" + resourceName);
  if (inputStream == null) {
    throw new IllegalStateException("Can't open the '" + resourceName + "' resource.");
  }
  String sourceCode;
  try {
    sourceCode = inputStreamToString(inputStream);
  } catch (IOException e) {
    throw new RuntimeException("Unable to load JavaScript from resource with name '" + resourceName + "'", e);
  }
  return fromString(sourceCode);
}
origin: arquillian/arquillian-graphene

public static Object execute(JavascriptExecutor executor, org.jboss.arquillian.graphene.spi.javascript.JavaScript javaScript, Object... args) {
  return execute(executor, javaScript.getSourceCode(), args);
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

@Override
public JavaScript getInstallationDetectionScript() {
  return JavaScript.fromString("return ((typeof window.Graphene != 'undefined') && (typeof window.Graphene.jQuery != 'undefined') && "
    + "(typeof window.Graphene.jQuery == 'function') && (typeof window.Graphene.jQuery != null))");
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

public static Object execute(JavascriptExecutor executor, org.jboss.arquillian.graphene.spi.javascript.JavaScript javaScript, Object... args) {
  return execute(executor, javaScript.getSourceCode(), args);
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * Append the JavaScript part to end of the this JavaScript
 *
 * @param sourceCodeToAppend JavaScript source code to append on the end of this JavaScript
 * @return this JavaScript with javaScriptPartToAppend appended
 */
public JavaScript append(String sourceCodeToAppend) {
  return fromString(this.source + sourceCodeToAppend);
}
origin: arquillian/arquillian-graphene

@Override
public JavaScript getInstallationDetectionScript() {
  return JavaScript.fromString("return ((typeof window.Graphene != 'undefined') && (typeof window.Graphene.jQuery != 'undefined') && "
    + "(typeof window.Graphene.jQuery == 'function') && (typeof window.Graphene.jQuery != null))");
}
org.jboss.arquillian.graphene.spi.javascriptJavaScript

Javadoc

Encapsulates JavaScript definitions.

Able to load JavaScript code from file or from classpath resource.

Most used methods

  • fromString
    The factory method for JavaScript object
  • getSourceCode
    Returns the source of hold by this JavaScript object instance.
  • <init>
    Instantiates a new JavaScript.
  • append
    Append the JavaScript part to end of the this JavaScript
  • fromResource
    Loads the JavaScript from classpath resource.
  • inputStreamToString
  • join
    Joins this JavaScript object with another JavaScript object to single JavaScript.

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • setScale (BigDecimal)
  • getSystemService (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now