本文整理汇总了Java中org.eclipse.graphiti.services.IGaService.createImage方法的典型用法代码示例。如果您正苦于以下问题:Java IGaService.createImage方法的具体用法?Java IGaService.createImage怎么用?Java IGaService.createImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.graphiti.services.IGaService
的用法示例。
在下文中一共展示了IGaService.createImage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
@Override
public PictogramElement add(IAddContext context) {
final Event addedEvent = (Event) context.getNewObject();
final ContainerShape parent = context.getTargetContainer();
// CONTAINER SHAPE WITH CIRCLE
final IPeCreateService peCreateService = Graphiti.getPeCreateService();
final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);
// check whether the context has a size (e.g. from a create feature)
// otherwise define a default size for the shape
final int width = context.getWidth() <= 0 ? 35 : context.getWidth();
final int height = context.getHeight() <= 0 ? 35 : context.getHeight();
final IGaService gaService = Graphiti.getGaService();
Ellipse circle;
{
final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
invisibleCircle.setFilled(false);
invisibleCircle.setLineVisible(false);
gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);
// create and set visible circle inside invisible circle
circle = gaService.createEllipse(invisibleCircle);
circle.setParentGraphicsAlgorithm(invisibleCircle);
circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
circle.setLineWidth(3);
gaService.setLocationAndSize(circle, 0, 0, width, height);
if (addedEvent.eResource() == null) {
Object parentObject = getBusinessObjectForPictogramElement(parent);
if (parentObject instanceof SubProcess) {
((SubProcess) parentObject).getFlowElements().add(addedEvent);
} else {
getDiagram().eResource().getContents().add(addedEvent);
}
}
// create link and wire it
link(containerShape, addedEvent);
}
{
final Shape shape = peCreateService.createShape(containerShape, false);
final Image image = gaService.createImage(shape, ActivitiImageProvider.IMG_ENDEVENT_ERROR);
gaService.setLocationAndSize(image, 5, 5, 25, 25);
}
// add a chopbox anchor to the shape
peCreateService.createChopboxAnchor(containerShape);
if (!(addedEvent instanceof EndEvent)) {
// create an additional box relative anchor at middle-right
final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
boxAnchor.setRelativeWidth(1.0);
boxAnchor.setRelativeHeight(0.51);
boxAnchor.setReferencedGraphicsAlgorithm(circle);
final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
}
layoutPictogramElement(containerShape);
return containerShape;
}
示例2: add
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
@Override
public PictogramElement add(IAddContext context) {
final Event addedEvent = (Event) context.getNewObject();
final ContainerShape parent = context.getTargetContainer();
// CONTAINER SHAPE WITH CIRCLE
final IPeCreateService peCreateService = Graphiti.getPeCreateService();
final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);
// check whether the context has a size (e.g. from a create feature)
// otherwise define a default size for the shape
final int width = context.getWidth() <= 0 ? 35 : context.getWidth();
final int height = context.getHeight() <= 0 ? 35 : context.getHeight();
final IGaService gaService = Graphiti.getGaService();
Ellipse circle;
{
final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
invisibleCircle.setFilled(false);
invisibleCircle.setLineVisible(false);
gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);
// create and set visible circle inside invisible circle
circle = gaService.createEllipse(invisibleCircle);
circle.setParentGraphicsAlgorithm(invisibleCircle);
circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
if (addedEvent instanceof EndEvent == true) {
circle.setLineWidth(3);
}
gaService.setLocationAndSize(circle, 0, 0, width, height);
// if addedClass has no resource we add it to the resource of the
// diagram
// in a real scenario the business model would have its own resource
if (addedEvent.eResource() == null) {
Object parentObject = getBusinessObjectForPictogramElement(parent);
if (parentObject instanceof SubProcess) {
((SubProcess) parentObject).getFlowElements().add(addedEvent);
} else {
getDiagram().eResource().getContents().add(addedEvent);
}
}
// create link and wire it
link(containerShape, addedEvent);
}
// add a chopbox anchor to the shape
peCreateService.createChopboxAnchor(containerShape);
if (!(addedEvent instanceof EndEvent)) {
// create an additional box relative anchor at middle-right
final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
boxAnchor.setRelativeWidth(1.0);
boxAnchor.setRelativeHeight(0.51);
boxAnchor.setReferencedGraphicsAlgorithm(circle);
final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
}
if (addedEvent instanceof StartEvent && ((StartEvent) addedEvent).getEventDefinitions().size() > 0) {
final Shape shape = peCreateService.createShape(containerShape, false);
final Image image = gaService.createImage(shape, ActivitiImageProvider.IMG_BOUNDARY_TIMER);
image.setStretchH(true);
image.setStretchV(true);
image.setWidth(IMAGE_SIZE);
image.setHeight(IMAGE_SIZE);
gaService.setLocationAndSize(image, (width - IMAGE_SIZE) / 2, (height - IMAGE_SIZE) / 2, IMAGE_SIZE, IMAGE_SIZE);
}
layoutPictogramElement(containerShape);
return containerShape;
}
示例3: add
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
@Override
public PictogramElement add(IAddContext context) {
final Event addedEvent = (Event) context.getNewObject();
final ContainerShape parent = context.getTargetContainer();
// CONTAINER SHAPE WITH CIRCLE
final IPeCreateService peCreateService = Graphiti.getPeCreateService();
final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);
// check whether the context has a size (e.g. from a create feature)
// otherwise define a default size for the shape
final int width = context.getWidth() <= 0 ? 35 : context.getWidth();
final int height = context.getHeight() <= 0 ? 35 : context.getHeight();
final IGaService gaService = Graphiti.getGaService();
Ellipse circle;
{
final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
invisibleCircle.setFilled(false);
invisibleCircle.setLineVisible(false);
gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);
// create and set visible circle inside invisible circle
circle = gaService.createEllipse(invisibleCircle);
circle.setParentGraphicsAlgorithm(invisibleCircle);
circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
gaService.setLocationAndSize(circle, 0, 0, width, height);
if (addedEvent.eResource() == null) {
Object parentObject = getBusinessObjectForPictogramElement(parent);
if (parentObject instanceof SubProcess) {
((SubProcess) parentObject).getFlowElements().add(addedEvent);
} else {
getDiagram().eResource().getContents().add(addedEvent);
}
}
// create link and wire it
link(containerShape, addedEvent);
}
{
final Shape shape = peCreateService.createShape(containerShape, false);
final Image image = gaService.createImage(shape, ActivitiImageProvider.IMG_BOUNDARY_TIMER);
image.setStretchH(true);
image.setStretchV(true);
image.setWidth(33);
image.setHeight(33);
gaService.setLocationAndSize(image, 1, 1, 33, 33);
}
// add a chopbox anchor to the shape
peCreateService.createChopboxAnchor(containerShape);
if (!(addedEvent instanceof EndEvent)) {
// create an additional box relative anchor at middle-right
final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
boxAnchor.setRelativeWidth(1.0);
boxAnchor.setRelativeHeight(0.51);
boxAnchor.setReferencedGraphicsAlgorithm(circle);
final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
}
layoutPictogramElement(containerShape);
return containerShape;
}
示例4: add
import org.eclipse.graphiti.services.IGaService; //导入方法依赖的package包/类
@Override
public PictogramElement add(IAddContext context) {
final Event addedEvent = (Event) context.getNewObject();
final ContainerShape parent = context.getTargetContainer();
// CONTAINER SHAPE WITH CIRCLE
final IPeCreateService peCreateService = Graphiti.getPeCreateService();
final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);
// check whether the context has a size (e.g. from a create feature)
// otherwise define a default size for the shape
final int width = context.getWidth() <= 0 ? 35 : context.getWidth();
final int height = context.getHeight() <= 0 ? 35 : context.getHeight();
final IGaService gaService = Graphiti.getGaService();
Ellipse circle;
{
final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
invisibleCircle.setFilled(false);
invisibleCircle.setLineVisible(false);
gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);
// create and set visible circle inside invisible circle
circle = gaService.createEllipse(invisibleCircle);
circle.setParentGraphicsAlgorithm(invisibleCircle);
circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
if (addedEvent instanceof EndEvent == true) {
circle.setLineWidth(3);
}
gaService.setLocationAndSize(circle, 0, 0, width, height);
// if addedClass has no resource we add it to the resource of the
// diagram
// in a real scenario the business model would have its own resource
if (addedEvent.eResource() == null) {
Object parentObject = getBusinessObjectForPictogramElement(parent);
if (parentObject instanceof SubProcess) {
((SubProcess) parentObject).getFlowElements().add(addedEvent);
} else {
getDiagram().eResource().getContents().add(addedEvent);
}
}
// create link and wire it
link(containerShape, addedEvent);
}
{
final Shape shape = peCreateService.createShape(containerShape, false);
final Image image = gaService.createImage(shape, "org.activiti.designer.alfresco.logo");
gaService.setLocationAndSize(image, 10, 10, IMAGE_SIZE, IMAGE_SIZE);
}
// add a chopbox anchor to the shape
peCreateService.createChopboxAnchor(containerShape);
// create an additional box relative anchor at middle-right
final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
boxAnchor.setRelativeWidth(1.0);
boxAnchor.setRelativeHeight(0.51);
boxAnchor.setReferencedGraphicsAlgorithm(circle);
final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
layoutPictogramElement(containerShape);
return containerShape;
}