/** * 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()); }
/* * (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(); }
/* * (non-Javadoc) * * @see * org.eclipse.draw2d.Figure#setLocation(org.eclipse.draw2d.geometry.Point) */ @Override public void setLocation(Point p) { super.setLocation(p); textFigure.setLocation(p); text.setLocation(p); }