Examples of CanvasModel


Examples of com.cburch.draw.model.CanvasModel

      Location start = mouseStart;
      Location end = mouseEnd;
      CanvasObject add = null;
      if (!start.equals(end)) {
        active = false;
        CanvasModel model = canvas.getModel();
        Location[] ends = { start, end };
        List<Location> locs = UnmodifiableList.create(ends);
        add = attrs.applyTo(new Poly(false, locs));
        add.setValue(DrawAttr.PAINT_TYPE, DrawAttr.PAINT_STROKE);
        canvas.doAction(new ModelAddAction(model, add));
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

    Curve c = updateMouse(canvas, e.getX(), e.getY(), e.getModifiersEx());
    mouseDown = false;
    if (state == CONTROL_DRAG) {
      if (c != null) {
        attrs.applyTo(c);
        CanvasModel model = canvas.getModel();
        canvas.doAction(new ModelAddAction(model, c));
        canvas.toolGestureComplete(this, c);
      }
      state = BEFORE_CREATION;
    }
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

    this.listener = new Listener();
    this.oldPreferredSize = null;
    setSelection(new AppearanceSelection());
    setTool(selectTool);

    CanvasModel model = super.getModel();
    if (model != null) model.addCanvasModelListener(listener);
    grid.addPropertyChangeListener(GridPainter.ZOOM_PROPERTY, listener);
  }
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

    }
  }
 
  @Override
  public void setModel(CanvasModel value, ActionDispatcher dispatcher) {
    CanvasModel oldModel = super.getModel();
    if (oldModel != null) {
      oldModel.removeCanvasModelListener(listener);
    }
    super.setModel(value, dispatcher);
    if (value != null) {
      value.addCanvasModelListener(listener);
    }
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

    ArrayList<Location> locs = locations;
    for(int i = locs.size() - 2; i >= 0; i--) {
      if (locs.get(i).equals(locs.get(i + 1))) locs.remove(i);
    }
    if (locs.size() > 1) {
      CanvasModel model = canvas.getModel();
      add = new Poly(closed, locs);
      canvas.doAction(new ModelAddAction(model, add));
      repaintArea(canvas);
    }
    locs.clear();
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

      Bounds bds = computeBounds(canvas, e.getX(), e.getY(), e.getModifiersEx());
      currentBounds = Bounds.EMPTY_BOUNDS;
      active = false;
      CanvasObject add = null;
      if (bds.getWidth() != 0 && bds.getHeight() != 0) {
        CanvasModel model = canvas.getModel();
        add = createShape(bds.getX(), bds.getY(),
            bds.getWidth(), bds.getHeight());
        canvas.doAction(new ModelAddAction(model, add));
        repaintArea(canvas, oldBounds.add(bds));
      }
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

    for (Map.Entry<AttributeSet, CanvasObject> ent : attrs.entries()) {
      AttributeMapKey key = new AttributeMapKey(attr, ent.getValue());
      oldVals.put(key, ent.getKey().getValue(attr));
      newVals.put(key, value);
    }
    CanvasModel model = canvas.getModel();
    canvas.doAction(new ModelChangeAttributeAction(model, oldVals, newVals));
  }
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

  public void mouseReleased(Canvas canvas, MouseEvent e) {
    beforePressSelection = null;
    beforePressHandle = null;
    setMouse(canvas, e.getX(), e.getY(), e.getModifiersEx());
   
    CanvasModel model = canvas.getModel();
    Selection selection = canvas.getSelection();
    Set<CanvasObject> selected = selection.getSelected();
    int action = curAction;
    curAction = IDLE;
   
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

          toRemove.add(shape);
        }
      }
      if (!toRemove.isEmpty()) {
        e.consume();
        CanvasModel model = canvas.getModel();
        canvas.doAction(new ModelRemoveAction(model, toRemove));
        selected.clearSelected();
        repaintArea(canvas);
      }
    } else if (ch == '\u001b' && !selected.isEmpty()) {
View Full Code Here

Examples of com.cburch.draw.model.CanvasModel

  public void doAction(Action action) {
    dispatcher.doAction(action);
  }
 
  public void setModel(CanvasModel value, ActionDispatcher dispatcher) {
    CanvasModel oldValue = model;
    if (oldValue != value) {
      if (oldValue != null) oldValue.removeCanvasModelListener(listener);
      model = value;
      this.dispatcher = dispatcher;
      if (value != null) value.addCanvasModelListener(listener);
      selection.clearSelected();
      repaint();
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.