Package nl.lxtreme.ols.util.ExportUtils.HtmlExporter

Examples of nl.lxtreme.ols.util.ExportUtils.HtmlExporter.Element


    aExporter.addCssStyle( ".w30 { width: 30%; } " );
    aExporter.addCssStyle( ".w20 { width: 20%; } " );
    aExporter.addCssStyle( ".w15 { width: 15%; } " );
    aExporter.addCssStyle( ".w10 { width: 10%; } " );

    final Element body = aExporter.getBody();
    body.addChild( H1 ).addContent( "1-Wire® Analysis results" );
    body.addChild( HR );
    body.addChild( DIV ).addAttribute( "class", "date" ).addContent( "{date-now}" );

    Element table, tr, thead, tbody;

    table = body.addChild( TABLE ).addAttribute( "class", "w100" );
    tbody = table.addChild( TBODY );
    tr = tbody.addChild( TR );
    tr.addChild( TH ).addAttribute( "colspan", "2" ).addContent( "Statistics" );
    tr = tbody.addChild( TR );
    tr.addChild( TD ).addAttribute( "class", "w30" ).addContent( "Decoded bytes" );
    tr.addChild( TD ).addContent( "{decoded-bytes}" );
    tr = tbody.addChild( TR );
    tr.addChild( TD ).addAttribute( "class", "w30" ).addContent( "Detected bus errors" );
    tr.addChild( TD ).addContent( "{detected-bus-errors}" );

    table = body.addChild( TABLE ).addAttribute( "class", "w100" );
    thead = table.addChild( THEAD );
    tr = thead.addChild( TR );
    tr.addChild( TH ).addAttribute( "class", "w30" ).addContent( "Index" );
    tr.addChild( TH ).addAttribute( "class", "w15" ).addContent( "Time" );
    tr.addChild( TH ).addAttribute( "class", "w20" ).addContent( "Hex" );
    tr.addChild( TH ).addAttribute( "class", "w20" ).addContent( "Bin" );
    tr.addChild( TH ).addAttribute( "class", "w20" ).addContent( "Dec" );
    tr.addChild( TH ).addAttribute( "class", "w10" ).addContent( "ASCII" );
    tbody = table.addChild( TBODY );
    tbody.addContent( "{decoded-data}" );

    return aExporter;
  }
View Full Code Here


          return Integer.valueOf( aAnalysisResult.getBusErrorCount() );
        }
        else if ( "decoded-data".equals( aMacro ) )
        {
          final List<OneWireData> dataSet = aAnalysisResult.getData();
          Element tr;

          for ( int i = 0; i < dataSet.size(); i++ )
          {
            final OneWireData data = dataSet.get( i );

            if ( data.isEvent() )
            {
              // this is an event
              final String event = data.getEventName();

              String bgColor;
              if ( OneWireDataSet.OW_RESET.equals( event ) )
              {
                bgColor = "#e0e0e0";
              }
              else
              {
                // unknown event
                bgColor = "#ff8000";
              }

              tr = aParent.addChild( TR ).addAttribute( "style", "background-color: " + bgColor + ";" );
              tr.addChild( TD ).addContent( String.valueOf( i ) );
              tr.addChild( TD ).addContent( Unit.Time.format( aAnalysisResult.getTime( data.getStartSampleIndex() ) ) );
              tr.addChild( TD ).addContent( event );
              tr.addChild( TD );
              tr.addChild( TD );
              tr.addChild( TD );
            }
            else
            {
              final int value = data.getValue();

              tr = aParent.addChild( TR );
              tr.addChild( TD ).addContent( String.valueOf( i ) );
              tr.addChild( TD ).addContent( Unit.Time.format( aAnalysisResult.getTime( data.getStartSampleIndex() ) ) );
              tr.addChild( TD ).addContent( "0x" + StringUtils.integerToHexString( value, 2 ) );
              tr.addChild( TD ).addContent( "0b" + StringUtils.integerToBinString( value, 8 ) );
              tr.addChild( TD ).addContent( String.valueOf( value ) );
              tr.addChild( TD ).addContent( String.valueOf( ( char )value ) );
            }
          }
        }

        return null;
View Full Code Here

    aExporter.addCssStyle( ".w10 { width: 10%; } " );
    aExporter.addCssStyle( ".w8 { width: 8%; } " );
    aExporter.addCssStyle( ".w7 { width: 7%; } " );
    aExporter.addCssStyle( ".w5 { width: 5%; } " );

    final Element body = aExporter.getBody();
    body.addChild( H1 ).addContent( "JTAG Analysis results" );
    body.addChild( HR );
    body.addChild( DIV ).addAttribute( "class", "date" ).addContent( "Generated: ", "{date-now}" );

    Element table, tr, thead, tbody;

    table = body.addChild( TABLE ).addAttribute( "class", "w100" );
    thead = table.addChild( THEAD );
    tr = thead.addChild( TR );
    tr.addChild( TH ).addAttribute( "class", "w44" ).addAttribute( "colspan", "3" );
    tr.addChild( TH ).addAttribute( "class", "w28" ).addAttribute( "colspan", "2" ).addContent( "TDI" );
    tr.addChild( TH ).addAttribute( "class", "w28" ).addAttribute( "colspan", "2" ).addContent( "TDO" );
    tr = thead.addChild( TR );
    tr.addChild( TH ).addAttribute( "class", "w5" ).addContent( "Index" );
    tr.addChild( TH ).addAttribute( "class", "w10" ).addContent( "Time" );
    tr.addChild( TH ).addAttribute( "class", "w28" ).addContent( "State" );
    tr.addChild( TH ).addAttribute( "class", "w8" ).addContent( "Hex" );
    tr.addChild( TH ).addAttribute( "class", "w20" ).addContent( "Bin" );
    tr.addChild( TH ).addAttribute( "class", "w8" ).addContent( "Hex" );
    tr.addChild( TH ).addAttribute( "class", "w20" ).addContent( "Bin" );
    tbody = table.addChild( TBODY );
    tbody.addContent( "{decoded-data}" );

    return aExporter;
  }
View Full Code Here

        else if ( "decoded-data".equals( aMacro ) )
        {
          LOG.log( Level.INFO, "toHtmlPage decoded-data" );

          final List<JTAGData> dataSet = aAnalysisResult.getData();
          Element tr;

          for ( int i = 0; i < dataSet.size(); i++ )
          {
            final JTAGData data = dataSet.get( i );

            if ( data.isEvent() )
            {
              tr = aParent.addChild( TR ).addAttribute( "style", "background-color: #fefeff;" );
              tr.addChild( TD ).addContent( String.valueOf( i ) );
              tr.addChild( TD ).addContent( Unit.Time.format( aAnalysisResult.getTime( data.getStartSampleIndex() ) ) );
              tr.addChild( TD ).addContent( String.valueOf( data.getDataValue() ) );
              tr.addChild( TD ).addAttribute( "colspan", "4" );
            }
            else
            {
              tr = aParent.addChild( TR );
              tr.addChild( TD ).addContent( String.valueOf( i ) );
              tr.addChild( TD ).addContent( Unit.Time.format( aAnalysisResult.getTime( data.getStartSampleIndex() ) ) );
              tr.addChild( TD ).addContent( data.getEventName() );

              BigInteger tdiData = null;
              BigInteger tdoData = null;

              // Try to coalesce equal timestamps...
              if ( ( i + 1 ) < dataSet.size() )
              {
                final JTAGData next = dataSet.get( i + 1 );
                if ( next.getStartSampleIndex() == data.getStartSampleIndex() )
                {
                  tdiData = ( BigInteger )( next.isTdiData() ? next.getDataValue() : data.getDataValue() );
                  tdoData = ( BigInteger )( next.isTdoData() ? next.getDataValue() : data.getDataValue() );
                  // Make sure to skip this entry in the next iteration...
                  i++;
                }
              }
             
              if ( ( tdiData == null ) && data.isTdiData() )
              {
                tdiData = ( BigInteger )data.getDataValue();
                tdoData = null;
              }
              else if ( ( tdoData == null ) && data.isTdoData() )
              {
                tdiData = null;
                tdoData = ( BigInteger )data.getDataValue();
              }

              if ( tdiData != null )
              {
                tr.addChild( TD ).addContent( "0x" + tdiData.toString( 16 ) );
                tr.addChild( TD ).addContent( "0b" + tdiData.toString( 2 ) );
              }
              else
              {
                tr.addChild( TD ).addAttribute( "colspan", "2" );
              }
              if ( tdoData != null )
              {
                tr.addChild( TD ).addContent( "0x" + tdoData.toString( 16 ) );
                tr.addChild( TD ).addContent( "0b" + tdoData.toString( 2 ) );
              }
              else
              {
                tr.addChild( TD ).addAttribute( "colspan", "2" );
              }
            }
          }
        }
View Full Code Here

    aExporter.addCssStyle( ".w15 { width: 15%; } " );
    aExporter.addCssStyle( ".w10 { width: 10%; } " );
    aExporter.addCssStyle( ".w8 { width: 8%; } " );
    aExporter.addCssStyle( ".w7 { width: 7%; } " );

    final Element body = aExporter.getBody();
    body.addChild( H1 ).addContent( "SPI Analysis results" );
    body.addChild( HR );
    body.addChild( DIV ).addAttribute( "class", "date" ).addContent( "Generated: ", "{date-now}" );

    Element table, tr, thead, tbody;

    table = body.addChild( TABLE ).addAttribute( "class", "w100" );
    tbody = table.addChild( TBODY );
    tr = tbody.addChild( TR );
    tr.addChild( TH ).addAttribute( "colspan", "2" ).addContent( "Configuration" );
    tr = tbody.addChild( TR );
    tr.addChild( TD ).addAttribute( "class", "w30" ).addContent( "SPI mode" );
    tr.addChild( TD ).addContent( "{detected-spi-mode}" );

    table = body.addChild( TABLE ).addAttribute( "class", "w100" );
    thead = table.addChild( THEAD );
    tr = thead.addChild( TR );
    tr.addChild( TH ).addAttribute( "class", "w30" ).addAttribute( "colspan", "2" );
    tr.addChild( TH ).addAttribute( "class", "w35" ).addAttribute( "colspan", "4" ).addContent( "MOSI" );
    tr.addChild( TH ).addAttribute( "class", "w35" ).addAttribute( "colspan", "4" ).addContent( "MISO" );
    tr = thead.addChild( TR );
    tr.addChild( TH ).addAttribute( "class", "w15" ).addContent( "Index" );
    tr.addChild( TH ).addAttribute( "class", "w15" ).addContent( "Time" );
    tr.addChild( TH ).addAttribute( "class", "w10" ).addContent( "Hex" );
    tr.addChild( TH ).addAttribute( "class", "w10" ).addContent( "Bin" );
    tr.addChild( TH ).addAttribute( "class", "w8" ).addContent( "Dec" );
    tr.addChild( TH ).addAttribute( "class", "w7" ).addContent( "ASCII" );
    tr.addChild( TH ).addAttribute( "class", "w10" ).addContent( "Hex" );
    tr.addChild( TH ).addAttribute( "class", "w10" ).addContent( "Bin" );
    tr.addChild( TH ).addAttribute( "class", "w8" ).addContent( "Dec" );
    tr.addChild( TH ).addAttribute( "class", "w7" ).addContent( "ASCII" );
    tbody = table.addChild( TBODY );
    tbody.addContent( "{decoded-data}" );

    return aExporter;
  }
View Full Code Here

  {
    if ( !this.needsCloseTag )
    {
      throw new IllegalStateException( "Cannot add children to tag that doesn't have close tag!" );
    }
    final Element child = aChild.clone();
    this.children.add( child );
    return child;
  }
View Full Code Here

  {
    if ( !this.needsCloseTag )
    {
      throw new IllegalStateException( "Cannot add children to tag that doesn't have close tag!" );
    }
    final Element child = new TagElement( aName );
    this.children.add( child );
    return child;
  }
View Full Code Here

        clone.attributes.add( attr.clone() );
      }
      clone.children = new ArrayList<Element>( this.children.size() );
      for ( Element child : getChildren() )
      {
        final Element childClone = child.clone();
        if ( childClone instanceof TextElement )
        {
          ( ( TextElement )childClone ).setParent( clone );
        }
        clone.children.add( childClone );
View Full Code Here

    if ( this.needsCloseTag )
    {
      for ( int i = 0; i < this.children.size(); i++ )
      {
        final Element child = this.children.get( i );

        sb.append( child.toString( aResolver ) );
      }
      sb.append( "</" ).append( this.name ).append( '>' );
    }

    return sb.toString();
View Full Code Here

    aExporter.addCssStyle( ".w30 { width: 30%; } " );
    aExporter.addCssStyle( ".w20 { width: 20%; } " );
    aExporter.addCssStyle( ".w15 { width: 15%; } " );
    aExporter.addCssStyle( ".w10 { width: 10%; } " );

    final Element body = aExporter.getBody();
    body.addChild( H1 ).addContent( "I<sup>2</sup>C Analysis results" );
    body.addChild( HR );
    body.addChild( DIV ).addAttribute( "class", "date" ).addContent( "{date-now}" );

    Element table, tr, thead, tbody;

    table = body.addChild( TABLE ).addAttribute( "class", "w100" );
    tbody = table.addChild( TBODY );
    tr = tbody.addChild( TR );
    tr.addChild( TH ).addAttribute( "colspan", "2" ).addContent( "Bus configuration" );
    tr = tbody.addChild( TR );
    tr.addChild( TD ).addAttribute( "class", "w30" ).addContent( "SDA" );
    tr.addChild( TD ).addContent( "{sda-bus-config}" );
    tr = tbody.addChild( TR );
    tr.addChild( TD ).addAttribute( "class", "w30" ).addContent( "SCL" );
    tr.addChild( TD ).addContent( "{scl-bus-config}" );

    tbody = table.addChild( TBODY );
    tr = tbody.addChild( TR );
    tr.addChild( TH ).addAttribute( "colspan", "2" ).addContent( "Statistics" );
    tr = tbody.addChild( TR );
    tr.addChild( TD ).addAttribute( "class", "w30" ).addContent( "Decoded bytes" );
    tr.addChild( TD ).addContent( "{decoded-bytes}" );
    tr = tbody.addChild( TR );
    tr.addChild( TD ).addAttribute( "class", "w30" ).addContent( "Detected bus errors" );
    tr.addChild( TD ).addContent( "{detected-bus-errors}" );

    table = body.addChild( TABLE ).addAttribute( "class", "w100" );
    thead = table.addChild( THEAD );
    tr = thead.addChild( TR );
    tr.addChild( TH ).addAttribute( "class", "w30" ).addContent( "Index" );
    tr.addChild( TH ).addAttribute( "class", "w15" ).addContent( "Time" );
    tr.addChild( TH ).addAttribute( "class", "w20" ).addContent( "Hex" );
    tr.addChild( TH ).addAttribute( "class", "w20" ).addContent( "Bin" );
    tr.addChild( TH ).addAttribute( "class", "w20" ).addContent( "Dec" );
    tr.addChild( TH ).addAttribute( "class", "w10" ).addContent( "ASCII" );
    tbody = table.addChild( TBODY );
    tbody.addContent( "{decoded-data}" );

    return aExporter;
  }
View Full Code Here

TOP

Related Classes of nl.lxtreme.ols.util.ExportUtils.HtmlExporter.Element

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.