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


Java IGaService.createImage方法代码示例

本文整理汇总了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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:67,代码来源:AddErrorEndEventFeature.java

示例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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:78,代码来源:AddEventFeature.java

示例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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:71,代码来源:AddTimerCatchingEventFeature.java

示例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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:71,代码来源:AddAlfrescoStartEventFeature.java


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