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


Java DropRequest类代码示例

本文整理汇总了Java中org.eclipse.gef.requests.DropRequest的典型用法代码示例。如果您正苦于以下问题:Java DropRequest类的具体用法?Java DropRequest怎么用?Java DropRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DropRequest类属于org.eclipse.gef.requests包,在下文中一共展示了DropRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAddCommand

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected Command getAddCommand(Request generic) {
	ChangeBoundsRequest request = (ChangeBoundsRequest) generic;
	if (acceptReorder(request)){
		List<EditPart> editParts = request.getEditParts();
		ElementEditPart movedElement = (ElementEditPart)editParts.get(0);
		Container parent = (Container) getHost().getParent().getModel();
		int siblingIndex = parent.getChildren().indexOf(getHost().getModel());
		int currentIndex = parent.getChildren().indexOf(movedElement.getModel());
		if (siblingIndex >= 0){
			if (isInsertAfter((DropRequest) request)) siblingIndex++;
			if (currentIndex <= siblingIndex) siblingIndex--;
			/*MoveChildCommand command = new MoveChildCommand(
					movedElement.getModel(), siblingIndex);*/
			AddCommand command = new AddCommand();
			command.setParent(parent);
			command.setChild(movedElement.getModel());
			command.setIndex(siblingIndex);
			return command;
		}
	}
	return super.getAddCommand(generic);
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:25,代码来源:AddStackElementEditPolicy.java

示例2: showLayoutTargetFeedback

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@Override
protected void showLayoutTargetFeedback(Request request) {
	eraseLayoutTargetFeedback(request);
	if (request instanceof ChangeBoundsRequest || (request instanceof CreateRequest
			&& acceptCreate((CreateRequest) request))){
		targetFeedback = new RectangleFigure();
		Rectangle parentBounds = ((ElementEditPart)getHost()).getBounds();
		translateToAbsolute(getContainerFigure(), parentBounds);
		Rectangle lineBounds = parentBounds.getCopy();
		lineBounds.height = 4;
		lineBounds.y--;
		targetFeedback.setForegroundColor(ColorConstants.green);
		targetFeedback.setBackgroundColor(ColorConstants.green);
		if (isInsertAfter((DropRequest) request)){
			lineBounds.y += parentBounds.height;
		}
		targetFeedback.setBounds(lineBounds);
		addFeedback(targetFeedback);
	} else if (request instanceof ChangeBoundsRequest){
		
	}
	
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:24,代码来源:AddStackElementEditPolicy.java

示例3: getTargetEditPart

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
/**
 * Returns the host EditPart when appropriate. Targeting is done by checking
 * if the mouse is clearly over the host's TreeItem.
 * 
 * @see org.eclipse.gef.EditPolicy#getTargetEditPart(Request)
 */
public EditPart getTargetEditPart(Request req) {
	if (req.getType().equals(REQ_ADD) || req.getType().equals(REQ_MOVE)
			|| req.getType().equals(REQ_CREATE)) {
		DropRequest drop = (DropRequest) req;
		Point where = new Point(drop.getLocation().x, drop.getLocation().y);
		Widget widget = ((TreeEditPart) getHost()).getWidget();
		if (widget instanceof Tree)
			return getHost();
		TreeItem treeitem = (TreeItem) widget;
		Rectangle bounds = treeitem.getBounds();
		int fudge = bounds.height / 5;
		Rectangle inner = new Rectangle(bounds.x, bounds.y + fudge,
				bounds.width, bounds.height
						- (treeitem.getExpanded() ? 0 : fudge * 2));
		// Point is either outside the Treeitem, or inside the inner Rect.
		if (!bounds.contains(where) || inner.contains(where))
			return getHost();
	}
	return null;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:27,代码来源:TreeContainerEditPolicy.java

示例4: showDropFeedback

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
private void showDropFeedback(DropRequest request) {
	Widget hostWidget = ((TreeEditPart) getHost()).getWidget();
	Tree tree = getTree();

	org.eclipse.draw2d.geometry.Point pt = request.getLocation();
	TreeItem item = findTreeItemAt(pt);
	if (item == null) {
		if (hostWidget == tree) {
			insertMarkAfterLastChild(tree.getItems());
		}
	} else if (item == hostWidget) {
		tree.setInsertMark(null, true);
	} else {
		boolean before = isInUpperHalf(item.getBounds(), pt);
		tree.setInsertMark(item, before);
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:18,代码来源:TreeContainerEditPolicy.java

示例5: eraseTargetConnectionFeedback

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@Override
protected void eraseTargetConnectionFeedback(DropRequest request) {
	EditPart part = (EditPart)getHost();
	
	if(part instanceof DwParentChildConnectionEditPart){
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:8,代码来源:DwFeatureGraphicalNodeEditPolicy.java

示例6: getDropLocation

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
private Point getDropLocation(DropRequest request){
	Point where = request.getLocation().getCopy();
	IFigure figure = getLayoutContainer();
	figure.translateToRelative(where);
	figure.translateFromParent(where);
	where.translate(getLayoutOrigin().getNegated());
	return where;
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:9,代码来源:AddStackElementEditPolicy.java

示例7: eraseTargetFeedback

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
/**
 * Calls {@link #eraseTargetConnectionFeedback(DropRequest)} when
 * appropriate.
 * 
 * @see org.eclipse.gef.EditPolicy#eraseTargetFeedback(Request)
 */
public void eraseTargetFeedback(Request request) {
	if (REQ_CONNECTION_START.equals(request.getType())
			|| REQ_CONNECTION_END.equals(request.getType())
			|| REQ_RECONNECT_SOURCE.equals(request.getType())
			|| REQ_RECONNECT_TARGET.equals(request.getType()))
		eraseTargetConnectionFeedback((DropRequest) request);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:14,代码来源:GraphicalNodeEditPolicy.java

示例8: showTargetFeedback

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
/**
 * Calls {@link #showTargetConnectionFeedback(DropRequest)} when
 * appropriate.
 * 
 * @see org.eclipse.gef.EditPolicy#showTargetFeedback(Request)
 */
public void showTargetFeedback(Request request) {
	if (REQ_CONNECTION_START.equals(request.getType())
			|| REQ_CONNECTION_END.equals(request.getType())
			|| REQ_RECONNECT_SOURCE.equals(request.getType())
			|| REQ_RECONNECT_TARGET.equals(request.getType()))
		showTargetConnectionFeedback((DropRequest) request);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:14,代码来源:GraphicalNodeEditPolicy.java

示例9: getSourceConnectionAnchor

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
	Point pt = new Point(((DropRequest) request).getLocation());
	return getComponentFigure().getSourceConnectionAnchorAt(pt);
	
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:7,代码来源:ComponentEditPart.java

示例10: getTargetConnectionAnchor

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
	Point pt = new Point(((DropRequest) request).getLocation());
	return getComponentFigure().getTargetConnectionAnchorAt(pt);
	
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:7,代码来源:ComponentEditPart.java

示例11: isInsertAfter

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
private boolean isInsertAfter(DropRequest request) {
	ElementEditPart ep = (ElementEditPart) getHost();
	Point where = getDropLocation(request);
	Rectangle parentBounds = ep.getBounds();
	return (parentBounds.height / 2) < where.y;
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:7,代码来源:AddStackElementEditPolicy.java

示例12: getLocationFromRequest

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
private Point getLocationFromRequest(Request request) {
	return ((DropRequest) request).getLocation();
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:4,代码来源:FlowLayoutEditPolicy.java

示例13: showTargetFeedback

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.EditPolicy#showTargetFeedback(Request)
 */
public void showTargetFeedback(Request req) {
	if (req.getType().equals(REQ_MOVE) || req.getType().equals(REQ_ADD)
			|| req.getType().equals(REQ_CREATE))
		showDropFeedback((DropRequest) req);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:9,代码来源:TreeContainerEditPolicy.java

示例14: eraseTargetConnectionFeedback

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
protected void eraseTargetConnectionFeedback( DropRequest request )
{
	// TODO Auto-generated method stub
	super.eraseTargetConnectionFeedback( request );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:6,代码来源:ConnectionCreationEditPolicy.java

示例15: showTargetConnectionFeedback

import org.eclipse.gef.requests.DropRequest; //导入依赖的package包/类
protected void showTargetConnectionFeedback( DropRequest request )
{
	// TODO Auto-generated method stub
	super.showTargetConnectionFeedback( request );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:6,代码来源:ConnectionCreationEditPolicy.java


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