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

Examples of org.pentaho.reporting.engine.classic.core.CompoundDataFactory


      return -1;
    }

    if (parent == getDataFactoryElement())
    {
      final CompoundDataFactory dataFactoryElement = getDataFactoryElement();
      for (int i = 0; i < dataFactoryElement.size(); i++)
      {
        final DataFactory dataFactory = dataFactoryElement.getReference(i);
        if (dataFactory == child)
        {
          return i;
        }
      }
View Full Code Here



  protected UndoEntry moveDataFactories(final AbstractReportDefinition report, final Object element)
          throws ReportDataFactoryException
  {
    final CompoundDataFactory collection = (CompoundDataFactory) report.getDataFactory();
    final int dataFactoryCount = collection.size();
    for (int j = 0; j < dataFactoryCount - 1; j++)
    {
      final DataFactory dataFactory = collection.getReference(j);
      if (element == dataFactory)
      {
        collection.remove(j);
        collection.add(dataFactory);

        report.fireModelLayoutChanged(report, ReportModelEvent.NODE_STRUCTURE_CHANGED, dataFactory);
        return new CompoundUndoEntry(new DataSourceEditUndoEntry(j, dataFactory, null),
                new DataSourceEditUndoEntry(collection.size()-1, null, dataFactory));
      }
    }
    return null;
  }
View Full Code Here

          undos.add(new ParameterEditUndoEntry(index, null, insertParam));
        }
        else if (insertResult instanceof DataFactory)
        {
          final DataFactory insertDataFactory = (DataFactory) insertResult;
          final CompoundDataFactory compoundDataFactory = (CompoundDataFactory) activeContext.getReportDefinition().getDataFactory();
          final int index = compoundDataFactory.size() - 1;
          undos.add(new DataSourceEditUndoEntry(index, null, insertDataFactory));
        }

      }
      getSelectionModel().setSelectedElements(selectedElements.toArray());
View Full Code Here


  protected UndoEntry moveDataFactories(final AbstractReportDefinition report, final Object element)
      throws ReportDataFactoryException
  {
    final CompoundDataFactory collection = (CompoundDataFactory) report.getDataFactory();
    final int dataFactoryCount = collection.size();
    for (int j = 0; j < dataFactoryCount; j++)
    {
      final DataFactory dataFactory = collection.getReference(j);
      if (element == dataFactory)
      {
        if (collection.size() > j + 1)
        {
          collection.remove(j);
          collection.add(j + 1, dataFactory);

          report.fireModelLayoutChanged(report, ReportModelEvent.NODE_STRUCTURE_CHANGED, dataFactory);
          return new CompoundUndoEntry
              (new DataSourceEditUndoEntry(j, dataFactory, null), new DataSourceEditUndoEntry(j + 1, null, dataFactory));
        }
View Full Code Here

      return;
    }

    final ReportDocumentContext activeContext = getActiveContext();
    final AbstractReportDefinition report = activeContext.getReportDefinition();
    final CompoundDataFactory collection = (CompoundDataFactory) report.getDataFactory();
    final int j = collection.indexOfByReference(dataFactory);
    if (j == -1)
    {
      throw new IllegalStateException("Edited data-source does not exist in the report anymore.");
    }

    DefaultDataFactoryChangeRecorder.applyChanges(collection, recorder.getChanges());

    final DataFactory editedClone = editedDataFactory.derive();
    collection.set(j, editedDataFactory);
    activeContext.getUndo().addChange
        (ActionMessages.getString("EditDataSourceAction.UndoName"), new DataSourceEditUndoEntry(j, storedFactory, editedClone));

    report.notifyNodeChildRemoved(dataFactory);
    report.notifyNodeChildAdded(editedDataFactory);
View Full Code Here

    }


    if (isLegacyDefaultDataFactory(originalDataFactory))
    {
      final CompoundDataFactory compoundDataFactory = CompoundDataFactory.normalize(dataFactory);
      DefaultDataFactoryChangeRecorder.applyChanges(compoundDataFactory, dataFactoryChanges);
      report.setDataFactory(compoundDataFactory);
      activeContext.getUndo().addChange(ActionMessages.getString("AddDataFactoryAction.UndoText"),
          new DataSourceEditUndoEntry(0, null, dataFactory.derive()));
    }
    else
    {
      final CompoundDataFactory reportDf = CompoundDataFactory.normalize(originalDataFactory);
      DefaultDataFactoryChangeRecorder.applyChanges(reportDf, dataFactoryChanges);
      final int position = reportDf.size();
      reportDf.add(dataFactory);
      activeContext.getUndo().addChange(ActionMessages.getString("AddDataFactoryAction.UndoText"),
          new DataSourceEditUndoEntry(position, null, dataFactory.derive()));
      report.setDataFactory(reportDf);
    }
  }
View Full Code Here


  protected UndoEntry moveDataFactories(final AbstractReportDefinition report, final Object element)
      throws ReportDataFactoryException
  {
    final CompoundDataFactory collection = (CompoundDataFactory) report.getDataFactory();
    final int dataFactoryCount = collection.size();
    for (int j = 1; j < dataFactoryCount; j++)
    {
      final DataFactory dataFactory = collection.getReference(j);
      if (element == dataFactory)
      {
        collection.remove(j);
        collection.add(j - 1, dataFactory);

        report.fireModelLayoutChanged(report, ReportModelEvent.NODE_STRUCTURE_CHANGED, dataFactory);
        return new CompoundUndoEntry
            (new DataSourceEditUndoEntry(j, dataFactory, null), new DataSourceEditUndoEntry(j - 1, null, dataFactory));
      }
View Full Code Here

      }

      final Window parentWindow = designTimeContext.getParentWindow();
      parentWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

      final CompoundDataFactory collection = (CompoundDataFactory) report.getDataFactory();
      final int dataFactoryCount = collection.size();
      for (int j = 0; j < dataFactoryCount; j++)
      {
        final DataFactory originalDataFactory = collection.getReference(j);
        if (originalDataFactory == dataFactory)
        {
          collection.remove(j);

          final DataFactory editedClone = editedDataFactory.derive();
          collection.add(j, editedDataFactory);
          activeContext.getUndo().addChange(ActionMessages.getString("EditQueryAction.Text"),
              new DataSourceEditUndoEntry(j, storedFactory, editedClone));

          report.notifyNodeChildRemoved(originalDataFactory);
          report.notifyNodeChildAdded(editedDataFactory);
View Full Code Here

  public static MasterReport prepareMasterReport()
  {
    final MasterReport report = new MasterReport();
    report.setAutoSort(Boolean.TRUE);
    report.setDataFactory(new CompoundDataFactory());
    report.setQuery(null);
    report.getRelationalGroup(0).getHeader().setAttribute(ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE);
    report.getRelationalGroup(0).getFooter().setAttribute(ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE);
    report.getDetailsFooter().setAttribute(ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE);
    report.getDetailsHeader().setAttribute(ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE);
View Full Code Here


  protected UndoEntry moveDataFactories(final AbstractReportDefinition report, final Object element)
      throws ReportDataFactoryException
  {
    final CompoundDataFactory collection = (CompoundDataFactory) report.getDataFactory();
    final int dataFactoryCount = collection.size();
    for (int j = 1; j < dataFactoryCount; j++)
    {
      final DataFactory dataFactory = collection.getReference(j);
      if (element == dataFactory)
      {
        collection.remove(j);
        collection.add(0, dataFactory);

        report.fireModelLayoutChanged(report, ReportModelEvent.NODE_STRUCTURE_CHANGED, dataFactory);
        return new CompoundUndoEntry
            (new DataSourceEditUndoEntry(j, dataFactory, null), new DataSourceEditUndoEntry(0, null, dataFactory));
      }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.CompoundDataFactory

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.