Search in sources :

Example 56 with Label

use of org.eclipse.draw2d.Label in project yamcs-studio by yamcs.

the class TabFigure method layout.

@Override
protected void layout() {
    super.layout();
    Rectangle clientArea = getClientArea();
    int left = clientArea.x;
    int top = clientArea.y;
    int width = getTabLabelWidth();
    int height = getTabLabelHeight();
    int i = 0;
    for (Label label : tabLabelList) {
        Dimension labelSize = label.getPreferredSize();
        if (horizontal) {
            if (getActiveTabIndex() == i)
                label.setBounds(new Rectangle(left, top, labelSize.width + MARGIN + GAP, height));
            else
                label.setBounds(new Rectangle(left + GAP, top + 2, labelSize.width + MARGIN - GAP, height - 2));
            left += (labelSize.width + MARGIN - 1);
        } else {
            int labelH = Math.max(labelSize.height, minimumTabHeight);
            if (getActiveTabIndex() == i)
                label.setBounds(new Rectangle(left, top, width, labelH + MARGIN + GAP));
            else
                label.setBounds(new Rectangle(left + 2, top + GAP, width - 2, labelH + MARGIN - GAP));
            top += (labelH + MARGIN - 1);
        }
        i++;
    }
    if (horizontal) {
        tabArea.setBounds(new Rectangle(clientArea.x, clientArea.y + height - 1, clientArea.width - 1, clientArea.height - height));
    } else {
        tabArea.setBounds(new Rectangle(clientArea.x + width - 1, clientArea.y, clientArea.width - width, clientArea.height - 1));
    }
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) Label(org.eclipse.draw2d.Label) Dimension(org.eclipse.draw2d.geometry.Dimension)

Aggregations

Label (org.eclipse.draw2d.Label)56 IFigure (org.eclipse.draw2d.IFigure)8 Rectangle (org.eclipse.draw2d.geometry.Rectangle)8 Point (org.eclipse.draw2d.geometry.Point)7 LineBorder (org.eclipse.draw2d.LineBorder)6 WrapLabel (org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel)6 Image (org.eclipse.swt.graphics.Image)6 MouseEvent (org.eclipse.draw2d.MouseEvent)5 MouseListener (org.eclipse.draw2d.MouseListener)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Figure (org.eclipse.draw2d.Figure)4 RectangleFigure (org.eclipse.draw2d.RectangleFigure)4 Dimension (org.eclipse.draw2d.geometry.Dimension)4 PolylineConnection (org.eclipse.draw2d.PolylineConnection)3 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)3 EImage (org.talend.commons.ui.runtime.image.EImage)3 ComboCellLabel (org.talend.designer.gefabstractmap.figures.ComboCellLabel)3 RowBorder (org.talend.designer.gefabstractmap.figures.borders.RowBorder)3 CompoundBorder (org.eclipse.draw2d.CompoundBorder)2