Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.Label


      }
    }
       
    if (image != null) {
      ImageFigure imageFigure = new ImageFigure(image);
      imageFigure.setToolTip(new Label( builder.toString() ));
      return imageFigure;
    }
    return null;
  }
View Full Code Here


        Color color = CommonUIPlugin.getDefault().getColorRegistry().get(IDetailsColors.COLOR_LIGHT_BACKGROUND);
        graphics.setForegroundColor(color);
        graphics.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width, rect.y + rect.height - 1);
      }
    });
    nameLabel = new Label();
    nameLabel.setLabelAlignment(PositionConstants.LEFT);
    add(nameLabel);
  }
View Full Code Here

   * Used to align the text of this entry with the text on the categories.
   */
  protected class EntryLayout extends AbstractLayout {
    public void layout(IFigure container) {
      List elements = container.getChildren();
      Label text = (Label)elements.get(0);
      Rectangle containerBounds = container.getBounds();
      Rectangle constraint = getCategoryTitleLabelBounds();
      int width = containerBounds.width - constraint.x;
      text.setBounds(new Rectangle(constraint.x, containerBounds.y, width, containerBounds.height));
    }
View Full Code Here

  @Override
  protected IFigure createTitleFigure() {
    mainTrayTitleFigure = new MainTrayTitleFigure();
    mainTrayTitleFigure.add(new ImageFigure(getLabelProvider().getImage(getModel())));
    nameLabel = new Label(getLabelProvider().getText(getModel()));
    mainTrayTitleFigure.add(nameLabel);
    decorator = createEditPartMarkerDecorator();
    return decorator.createFigure(mainTrayTitleFigure);
  }
View Full Code Here

  /**
   * Return the label to be used as the tooltip for the Add button.
   * Subclasses may override.
   */
  protected IFigure getAddToolTip() {
      return new Label("Add");
  }
View Full Code Here

  /**
   * Return the label to be used as the tooltip for the Add button.
   * Subclasses may override.
   */
  protected IFigure getRemoveToolTip() {
      return new Label("Remove");
 
View Full Code Here

  protected class TitleLayout extends AbstractLayout {
    private static final int SPACING = 2;
    public void layout(IFigure container) {
      List elements = container.getChildren();
      ImageFigure icon = (ImageFigure)elements.get(0);
      Label text = (Label)elements.get(1);
      Figure removeButton = (Figure)elements.get(2);
      Figure addButton = (Figure)elements.get(3);
     
      Rectangle containerBounds = container.getBounds();
      int x = containerBounds.x + SPACING;
      int y = containerBounds.y;
      int height = containerBounds.height;
     
      Dimension size = icon.getPreferredSize();
      Rectangle bounds = new Rectangle(x, y, size.width, height);
      icon.setBounds(bounds);
     
      size = removeButton.getPreferredSize();
      x = (containerBounds.x + containerBounds.width) - size.width;
      bounds = new Rectangle(x, y, size.width, height);
      removeButton.setBounds(bounds);

      size = addButton.getPreferredSize();
      x = x - size.width;
      bounds = new Rectangle(x, y, size.width, height);
      addButton.setBounds(bounds);

      x = icon.getBounds().x + icon.getBounds().width;
      x = x + SPACING;
      int width = containerBounds.width - (icon.getBounds().width + removeButton.getBounds().width + addButton.getBounds().width);
      bounds = new Rectangle(x, y, width, height);
      text.setBounds(bounds);
    }
View Full Code Here

      super();
      setLayoutManager(new TitleLayout());
      setOpaque(true);
      setBackgroundColor(CommonUIPlugin.getDefault().getColorRegistry().get(IDetailsColors.COLOR_LIGHT_BACKGROUND));
      add(new ImageFigure(getLabelProvider().getImage(getModel())));
      textLabel = new Label(getLabelProvider().getText(getModel()));
      textLabel.setLabelAlignment(PositionConstants.LEFT);
      add(textLabel);
     
      removeButton = new NoBorderButton(CommonUIPlugin.getDefault().getImageRegistry().get(ICommonUIConstants.ICON_TRAY_CATEGORY_REMOVE_BUTTON)) {
        public void handleKeyPressed(KeyEvent event) {
View Full Code Here

          TextCellEditor.class, new CellEditorLocator() {
            public void relocate(CellEditor celleditor) {
              Text text = (Text) celleditor.getControl();
              Point sel = text.getSelection();
              Point pref = text.computeSize(-1, -1);
              Label label = getDirectEditLabel();
              Rectangle rect = label.getTextBounds().getCopy();
              label.translateToAbsolute(rect);
              text.setBounds(rect.x - 4, rect.y - 1, pref.x + 1, pref.y + 1);
              text.setSelection(0);
              text.setSelection(sel);
            }
          });
View Full Code Here

    }
    e.children = childList.toArray();
  }

  public void getName(AccessibleEvent e) {
    Label label = part.getDirectEditLabel();
    if (label != null) {
      e.result = label.getText();
    } else {
      e.result = null;
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.Label

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.