Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.Figure


    ConnectionEndpointLocator relationshipLocator = new ConnectionEndpointLocator(
        (PolylineConnection) connection.getConnectionFigure(), true);
    relationshipLocator.setUDistance(10);
    relationshipLocator.setVDistance(10);

    Figure decoractionFigure = new Figure();

    ToolbarLayout layout = new ToolbarLayout();
    decoractionFigure.setLayoutManager(layout);
    decoractionFigure.setOpaque(false);

    Label upperHurtLabel = new Label("_");
    upperHurtLabel.setFont(decoractionFontLarge);
    decoractionFigure.add(upperHurtLabel);

    Label lowerHurtLabel = new Label("\u25CF"); // = "â—�"
    lowerHurtLabel.setFont(decoractionFontTiny);
    decoractionFigure.add(lowerHurtLabel);
    decoractionFigure.setSize(-1, -1);
    ((PolylineConnection) connection.getConnectionFigure()).add(
        decoractionFigure, relationshipLocator);

  }
View Full Code Here


    ConnectionEndpointLocator relationshipLocator = new ConnectionEndpointLocator(
        (PolylineConnection) connection.getConnectionFigure(), true);
    relationshipLocator.setUDistance(10);
    relationshipLocator.setVDistance(10);

    Figure decoractionFigure = new Figure();

    ToolbarLayout layout = new ToolbarLayout();
    decoractionFigure.setLayoutManager(layout);
    decoractionFigure.setOpaque(false);

    Label upperHelpLabel = new Label("+");
    upperHelpLabel.setFont(decoractionFontLarge);
    decoractionFigure.add(upperHelpLabel);

    Label lowerHelpLabel = new Label("\u25CF"); // = "â—�"
    lowerHelpLabel.setFont(decoractionFontTiny);
    decoractionFigure.add(lowerHelpLabel);
    decoractionFigure.setSize(-1, -1);
    ((PolylineConnection) connection.getConnectionFigure()).add(
        decoractionFigure, relationshipLocator);
  }
View Full Code Here

    ConnectionEndpointLocator relationshipLocator = new ConnectionEndpointLocator(
        (PolylineConnection) connection.getConnectionFigure(), true);
    relationshipLocator.setUDistance(10);
    relationshipLocator.setVDistance(10);

    Figure decoractionFigure = new Figure();

    ToolbarLayout layout = new ToolbarLayout();
    decoractionFigure.setLayoutManager(layout);
    decoractionFigure.setOpaque(false);

    Label upperHelpLabel = new Label("\u25CF"); // = "â—�"
    upperHelpLabel.setFont(decoractionFontSmall);
    decoractionFigure.add(upperHelpLabel);
   
    Label lowerHelpLabel = new Label("+");
    lowerHelpLabel.setFont(decoractionFontLarge);
    decoractionFigure.add(lowerHelpLabel);
   
    decoractionFigure.setSize(-1, -1);
    ((PolylineConnection) connection.getConnectionFigure()).add(
        decoractionFigure, relationshipLocator);
  }
View Full Code Here

    ConnectionEndpointLocator relationshipLocator = new ConnectionEndpointLocator(
        (PolylineConnection) connection.getConnectionFigure(), true);
    relationshipLocator.setUDistance(10);
    relationshipLocator.setVDistance(10);

    Figure decoractionFigure = new Figure();

    ToolbarLayout layout = new ToolbarLayout();
    decoractionFigure.setLayoutManager(layout);
    decoractionFigure.setOpaque(false);

    Label upperHelpLabel = new Label("\u25CF"); // = "â—�"
    upperHelpLabel.setFont(decoractionFontSmall);
    decoractionFigure.add(upperHelpLabel);
   
    Label lowerHelpLabel = new Label("-");
    lowerHelpLabel.setFont(decoractionFontLarge);
    decoractionFigure.add(lowerHelpLabel);
   
    decoractionFigure.setSize(-1, -1);
    ((PolylineConnection) connection.getConnectionFigure()).add(
        decoractionFigure, relationshipLocator);
  }
View Full Code Here

   * @return the created Figure
   */
  private static IFigure createTooltipFigure(GraphConnection connection,
      Relation relation, Element source, Element target, String weight) {
   
    Figure tooltipFigure = new Figure();

    ToolbarLayout layout = new ToolbarLayout();
    tooltipFigure.setLayoutManager(layout);
    tooltipFigure.setOpaque(true);
   
    String relationType = "";
  if (relation instanceof Impact){
    relationType = "Impact";
  } else   if (relation instanceof Decomposition){
    relationType = "Decomposition";
  } else   if (relation instanceof isA){
    relationType = "IsA";
    } else   if (relation instanceof Offset){
      relationType = "Offset";
    else  {
      relationType = "Relation";
    }
   
 
    String sourceName = source != null? source.getName() : "";
    String targetName = target != null? target.getName() : "";;
   
    String tooltipText = "";
    //3 free spaces before and behind each line start and line end due to ascetic reasons (prevent text to border on tooltip bounds)
    tooltipText += "\n";
    tooltipText += "   Source:\t"+ sourceName+"   \n";
    tooltipText += "   Target:\t"+ targetName+"   \n";
   
    if (weight != ""){
      tooltipText += "   Weight:\t"+ weight+"   \n"
    }
   
    Label titleLabel = new Label("   "+relationType+"   ");
    titleLabel.setFont(decoractionFontLarge);

    tooltipFigure.add(titleLabel);

    Label valuesLabel = new Label(tooltipText);
    valuesLabel.setFont(decoractionFontNormal);
    tooltipFigure.add(valuesLabel);
    tooltipFigure.setSize(-1, -1)
   
    return tooltipFigure;
  }
View Full Code Here

   */
  protected ElementFigure createElementFigure(final Element element,
      boolean isLeaf, boolean isExpandable, Figure topFigure) {

    ElementFigure elementFigure = null;
    Figure decompostionTypeFigure = null;

    if (!isLeaf) {
      String decompostionType;
      if (element instanceof SolutionInstrument)
        decompostionType = RefinementType.IsA;
      else
        decompostionType = RefinementType.AND;
      decompostionTypeFigure = new RefinementTypeFigure(decompostionType);

    }
   
    Figure globalTopFigure = new Figure();
   
    if (topFigure != null)
      globalTopFigure.add(topFigure);
   
   
    if (element instanceof ConstrainedElement && ((ConstrainedElement)element).getPrecondition() != null &&  (!((ConstrainedElement)element).getPrecondition().getLogicConditions().isEmpty() ||  !((ConstrainedElement)element).getPrecondition().getBaseConditions().isEmpty())){
     
      PreconditionFigure preconditionFigure = new PreconditionFigure(PreconditionFinder.formatConditionString(((ConstrainedElement)element).getPrecondition()));
      globalTopFigure.add(preconditionFigure);
     
    }

   
    ToolbarLayout globalTopFigureLayout = new ToolbarLayout(false);

    globalTopFigureLayout.setMinorAlignment(OrderedLayout.ALIGN_BOTTOMRIGHT);
    globalTopFigure.setLayoutManager(globalTopFigureLayout);
    globalTopFigure.setOpaque(false);

    AbstractDecoratorFigure bodyFigure = null;
    if (element instanceof Goal) {
      bodyFigure = new SoftGoalFigure(element.getName(), isExpandable);
      elementFigure = new ElementFigure(bodyFigure,
View Full Code Here

   * @param element an Element
   * @return the created IFigure
   */
  protected IFigure createTooltipFigure(Element element) {

    Figure tooltipFigure = new Figure();

    ToolbarLayout layout = new ToolbarLayout();
    tooltipFigure.setLayoutManager(layout);
    tooltipFigure.setOpaque(true);
    String name = element.getName();
    if (name == null)
      name = "";
    org.eclipse.draw2d.Label titleLabel = new org.eclipse.draw2d.Label(
        "   " + element.getName() + "   ");
    titleLabel.setFont(defaultTitleFont);
    tooltipFigure.add(titleLabel);

    String attributesAndFeaturesText = "\n";
    if (element.getDescription() != null)
      attributesAndFeaturesText += " Description: \n "
          + formatDescription(element.getDescription());
     
    if (element instanceof ConstrainedElement && ((ConstrainedElement)element).getPrecondition() != null &&  (!((ConstrainedElement)element).getPrecondition().getLogicConditions().isEmpty() ||  !((ConstrainedElement)element).getPrecondition().getBaseConditions().isEmpty())){
     
      attributesAndFeaturesText += " Precondition: \n " + PreconditionFinder.formatConditionString(((ConstrainedElement)element).getPrecondition());
 
    }

    org.eclipse.draw2d.Label attributesAndFeaturesLabel = new org.eclipse.draw2d.Label(
        " " + attributesAndFeaturesText + " \n");
    attributesAndFeaturesLabel.setFont(defaultLabelFont);
    tooltipFigure.add(attributesAndFeaturesLabel);
    tooltipFigure.setSize(-1, -1);

    return tooltipFigure;
  }
View Full Code Here

   * @param text a String
   * @return the created IFigure
   */
  protected static IFigure createTooltipFigure(String text) {

    Figure tooltipFigure = new Figure();

    ToolbarLayout layout = new ToolbarLayout();
    tooltipFigure.setLayoutManager(layout);
    tooltipFigure.setOpaque(true);

    org.eclipse.draw2d.Label label = new org.eclipse.draw2d.Label(text);
    label.setFont(new Font(null, "Arial", 10, SWT.NORMAL));
    tooltipFigure.add(label);

    tooltipFigure.setSize(-1, -1);

    return tooltipFigure;
  }
View Full Code Here

        GridData data = new GridData(GridData.FILL_HORIZONTAL);
        add(fp, data);
    }

    protected void addLabel() {
        Figure figure = new Figure();
        CenteredFlowLayout layout = new CenteredFlowLayout();
        layout.setMajorAlignment(FlowLayout.ALIGN_CENTER);
        figure.setLayoutManager(layout);
        figure.setOpaque(false);

        label = new TextFlow();

        FlowPage fp = new FlowPage();
        fp.setLayoutManager(new PageFlowLayout(fp));
        fp.setHorizontalAligment(PositionConstants.CENTER);
        fp.add(label);

        figure.add(fp, FlowLayout.ALIGN_CENTER);

        GridData data = new GridData(GridData.FILL_BOTH);
        add(figure, data);
    }
View Full Code Here

    // ok, recreate all children.
    CSSFigure cssfigure = (CSSFigure) getOwner().getFigure();
    List fragments = cssfigure.getFragmentsForRead();
    for (int i = 0, size = fragments.size(); i < size; i++) {
      // the rectangle.
      Figure childFigure = new BorderFigure();
      childFigure.setBorder(new LineBorder(1));
      this.add(childFigure);

      FlowBox box = (FlowBox) fragments.get(i);
      Rectangle rect = new Rectangle(box.getX(), box.getY(), box.getWidth(), box
          .getHeight());
      cssfigure.translateToAbsolute(rect);

      childFigure.translateToRelative(rect);
      childFigure.setBounds(rect);

      createCornerHandles(cssfigure, box);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.Figure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.