Package com.github.dandelion.datatables.core.html

Examples of com.github.dandelion.datatables.core.html.HtmlColumn


    TableTag parent = (TableTag) findAncestorWithClass(this, TableTag.class);
    if (parent != null) {

      // On the first iteration, a header cell must be added
      if (parent.isFirstIteration()) {
        headerColumn = new HtmlColumn(true, null, dynamicAttributes, display);
      }

      // When using a DOM source, the 'property' attribute has precedence
      // over the body, so we don't even evaluate it
      if (StringUtils.isNotBlank(property)) {
View Full Code Here


    } else {
      content = element.getChildren().toString();
    }

    // Init a new header column
    HtmlColumn htmlColumn = new HtmlColumn(true, content);

    // Applies the staging configuration against the current column configuration
    ColumnConfig.applyConfiguration(stagingConf, stagingExt, htmlColumn);
    ColumnConfig.processConfiguration(htmlColumn, htmlTable);
   
View Full Code Here

  protected ProcessorResult doProcessElement(Arguments arguments, Element element,
      HttpServletRequest request, HttpServletResponse response, HtmlTable htmlTable) {

    if (htmlTable != null) {

      HtmlColumn column = null;
      String content = null;
     
      if(element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":csv")
          || element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xml")
          || element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":pdf")
          || element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xls")
          || element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xlsx")){
       
        if(element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":csv")) {
          content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":csv", String.class);
          element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":csv");
          column = new HtmlColumn(ReservedFormat.CSV);
          column.setContent(new StringBuilder(content));
          htmlTable.getLastBodyRow().addColumn(column);
        }
        if(element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xml")) {
          content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":xml", String.class);
          element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":xml");
          column = new HtmlColumn(ReservedFormat.XML);
          column.setContent(new StringBuilder(content));
          htmlTable.getLastBodyRow().addColumn(column);
        }
        if(element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":pdf")) {
          content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":pdf", String.class);
          element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":pdf");
          column = new HtmlColumn(ReservedFormat.PDF);
          column.setContent(new StringBuilder(content));
          htmlTable.getLastBodyRow().addColumn(column);
        }
        if(element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xls")) {
          content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":xls", String.class);
          element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":xls");
          column = new HtmlColumn(ReservedFormat.XLS);
          column.setContent(new StringBuilder(content));
          htmlTable.getLastBodyRow().addColumn(column);
        }
        if(element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xlsx")) {
          content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":xlsx", String.class);
          element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":xlsx");
          column = new HtmlColumn(ReservedFormat.XLSX);
          column.setContent(new StringBuilder(content));
          htmlTable.getLastBodyRow().addColumn(column);
        }
      }
      // If the element contains a Text node, the content of the text node
      // will be displayed in all formats
View Full Code Here

   */
  protected void addDomBodyColumn(String content) throws JspException {

    AbstractTableTag parent = (AbstractTableTag) findAncestorWithClass(this, AbstractTableTag.class);

    HtmlColumn bodyColumn = new HtmlColumn(false, content, dynamicAttributes, display);

    // Note that these attributes are not handled via the ColumnConfig
    // object because a ColumnConfiguration is only attached to header
    // columns
    if (StringUtils.isNotBlank(this.cssCellClass)) {
      bodyColumn.addCssCellClass(this.cssCellClass);
    }
    if (StringUtils.isNotBlank(this.cssCellStyle)) {
      bodyColumn.addCssCellStyle(this.cssCellStyle);
    }

    parent.getTable().getLastBodyRow().addColumn(bodyColumn);
  }
View Full Code Here

    }
   
    // Table configuration

    public Steps<T> column() {
      HtmlColumn column = new HtmlColumn(true, "");
      headerColumns.add(column);
      return this;
    }
View Full Code Here

  @Test
  public void should_set_one_sort_init_direction_sort_init_order() {
    firstColumn.getColumnConfiguration().set(ColumnConfig.SORTINITDIRECTION, "desc");
    firstColumn.getColumnConfiguration().set(ColumnConfig.SORTINITORDER, 1);
    HtmlColumn secondColumn = headerRow.addHeaderColumn("secondColumn");
    secondColumn.getColumnConfiguration().set(ColumnConfig.SORTINITDIRECTION, "asc");
    secondColumn.getColumnConfiguration().set(ColumnConfig.SORTINITORDER, 0);
    Set<String> enabledDisplayTypes = new HashSet<String>();
    enabledDisplayTypes.add(ReservedFormat.HTML);
    secondColumn.setEnabledDisplayTypes(enabledDisplayTypes);
   
    Map<String, Object> mainConf = generator.generateConfig(table);

    List<List<Object>> columnsInitialSorting = (List<List<Object>>)mainConf.get(DTConstants.DT_SORT_INIT);
    assertThat(columnsInitialSorting).hasSize(2);
View Full Code Here

 
  @Test
  public void should_set_several_sort_init_directions() {
    firstColumn.getColumnConfiguration().set(ColumnConfig.SORTINITDIRECTION, "desc");
    headerRow.addHeaderColumn("secondColumn");
    HtmlColumn thirdColumn = headerRow.addHeaderColumn("thirdColumn");
    Set<String> enabledDisplayTypes = new HashSet<String>();
    enabledDisplayTypes.add(ReservedFormat.XLS);
    thirdColumn.setEnabledDisplayTypes(enabledDisplayTypes);
    HtmlColumn fourthColumn = headerRow.addHeaderColumn("fourthColumn");
    fourthColumn.getColumnConfiguration().set(ColumnConfig.SORTINITDIRECTION, "asc");

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

    List<List<Object>> columnsInitialSorting = (List<List<Object>>)mainConf.get(DTConstants.DT_SORT_INIT);
    assertThat(columnsInitialSorting).hasSize(2);
View Full Code Here

TOP

Related Classes of com.github.dandelion.datatables.core.html.HtmlColumn

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.