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


Java CreateRequest.getNewObjectType方法代码示例

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


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

示例1: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	if (request.getType() == REQ_CREATE) {
		String newObjectType = (String) request.getNewObjectType();
		FieldCreateCommand cmd = new FieldCreateCommand();
		cmd.setParent((BaseElement) getHost().getModel());
		cmd.setField(request.getNewObject());
		cmd.setLabel(newObjectType);

		Rectangle constraint = (Rectangle) getConstraintFor(request);
		constraint.x = (constraint.x < 0) ? 0 : constraint.x;
		constraint.y = (constraint.y < 0) ? 0 : constraint.y;
		constraint.width = (constraint.width <= 0) ? 120 : constraint.width;
		constraint.height = (constraint.height <= 0) ? 40
				: constraint.height;
		cmd.setLayout(constraint);
		return cmd;
	}
	return null;
}
 
开发者ID:snakerflow,项目名称:snaker-designer,代码行数:21,代码来源:FormXYEditLayoutPolicy.java

示例2: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * Returns a command to be executed when the palette tries to create something
 * 
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
protected Command getCreateCommand(CreateRequest request) {
    Object newObjectType = null;
    if (request.getNewObject() != null)
        newObjectType = request.getNewObjectType();

    // converts relative to absolute positions (so that zooms work properly)
    Rectangle constraint = (Rectangle) getConstraintFor(request);
    Command createCommand = null;

    if ((newObjectType == IntentionalElementRef.class) || (newObjectType == Belief.class) || (newObjectType == KPIInformationElementRef.class)) {
        createCommand = handleCreateGrlNode(request, constraint);
    } else if (newObjectType == ActorRef.class) {
        createCommand = handleCreateActorRef(request, constraint);
    } else if (newObjectType == Comment.class) {
        createCommand = handleCreateComment(request, constraint);
    }
    return createCommand;
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:24,代码来源:GrlGraphXYLayoutEditPolicy.java

示例3: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
 * Returns a command to be executed when the palette tries to create something on the MapAndPathGraphEditPart.
 * 
 * Extends path for PathTool and creates ComponentRefs. PathNodes are created on NodeConnections so are not handled here.
 * 
 * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
 */
protected Command getCreateCommand(CreateRequest request) {
    Object newObjectType = null;
    if (request.getNewObject() != null)
        newObjectType = request.getNewObjectType();

    // converts relative to absolute positions (so that zooms work properly)
    Rectangle constraint = (Rectangle) getConstraintFor(request);
    Command createCommand = null;

    // if PathTool
    if (newObjectType == EndPoint.class || newObjectType == StartPoint.class) {
        createCommand = handleCreateOrExtendPath(request, constraint);
    } else if (newObjectType == ComponentRef.class) {
        createCommand = handleCreateComponentRef(request, constraint);
    } else if (newObjectType == Comment.class) {
        createCommand = handleCreateComment(request, constraint);
    }

    return createCommand;
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:28,代码来源:MapXYLayoutEditPolicy.java

示例4: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	Command retVal = null;
	Class clazz = (Class)request.getNewObjectType();
 	if(Vertex.class.isAssignableFrom(clazz)) {
		VertexCreateCommand command = new VertexCreateCommand();
		command.setLocation(request.getLocation());
		Vertex vertex  = (Vertex)(request.getNewObject());
		vertex.setGraph((GWGraph)(getHost().getModel()));
		command.setVertex(vertex);
		retVal = command;
	}  
	return retVal;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:15,代码来源:GW4EEditLayoutPolicy.java

示例5: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	if (request.getNewObjectType() == Table.class && getHost().getModel() instanceof Schema) {
		return new TableCreateCommand((Table) request.getNewObject(), (Schema) getHost().getModel(), request.getLocation());
	}
	return null;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:8,代码来源:SchemaXYLayoutEditPolicy.java

示例6: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
	if (request.getNewObjectType() == Column.class && getHost().getModel() instanceof Table) {
		int index = getHost().getChildren().size();
		return new ColumnCreateCommand((Column) request.getNewObject(), (Table) getHost().getModel(), index);
	}
	return null;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:9,代码来源:ColumnOrderedLayoutEditPolicy.java

示例7: getCreateFieldCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
private static Command getCreateFieldCommand(CreateRequest request,
		BaseElement parent) {
	String newObjectType = (String) request.getNewObjectType();
	FieldCreateCommand create = new FieldCreateCommand();
	create.setField((Field) request.getNewObject());
	create.setParent(parent);
	create.setLabel(newObjectType);
	return create;
}
 
开发者ID:snakerflow,项目名称:snaker-designer,代码行数:10,代码来源:CommandHelper.java

示例8: getCreateCommand

import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
protected Command getCreateCommand(CreateRequest request) {
	Object childClass = request.getNewObjectType();
	if (childClass == EllipticalShape.class
			|| childClass == RectangularShape.class) {
		// return a command that can add a Shape to a ShapesDiagram
		return new ShapeCreateCommand((Shape) request.getNewObject(),
				(ShapesDiagram) getHost().getModel(),
				(Rectangle) getConstraintFor(request));
	}
	return null;
}
 
开发者ID:lunifera,项目名称:lunifera-sharky-m2m,代码行数:12,代码来源:DiagramEditPart.java


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