本文整理汇总了Java中com.cburch.draw.canvas.Selection.clearSelected方法的典型用法代码示例。如果您正苦于以下问题:Java Selection.clearSelected方法的具体用法?Java Selection.clearSelected怎么用?Java Selection.clearSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cburch.draw.canvas.Selection
的用法示例。
在下文中一共展示了Selection.clearSelected方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cancelMousePress
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void cancelMousePress(Canvas canvas) {
List<CanvasObject> before = beforePressSelection;
Handle handle = beforePressHandle;
beforePressSelection = null;
beforePressHandle = null;
if (before != null) {
curAction = IDLE;
Selection sel = canvas.getSelection();
sel.clearDrawsSuppressed();
sel.setMovingShapes(Collections.<CanvasObject>emptySet(), 0, 0);
sel.clearSelected();
sel.setSelected(before, true);
sel.setHandleSelected(handle);
repaintArea(canvas);
}
}
示例2: keyTyped
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void keyTyped(Canvas canvas, KeyEvent e) {
char ch = e.getKeyChar();
Selection selected = canvas.getSelection();
if ((ch == '\u0008' || ch == '\u007F') && !selected.isEmpty()) {
ArrayList<CanvasObject> toRemove = new ArrayList<CanvasObject>();
for (CanvasObject shape : selected.getSelected()) {
if (shape.canRemove()) {
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()) {
selected.clearSelected();
repaintArea(canvas);
}
}
示例3: doIt
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void doIt(Project proj) {
Selection sel = canvas.getSelection();
sel.clearSelected();
if (toRemove != null)
canvasModel.removeObjects(toRemove.keySet());
int dest = AppearanceCanvas.getMaxIndex(canvasModel) + 1;
if (toAdd != null)
canvasModel.addObjects(dest, toAdd);
AppearanceAnchor anchor = findAnchor(canvasModel);
if (anchor != null && anchorNewLocation != null) {
anchorOldLocation = anchor.getLocation();
anchor.translate(anchorNewLocation.getX() - anchorOldLocation.getX(),
anchorNewLocation.getY() - anchorOldLocation.getY());
}
if (anchor != null && anchorNewFacing != null) {
anchorOldFacing = anchor.getFacing();
anchor.setValue(AppearanceAnchor.FACING, anchorNewFacing);
}
sel.setSelected(newSelection, true);
canvas.repaint();
}
示例4: undo
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void undo(Project proj) {
AppearanceAnchor anchor = findAnchor(canvasModel);
if (anchor != null && anchorOldLocation != null) {
anchor.translate(anchorOldLocation.getX() - anchorNewLocation.getX(),
anchorOldLocation.getY() - anchorNewLocation.getY());
}
if (anchor != null && anchorOldFacing != null) {
anchor.setValue(AppearanceAnchor.FACING, anchorOldFacing);
}
Selection sel = canvas.getSelection();
sel.clearSelected();
if (toAdd != null)
canvasModel.removeObjects(toAdd);
if (toRemove != null)
canvasModel.addObjects(toRemove);
sel.setSelected(oldSelection, true);
canvas.repaint();
}
示例5: cancelMousePress
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void cancelMousePress(Canvas canvas) {
List<CanvasObject> before = beforePressSelection;
Handle handle = beforePressHandle;
beforePressSelection = null;
beforePressHandle = null;
if (before != null) {
curAction = IDLE;
Selection sel = canvas.getSelection();
sel.clearDrawsSuppressed();
sel.setMovingShapes(Collections.<CanvasObject> emptySet(), 0, 0);
sel.clearSelected();
sel.setSelected(before, true);
sel.setHandleSelected(handle);
repaintArea(canvas);
}
}
示例6: doIt
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void doIt(Project proj) {
Selection sel = canvas.getSelection();
sel.clearSelected();
if (toRemove != null)
canvasModel.removeObjects(toRemove.keySet());
int dest = AppearanceCanvas.getMaxIndex(canvasModel) + 1;
if (toAdd != null)
canvasModel.addObjects(dest, toAdd);
AppearanceAnchor anchor = findAnchor(canvasModel);
if (anchor != null && anchorNewLocation != null) {
anchorOldLocation = anchor.getLocation();
anchor.translate(
anchorNewLocation.getX() - anchorOldLocation.getX(),
anchorNewLocation.getY() - anchorOldLocation.getY());
}
if (anchor != null && anchorNewFacing != null) {
anchorOldFacing = anchor.getFacing();
anchor.setValue(AppearanceAnchor.FACING, anchorNewFacing);
}
sel.setSelected(newSelection, true);
canvas.repaint();
}
示例7: undo
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void undo(Project proj) {
AppearanceAnchor anchor = findAnchor(canvasModel);
if (anchor != null && anchorOldLocation != null) {
anchor.translate(
anchorOldLocation.getX() - anchorNewLocation.getX(),
anchorOldLocation.getY() - anchorNewLocation.getY());
}
if (anchor != null && anchorOldFacing != null) {
anchor.setValue(AppearanceAnchor.FACING, anchorOldFacing);
}
Selection sel = canvas.getSelection();
sel.clearSelected();
if (toAdd != null)
canvasModel.removeObjects(toAdd);
if (toRemove != null)
canvasModel.addObjects(toRemove);
sel.setSelected(oldSelection, true);
canvas.repaint();
}
示例8: doIt
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void doIt(Project proj) {
Selection sel = canvas.getSelection();
sel.clearSelected();
if (toRemove != null) canvasModel.removeObjects(toRemove.keySet());
int dest = AppearanceCanvas.getMaxIndex(canvasModel) + 1;
if (toAdd != null) canvasModel.addObjects(dest, toAdd);
AppearanceAnchor anchor = findAnchor(canvasModel);
if (anchor != null && anchorNewLocation != null) {
anchorOldLocation = anchor.getLocation();
anchor.translate(anchorNewLocation.getX() - anchorOldLocation.getX(),
anchorNewLocation.getY() - anchorOldLocation.getY());
}
if (anchor != null && anchorNewFacing != null) {
anchorOldFacing = anchor.getFacing();
anchor.setValue(AppearanceAnchor.FACING, anchorNewFacing);
}
sel.setSelected(newSelection, true);
canvas.repaint();
}
示例9: undo
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void undo(Project proj) {
AppearanceAnchor anchor = findAnchor(canvasModel);
if (anchor != null && anchorOldLocation != null) {
anchor.translate(anchorOldLocation.getX() - anchorNewLocation.getX(),
anchorOldLocation.getY() - anchorNewLocation.getY());
}
if (anchor != null && anchorOldFacing != null) {
anchor.setValue(AppearanceAnchor.FACING, anchorOldFacing);
}
Selection sel = canvas.getSelection();
sel.clearSelected();
if (toAdd != null) canvasModel.removeObjects(toAdd);
if (toRemove != null) canvasModel.addObjects(toRemove);
sel.setSelected(oldSelection, true);
canvas.repaint();
}
示例10: mousePressed
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void mousePressed(Canvas canvas, MouseEvent e) {
beforePressSelection = new ArrayList<CanvasObject>(canvas.getSelection().getSelected());
beforePressHandle = canvas.getSelection().getSelectedHandle();
int mx = e.getX();
int my = e.getY();
boolean shift = (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0;
dragStart = Location.create(mx, my);
dragEffective = false;
dragEnd = dragStart;
lastMouseX = mx;
lastMouseY = my;
Selection selection = canvas.getSelection();
selection.setHandleSelected(null);
// see whether user is pressing within an existing handle
int halfSize = getHandleSize(canvas) / 2;
CanvasObject clicked = null;
for (CanvasObject shape : selection.getSelected()) {
List<Handle> handles = shape.getHandles(null);
for (Handle han : handles) {
int dx = han.getX() - mx;
int dy = han.getY() - my;
if (dx >= -halfSize && dx <= halfSize && dy >= -halfSize && dy <= halfSize) {
if (shape.canMoveHandle(han)) {
curAction = MOVE_HANDLE;
curGesture = new HandleGesture(han, 0, 0, e.getModifiersEx());
repaintArea(canvas);
return;
} else if (clicked == null) {
clicked = shape;
}
}
}
}
// see whether the user is clicking within a shape
if (clicked == null) {
clicked = getObjectAt(canvas.getModel(), e.getX(), e.getY(), false);
}
if (clicked != null) {
if (shift && selection.isSelected(clicked)) {
selection.setSelected(clicked, false);
curAction = IDLE;
} else {
if (!shift && !selection.isSelected(clicked)) {
selection.clearSelected();
}
selection.setSelected(clicked, true);
selection.setMovingShapes(selection.getSelected(), 0, 0);
curAction = MOVE_ALL;
}
repaintArea(canvas);
return;
}
clicked = getObjectAt(canvas.getModel(), e.getX(), e.getY(), true);
if (clicked != null && selection.isSelected(clicked)) {
if (shift) {
selection.setSelected(clicked, false);
curAction = IDLE;
} else {
selection.setMovingShapes(selection.getSelected(), 0, 0);
curAction = MOVE_ALL;
}
repaintArea(canvas);
return;
}
if (shift) {
curAction = RECT_TOGGLE;
} else {
selection.clearSelected();
curAction = RECT_SELECT;
}
repaintArea(canvas);
}
示例11: mousePressed
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void mousePressed(Canvas canvas, MouseEvent e) {
beforePressSelection = new ArrayList<CanvasObject>(canvas
.getSelection().getSelected());
beforePressHandle = canvas.getSelection().getSelectedHandle();
int mx = e.getX();
int my = e.getY();
boolean shift = (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) != 0;
dragStart = Location.create(mx, my);
dragEffective = false;
dragEnd = dragStart;
lastMouseX = mx;
lastMouseY = my;
Selection selection = canvas.getSelection();
selection.setHandleSelected(null);
// see whether user is pressing within an existing handle
int halfSize = getHandleSize(canvas) / 2;
CanvasObject clicked = null;
for (CanvasObject shape : selection.getSelected()) {
List<Handle> handles = shape.getHandles(null);
for (Handle han : handles) {
int dx = han.getX() - mx;
int dy = han.getY() - my;
if (dx >= -halfSize && dx <= halfSize && dy >= -halfSize
&& dy <= halfSize) {
if (shape.canMoveHandle(han)) {
curAction = MOVE_HANDLE;
curGesture = new HandleGesture(han, 0, 0,
e.getModifiersEx());
repaintArea(canvas);
return;
} else if (clicked == null) {
clicked = shape;
}
}
}
}
// see whether the user is clicking within a shape
if (clicked == null) {
clicked = getObjectAt(canvas.getModel(), e.getX(), e.getY(), false);
}
if (clicked != null) {
if (shift && selection.isSelected(clicked)) {
selection.setSelected(clicked, false);
curAction = IDLE;
} else {
if (!shift && !selection.isSelected(clicked)) {
selection.clearSelected();
}
selection.setSelected(clicked, true);
selection.setMovingShapes(selection.getSelected(), 0, 0);
curAction = MOVE_ALL;
}
repaintArea(canvas);
return;
}
clicked = getObjectAt(canvas.getModel(), e.getX(), e.getY(), true);
if (clicked != null && selection.isSelected(clicked)) {
if (shift) {
selection.setSelected(clicked, false);
curAction = IDLE;
} else {
selection.setMovingShapes(selection.getSelected(), 0, 0);
curAction = MOVE_ALL;
}
repaintArea(canvas);
return;
}
if (shift) {
curAction = RECT_TOGGLE;
} else {
selection.clearSelected();
curAction = RECT_SELECT;
}
repaintArea(canvas);
}
示例12: mousePressed
import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void mousePressed(Canvas canvas, MouseEvent e) {
beforePressSelection = new ArrayList<CanvasObject>(canvas.getSelection().getSelected());
beforePressHandle = canvas.getSelection().getSelectedHandle();
int mx = e.getX();
int my = e.getY();
boolean shift = (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) != 0;
dragStart = Location.create(mx, my);
dragEffective = false;
dragEnd = dragStart;
lastMouseX = mx;
lastMouseY = my;
Selection selection = canvas.getSelection();
selection.setHandleSelected(null);
// see whether user is pressing within an existing handle
int halfSize = getHandleSize(canvas) / 2;
CanvasObject clicked = null;
for (CanvasObject shape : selection.getSelected()) {
List<Handle> handles = shape.getHandles(null);
for (Handle han : handles) {
int dx = han.getX() - mx;
int dy = han.getY() - my;
if (dx >= -halfSize && dx <= halfSize
&& dy >= -halfSize && dy <= halfSize) {
if (shape.canMoveHandle(han)) {
curAction = MOVE_HANDLE;
curGesture = new HandleGesture(han, 0, 0,
e.getModifiersEx());
repaintArea(canvas);
return;
} else if (clicked == null) {
clicked = shape;
}
}
}
}
// see whether the user is clicking within a shape
if (clicked == null) {
clicked = getObjectAt(canvas.getModel(), e.getX(), e.getY(), false);
}
if (clicked != null) {
if (shift && selection.isSelected(clicked)) {
selection.setSelected(clicked, false);
curAction = IDLE;
} else {
if (!shift && !selection.isSelected(clicked)) {
selection.clearSelected();
}
selection.setSelected(clicked, true);
selection.setMovingShapes(selection.getSelected(), 0, 0);
curAction = MOVE_ALL;
}
repaintArea(canvas);
return;
}
clicked = getObjectAt(canvas.getModel(), e.getX(), e.getY(), true);
if (clicked != null && selection.isSelected(clicked)) {
if (shift) {
selection.setSelected(clicked, false);
curAction = IDLE;
} else {
selection.setMovingShapes(selection.getSelected(), 0, 0);
curAction = MOVE_ALL;
}
repaintArea(canvas);
return;
}
if (shift) {
curAction = RECT_TOGGLE;
} else {
selection.clearSelected();
curAction = RECT_SELECT;
}
repaintArea(canvas);
}