Package org.pentaho.reporting.designer.core

Examples of org.pentaho.reporting.designer.core.ReportDesignerContext


    if (activeContext == null)
    {
      return;
    }

    final ReportDesignerContext context = getReportDesignerContext();
    final Component parent = context.getView().getParent();
    final Window window = LibSwingUtil.getWindowAncestor(parent);
    final BundledResourceEditor dialog;
    if (window instanceof JDialog)
    {
      dialog = new BundledResourceEditor((JDialog) window, getReportDesignerContext());
View Full Code Here


    elementX.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, 0f);

    report.getReportHeader().addElement(elementX);

    // setup a dummy environment that simulates the setup of a full prd
    final ReportDesignerContext rdc = new TestReportDesignerContext();
    rdc.addMasterReport(report);
    final ReportRenderContext activeContext = rdc.getReportRenderContext(0);
    rdc.setActiveDocument(activeContext);
    assertNotNull(activeContext);

    // use the style editor panel in isolation to make the whole process debuggable ..
    final TestStyleEditorPanel sep = new TestStyleEditorPanel();
    sep.setReportDesignerContext(rdc);
View Full Code Here

  }

  public Component getElementCellEditorComponent(final ReportElementEditorContext rootBandRenderComponent,
                                                 final ReportElement value)
  {
    final ReportDesignerContext context = rootBandRenderComponent.getDesignerContext();
    final int contextCount = context.getReportRenderContextCount();
    for (int i = 0; i < contextCount; i++)
    {
      final ReportRenderContext rrc = context.getReportRenderContext(i);
      if (rrc.getReportDefinition() == value)
      {
        context.setActiveDocument(rrc);
        return null;
      }
    }

    final TocElement report = (TocElement) value;
    try
    {
      context.addSubReport(rootBandRenderComponent.getRenderContext(), report);
    }
    catch (ReportDataFactoryException e1)
    {
      UncaughtExceptionsModel.getInstance().addException(e1);
    }
View Full Code Here

  /**
   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {
    final ReportDesignerContext designerContext = getReportDesignerContext();
    if (designerContext == null)
    {
      return;
    }

    final ReportDocumentContext activeReportContext = getActiveContext();
    if (activeReportContext == null)
    {
      return;
    }

    final DocumentContextSelectionModel selectionModel1 = getSelectionModel();
    if (selectionModel1 == null)
    {
      return;
    }
    final Object leadSelection = selectionModel1.getLeadSelection();
    if (leadSelection instanceof Element == false)
    {
      return;
    }

    final Element element = (Element) leadSelection;
    if (element instanceof IndexElement)
    {
      final int contextCount = designerContext.getReportRenderContextCount();
      for (int i = 0; i < contextCount; i++)
      {
        final ReportRenderContext rrc = designerContext.getReportRenderContext(i);
        if (rrc.getReportDefinition() == element)
        {
          designerContext.setActiveDocument(rrc);
          return;
        }
      }

      final IndexElement report = (IndexElement) element;
      try
      {
        designerContext.addSubReport(activeReportContext, report);
      }
      catch (ReportDataFactoryException e1)
      {
        UncaughtExceptionsModel.getInstance().addException(e1);
      }
View Full Code Here

  /**
   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {
    final ReportDesignerContext designerContext = getReportDesignerContext();
    if (designerContext == null)
    {
      return;
    }

    final ReportDocumentContext activeReportContext = getActiveContext();
    if (activeReportContext == null)
    {
      return;
    }

    final DocumentContextSelectionModel selectionModel1 = getSelectionModel();
    if (selectionModel1 == null)
    {
      return;
    }
    final Object leadSelection = selectionModel1.getLeadSelection();
    if (leadSelection instanceof Element == false)
    {
      return;
    }

    final Element element = (Element) leadSelection;
    if (element instanceof TocElement)
    {
      final int contextCount = designerContext.getReportRenderContextCount();
      for (int i = 0; i < contextCount; i++)
      {
        final ReportRenderContext rrc = designerContext.getReportRenderContext(i);
        if (rrc.getReportDefinition() == element)
        {
          designerContext.setActiveDocument(rrc);
          return;
        }
      }

      final TocElement report = (TocElement) element;
      try
      {
        designerContext.addSubReport(activeReportContext, report);
      }
      catch (ReportDataFactoryException e1)
      {
        UncaughtExceptionsModel.getInstance().addException(e1);
      }
View Full Code Here

  }

  public Component getElementCellEditorComponent(final ReportElementEditorContext rootBandRenderComponent,
                                                 final ReportElement value)
  {
    final ReportDesignerContext context = rootBandRenderComponent.getDesignerContext();
    final int contextCount = context.getReportRenderContextCount();
    for (int i = 0; i < contextCount; i++)
    {
      final ReportRenderContext rrc = context.getReportRenderContext(i);
      if (rrc.getReportDefinition() == value)
      {
        context.setActiveDocument(rrc);
        return null;
      }
    }

    final IndexElement report = (IndexElement) value;
    try
    {
      context.addSubReport(rootBandRenderComponent.getRenderContext(), report);
    }
    catch (ReportDataFactoryException e1)
    {
      UncaughtExceptionsModel.getInstance().addException(e1);
    }
View Full Code Here

    putValue(Action.NAME, Messages.getString("EditWizardReportAction.MenuText")); //$NON-NLS-1$
  }

  public void actionPerformed(final ActionEvent e)
  {
    final ReportDesignerContext reportDesignerContext1 = getReportDesignerContext();
    if (reportDesignerContext1 == null)
    {
      return;
    }
    final ReportDocumentContext activeContext = reportDesignerContext1.getActiveContext();
    if (activeContext == null)
    {
      return;
    }
    final Component parent = reportDesignerContext1.getView().getParent();
    final Window window = LibSwingUtil.getWindowAncestor(parent);
    final EmbeddedWizard dialog;
    dialog = new EmbeddedWizard(window, new ReportDesignerDesignTimeContext(reportDesignerContext1));

    try
    {
      final AbstractReportDefinition realOriginal = activeContext.getReportDefinition();
      final AbstractReportDefinition original = (AbstractReportDefinition) realOriginal.derive();
      final AbstractReportDefinition def = dialog.run(original);
      if (def == null)
      {
        return;
      }

      if (def instanceof MasterReport)
      {
        reportDesignerContext1.addMasterReport((MasterReport) def);
      }
      else if (def instanceof SubReport)
      {
        // todo: Undo entries ...
View Full Code Here

    putValue(Action.ACCELERATOR_KEY, Messages.getOptionalKeyStroke("NewWizardReportAction.Accelerator")); //$NON-NLS-1$ //$NON-NLS-2$
  }

  public void actionPerformed(final ActionEvent e)
  {
    final ReportDesignerContext designerContext = getReportDesignerContext();
    if (designerContext == null)
    {
      return;
    }
    final Component parent = designerContext.getView().getParent();
    final Window window = LibSwingUtil.getWindowAncestor(parent);
    final EmbeddedWizard dialog;
    if (window instanceof JDialog)
    {
      dialog = new EmbeddedWizard((JDialog) window);
    }
    else if (window instanceof JFrame)
    {
      dialog = new EmbeddedWizard((JFrame) window);
    }
    else
    {
      dialog = new EmbeddedWizard();
    }

    // final MasterReport report = new MasterReport();
    // report.setDataFactory(new CompoundDataFactory());
    // report.setQuery(null);

    try
    {
      final MasterReport def = (MasterReport) dialog.run(null);
      if (def == null)
      {
        return;
      }

      try
      {
        final MemoryDocumentBundle bundle = (MemoryDocumentBundle) def.getBundle();
        if (bundle.isEntryExists(TRANSLATIONS_PROPERTIES) == false)
        {
          final String defaultMessage = ActionMessages.getString("Translations.DefaultContent");
          final OutputStream outputStream = bundle.createEntry(TRANSLATIONS_PROPERTIES, "text/plain");
          outputStream.write(defaultMessage.getBytes("ISO-8859-1"));
          outputStream.close();
          bundle.getWriteableDocumentMetaData().setEntryAttribute(TRANSLATIONS_PROPERTIES, BundleUtilities.STICKY_FLAG, "true");
        }
      }
      catch (Exception ex)
      {
        // ignore, its not that important ..
        DebugLog.log("Failed to created default translation entry", ex);
      }

      designerContext.addMasterReport(def);
    }
    catch (ReportProcessingException e1)
    {
      UncaughtExceptionsModel.getInstance().addException(e1);
    }
View Full Code Here

   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {

    final ReportDesignerContext reportDesignerContext = getReportDesignerContext();
    final ReportDocumentContext activeContext = getActiveContext();
    if (activeContext == null)
    {
      return;
    }

    if (activeContext.isChanged())
    {
      // ask the user and maybe save the report..
      final int option = JOptionPane.showConfirmDialog(reportDesignerContext.getView().getParent(),
          Messages.getInstance().getString("PublishToServerAction.ReportModifiedWarning.Message"),
          Messages.getInstance().getString("PublishToServerAction.ReportModifiedWarning.Title"),
          JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
      if (option == JOptionPane.YES_OPTION)
      {
        if (SaveReportAction.saveReport
            (reportDesignerContext, activeContext, reportDesignerContext.getView().getParent()) == false)
        {
          return;
        }
      }
      if (option == JOptionPane.CANCEL_OPTION)
      {
        return;
      }
    }

    final PublishToServerTask publishToServerTask =
        new PublishToServerTask(reportDesignerContext, reportDesignerContext.getView().getParent());
    final LoginTask loginTask = new LoginTask
        (reportDesignerContext, reportDesignerContext.getView().getParent(), publishToServerTask, null, true);

    SwingUtilities.invokeLater(loginTask);

  }
View Full Code Here

  /**
   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {
    final ReportDesignerContext reportDesignerContext = getReportDesignerContext();
    final OpenFileFromRepositoryTask openFileFromRepositoryTask =
        new OpenFileFromRepositoryTask(reportDesignerContext, reportDesignerContext.getView().getParent());
    final LoginTask loginTask = new LoginTask
        (reportDesignerContext, reportDesignerContext.getView().getParent(), openFileFromRepositoryTask);

    SwingUtilities.invokeLater(loginTask);
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.designer.core.ReportDesignerContext

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.