Package net.java.textilej.parser

Examples of net.java.textilej.parser.TableAttributes


    applyAttributes(attributes);
    if (attributes.getTitle() != null) {
      writer.writeAttribute("title", attributes.getTitle());
    }
    if (attributes instanceof TableAttributes) {
      TableAttributes tableAttributes = (TableAttributes) attributes;
      if (tableAttributes.getBgcolor() != null) {
        writer.writeAttribute("bgcolor", tableAttributes.getBgcolor());
      }
      if (tableAttributes.getBorder() != null) {
        writer.writeAttribute("border", tableAttributes.getBorder());
      }
      if (tableAttributes.getCellpadding() != null) {
        writer.writeAttribute("cellpadding", tableAttributes.getCellpadding());
      }
      if (tableAttributes.getCellspacing() != null) {
        writer.writeAttribute("cellspacing", tableAttributes.getCellspacing());
      }
      if (tableAttributes.getFrame() != null) {
        writer.writeAttribute("frame", tableAttributes.getFrame());
      }
      if (tableAttributes.getRules() != null) {
        writer.writeAttribute("rules", tableAttributes.getRules());
      }
      if (tableAttributes.getSummary() != null) {
        writer.writeAttribute("summary", tableAttributes.getSummary());
      }
      if (tableAttributes.getWidth() != null) {
        writer.writeAttribute("width", tableAttributes.getWidth());
      }
    }
  }
View Full Code Here


  private boolean openRow;

  @Override
  public int processLineContent(String line,int offset) {
    if (blockLineCount++ == 0) {
      TableAttributes attributes = new TableAttributes();
     
      // first line opens table
      String options = matcher.group(1);
      if (options != null) {
        Matcher optionsMatcher = optionsPattern.matcher(options);
        while (optionsMatcher.find()) {
          String optionName = optionsMatcher.group(1);
          String optionValue = optionsMatcher.group(2);
          if (optionName.equalsIgnoreCase("id")) {
            attributes.setId(optionValue);
          } else if (optionName.equalsIgnoreCase("style")) {
            attributes.setCssStyle(optionValue);
          } else if (optionName.equalsIgnoreCase("class")) {
            attributes.setCssClass(optionValue);
          } else if (optionName.equalsIgnoreCase("title")) {
            attributes.setTitle(optionValue);
          } else if (optionName.equalsIgnoreCase("border")) {
            attributes.setBorder(optionValue);
          } else if (optionName.equalsIgnoreCase("summary")) {
            attributes.setSummary(optionValue);
          } else if (optionName.equalsIgnoreCase("width")) {
            attributes.setWidth(optionValue);
          } else if (optionName.equalsIgnoreCase("frame")) {
            attributes.setFrame(optionValue);
          } else if (optionName.equalsIgnoreCase("rules")) {
            attributes.setRules(optionValue);
          } else if (optionName.equalsIgnoreCase("cellspacing")) {
            attributes.setCellspacing(optionValue);
          } else if (optionName.equalsIgnoreCase("cellpadding")) {
            attributes.setCellpadding(optionValue);
          } else if (optionName.equalsIgnoreCase("bgcolor")) {
            attributes.setBgcolor(optionValue);
          }
        }
      }
      builder.beginBlock(BlockType.TABLE, attributes);
      // table open line never has cells
      return -1;
    } else {
      Matcher newRowMatcher = newRowPattern.matcher(line);
      if (newRowMatcher.matches()) {
        TableRowAttributes attributes = new TableRowAttributes();
        String newRowOptions = newRowMatcher.group(1);
        if (newRowOptions != null) {
          Matcher optionsMatcher = optionsPattern.matcher(newRowOptions);
          while (optionsMatcher.find()) {
            String optionName = optionsMatcher.group(1);
            String optionValue = optionsMatcher.group(2);
            if (optionName.equalsIgnoreCase("id")) {
              attributes.setId(optionValue);
            } else if (optionName.equalsIgnoreCase("style")) {
              attributes.setCssStyle(optionValue);
            } else if (optionName.equalsIgnoreCase("class")) {
              attributes.setCssClass(optionValue);
            } else if (optionName.equalsIgnoreCase("title")) {
              attributes.setTitle(optionValue);
            } else if (optionName.equalsIgnoreCase("align")) {
              attributes.setAlign(optionValue);
            } else if (optionName.equalsIgnoreCase("valign")) {
              attributes.setValign(optionValue);
            } else if (optionName.equalsIgnoreCase("bgcolor")) {
              attributes.setBgcolor(optionValue);
            }
          }
        }
        openRow(newRowMatcher.start(),attributes);
        return -1;
View Full Code Here

TOP

Related Classes of net.java.textilej.parser.TableAttributes

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.