Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.IFigure


   * @generated
   */
  protected NodeFigure createNodeFigure() {
    NodeFigure figure = createNodePlate();
    figure.setLayoutManager(new StackLayout());
    IFigure shape = createNodeShape();
    figure.add(shape);
    contentPane = setupContentPane(shape);
    return figure;
  }
View Full Code Here


        SWTGraphics g = null;
        GC gc = null;
        Image image = null;
        LayerManager layerManager = (LayerManager)
            getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
        IFigure figure = layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
        Rectangle r = figure.getBounds();
        try {
            image = new Image(Display.getDefault(), r.width, r.height);
            gc = new GC(image);
            g = new SWTGraphics(gc);
            g.translate(r.x * -1, r.y * -1);
            figure.paint(g);
            ImageLoader imageLoader = new ImageLoader();
            imageLoader.data = new ImageData[] { image.getImageData() };
            imageLoader.save(stream, format);
        } catch (Throwable t) {
            DroolsEclipsePlugin.log(t);
View Full Code Here

  /**
   * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getContentPane()
   */
  @Override
  public IFigure getContentPane() {
    IFigure contentPane = super.getContentPane();
    if (logger.isLoggable(Level.FINE)) {
      //$ANALYSIS-IGNORE
      logger.fine("getContentPane() -> " + contentPane);
    }
    return contentPane;
View Full Code Here

  /**
   * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getContentPane()
   */
  @Override
  public IFigure getContentPane() {
    IFigure contentPane = ((ProjectFigure) getFigure()).getContentPane();
    if (logger.isLoggable(Level.FINE)) {
      //$ANALYSIS-IGNORE
      logger.fine("Returning ContentPane: { class=" + contentPane.getClass().getSimpleName() + ", Layout="
          + contentPane.getLayoutManager().getClass().getSimpleName() + "}");
    }
    return contentPane;
  }
View Full Code Here

       
        Text text = (Text) getCellEditor().getControl();
        text.addVerifyListener(verifyListener);
        text.setText(((LabelBoxPrinter) ((Box)getEditPart().getModel()).getBoxPrinter()).getText());
        getCellEditor().setValue(this.nodeFigure.getText());
        IFigure figure = ((GraphicalEditPart) getEditPart()).getFigure();
        scaledFont = figure.getFont();
        FontData data = scaledFont.getFontData()[0];
        Dimension fontSize = new Dimension(0, data.getHeight());
        data.setHeight(fontSize.height);
        scaledFont = new Font(null, data);
       
View Full Code Here

        Point loc = new Point(0, 0);
        Dimension size = page.getSize();
        Rectangle rectangle = new Rectangle(loc, size);

        // this should trigger all the resize in PageImpl
        IFigure fig = getFigure();
        // Dimension fSize = fig.getSize();
        fig.setSize(size);
        getParent().setLayoutConstraint(this, fig, rectangle);
        //
        // List<Box> boxes = page.getBoxes();
        // for( Box box : boxes ) {
        // Dimension size2 = box.getSize();
View Full Code Here

    // find the edit part for this element
    ShapeNodeEditPart part = assertHasOperation(editor, "my operation");
    assertNotNull(part);

    // what is the content pane?
    IFigure fig = part.getContentPane();
    assertTrue("CompositeOperation should be extended: " + fig.getClass(),
        fig instanceof ExtendedActivityOperationFigure);

    ExtendedActivityOperationFigure ext = (ExtendedActivityOperationFigure) fig;
    // check to see it has the correct initial parent value
    assertEquals("Parent: root element", ext.getFigureActivityOperationParentNameFigure().getText());
View Full Code Here

    // find the edit part for this element
    ShapeNodeEditPart partOp = assertHasOperation(editor, "my operation");
    assertNotNull(partOp);
    // what is the content pane?
    IFigure fig_o = partOp.getContentPane();
    assertTrue("CompositeOperation should be extended: " + fig_o.getClass(),
        fig_o instanceof ExtendedActivityOperationFigure);

    ExtendedActivityOperationFigure ext_o = (ExtendedActivityOperationFigure) fig_o;
    // check to see it has the correct initial parent value
    assertEquals("Parent: root element", ext_o.getFigureActivityOperationParentNameFigure().getText());
View Full Code Here

    // find the edit part for this element
    ShapeNodeEditPart part = assertHasEmail(editor, "my email");
    assertNotNull(part);

    // what is the content pane?
    IFigure fig = part.getContentPane();
    assertEquals("Email should be extended.",
        "ExtendedEmailFigure",
        fig.getClass().getSimpleName());
  }
View Full Code Here

   * org.emftrace.quarc.ui.zestgpraphbuilders.AbstractElementGraphBuilder#
   * createTooltipFigure(org.emftrace.metamodel.QUARCModel.GSS.Element)
   */
  @Override
  protected IFigure createTooltipFigure(Element element) {
    IFigure tooltipFigure = super.createTooltipFigure(element);

    if (element instanceof ConstrainedElement) {

      String ratingsString = "";

      ratingsString += " Ratings:";
      HashMap<String, AbstractCalculator> calculators = new HashMap<String, AbstractCalculator>();
      List<Element> leafElementsGoalLayer = getCacheManager()
          .getLeafApplicableElementElements(GSSLayer.layer1);
      for (Element leafGoal : leafElementsGoalLayer) {
        float rating = getCacheManager()
            .getIndirectRatingWeight((ConstrainedElement) element, (Goal) leafGoal);
        if (rating == 0.0f) continue;
        ratingsString += "\n "
            + accessLayer.getAttributeValue(leafGoal, "name")
            + ": ";
        ratingsString += String.format("%.2f", rating);
      }

      ratingsString += "\n";

      List<Element> leafElementsPrincipleLayer = getCacheManager()
          .getLeafApplicableElementElements(GSSLayer.layer3);
      if (element instanceof SolutionInstrument) {

        for (Element leafPrinciple : leafElementsPrincipleLayer) {
          float rating = getCacheManager()
              .getIndirectRatingWeight((ConstrainedElement) element, (Element) leafPrinciple);
          if (rating == 0.0f) continue;
          ratingsString += " \n "
              + accessLayer.getAttributeValue(leafPrinciple,
                  "name") + ": ";
          ratingsString += String.format("%.2f", rating);
        }
        ratingsString += "\n";
      }

      ratingsString += "\n";
      calculators.put("max", new MaxCalculator(leafElementsGoalLayer,
          getCacheManager()));
      calculators.put("min", new MinCalculator(leafElementsGoalLayer,
          getCacheManager()));
      calculators.put("avg", new AvgCalculator(leafElementsGoalLayer,
          getCacheManager()));
      if (!getCacheManager().getSelectedGoals().isEmpty()) {
        calculators.put("weighted max", new WeightedMaxCalculator(
            leafElementsGoalLayer, getCacheManager()));
        calculators.put("weighted min", new WeightedMinCalculator(
            leafElementsGoalLayer, getCacheManager()));
        calculators.put("weighted avg", new WeightedAvgCalculator(
            leafElementsGoalLayer, getCacheManager()));
      }

      if (element instanceof SolutionInstrument) {
        calculators.put("max", new MaxCalculator(
            leafElementsPrincipleLayer, getCacheManager()));
        calculators.put("min", new MinCalculator(
            leafElementsPrincipleLayer, getCacheManager()));
        calculators.put("avg", new AvgCalculator(
            leafElementsPrincipleLayer, getCacheManager()));
        if (!getCacheManager().getSelectedPrinciples().isEmpty()) {
          calculators.put("weighted max", new WeightedMaxCalculator(
              leafElementsPrincipleLayer, getCacheManager()));
          calculators.put("weighted min", new WeightedMinCalculator(
              leafElementsPrincipleLayer, getCacheManager()));
          calculators.put("weighted avg", new WeightedAvgCalculator(
              leafElementsPrincipleLayer, getCacheManager()));
        }
      }

      ratingsString += " Aggregations:";
      for (Entry<String, AbstractCalculator> entry : calculators
          .entrySet()) {
        ratingsString += " \n " + entry.getKey() + ": ";
        ratingsString += entry.getValue()
            .calcAggregationAsString((ConstrainedElement) element);
      }

      org.eclipse.draw2d.Label ratingsLabel = new org.eclipse.draw2d.Label(
          "\n" + ratingsString + "\n");
      ratingsLabel.setFont(defaultLabelFont);
      tooltipFigure.add(ratingsLabel);
      tooltipFigure.setSize(-1, -1);
    }
    return tooltipFigure;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.IFigure

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.