Ejemplo n.º 1
0
  protected IFigure createFigure() {
    if (image == null) {
      ILabeledElement element = BPELUtil.adapt(getStartNode(), ILabeledElement.class);
      image = element.getSmallImage(getStartNode());
      Rectangle rect = image.getBounds();
      imageWidth = rect.width;
      imageHeight = rect.height;
    }
    this.hasFH = getFaultHandler() != null;
    this.hasEH = getEventHandler() != null;
    // Cause the handlerIcons don't belong to the
    // bounds of the StartNodeFigure (as a result of
    // moving them a bit to the right in vertical layout and a bit to to the bottom
    // in horizontal layout) hit testing
    // doesn't reach the Startnode. So add an invisible
    // border
    StartNodeFigure snf = new StartNodeFigure();
    if (!ModelHelper.isHorizontalLayout(getModel()))
      snf.setBorder(new MarginBorder(0, 7 + BORDER_WIDTH, 0, 7 + BORDER_WIDTH));
    else snf.setBorder(new MarginBorder(5, 0, 5, 0));

    faultImageFigure = new ImageFigure(faultImage);
    faultImageFigure.setParent(snf);

    eventImageFigure = new ImageFigure(eventImage);
    eventImageFigure.setParent(snf);

    return snf;
  }
Ejemplo n.º 2
0
  @Override
  protected IFigure createFigure() {
    // TODO: Shouldn't have to initialize labels in each subclass.
    initializeLabels();
    if (collapsedImage == null) {
      // Create the actual figure for the collapsed edit part
      ILabeledElement element = BPELUtil.adapt(getActivity(), ILabeledElement.class);
      collapsedImage = element.getSmallImage(getActivity());
    }
    this.collapsedImageLabel = new Label(collapsedImage);
    this.collapsedNameLabel = new Label(getLabel());

    // TODO: Shouldn't have to set the decorator in each subclass.
    editPartMarkerDecorator =
        new BPELEditPartMarkerDecorator(
            (EObject) getModel(),
            new CollapsableDecorationLayout(/*collapsedImage.getBounds().width*/ 0));
    editPartMarkerDecorator.addMarkerMotionListener(getMarkerMotionListener());

    this.parentFigure = new Figure();
    AlignedFlowLayout layout = new AlignedFlowLayout();
    layout.setHorizontal(true);
    layout.setHorizontalSpacing(0);
    layout.setVerticalSpacing(0);
    parentFigure.setLayoutManager(layout);

    this.contentFigure = new CollapsableScopeContainerFigure(getModel(), getImage(), getLabel());
    contentFigure.addMouseMotionListener(getMouseMotionListener());
    contentFigure.setEditPart(this);
    contentFigure.setForegroundColor(
        BPELUIPlugin.INSTANCE.getColorRegistry().get(IBPELUIConstants.COLOR_BLACK));
    parentFigure.add(contentFigure);

    // Configure the border and contents based on collapsed state
    if (isCollapsed()) {
      configureCollapsedFigure(contentFigure);
    } else {
      configureExpandedFigure(contentFigure);
    }

    boolean isHorizontal = ModelHelper.isHorizontalLayout(getModel());

    this.auxilaryFigure = new AuxiliaryFigure();
    layout = new AlignedFlowLayout();
    layout.setHorizontal(!isHorizontal);
    auxilaryFigure.setLayoutManager(layout);
    contentFigure.addFigureListener(auxilaryFigure);

    parentFigure.add(auxilaryFigure);

    ScopeBorder border = getScopeBorder();
    border.setShowFault(getFaultHandler() != null);
    border.setShowCompensation(getCompensationHandler() != null);
    border.setShowTermination(getTerminationHandler() != null);
    border.setShowEvent(getEventHandler() != null);

    return editPartMarkerDecorator.createFigure(parentFigure);
  }