Examples of MassElementStyleUndoEntryBuilder


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

    if (visualElements.isEmpty())
    {
      return;
    }

    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(visualElements);
    final MoveDragOperation mop = new MoveDragOperation
        (visualElements, new Point(), EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
    mop.update(new Point(1, 0), 1);
    mop.finish();

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

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

      return;
    }

    final Element[] carrier = new Element[1];
    final List<Element> objects = ModelUtility.filterParents(visualElements);
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(objects);

    long minX = Long.MAX_VALUE;
    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long x1 = data.getX();
      if (x1 < minX)
      {
        minX = x1;
      }
    }

    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long elementCenter = data.getX();
      final long delta = minX - elementCenter;
      if (delta == 0)
      {
        continue;
      }

      carrier[0] = object;
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), ORIGIN_POINT, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(StrictGeomUtility.toExternalValue(delta), 0), 1);
      mop.finish();
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("AlignLeftAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

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

      return;
    }

    final Element[] carrier = new Element[1];
    final List<Element> objects = ModelUtility.filterParents(visualElements);
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(objects);

    long maxY = Long.MIN_VALUE;
    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long l = data.getY() + data.getHeight();
      if (l > maxY)
      {
        maxY = l;
      }
    }

    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long l = data.getY() + data.getHeight();
      final long delta = maxY - l;
      if (delta == 0)
      {
        continue;
      }

      carrier[0] = object;
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), ORIGIN_POINT, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(0, StrictGeomUtility.toExternalValue(delta)), 1);
      mop.finish();
    }

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

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

    {
      return;
    }
    final Element[] carrier = new Element[1];
    final List<Element> objects = ModelUtility.filterParents(visualElements);
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(objects);

    long maxX = Long.MIN_VALUE;
    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long x1 = data.getX();
      final long x2 = x1 + data.getWidth();
      if (x2 > maxX)
      {
        maxX = x2;
      }
    }

    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long elementCenter = data.getX() + data.getWidth();
      final long delta = maxX - elementCenter;
      if (delta == 0)
      {
        continue;
      }

      carrier[0] = object;
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), ORIGIN_POINT, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(StrictGeomUtility.toExternalValue(delta), 0), 1);
      mop.finish();
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("AlignRightAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

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

    }

    final Element[] carrier = new Element[1];
    final List<Element> objects = ModelUtility.filterParents(visualElements);
    long minY = Long.MAX_VALUE;
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(objects);

    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long y1 = data.getY();
      if (y1 < minY)
      {
        minY = y1;
      }
    }

    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);

      final long delta = minY - data.getY();
      if (delta == 0)
      {
        continue;
      }

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

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

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

    {
      return;
    }
    final Element[] carrier = new Element[1];
    final List<Element> objects = ModelUtility.filterParents(visualElements);
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(objects);

    long minY = Long.MAX_VALUE;
    long maxY = Long.MIN_VALUE;
    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long y1 = data.getY();
      final long y2 = y1 + data.getHeight();
      if (y2 > maxY)
      {
        maxY = y2;
      }
      if (y1 < minY)
      {
        minY = y1;
      }
    }

    final long centerPoint = minY + (maxY - minY) / 2;

    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long elementCenter = data.getY() + data.getHeight() / 2;

      final long delta = centerPoint - elementCenter;
      if (delta == 0)
      {
        continue;
      }

      carrier[0] = object;
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), ORIGIN_POINT, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(0, StrictGeomUtility.toExternalValue(delta)), 1);
      mop.finish();
    }
    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("AlignMiddleAction.UndoName"), massElementStyleUndoEntry);
  }
View Full Code Here

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

    {
      return;
    }
    final List<Band> visualElements = model.getSelectedElementsOfType(Band.class);

    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(visualElements);

    for (Band object : visualElements)
    {
      object.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, layoutMode);
    }

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

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

      return;
    }

    final Element[] carrier = new Element[1];
    final List<Element> objects = ModelUtility.filterParents(visualElements);
    final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(objects);

    long minX = Long.MAX_VALUE;
    long maxX = Long.MIN_VALUE;
    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long x1 = data.getX();
      final long x2 = x1 + data.getWidth();
      if (x2 > maxX)
      {
        maxX = x2;
      }
      if (x1 < minX)
      {
        minX = x1;
      }
    }

    final long centerPoint = minX + (maxX - minX) / 2;

    for (Element object : objects)
    {
      final CachedLayoutData data = ModelUtility.getCachedLayoutData(object);
      final long elementCenter = data.getX() + data.getWidth() / 2;
      final long delta = centerPoint - elementCenter;
      if (delta == 0)
      {
        continue;
      }

      carrier[0] = object;
      final MoveDragOperation mop = new MoveDragOperation
          (Arrays.asList(carrier), ORIGIN_POINT, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
      mop.update(new Point2D.Double(StrictGeomUtility.toExternalValue(delta), 0), 1);
      mop.finish();
    }

    final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
    getActiveContext().getUndo().addChange(ActionMessages.getString("AlignCenterAction.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() / 2) -
        (firstLayoutData.getX() + firstLayoutData.getWidth() / 2);

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

    for (Element reportElement : reportElements)
    {
      final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
      final long delta = currentY - layoutData.getWidth() / 2;
      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("DistributeCenterAction.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.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.get(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
          (Arrays.asList(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
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.