当前位置: 首页>>代码示例>>Java>>正文


Java Selection.setSelected方法代码示例

本文整理汇总了Java中com.cburch.draw.canvas.Selection.setSelected方法的典型用法代码示例。如果您正苦于以下问题:Java Selection.setSelected方法的具体用法?Java Selection.setSelected怎么用?Java Selection.setSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cburch.draw.canvas.Selection的用法示例。


在下文中一共展示了Selection.setSelected方法的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);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:18,代码来源:SelectTool.java

示例2: 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();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:24,代码来源:SelectionAction.java

示例3: 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();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:20,代码来源:SelectionAction.java

示例4: 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);
	}
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:18,代码来源:SelectTool.java

示例5: 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();
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:25,代码来源:SelectionAction.java

示例6: 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();
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:21,代码来源:SelectionAction.java

示例7: 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();
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:22,代码来源:SelectionAction.java

示例8: 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();
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:18,代码来源:SelectionAction.java

示例9: 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);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:78,代码来源:SelectTool.java

示例10: selectAll

import com.cburch.draw.canvas.Selection; //导入方法依赖的package包/类
@Override
public void selectAll() {
	Selection sel = canvas.getSelection();
	sel.setSelected(canvas.getModel().getObjectsFromBottom(), true);
	canvas.repaint();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:7,代码来源:AppearanceEditHandler.java

示例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);
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:81,代码来源:SelectTool.java

示例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);
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:80,代码来源:SelectTool.java


注:本文中的com.cburch.draw.canvas.Selection.setSelected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。