Package com.github.dandelion.datatables.core.asset

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


    }
  }

  private void processJavascriptSnippet(Parameter conf) {

    JavascriptSnippet jsSnippet = (JavascriptSnippet) mainConfig.get(conf.getName());
    String newValue = null;

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

    case APPEND:
      newValue = ((JavascriptSnippet) conf.getValue()).getJavascript() + jsSnippet.getJavascript();
      jsSnippet.setJavascript(newValue);
      mainConfig.put(conf.getName(), jsSnippet);
      break;

    case PREPEND:
      newValue = jsSnippet.getJavascript() + ((JavascriptSnippet) conf.getValue()).getJavascript();
      jsSnippet.setJavascript(newValue);
      mainConfig.put(conf.getName(), jsSnippet);
      break;

    case APPEND_WITH_SPACE:
      newValue = ((JavascriptSnippet) conf.getValue()).getJavascript() + " " + jsSnippet.getJavascript();
      jsSnippet.setJavascript(newValue);
      mainConfig.put(conf.getName(), jsSnippet);
      break;

    case PREPEND_WITH_SPACE:
      newValue = jsSnippet.getJavascript() + " " + ((JavascriptSnippet) conf.getValue()).getJavascript();
      jsSnippet.setJavascript(newValue);
      mainConfig.put(conf.getName(), jsSnippet);
      break;

    default:
      break;
View Full Code Here


    }
    if (featureJqueryUi != null) {
      mainConf.put(DTConstants.DT_JQUERYUI, featureJqueryUi);
    }
    if (StringUtils.isNotBlank(featureLengthMenu)) {
      mainConf.put(DTConstants.DT_A_LENGTH_MENU, new JavascriptSnippet(featureLengthMenu));
    }
    if (StringUtils.isNotBlank(cssStripeClasses)) {
      mainConf.put(DTConstants.DT_AS_STRIPE_CLASSES,
          new JavascriptSnippet(cssStripeClasses));
    }
   
  }
View Full Code Here

          tmp.put(DTConstants.DT_DATA, property);
        }

        String renderFunction = ColumnConfig.RENDERFUNCTION.valueFrom(columnConfiguration);
        if (StringUtils.isNotBlank(renderFunction)) {
          tmp.put(DTConstants.DT_COLUMN_RENDERER, new JavascriptSnippet(renderFunction));
        }

        String defaultValue = ColumnConfig.DEFAULTVALUE.valueFrom(columnConfiguration);
        if (defaultValue != null) {
          tmp.put(DTConstants.DT_S_DEFAULT_CONTENT, defaultValue);
View Full Code Here

      if (StringUtils.isNotBlank(ajaxSource)) {
        mainConf.put(DTConstants.DT_S_AJAX_SOURCE, ajaxSource);
      }
      if (StringUtils.isNotBlank(ajaxServerData)) {
        mainConf.put(DTConstants.DT_FN_SERVERDATA,
            new JavascriptSnippet(ajaxServerData));
      }
      if (StringUtils.isNotBlank(ajaxServerParam)) {
        mainConf.put(DTConstants.DT_FN_SERVERPARAMS,
            new JavascriptSnippet(ajaxServerParam));
      }
      if (StringUtils.isNotBlank(ajaxServerMethod)) {
        mainConf.put(DTConstants.DT_S_SERVERMETHOD, ajaxServerMethod);
      }
    }
View Full Code Here

          tmp.put(DTConstants.DT_S_SELECTOR, selector);
        }

        String filterValues = ColumnConfig.FILTERVALUES.valueFrom(columnConfiguration);
        if (StringUtils.isNotBlank(filterValues)) {
          tmp.put(DTConstants.DT_FILTER_VALUES, new JavascriptSnippet(filterValues));
        }

        Integer filterMinLength = ColumnConfig.FILTERMINLENGTH.valueFrom(columnConfiguration);
        if (filterMinLength != null) {
          tmp.put(DTConstants.DT_FILTER_LENGTH, filterMinLength);
View Full Code Here

    // Adapt the pipe size if it has been overriden
    if (pipeSize != null && pipeSize != 5) {
      addBundleParameter("pipelining-js", "var iPipe = 5", "var iPipe = " + pipeSize);
    }

    addParameter(DTConstants.DT_FN_SERVERDATA, new JavascriptSnippet("fnDataTablesPipeline"));
  }
View Full Code Here

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

    List<Map<String, Object>> aoColumnsContent = new ArrayList<Map<String, Object>>();
    Map<String, Object> conf = new HashMap<String, Object>();

    conf.put(DTConstants.DT_FILTER_VALUES, new JavascriptSnippet("myValues"));
    conf.put(DTConstants.DT_FILTER_TYPE, "null");
    aoColumnsContent.add(conf);

    assertThat(mainConf).hasSize(1);
    assertThat(mainConf.get(DTConstants.DT_AOCOLUMNS)).isEqualTo(aoColumnsContent);
View Full Code Here

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

    assertThat(AssetRequestContext.get(table.getTableConfiguration().getRequest()).getBundles(true)).hasSize(1);
    assertThat(mainConfig).hasSize(1);
    assertThat(mainConfig).includes(
        entry(DTConstants.DT_AS_STRIPE_CLASSES, new JavascriptSnippet("[]")));
  }
View Full Code Here

    TableConfig.CSS_THEMEOPTION.setIn(table.getTableConfiguration(), ThemeOption.TABLECLOTH);
    extensionProcessor.process(new HashSet<Extension>(Arrays.asList(new Bootstrap2Theme())));

    assertThat(AssetRequestContext.get(table.getTableConfiguration().getRequest()).getBundles(true)).hasSize(2);
    assertThat(mainConfig).hasSize(1);
    assertThat(mainConfig).includes(entry(DTConstants.DT_AS_STRIPE_CLASSES, new JavascriptSnippet("[]")));
  }
View Full Code Here

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

    assertThat(AssetRequestContext.get(table.getTableConfiguration().getRequest()).getBundles(true)).hasSize(1);
    assertThat(mainConfig).hasSize(1);
    assertThat(mainConfig).includes(
        entry(DTConstants.DT_AS_STRIPE_CLASSES, new JavascriptSnippet("[]")));
  }
View Full Code Here

TOP

Related Classes of com.github.dandelion.datatables.core.asset.JavascriptSnippet

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.