Package org.pentaho.reporting.engine.classic.core.style

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheetCollection


  }


  private void assertStyleCollectionConnected(final MasterReport report)
  {
    final StyleSheetCollection con = report.getStyleSheetCollection();
    assertStyleCollectionConnected (report.getPageFooter (), con);
    assertStyleCollectionConnected (report.getPageHeader (), con);
    assertStyleCollectionConnected (report.getReportFooter (), con);
    assertStyleCollectionConnected (report.getReportHeader (), con);
    assertStyleCollectionConnected (report.getItemBand (), con);
View Full Code Here


      final PageDefinition definition = report.getPageDefinition();
      writePageDefinition(writer, definition);
    }

    // write list of styles
    final StyleSheetCollection styles = report.getStyleSheetCollection();
    final String[] styleNames = styles.getStyleNames();

    for (int i = 0; i < styleNames.length; i++)
    {
      final String name = styleNames[i];
      final ElementStyleSheet style = styles.getStyleSheet(name);

      StyleWriterUtility.writeStyleRule(BundleNamespaces.STYLE, "style-rule", writer, style, true);
    }

    // write layout processor section
View Full Code Here

    {
      throw new ParseException("Invalid internal configuration for 'report-obj'", getLocator());
    }

    final ReportDefinition def = (ReportDefinition) maybeReport;
    final StyleSheetCollection styleSheetCollection = def.getStyleSheetCollection();

    final String name = attrs.getValue(getUri(), "name");
    if (name == null)
    {
      throw new ParseException("Required attribute 'name' is not defined.", getLocator());
    }
    styleSheet = styleSheetCollection.createStyleSheet(name);
    final String parent = attrs.getValue(getUri(), "parent");
    if (parent != null)
    {
      final String[] classes = StringUtils.split(parent, " ", "'");
      for (int i = 0; i < classes.length; i++)
      {
        final String aClass = classes[i];
        final ElementStyleSheet parentStyleSheet = styleSheetCollection.createStyleSheet(aClass);
        try
        {
          styleSheet.addParent(parentStyleSheet);
        }
        catch (IllegalArgumentException e)
View Full Code Here

    {
      throw new ParseException("Invalid internal configuration for 'report-obj'", getLocator());
    }

    final ReportDefinition def = (ReportDefinition) maybeReport;
    final StyleSheetCollection styleSheetCollection = def.getStyleSheetCollection();

    final String parent = attrs.getValue(getUri(), "parent");
    if (parent != null)
    {
      final String[] classes = StringUtils.split(parent, " ", "'");
      for (int i = 0; i < classes.length; i++)
      {
        final String aClass = classes[i];
        final ElementStyleSheet parentStyleSheet = styleSheetCollection.createStyleSheet(aClass);
        try
        {
          styleSheet.addParent(parentStyleSheet);
        }
        catch (IllegalArgumentException e)
View Full Code Here

  private void init()
  {
    this.dataSchemaDefinition = new DefaultDataSchemaDefinition();
    this.properties = new ReportProperties();
    this.styleSheetCollection = new StyleSheetCollection();
    this.rootGroup = new RelationalGroup();
    this.reportHeader = new ReportHeader();
    this.reportFooter = new ReportFooter();
    this.pageHeader = new PageHeader();
    this.pageFooter = new PageFooter();
View Full Code Here

  }

  public void testSimpleClone ()
          throws CloneNotSupportedException
  {
    final StyleSheetCollection sc = new StyleSheetCollection();
    final ElementStyleSheet es1 = sc.createStyleSheet("one");
    final ElementStyleSheet es2 = sc.createStyleSheet("two");
    final ElementStyleSheet es3 = sc.createStyleSheet("three");
    final ElementStyleSheet es4 = sc.createStyleSheet("four");

    es1.addParent(es2);
    es1.addParent(es4);

    es2.addParent(es3);
    es3.addParent(es4);

    try
    {
      es4.addParent(es1);
      fail("Loop not detected");
    }
    catch(Exception e)
    {

    }

    final StyleSheetCollection scc = (StyleSheetCollection) sc.clone();
    final ElementStyleSheet esc1 = scc.getStyleSheet("one");
    final ElementStyleSheet esc2 = scc.getStyleSheet("two");
    final ElementStyleSheet esc3 = scc.getStyleSheet("three");
    final ElementStyleSheet esc4 = scc.getStyleSheet("four");

    assertEquals(es1.getId(), esc1.getId());
    assertEquals(es2.getId(), esc2.getId());
    assertEquals(es3.getId(), esc3.getId());
    assertEquals(es4.getId(), esc4.getId());
View Full Code Here

  }

  public void testForeignStyles ()
          throws CloneNotSupportedException
  {
    final StyleSheetCollection sc = new StyleSheetCollection();
    final ElementStyleSheet es1 = sc.createStyleSheet("one");
    final ElementStyleSheet es2 = sc.createStyleSheet("two");

    es1.addParent(es2);

    final StyleSheetCollection scc = (StyleSheetCollection) sc.clone();
    final ElementStyleSheet esc1 = scc.getStyleSheet("one");
    final ElementStyleSheet esc2 = scc.getStyleSheet("two");
    final List parents = Arrays.asList(esc1.getParents());
    assertTrue(parents.contains(esc2));
  }
View Full Code Here

      throw new ReportDefinitionException("URL is invalid");
    }
    try
    {
      MasterReport report = generator.parseReport(in);
      final StyleSheetCollection styleCollection =
          report.getStyleSheetCollection();
      final ElementStyleSheet styleSheet =
          styleCollection.createStyleSheet("my-style");
      styleSheet.setStyleProperty(TextStyleKeys.FONT, "SansSerif");
      styleSheet.setStyleProperty(ElementStyleKeys.PAINT, Color.blue);

      report.setDataFactory(new TableDataFactory("default", data));
      return report;
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.style.StyleSheetCollection

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.