use of com.cburch.draw.model.ReorderRequest in project logisim-evolution by reds-heig.
the class ModelReorderAction method createLowerBottom.
public static ModelReorderAction createLowerBottom(CanvasModel model, Collection<? extends CanvasObject> objects) {
List<ReorderRequest> reqs = new ArrayList<ReorderRequest>();
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);
repairRequests(reqs);
return new ModelReorderAction(model, reqs);
}
}
use of com.cburch.draw.model.ReorderRequest in project logisim-evolution by reds-heig.
the class ModelReorderAction method createLower.
public static ModelReorderAction createLower(CanvasModel model, Collection<? extends CanvasObject> objects) {
List<ReorderRequest> reqs = new ArrayList<ReorderRequest>();
Map<CanvasObject, Integer> zmap = ZOrder.getZIndex(objects, model);
for (Map.Entry<CanvasObject, Integer> entry : zmap.entrySet()) {
CanvasObject obj = entry.getKey();
int from = entry.getValue().intValue();
CanvasObject above = ZOrder.getObjectBelow(obj, model, objects);
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 {
Collections.sort(reqs, ReorderRequest.ASCENDING_FROM);
repairRequests(reqs);
return new ModelReorderAction(model, reqs);
}
}
Aggregations