コード例 #1
0
 /**
  * Sets the name.
  *
  * @param name the new name
  */
 @Override
 public void setName(String name) {
   text.setText(name);
   textFigure.setSize(width, 10);
   text.setSize(width, 10);
   text.setLocation(getLocation());
   textFigure.setLocation(getLocation());
 }
コード例 #2
0
  /**
   * Instantiates a new node figure.
   *
   * @param name the name
   * @param width the weight
   */
  public SimpleNodeFigure(Node node, int width, MouseListener mouseListener) {
    super();

    this.node = node;

    LineBorder b = new LineBorder();
    b.setColor(NodeUtil.FG_COLOR);
    setBorder(b);

    textFigure = new RectangleFigure();
    text = new Label(getNodeName());
    text.setForegroundColor(NodeUtil.FG_COLOR_DARK);

    setSize(width, 10);

    textFigure.add(text);

    hideButton = new RectangleFigure();

    hideSymbol = new Label(getSymbol());
    hideSymbol.setSize(10, 10);
    hideSymbol.setTextAlignment(PositionConstants.CENTER);

    hideSymbol.setFont(hideButtonFont);
    hideSymbol.setForegroundColor(NodeUtil.FG_COLOR_DARK);
    hideButton.add(hideSymbol);
    hideButton.setBackgroundColor(exitClor);
    hideButton.addMouseListener(mouseListener);
    hideButton.addMouseMotionListener(
        new MouseMotionListener() {

          @Override
          public void mouseMoved(MouseEvent me) {}

          @Override
          public void mouseHover(MouseEvent me) {}

          @Override
          public void mouseExited(MouseEvent me) {
            hideButton.setBackgroundColor(exitClor);
          }

          @Override
          public void mouseEntered(MouseEvent me) {
            hideButton.setBackgroundColor(entredClor);
          }

          @Override
          public void mouseDragged(MouseEvent me) {}
        });
    hideButton.setSize(10, 10);

    setLayoutManager(new XYLayout());

    add(textFigure);
  }
コード例 #3
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.draw2d.Figure#repaint()
   */
  @Override
  public void repaint() {
    int x = getLocation().x;
    int y = getLocation().y;

    if (collapsing) {
      width = Constants.SIZE_16;
      height = Constants.SIZE_18;
      getBounds().height = height;
      getBounds().width = width;
    } else {

      if (hideButton != null) {

        if (hide) {
          super.setSize(width, 18);
        } else {
          super.setSize(width, height);
        }
        textFigure.setSize(width, 10);
        text.setSize(width, 15);
        text.setLocation(new Point(x, y));

        if (getChildren().size() > 1) {
          if (!textFigure.getChildren().contains(hideButton)) {
            textFigure.add(hideButton);
          }
          hideButton.setLocation(new Point(x + width - 11, y + 1));
        } else {
          if (textFigure.getChildren().contains(hideButton)) {
            textFigure.remove(hideButton);
          }
        }
      }

      for (int i = 0; i < getChildren().size(); i++) {
        IFigure figure = (IFigure) getChildren().get(i);

        if (figure == textFigure || hide) {
          figure.setSize(width, 16);
          figure.setLocation(new Point(x, y));
        } else {
          figure.setSize(width - 5, 15);
          figure.setLocation(new Point(x + 5, y + 16 + 15 * i));
        }
      }
    }

    super.repaint();
  }
コード例 #4
0
  public DashboardFigure() {
    imgReg = Activator.getDefault().getImageRegistry();
    add(
        logoFigure =
            new ImageFigure() {

              @Override
              protected void paintFigure(Graphics graphics) {
                if (getImage() != null) {
                  graphics.drawImage(
                      getImage(), new Rectangle(getImage().getBounds()), getBounds());
                }
              }
            });
    Image logoImage = imgReg.get(Activator.IMG_MDA_ID);
    if (logoImage != null) {
      logoFigure.setImage(logoImage);
    }
    initFigure.setSize(20, 20);
    initFigure.setBackgroundColor(DASHBOARD_FG);
    add(initFigure);
    add(methodoFigure = createMethodologyFigure("Methodology"));
    add(processFigure = createProcessFigure("Process"));
    endFigure.setSize(20, 20);
    endFigure.setBackgroundColor(DASHBOARD_FG);
    add(endFigure);
    add(init2methoFlow = createFlowFigure(true));
    add(metho2processFlow = createFlowFigure(true));
    add(process2endFlow = createFlowFigure(true));
    add(statusFigure = new Figure());
    statusFigure.setFont(JFaceResources.getBannerFont());
    ToolbarLayout statusLayout = new ToolbarLayout();
    statusLayout.setStretchMinorAxis(false);
    statusFigure.setLayoutManager(statusLayout);
    statusFigure.add(new Label());
    statusFigure.add(new Label());
    setLayoutManager(new DashboardLayout());
    setBorder(new MarginBorder(10));
    setBackgroundColor(DASHBOARD_BG);
    setForegroundColor(DASHBOARD_FG);
  }