Examples of ReportDocumentContext


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

    putValue(Action.ACCELERATOR_KEY, ActionMessages.getOptionalKeyStroke("EditRowBandingAction.Accelerator"));
  }

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

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

    final RowBandingFunction function = findRowbandingFunction(activeContext);
    final AbstractReportDefinition report = activeContext.getReportDefinition();
    if (function == null)
    {
      final RowBandingFunction newFunction = new RowBandingFunction();
      if (dialog.performEdit(newFunction))
      {
        report.getExpressions().add(newFunction);
        activeContext.getUndo().addChange(ActionMessages.getString("EditRowBandingAction.Text"),
            new ExpressionAddedUndoEntry(report.getExpressions().size() - 1, newFunction));
        report.notifyNodeChildAdded(function);
      }
    }
    else
    {
      final RowBandingFunction instance = (RowBandingFunction) function.getInstance();
      if (dialog.performEdit(instance))
      {
        final ExpressionCollection expressionCollection = report.getExpressions();
        final int idx = expressionCollection.indexOf(function);
        expressionCollection.set(idx, instance);
        activeContext.getUndo().addChange(ActionMessages.getString("EditRowBandingAction.Text"),
            new ExpressionEditUndoEntry(idx, function, instance));
        report.fireModelLayoutChanged(report, ReportModelEvent.NODE_PROPERTIES_CHANGED, instance);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.