Examples of JavaScript


Examples of org.jboss.arquillian.ajocado.javascript.JavaScript

     * @param retriever
     *            implementation of retrieving actual value
     * @return new retrieved value
     */
    public <T> T waitForChangeAndReturn(T oldValue, JavaScriptRetriever<T> retriever) {
        final JavaScript script = retriever.getJavaScriptRetrieve();
        final JavaScript condition = prepareCondition(oldValue, retriever);

        waitExpectingTimeout(condition);
        String retrieved = selenium.getEval(script);

        T converted = retriever.getConvertor().backwardConversion(retrieved);
View Full Code Here

Examples of org.jboss.arquillian.ajocado.javascript.JavaScript

        return Boolean.valueOf(selenium.getEval(containsScriptWithResourceName
            .parametrize(escapeJavaScript(resourceName))));
    }

    private void loadScript(String resourceName) {
        JavaScript extension = JavaScript.fromResource(resourceName);
        String identification = extension.getIdentification();
        String escapedResourceName = escapeJavaScript(resourceName);
        selenium.addScript(extension);
        selenium.getEval(setResourceNameForId.parametrize(identification, escapedResourceName));
    }
View Full Code Here

Examples of org.jboss.arquillian.ajocado.javascript.JavaScript

        this.configureBrowser();
    }

    protected void loadCustomLocationStrategies() {
        // jQuery location strategy
        JavaScript strategySource = fromResource("javascript/selenium-location-strategies/jquery-location-strategy.js");
        this.addLocationStrategy(ElementLocationStrategy.JQUERY, strategySource);
    }
View Full Code Here

Examples of org.jboss.arquillian.ajocado.javascript.JavaScript

        return Boolean.valueOf(selenium.getEval(containsScriptWithResourceName
            .parametrize(escapeJavaScript(resourceName))));
    }

    private void loadScript(String resourceName) {
        JavaScript extension = JavaScript.fromResource(resourceName);
        String identification = extension.getIdentification();
        String escapedResourceName = escapeJavaScript(resourceName);
        selenium.addScript(extension);
        selenium.getEval(setResourceNameForId.parametrize(identification, escapedResourceName));
    }
View Full Code Here

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

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

Examples of org.pdfclown.documents.interaction.actions.JavaScript

        new Rectangle(150, 50, 136, 36)
        );
      WidgetActions fieldWidgetActions = new WidgetActions(fieldWidget);
      fieldWidget.setActions(fieldWidgetActions);
      fieldWidgetActions.setOnActivate(
        new JavaScript(
          document,
          "app.alert(\"Radio button currently selected: '\" + this.getField(\"myRadio\").value + \"'.\",3,0,\"Activation event\");"
          )
        );
      PushButton field = new PushButton(
        "okButton",
        fieldWidget,
        "Push" // Current value.
        ); // 4.1. Field instantiation.
      fields.add(field); // 4.2. Field insertion into the fields collection.
      fieldStyle.apply(field); // 4.3. Appearance style applied.

      {
        BlockComposer blockComposer = new BlockComposer(composer);
        blockComposer.begin(new Rectangle2D.Double(296,50,page.getSize().getWidth()-336,36),AlignmentXEnum.Left,AlignmentYEnum.Middle);
        composer.setFont(composer.getState().getFont(),7);
        blockComposer.showText("If you click this push button, a javascript action should prompt you an alert box responding to the activation event triggered by your PDF viewer.");
        blockComposer.end();
      }
    }

    // 4.b. Check box.
    {
      composer.showText(
        "CheckBox:",
        new Point2D.Double(140, 118),
        AlignmentXEnum.Right,
        AlignmentYEnum.Middle,
        0
        );
      CheckBox field = new CheckBox(
        "myCheck",
        new Widget(
          page,
          new Rectangle(150, 100, 36, 36)
          ),
        true // Current value.
        ); // 4.1. Field instantiation.
      fieldStyle.apply(field);
      fields.add(field);
      field = new CheckBox(
        "myCheck2",
        new Widget(
          page,
          new Rectangle(200, 100, 36, 36)
          ),
        true // Current value.
        ); // 4.1. Field instantiation.
      fieldStyle.apply(field);
      fields.add(field);
      field = new CheckBox(
        "myCheck3",
        new Widget(
          page,
          new Rectangle(250, 100, 36, 36)
          ),
        false // Current value.
        ); // 4.1. Field instantiation.
      fields.add(field); // 4.2. Field insertion into the fields collection.
      fieldStyle.apply(field); // 4.3. Appearance style applied.
    }

    // 4.c. Radio button.
    {
      composer.showText(
        "RadioButton:",
        new Point2D.Double(140, 168),
        AlignmentXEnum.Right,
        AlignmentYEnum.Middle,
        0
        );
      RadioButton field = new RadioButton(
        "myRadio",
        /*
          NOTE: A radio button field typically combines multiple alternative widgets.
        */
        new DualWidget[]
        {
          new DualWidget(
            page,
            new Rectangle(150, 150, 36, 36),
            "first"
            ),
          new DualWidget(
            page,
            new Rectangle(200, 150, 36, 36),
            "second"
            ),
          new DualWidget(
            page,
            new Rectangle(250, 150, 36, 36),
            "third"
            )
        },
        "second" // Selected item (it MUST correspond to one of the available widgets' names).
        ); // 4.1. Field instantiation.
      fields.add(field); // 4.2. Field insertion into the fields collection.
      fieldStyle.apply(field); // 4.3. Appearance style applied.
    }

    // 4.d. Text field.
    {
      composer.showText(
        "TextField:",
        new Point2D.Double(140, 218),
        AlignmentXEnum.Right,
        AlignmentYEnum.Middle,
        0
        );
      TextField field = new TextField(
        "myText",
        new Widget(
          page,
          new Rectangle(150, 200, 200, 36)
          ),
        "Carmen Consoli" // Current value.
        ); // 4.1. Field instantiation.
      field.setSpellChecked(false); // Avoids text spell check.
      FieldActions fieldActions = new FieldActions(document);
      field.setActions(fieldActions);
      fieldActions.setOnValidate(
        new JavaScript(
          document,
          "app.alert(\"Text '\" + this.getField(\"myText\").value + \"' has changed!\",3,0,\"Validation event\");"
          )
        );
      fields.add(field); // 4.2. Field insertion into the fields collection.
View Full Code Here

Examples of org.sonar.plugins.javascript.core.JavaScript

public class JavaScriptCpdMappingTest {

  @Test
  public void test() {
    JavaScript language = mock(JavaScript.class);
    ProjectFileSystem fs = mock(ProjectFileSystem.class);
    JavaScriptCpdMapping mapping = new JavaScriptCpdMapping(language, fs);
    assertThat(mapping.getLanguage()).isSameAs(language);
    assertThat(mapping.getTokenizer()).isInstanceOf(JavaScriptTokenizer.class);
  }
View Full Code Here

Examples of org.sonar.plugins.javascript.core.JavaScript

  private JavaScript javaScript;

  @Before
  public void setUp() {
    settings = new Settings();
    javaScript = new JavaScript(settings);
  }
View Full Code Here

Examples of org.tamacat.util.JavaScript_test.JavaScript

  @Test
  public void testEvalMethod() throws ScriptException {
    Method method = ClassUtils.getMethod(JavaScriptUtilsTest.class, "execute", (Class<?>[]) null);
    ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = manager.getEngineByName("js");
    JavaScript script = method.getAnnotation(JavaScript.class);
    assertNull(engine.eval(script.value()));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.