Examples of JavascriptFunction


Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

    assertThat(mainConfig).includes(
        entry(DTConstants.DT_B_DEFER_RENDER, true),
        entry(DTConstants.DT_S_AJAXDATAPROP, ""),
        entry(DTConstants.DT_S_AJAX_SOURCE, "/ajaxSource"));
    assertThat(mainConfig.get(CallbackType.INIT.getName()).toString())
    .isEqualTo(new JavascriptFunction("oTable_fakeId.fnAdjustColumnSizing(true);", CallbackType.INIT.getArgs()).toString());
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

    }
  }

  private void processJavascriptFunction(Parameter conf) {

    JavascriptFunction jsFunction = (JavascriptFunction) mainConfig.get(conf.getName());
    StringBuilder newValue = null;

    switch (conf.getMode()) {
    case OVERRIDE:
      mainConfig.put(conf.getName(), conf.getValue());
      break;

    case APPEND:
      newValue = new StringBuilder(((JavascriptFunction) conf.getValue()).getCode());
      newValue.append(NEWLINE).append(INDENT).append(INDENT);
      newValue.append(jsFunction.getCode());
      jsFunction.setCode(newValue.toString());
      mainConfig.put(conf.getName(), jsFunction);
      break;

    case PREPEND:
      newValue = new StringBuilder(jsFunction.getCode());
      newValue.append(((JavascriptFunction) conf.getValue()).getCode());
      jsFunction.setCode(newValue.toString());
      mainConfig.put(conf.getName(), jsFunction);
      break;

    case APPEND_WITH_SPACE:
      newValue = new StringBuilder(((JavascriptFunction) conf.getValue()).getCode());
      newValue.append(" ");
      newValue.append(jsFunction.getCode());
      jsFunction.setCode(newValue.toString());
      mainConfig.put(conf.getName(), jsFunction);
      break;

    case PREPEND_WITH_SPACE:
      newValue = new StringBuilder(jsFunction.getCode());
      newValue.append(" ");
      newValue.append(((JavascriptFunction) conf.getValue()).getCode());
      jsFunction.setCode(newValue.toString());
      mainConfig.put(conf.getName(), jsFunction);
      break;

    default:
      break;
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

  private CallbackType type;
  private JavascriptFunction function;

  public Callback(CallbackType type, String functionContent) {
    this.type = type;
    this.function = new JavascriptFunction(functionContent, this.type.getArgs());
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

   *            The type of the callback.
   * @param javascript
   *            The Javascript code to execute in the callback.
   */
  public void addCallback(CallbackType callbackType, String javascript) {
    addParameter(new Parameter(callbackType.getName(), new JavascriptFunction(javascript, callbackType.getArgs()),
        Mode.APPEND));
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

   *            The Javascript code to execute in the callback.
   * @param mode
   *            Method of updating used for this parameter.
   */
  public void addCallback(CallbackType callbackType, String javascript, Mode mode) {
    addParameter(new Parameter(callbackType.getName(), new JavascriptFunction(javascript, callbackType.getArgs()),
        mode));
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

    assertThat(mainConfig).hasSize(4);
    assertThat(mainConfig).includes(entry(DTConstants.DT_AUTO_WIDTH, false));
    assertThat(mainConfig.keySet()).contains(CallbackType.DRAW.getName(), CallbackType.ROW.getName(), CallbackType.PREDRAW.getName());
   
    assertThat(mainConfig.get(CallbackType.DRAW.getName()).toString())
      .isEqualTo(new JavascriptFunction("responsiveHelper_fakeId.respond();", CallbackType.DRAW.getArgs()).toString());
    assertThat(mainConfig.get(CallbackType.ROW.getName()).toString())
      .isEqualTo(new JavascriptFunction("responsiveHelper_fakeId.createExpandIcon(nRow);", CallbackType.ROW.getArgs()).toString());
    assertThat(mainConfig.get(CallbackType.PREDRAW.getName()).toString())
      .isEqualTo(new JavascriptFunction("if (!responsiveHelper_fakeId) { responsiveHelper_fakeId = new ResponsiveDatatablesHelper(oTable_fakeId, breakpointDefinition); }", CallbackType.PREDRAW.getArgs()).toString());
   
    assertThat(mainJsFile.getBeforeAll().toString()).isEqualTo("var responsiveHelper_fakeId;\nvar breakpointDefinition = { tablet: 1024, phone : 480 };\n");
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

    assertThat(mainConfig).hasSize(4);
    assertThat(mainConfig).includes(entry(DTConstants.DT_AUTO_WIDTH, false));
    assertThat(mainConfig.keySet()).contains(CallbackType.DRAW.getName(), CallbackType.ROW.getName(), CallbackType.PREDRAW.getName());
   
    assertThat(mainConfig.get(CallbackType.DRAW.getName()).toString())
      .isEqualTo(new JavascriptFunction("responsiveHelper_fakeId.respond();", CallbackType.DRAW.getArgs()).toString());
    assertThat(mainConfig.get(CallbackType.ROW.getName()).toString())
      .isEqualTo(new JavascriptFunction("responsiveHelper_fakeId.createExpandIcon(nRow);", CallbackType.ROW.getArgs()).toString());
    assertThat(mainConfig.get(CallbackType.PREDRAW.getName()).toString())
      .isEqualTo(new JavascriptFunction("if (!responsiveHelper_fakeId) { responsiveHelper_fakeId = new ResponsiveDatatablesHelper(oTable_fakeId, breakpointDefinition); }", CallbackType.PREDRAW.getArgs()).toString());
   
    assertThat(mainJsFile.getBeforeAll().toString()).isEqualTo("var responsiveHelper_fakeId;\nvar breakpointDefinition = { tablet: 1024, phone : 480 };\n");
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

    table.getTableConfiguration().setCallbacks(callbacks);

    Map<String, Object> mainConf = generator.generateConfig(table);

    assertThat(mainConf).hasSize(2);
    assertThat(mainConf.get(CallbackType.CREATEDROW.getName())).isEqualTo(new JavascriptFunction(callback.getFunction().getCode(), CallbackType.CREATEDROW.getArgs()));
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

    table.getTableConfiguration().setCallbacks(callbacks);

    Map<String, Object> mainConf = generator.generateConfig(table);

    assertThat(mainConf).hasSize(4);
    assertThat(mainConf.get(CallbackType.CREATEDROW.getName())).isEqualTo(new JavascriptFunction(callback.getFunction().getCode(), CallbackType.CREATEDROW.getArgs()));
    assertThat(mainConf.get(CallbackType.COOKIE.getName())).isEqualTo(new JavascriptFunction(callback2.getFunction().getCode(), CallbackType.COOKIE.getArgs()));
    assertThat(mainConf.get(CallbackType.PREDRAW.getName())).isEqualTo(new JavascriptFunction(callback3.getFunction().getCode(), CallbackType.PREDRAW.getArgs()));
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.asset.JavascriptFunction

   
    extensionProcessor.process(new HashSet<Extension>(Arrays.asList(new ServerSideFeature())));

    assertThat(AssetRequestContext.get(table.getTableConfiguration().getRequest()).getBundles(true)).hasSize(0);
    assertThat(mainConfig.get(CallbackType.INIT.getName()).toString())
    .isEqualTo(new JavascriptFunction("oTable_fakeId.fnAdjustColumnSizing(true);", CallbackType.INIT.getArgs()).toString());
  }
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.