Package org.pentaho.reporting.designer.core

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


    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 ReportRenderContext activeContext = reportDesignerContext1.getActiveContext();
    if (activeContext == null)
    {
      return;
    }
    final Component parent = reportDesignerContext1.getParent();
    final Window window = SwingUtil.getWindowAncestor(parent);
    final EmbeddedWizard dialog;
    if (window instanceof JDialog)
    {
      dialog = new EmbeddedWizard((JDialog) window);
    }
    else if (window instanceof JFrame)
    {
      dialog = new EmbeddedWizard(window);
    }
    else
    {
      dialog = new EmbeddedWizard();
    }


    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.getParent();
    final Window window = SwingUtil.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 String defaultMessage =
            ActionMessages.getString("Translations.DefaultContent");
        final MemoryDocumentBundle bundle = (MemoryDocumentBundle) def.getBundle();
        final OutputStream outputStream = bundle.createEntry("translations.properties", "text/plain");
        outputStream.write
            (defaultMessage.getBytes("ISO-8859-1"));
        outputStream.close();
        bundle.getWriteableDocumentMetaData().setEntryAttribute("translations.properties", "sticky", "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

  }

  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.setActiveContext(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

  }

  protected ReportRenderContext getActiveContext()
  {

    final ReportDesignerContext context = getReportDesignerContext();
    if (context == null)
    {
      return null;
    }
    return context.getActiveContext();
  }
View Full Code Here

    setEnabled(false);
  }

  public void setReportDesignerContext(final ReportDesignerContext context)
  {
    final ReportDesignerContext old = this.reportDesignerContext;
    this.reportDesignerContext = context;
    updateDesignerContext(old, reportDesignerContext);
  }
View Full Code Here

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

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

    if (activeContext.isChanged())
    {
      // ask the user and maybe save the report..
      final int option = JOptionPane.showConfirmDialog(reportDesignerContext.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.getParent()) == false)
        {
          return;
        }
      }
      if (option == JOptionPane.CANCEL_OPTION)
      {
        return;
      }
    }

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

    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.getParent());
    final LoginTask loginTask = new LoginTask
        (reportDesignerContext, reportDesignerContext.getParent(), openFileFromRepositoryTask);

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

    return true;
  }

  public void setReportDesignerContext(final ReportDesignerContext context)
  {
    final ReportDesignerContext old = this.reportDesignerContext;
    this.reportDesignerContext = context;
    updateDesignerContext(old, reportDesignerContext);
  }
View Full Code Here

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

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

    final ReportSelectionModel 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.setActiveContext(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 ReportRenderContext activeReportContext = getActiveContext();
    if (activeReportContext == null)
    {
      return;
    }

    final ReportSelectionModel 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.setActiveContext(rrc);
          return;
        }
      }

      final TocElement report = (TocElement) element;
      try
      {
        designerContext.addSubReport(activeReportContext, report);
      }
      catch (ReportDataFactoryException e1)
      {
        UncaughtExceptionsModel.getInstance().addException(e1);
      }
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.