Package com.cburch.draw.model

Examples of com.cburch.draw.model.ReorderRequest


            changed = true;
            movedToMax = true;
            if (from == max && !movedToMax) {
              ; // this change is ineffective - don't add it
            } else {
              mod.add(new ReorderRequest(o, from, max));
            }
          } else {
            if (r.getToIndex() == max) movedToMax = true;
            mod.add(r);
          }
View Full Code Here


      if (above != null) {
        int to = ZOrder.getZIndex(above, model);
        if (objects.contains(above)) {
          to--;
        }
        reqs.add(new ReorderRequest(obj, from, to));
      }
    }
    if (reqs.isEmpty()) {
      return null;
    } else {
View Full Code Here

      if (above != null) {
        int to = ZOrder.getZIndex(above, model);
        if (objects.contains(above)) {
          to++;
        }
        reqs.add(new ReorderRequest(obj, from, to));
      }
    }
    if (reqs.isEmpty()) {
      return null;
    } else {
View Full Code Here

    Map<CanvasObject, Integer> zmap = ZOrder.getZIndex(objects, model);
    int to = model.getObjectsFromBottom().size() - 1;
    for(Map.Entry<CanvasObject, Integer> entry : zmap.entrySet()) {
      CanvasObject obj = entry.getKey();
      int from = entry.getValue().intValue();
      reqs.add(new ReorderRequest(obj, from, to));
    }
    if (reqs.isEmpty()) {
      return null;
    } else {
      Collections.sort(reqs, ReorderRequest.ASCENDING_FROM);
View Full Code Here

    Map<CanvasObject, Integer> zmap = ZOrder.getZIndex(objects, model);
    int to = 0;
    for(Map.Entry<CanvasObject, Integer> entry : zmap.entrySet()) {
      CanvasObject obj = entry.getKey();
      int from = entry.getValue().intValue();
      reqs.add(new ReorderRequest(obj, from, to));
    }
    if (reqs.isEmpty()) {
      return null;
    } else {
      Collections.sort(reqs, ReorderRequest.ASCENDING_FROM);
View Full Code Here

    }
  }
 
  private static void repairRequests(List<ReorderRequest> reqs) {
    for (int i = 0, n = reqs.size(); i < n; i++) {
      ReorderRequest req = reqs.get(i);
      int from = req.getFromIndex();
      int to = req.getToIndex();
      for (int j = 0; j < i; j++) {
        ReorderRequest prev = reqs.get(j);
        int prevFrom = prev.getFromIndex();
        int prevTo = prev.getToIndex();
        if (prevFrom <= from && from < prevTo) {
          from--;
        } else if (prevTo <= from && from < prevFrom) {
          from++;
        }
        if (prevFrom <= to && to < prevTo) {
          to--;
        } else if (prevTo <= to && to < prevFrom) {
          to++;
        }
      }
      if (from != req.getFromIndex() || to != req.getToIndex()) {
        reqs.set(i, new ReorderRequest(req.getObject(), from, to));
      }
    }
    for (int i = reqs.size() - 1; i >= 0; i--) {
      ReorderRequest req = reqs.get(i);
      if (req.getFromIndex() == req.getToIndex()) {
        reqs.remove(i);
      }
    }
  }
View Full Code Here

 
  @Override
  void undoSub(CanvasModel model) {
    ArrayList<ReorderRequest> inv = new ArrayList<ReorderRequest>(requests.size());
    for (int i = requests.size() - 1; i >= 0; i--) {
      ReorderRequest r = requests.get(i);
      inv.add(new ReorderRequest(r.getObject(), r.getToIndex(),
          r.getFromIndex()));
    }
    model.reorderObjects(inv);
  }
View Full Code Here

            if (above != null) {
                int to = ZOrder.getZIndex(above, model);
                if (objects.contains(above)) {
                    to--;
                }
                reqs.add(new ReorderRequest(obj, from, to));
            }
        }
        if (reqs.isEmpty()) {
            return null;
        } else {
View Full Code Here

            if (above != null) {
                int to = ZOrder.getZIndex(above, model);
                if (objects.contains(above)) {
                    to++;
                }
                reqs.add(new ReorderRequest(obj, from, to));
            }
        }
        if (reqs.isEmpty()) {
            return null;
        } else {
View Full Code Here

        Map<CanvasObject, Integer> zmap = ZOrder.getZIndex(objects, model);
        int to = model.getObjectsFromBottom().size() - 1;
        for(Map.Entry<CanvasObject, Integer> entry : zmap.entrySet()) {
            CanvasObject obj = entry.getKey();
            int from = entry.getValue().intValue();
            reqs.add(new ReorderRequest(obj, from, to));
        }
        if (reqs.isEmpty()) {
            return null;
        } else {
            Collections.sort(reqs, ReorderRequest.ASCENDING_FROM);
View Full Code Here

TOP

Related Classes of com.cburch.draw.model.ReorderRequest

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.