Package pt.webdetails.cdf.dd.structure

Examples of pt.webdetails.cdf.dd.structure.DashboardWcdfDescriptor


    } catch ( DocumentException e ) {
      e.printStackTrace();
    } catch ( FileNotFoundException e ) {
      e.printStackTrace();
    }
    DashboardWcdfDescriptor wcdf = DashboardWcdfDescriptor.fromXml( wcdfDoc );
    Dashboard.Builder builder = new Dashboard.Builder();
    DashboardType dashboardType = null;
    try {
      dashboardType = new DashboardType.Builder().build();
    } catch ( ValidationException e ) {
View Full Code Here


      JSONObject jsonObj = JSONObject.fromObject( origStructure );

      if( jsonObj != null && jsonObj.containsKey( "filename" ) ){

        DashboardWcdfDescriptor wcdf = loadWcdfDescriptor( jsonObj.getString( "filename" ) );

        if( wcdf != null ){

          // update the template structure
          jsonObj.put( "style" , wcdf.getStyle() );
          jsonObj.put( "rendererType" , wcdf.getRendererType() );

          updatedStructure = jsonObj.toString( 2 );
        }
      }
View Full Code Here

    } catch ( DocumentException e ) {
      e.printStackTrace();
    } catch ( FileNotFoundException e ) {
      e.printStackTrace();
    }
    DashboardWcdfDescriptor wcdf = DashboardWcdfDescriptor.fromXml( wcdfDoc );
    Dashboard.Builder builder = new Dashboard.Builder();
    DashboardType dashboardType = null;
    try {
      dashboardType = new DashboardType.Builder().build();
    } catch ( ValidationException e ) {
View Full Code Here

    if ( wcdfFilePath == null ) {
      throw new IllegalArgumentException( "wcdfFilePath" );
    }

    // Figure out what dashboard we should be handling: load its wcdf descriptor.
    DashboardWcdfDescriptor wcdf;
    if ( !wcdfFilePath.isEmpty() && wcdfFilePath.endsWith( ".wcdf" ) ) {
      try {
        wcdf = DashboardWcdfDescriptor.load( wcdfFilePath );
      } catch ( IOException ex ) {
        // TODO: User has no permission to WCDF falls here?
        throw new ThingWriteException( "While accessing the WCDF file.", ex );
      }

      if ( wcdf == null ) {
        // Doesn't exist
        // TODO: Explain or fix, why create a (totally) empty one?
        wcdf = new DashboardWcdfDescriptor();
      }
    } else {
      // We didn't receive a valid path. We're in preview mode.
      // TODO: Support mobile preview mode (must remove dependency on setStyle())
      wcdf = getPreviewWcdf( wcdfFilePath );
      bypassCacheRead = true; // no cache for preview
    }

    if ( StringUtils.isNotEmpty( style ) ) {
      wcdf.setStyle( style );
    }

    return this.getDashboardCdfRunJs( wcdf, options, bypassCacheRead );
  }
View Full Code Here

  }

  //TODO: is wcdfPath needed?
  public DashboardWcdfDescriptor getPreviewWcdf( String cdfdePath )
    throws ThingWriteException {
    DashboardWcdfDescriptor wcdf = new DashboardWcdfDescriptor();
    //TODO is this needed?
    if ( !cdfdePath.isEmpty() && cdfdePath.endsWith( ".cdfde" ) ) {
      wcdf.setPath( cdfdePath );
    }
    wcdf.setStyle( CdeConstants.DEFAULT_STYLE );
    wcdf.setRendererType( DashboardRendererType.BLUEPRINT.getType() );
    return wcdf;
  }
View Full Code Here

  public Dashboard getDashboard(
    String wcdfPath,
    boolean bypassCacheRead )
    throws ThingReadException {
    try {
      DashboardWcdfDescriptor wcdf = DashboardWcdfDescriptor.load( wcdfPath );
      if ( wcdf == null ) {
        throw new ThingReadException( new FileNotFoundException( wcdfPath ) );
      }

      return this.getDashboard( wcdf, bypassCacheRead );
View Full Code Here

*/
public class CdfRunJsThingWriterFactory implements IThingWriterFactory
{
 
  public CdfRunJsDashboardWriter getDashboardWriter(Dashboard dashboard) {
    DashboardWcdfDescriptor wcdf = dashboard.getWcdf();
    DashboardRendererType rendererType = wcdf.getParsedRendererType();
     
    if(rendererType == DashboardRendererType.MOBILE)
    {
      return new CdfRunJsMobileDashboardWriter();
    }
   
    if(rendererType == DashboardRendererType.BOOTSTRAP)
      {
        return wcdf.isWidget() ?
                   new CdfRunJsBootstrapWidgetWriter() :
                   new CdfRunJsBootstrapDashboardWriter();
      }   
   

    return wcdf.isWidget() ?
           new CdfRunJsBlueprintWidgetWriter() :
           new CdfRunJsBlueprintDashboardWriter();
  }
View Full Code Here

    CdfRunJsDashboardWriteContext ctx,
    Dashboard dash )
    throws ThingWriteException {
    assert dash == ctx.getDashboard();

    DashboardWcdfDescriptor wcdf = dash.getWcdf();

    // ------------

    String template;
    try {
View Full Code Here

  }

  // -----------------

  protected String writeComponents( CdfRunJsDashboardWriteContext context, Dashboard dash ) throws ThingWriteException {
    DashboardWcdfDescriptor wcdf = dash.getWcdf();

    StringBuilder out = new StringBuilder();
    StringBuilder widgetsOut = new StringBuilder();

    // Output WCDF
    out.append( "wcdfSettings = " );
    out.append( wcdf.toJSON().toString( 2 ) );
    out.append( ';' );
    out.append( NEWLINE );
    out.append( NEWLINE );

    boolean isFirstComp = true;
View Full Code Here

  protected String writeHeaders(
    String contents,
    CdfRunJsDashboardWriteContext context ) {
    CdfRunJsDashboardWriteOptions options = context.getOptions();

    DashboardWcdfDescriptor wcdf = context.getDashboard().getWcdf();

    final String title = "<title>" + wcdf.getTitle() + "</title>";

    // Get CDF headers
    String cdfDeps;
    try {
      cdfDeps = CdeEngine.getEnv().getCdfIncludes(
View Full Code Here

TOP

Related Classes of pt.webdetails.cdf.dd.structure.DashboardWcdfDescriptor

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.