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

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


    public void undo(final ReportRenderContext renderContext)
    {
      final RelationalGroup selectedGroup = (RelationalGroup)
          ModelUtility.findElementById(renderContext.getReportDefinition(), target);

      final GroupBody bodyElement = selectedGroup.getBody();
      if (bodyElement instanceof SubGroupBody == false)
      {
        throw new IllegalStateException();
      }
      final SubGroupBody sgb = (SubGroupBody) bodyElement;
      final GroupBody maybeDataBody = sgb.getGroup().getBody();
      if (maybeDataBody instanceof GroupDataBody == false)
      {
        throw new IllegalStateException();
      }
View Full Code Here


    public void redo(final ReportRenderContext renderContext)
    {
      final RelationalGroup selectedGroup = (RelationalGroup)
          ModelUtility.findElementById(renderContext.getReportDefinition(), target);

      final GroupBody bodyElement = selectedGroup.getBody();
      if (bodyElement instanceof GroupDataBody == false)
      {
        throw new IllegalStateException();
      }
View Full Code Here

      if (selectedElement instanceof CrosstabOtherGroup)
      {
        // execution order is important here.
        // first unlink the old root-group by setting a new one ...
        final CrosstabOtherGroup selectedGroup = (CrosstabOtherGroup) selectedElement;
        final GroupBody oldGroupBody = selectedGroup.getBody();
        final CrosstabOtherGroupBody newGroupBody = new CrosstabOtherGroupBody(newGroup);
        selectedGroup.setBody(newGroupBody);
        newGroup.setBody(oldGroupBody);

        activeContext.getUndo().addChange(ActionMessages.getString("InsertCrosstabOtherGroupAction.UndoName"),
            new InsertGroupBodyOnGroupUndoEntry(selectedGroup.getObjectID(), oldGroupBody, newGroupBody));
      }
      if (selectedElement instanceof CrosstabGroup)
      {
        final CrosstabGroup selectedGroup = (CrosstabGroup) selectedElement;
        final GroupBody oldGroupBody = selectedGroup.getBody();
        final CrosstabOtherGroupBody newGroupBody = new CrosstabOtherGroupBody(newGroup);
        selectedGroup.setBody(newGroupBody);
        newGroup.setBody(oldGroupBody);

        activeContext.getUndo().addChange(ActionMessages.getString("InsertCrosstabOtherGroupAction.UndoName"),
View Full Code Here

      }

      if (selectedElement instanceof CrosstabColumnGroup)
      {
        final CrosstabColumnGroup selectedGroup = (CrosstabColumnGroup) selectedElement;
        final GroupBody oldGroupBody = selectedGroup.getBody();
        final CrosstabColumnGroupBody newGroupBody = new CrosstabColumnGroupBody(newGroup);
        selectedGroup.setBody(newGroupBody);
        newGroup.setBody(oldGroupBody);
        activeContext.getUndo().addChange(ActionMessages.getString("InsertCrosstabColumnGroupAction.UndoName"),
            new InsertGroupBodyOnGroupUndoEntry(selectedGroup.getObjectID(), oldGroupBody, newGroupBody));
View Full Code Here

      if (selectedElement instanceof CrosstabRowGroup)
      {
        // execution order is important here.
        // first unlink the old root-group by setting a new one ...
        final CrosstabRowGroup selectedGroup = (CrosstabRowGroup) selectedElement;
        final GroupBody oldGroupBody = selectedGroup.getBody();
        final CrosstabRowGroupBody newGroupBody = new CrosstabRowGroupBody(newGroup);
        selectedGroup.setBody(newGroupBody);
        newGroup.setBody(oldGroupBody);
       
        activeContext.getUndo().addChange(ActionMessages.getString("InsertCrosstabRowGroupAction.UndoName"),
View Full Code Here

          return footer;
        }

        if (insert instanceof GroupBody)
        {
          final GroupBody body = (GroupBody) insert.derive();
          try
          {
            g.setBody(body);
            return body;
          }
          catch (final Exception e)
          {
            return null;
          }
        }
        return null;
      }
      catch (CloneNotSupportedException cne)
      {
        UncaughtExceptionsModel.getInstance().addException(cne);
        return null;
      }
    }

    if (rawLeadSelection instanceof SubGroupBody)
    {
      final SubGroupBody body = (SubGroupBody) rawLeadSelection;
      if (insert instanceof RelationalGroup || insert instanceof CrosstabGroup)
      {
        try
        {
          final Group group = (Group) insert.derive();
          body.setGroup(group);
          return group;
        }
        catch (Exception cne)
        {
          UncaughtExceptionsModel.getInstance().addException(cne);
          return null;
        }
      }
      return null;
    }

    if (rawLeadSelection instanceof GroupDataBody)
    {
      final GroupDataBody body = (GroupDataBody) rawLeadSelection;
      try
      {
        if (insert instanceof DetailsHeader)
        {
          final DetailsHeader detailsHeader = (DetailsHeader) insert.derive();
          body.setDetailsHeader(detailsHeader);
          return detailsHeader;
        }
        if (insert instanceof DetailsFooter)
        {
          final DetailsFooter footer = (DetailsFooter) insert.derive();
          body.setDetailsFooter(footer);
          return footer;
        }
        if (insert instanceof ItemBand)
        {
          final ItemBand itemBand = (ItemBand) insert.derive();
          body.setItemBand(itemBand);
          return itemBand;
        }
        if (insert instanceof NoDataBand)
        {
          final NoDataBand noDataBand = (NoDataBand) insert.derive();
          body.setNoDataBand(noDataBand);
          return noDataBand;
        }
      }
      catch (CloneNotSupportedException cne)
      {
View Full Code Here

      return null;
    }

    if (data instanceof GroupBody)
    {
      final GroupBody subgroup = (GroupBody) data;
      final RelationalGroup parent = (RelationalGroup) subgroup.getParentSection();
      if (parent != null)
      {
        final GroupBody body = parent.getBody();
        final GroupDataBody newBody = new GroupDataBody();
        parent.setBody(newBody);
        return new SectionEditUndoEntry
                (parent.getObjectID(), ModelUtility.findIndexOf(parent, newBody), body, newBody);
      }
View Full Code Here

    while (group instanceof RelationalGroup)
    {
      final RelationalGroup rgroup = (RelationalGroup) group;
      data.add(new GroupDataEntry(group.getObjectID(), group.getName(), rgroup.getFieldsArray()));

      final GroupBody body = rgroup.getBody();
      if (body instanceof SubGroupBody)
      {
        final SubGroupBody subGroupBody = (SubGroupBody) body;
        group = subGroupBody.getGroup();
      }
View Full Code Here

    {
      final RelationalGroup rgroup = (RelationalGroup) group;
      innermostGroup = rgroup;
      groups.put(group.getObjectID(), rgroup);

      final GroupBody body = rgroup.getBody();
      if (body instanceof SubGroupBody)
      {
        final SubGroupBody subGroupBody = (SubGroupBody) body;
        group = subGroupBody.getGroup();
      }
      else
      {
        group = null;
      }
    }

    final RelationalGroup[] resultGroups = new RelationalGroup[newEntries.length];
    for (int i = 0; i < newEntries.length; i++)
    {
      final GroupDataEntry o = newEntries[i];
      final RelationalGroup sourceGroup = groups.get(o.getInstanceID());
      if (sourceGroup == null)
      {
        resultGroups[i] = new RelationalGroup();
      }
      else
      {
        resultGroups[i] = sourceGroup;
      }

      resultGroups[i].setName(o.getName());
      resultGroups[i].setFieldsArray(o.getFields());
    }

    final GroupBody innermostBody;
    if (innermostGroup == null)
    {
      innermostBody = new SubGroupBody(abstractReportDefinition.getRootGroup());
    }
    else
    {
      innermostBody = innermostGroup.getBody();
    }

    if (resultGroups.length > 0)
    {
      for (int i = 0; i < resultGroups.length; i++)
      {
        final RelationalGroup resultGroup = resultGroups[i];
        if (i == 0)
        {
          abstractReportDefinition.setRootGroup(resultGroup);
        }
        else
        {
          final RelationalGroup prevGroup = resultGroups[i - 1];
          final GroupBody body = prevGroup.getBody();
          if (body instanceof SubGroupBody)
          {
            final SubGroupBody sgb = (SubGroupBody) body;
            sgb.setGroup(resultGroup);
          }
View Full Code Here

TOP

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

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.