Examples of MassElementStyleUndoEntryBuilder


Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Collections.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final Element[] carrier = new Element[1];

    final int lastElementIdx = reportElements.size() - 1;
    final Element lastElement = reportElements.get(lastElementIdx);
    final Element firstElement = reportElements.get(0);

    final CachedLayoutData firstLayoutData = ModelUtility.getCachedLayoutData(firstElement);
    final CachedLayoutData lastLayoutData = ModelUtility.getCachedLayoutData(lastElement);

    final long height = (lastLayoutData.getX()) - (firstLayoutData.getX());

    final long incr = height / lastElementIdx;
    long currentY = firstLayoutData.getX();
    currentY += incr;//start from second element

    for (Element reportElement : reportElements)
    {
      carrier[0] = reportElement;
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final Point2D.Double originPoint = new Point2D.Double(StrictGeomUtility.toExternalValue(layoutData.getX()), 0);
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(StrictGeomUtility.toExternalValue(currentY), 0), 1);
      mop.finish();

      currentY += incr;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeLeftAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Collections.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final List<Element> carrier = new ArrayList<Element>(1);
    carrier.add(null);

    final int lastElementIdx = reportElements.size() - 1;
    final Element lastElement = reportElements.get(lastElementIdx);
    final Element firstElement = reportElements.get(0);

    final CachedLayoutData firstLayoutData = ModelUtility.getCachedLayoutData(firstElement);
    final CachedLayoutData lastLayoutData = ModelUtility.getCachedLayoutData(lastElement);

    final long height = (lastLayoutData.getY() + lastLayoutData.getHeight() / 2) -
        (firstLayoutData.getY() + firstLayoutData.getHeight() / 2);

    final long incr = height / lastElementIdx;
    long currentY = firstLayoutData.getY() + firstLayoutData.getHeight() / 2;
    currentY += incr;//start from second element

    for (Element reportElement : reportElements)
    {
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final long delta = currentY - layoutData.getHeight() / 2;
      if (delta == 0)
      {
        continue;
      }

      carrier.set(0, reportElement);
      final Point2D.Double originPoint = new Point2D.Double(0, StrictGeomUtility.toExternalValue(layoutData.getY()));

      final MoveDragOperation mop = new MoveDragOperation
          (carrier, originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(0, StrictGeomUtility.toExternalValue(delta)), 1);
      mop.finish();

      currentY += incr;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeMiddleAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Collections.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final Element[] carrier = new Element[1];

    long totalHeight = 0;
    long topmostY = Long.MAX_VALUE;
    long bottommostY = Long.MIN_VALUE;

    for (Element element : reportElements)
    {
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(element);
      totalHeight += layoutData.getWidth();
      topmostY = Math.min(topmostY, layoutData.getX());
      bottommostY = Math.max(bottommostY, layoutData.getX() + layoutData.getWidth());
    }

    final long gap = (bottommostY - topmostY - totalHeight) / (reportElements.size() - 1);
    long currentY = topmostY;
    for (Element reportElement : reportElements)
    {
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final long height = layoutData.getWidth();

      carrier[0] = reportElement;
      final Point2D.Double originPoint = new Point2D.Double(StrictGeomUtility.toExternalValue(layoutData.getX()), 0);
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(StrictGeomUtility.toExternalValue(currentY), 0), 1);
      mop.finish();

      currentY += height + gap;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeHorizontalJustifyAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Collections.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final Element[] carrier = new Element[1];

    final int lastElementIdx = reportElements.size() - 1;
    final Element lastElement = reportElements.get(lastElementIdx);
    final Element firstElement = reportElements.get(0);

    final CachedLayoutData firstLayoutData = ModelUtility.getCachedLayoutData(firstElement);
    final CachedLayoutData lastLayoutData = ModelUtility.getCachedLayoutData(lastElement);

    final long firstElementY = firstLayoutData.getY();
    final long height = (lastLayoutData.getY()) - (firstElementY);

    final long incr = height / lastElementIdx;
    long currentY = firstElementY;
    currentY += incr;//start from second element

    for (Element reportElement : reportElements)
    {
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);

      carrier[0] = reportElement;
      final Point2D.Double originPoint = new Point2D.Double(0, StrictGeomUtility.toExternalValue(layoutData.getY()));
      final MoveDragOperation mop =
          new MoveDragOperation(Arrays.asList(carrier), originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(0, StrictGeomUtility.toExternalValue(currentY)), 1);
      mop.finish();

      currentY += incr;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeTopAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Collections.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final Element[] carrier = new Element[1];

    long totalHeight = 0;
    long topmostY = Long.MAX_VALUE;
    long bottommostY = Long.MIN_VALUE;
    for (Element element : reportElements)
    {
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(element);
      totalHeight += layoutData.getHeight();
      topmostY = Math.min(topmostY, layoutData.getY());
      bottommostY = Math.max(bottommostY, layoutData.getY() + layoutData.getHeight());
    }

    final long gap = (bottommostY - topmostY - totalHeight) / (reportElements.size() - 1);
    long currentY = topmostY;
    for (Element reportElement : reportElements)
    {
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final long height = layoutData.getHeight();

      carrier[0] = reportElement;
      final Point2D.Double originPoint = new Point2D.Double(StrictGeomUtility.toExternalValue(layoutData.getX()), 0);
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(0, StrictGeomUtility.toExternalValue(currentY)), 1);
      mop.finish();

      currentY += height + gap;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeVerticalJustifyAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Collections.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final Element[] carrier = new Element[1];

    final int lastElementIdx = reportElements.size() - 1;
    final Element lastElement = reportElements.get(lastElementIdx);
    final Element firstElement = reportElements.get(0);

    final CachedLayoutData firstLayoutData = ModelUtility.getCachedLayoutData(firstElement);
    final CachedLayoutData lastLayoutData = ModelUtility.getCachedLayoutData(lastElement);

    final long height = (lastLayoutData.getX() + lastLayoutData.getWidth()) -
        (firstLayoutData.getX() + firstLayoutData.getWidth());

    final long incr = height / lastElementIdx;
    long currentY = firstLayoutData.getX() + firstLayoutData.getWidth();
    currentY += incr;//start from second element

    for (Element reportElement : reportElements)
    {
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final long delta = currentY - layoutData.getWidth();
      if (delta == 0)
      {
        continue;
      }

      carrier[0] = reportElement;
      final Point2D.Double originPoint = new Point2D.Double(StrictGeomUtility.toExternalValue(layoutData.getX()), 0);
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(StrictGeomUtility.toExternalValue(delta), 0), 1);
      mop.finish();

      currentY += incr;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeRightAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    final ArrayList<Element> elementArrayList = new ArrayList<Element>();
    collectAlignableElements(masterReport, elementArrayList);
    visualElements = elementArrayList.toArray(new Element[elementArrayList.size()]);

    builder = new MassElementStyleUndoEntryBuilder(visualElements);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Arrays.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final Element[] carrier = new Element[1];

    final int lastElementIdx = reportElements.length - 1;
    final Element lastElement = reportElements[lastElementIdx];
    final Element firstElement = reportElements[0];

    final CachedLayoutData firstLayoutData = ModelUtility.getCachedLayoutData(firstElement);
    final CachedLayoutData lastLayoutData = ModelUtility.getCachedLayoutData(lastElement);

    final long height = (lastLayoutData.getY() + lastLayoutData.getHeight()) -
        (firstLayoutData.getY() + firstLayoutData.getHeight());

    final long incr = height / lastElementIdx;
    long currentY = firstLayoutData.getY() + firstLayoutData.getHeight();
    currentY += incr;//start from second element

    for (int i = 1; i < lastElementIdx; i++)
    {
      final Element reportElement = reportElements[i];
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final long delta = currentY - layoutData.getHeight();
      if (delta == 0)
      {
        continue;
      }

      carrier[0] = reportElement;
      final Point2D.Double originPoint = new Point2D.Double(0, StrictGeomUtility.toExternalValue(layoutData.getY()));
      final MoveDragOperation mop = new MoveDragOperation
          (carrier, originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(0, StrictGeomUtility.toExternalValue(delta)), 1);
      mop.finish();

      currentY += incr;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeBottomAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Arrays.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final Element[] carrier = new Element[1];

    final int lastElementIdx = reportElements.length - 1;
    final Element lastElement = reportElements[lastElementIdx];
    final Element firstElement = reportElements[0];

    final CachedLayoutData firstLayoutData = ModelUtility.getCachedLayoutData(firstElement);
    final CachedLayoutData lastLayoutData = ModelUtility.getCachedLayoutData(lastElement);

    final long height = (lastLayoutData.getX()) - (firstLayoutData.getX());

    final long incr = height / lastElementIdx;
    long currentY = firstLayoutData.getX();
    currentY += incr;//start from second element

    for (int i = 1; i < lastElementIdx; i++)
    {
      final Element reportElement = reportElements[i];
      carrier[0] = reportElement;
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final Point2D.Double originPoint = new Point2D.Double(StrictGeomUtility.toExternalValue(layoutData.getX()), 0);
      final MoveDragOperation mop = new MoveDragOperation
          (carrier, originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(StrictGeomUtility.toExternalValue(currentY), 0), 1);
      mop.finish();

      currentY += incr;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeLeftAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.util.undo.MassElementStyleUndoEntryBuilder

    {
      return;
    }

    Arrays.sort(reportElements, new ElementPositionComparator());
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
    final Element[] carrier = new Element[1];

    final int lastElementIdx = reportElements.length - 1;
    final Element lastElement = reportElements[lastElementIdx];
    final Element firstElement = reportElements[0];

    final CachedLayoutData firstLayoutData = ModelUtility.getCachedLayoutData(firstElement);
    final CachedLayoutData lastLayoutData = ModelUtility.getCachedLayoutData(lastElement);

    final long height = (lastLayoutData.getY() + lastLayoutData.getHeight() / 2) -
        (firstLayoutData.getY() + firstLayoutData.getHeight() / 2);

    final long incr = height / lastElementIdx;
    long currentY = firstLayoutData.getY() + firstLayoutData.getHeight() / 2;
    currentY += incr;//start from second element

    for (int i = 1; i < lastElementIdx; i++)
    {
      final Element reportElement = reportElements[i];
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final long delta = currentY - layoutData.getHeight() / 2;
      if (delta == 0)
      {
        continue;
      }

      carrier[0] = reportElement;
      final Point2D.Double originPoint = new Point2D.Double(0, StrictGeomUtility.toExternalValue(layoutData.getY()));

      final MoveDragOperation mop = new MoveDragOperation
          (carrier, originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(0, StrictGeomUtility.toExternalValue(delta)), 1);
      mop.finish();

      currentY += incr;
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeMiddleAction.UndoName"), massElementStyleUndoEntry);
  }
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.