Package org.pentaho.reporting.designer.core.editor

Examples of org.pentaho.reporting.designer.core.editor.ReportDocumentContext


  /**
   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {
    final ReportDocumentContext activeContext = getReportDesignerContext().getActiveContext();
    if (activeContext == null)
    {
      // has no effect
      return;
    }

    final ConfigurationEditorDialog dialog;

    final Window window = LibSwingUtil.getWindowAncestor(getReportDesignerContext().getView().getParent());
    if (window instanceof JDialog)
    {
      dialog = new ConfigurationEditorDialog((JDialog) window);
    }
    else if (window instanceof JFrame)
    {
      dialog = new ConfigurationEditorDialog((JFrame) window);
    }
    else
    {
      dialog = new ConfigurationEditorDialog();
    }

    final HierarchicalConfiguration config =
        (HierarchicalConfiguration) activeContext.getContextRoot().getReportConfiguration();
    final HashMap oldConfig = copyConfig(config);

    if (dialog.performEdit(config))
    {
      final HashMap newConfig = copyConfig(config);
      activeContext.getUndo().addChange(ActionMessages.getString("EditReportConfigurationAction.Text"),
          new EditReportConfigUndoEntry(oldConfig, newConfig));
      activeContext.getContextRoot().notifyNodeStructureChanged();
    }


  }
View Full Code Here


      try
      {
        context.addMasterReport((MasterReport) report);
        context.getRecentFilesModel().addFile(selectedFile);

        final ReportDocumentContext activeContext = context.getActiveContext();
        if (activeContext != null)
        {
          activeContext.resetChangeTracker();
        }
      }
      catch (ReportDataFactoryException e)
      {
        UncaughtExceptionsModel.getInstance().addException(e);
View Full Code Here

   *
   * @param e a ChangeEvent object
   */
  public void stateChanged(final ChangeEvent e)
  {
    final ReportDocumentContext activeContext = getActiveContext();
    if (activeContext == null)
    {
      return;
    }
    setEnabled(activeContext.getUndo().isUndoPossible());
    if (isEnabled())
    {
      putValue(Action.SHORT_DESCRIPTION, ActionMessages.getString("UndoAction.DescriptionPattern", activeContext.getUndo().getUndoName()));
    }
    else
    {
      putValue(Action.SHORT_DESCRIPTION, ActionMessages.getString("UndoAction.Description"));
    }
View Full Code Here

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

    final ReportDocumentContext activeContext = getActiveContext();
    if (activeContext == null)
    {
      return;
    }
    activeContext.getUndo().undo(activeContext);
    activeContext.getReportDefinition().notifyNodeStructureChanged();
  }
View Full Code Here

    final DataFactory dataFactory = new CachingDataFactory(rawDataFactory, true);

    try
    {
      final ReportDocumentContext activeContext = reportDesignerContext.getActiveContext();
      if (activeContext != null)
      {
        final MasterReport reportDefinition = activeContext.getContextRoot();
        dataFactory.initialize(new DesignTimeDataFactoryContext(reportDefinition));
      }

      final TableModel tableModel = dataFactory.queryData
          (queryName, new QueryDataRowWrapper(new ReportParameterValues(), 1, 0));
View Full Code Here

  /**
   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {
    final ReportDocumentContext activeContext = getActiveContext();
    if (activeContext == null)
    {
      return;
    }

    final Component parent = getReportDesignerContext().getView().getParent();
    final Window window = LibSwingUtil.getWindowAncestor(parent);
    final ExpressionChooserDialog dialog;
    if (window instanceof JDialog)
    {
      dialog = new ExpressionChooserDialog((JDialog) window);
    }
    else if (window instanceof JFrame)
    {
      dialog = new ExpressionChooserDialog((JFrame) window);
    }
    else
    {
      dialog = new ExpressionChooserDialog();
    }

    final Expression expression = dialog.performSelect();
    if (expression == null)
    {
      return;
    }
    final AbstractReportDefinition definition = activeContext.getReportDefinition();
    // try generate a unique expression name
    String possibleName = expression.getClass().getSimpleName() + nameCounter++;
    while (definition.getExpressions().get(possibleName) != null)
    {
      possibleName = expression.getClass().getSimpleName() + nameCounter++;
    }
    expression.setName(possibleName);
    final int position = definition.getExpressions().size();
    activeContext.getUndo().addChange(ActionMessages.getString("AddExpressionsAction.Text"),
        new ExpressionAddedUndoEntry(position, expression));
    definition.addExpression(expression);
  }
View Full Code Here

    }

    final EditGroupUndoEntry groupUndoEntry = performEditGroup(getReportDesignerContext(), selectedElement, false);
    if (groupUndoEntry != null)
    {
      final ReportDocumentContext activeContext = getActiveContext();
      groupUndoEntry.redo(activeContext);
    }
  }
View Full Code Here

    WorkspaceSettings.getInstance().addSettingsListener(this);
  }

  public void actionPerformed(final ActionEvent e)
  {
    final ReportDocumentContext activeContext = getActiveContext();
    if (activeContext == null)
    {
      return;
    }

    try
    {
      Object selectedElement = null;
      if (getSelectionModel().getSelectionCount() > 0)
      {
        selectedElement = getSelectionModel().getSelectedElement(0);
      }
      if (selectedElement instanceof CrosstabCellBody)
      {
        // execution order is important here.
        // first unlink the old root-group by setting a new one ...
        final CrosstabCellBody selectedGroup = (CrosstabCellBody) selectedElement;
        final CrosstabCell crosstabCell = new CrosstabCell();
        selectedGroup.addElement(crosstabCell);

        activeContext.getUndo().addChange(ActionMessages.getString("InsertCrosstabCellAction.UndoName"),
            new InsertCellBodyUndoEntry(selectedGroup.getObjectID(), crosstabCell));
      }
    }
    catch (Exception ex)
    {
View Full Code Here

   *
   * @param e a ChangeEvent object
   */
  public void stateChanged(final ChangeEvent e)
  {
    final ReportDocumentContext activeContext = getActiveContext();
    if (activeContext == null)
    {
      return;
    }
    setEnabled(activeContext.getUndo().isRedoPossible());
    if (isEnabled())
    {
      putValue(Action.SHORT_DESCRIPTION, ActionMessages.getString("RedoAction.DescriptionPattern", activeContext.getUndo().getRedoName()));
    }
    else
    {
      putValue(Action.SHORT_DESCRIPTION, ActionMessages.getString("RedoAction.Description"));
    }
View Full Code Here

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

    final ReportDocumentContext activeContext = getActiveContext();
    if (activeContext == null)
    {
      return;
    }
    activeContext.getUndo().redo(activeContext);
    activeContext.getReportDefinition().notifyNodeStructureChanged();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.designer.core.editor.ReportDocumentContext

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.