Search in sources :

Example 26 with Label

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

the class TabFigure method createTabLabel.

private Label createTabLabel(String title, final int index) {
    final Label tabLabel = new Label(title) {

        @Override
        protected void paintFigure(Graphics graphics) {
            graphics.pushState();
            graphics.setForegroundColor(TAB_3D_COLOR);
            graphics.fillGradient(getClientArea(), horizontal);
            graphics.popState();
            super.paintFigure(graphics);
        }
    };
    tabLabel.setLabelAlignment(PositionConstants.CENTER);
    tabLabel.setOpaque(false);
    tabLabel.setBorder(new LineBorder(BORDER_COLOR));
    tabLabel.setBackgroundColor(getDarkColor(DEFAULT_TABCOLOR));
    // tabLabel.setCursor(Cursors.HAND);
    tabLabel.addMouseListener(new MouseListener.Stub() {

        @Override
        public void mousePressed(MouseEvent me) {
            if (me.button != 1)
                return;
            setActiveTabIndex(tabLabelList.indexOf(tabLabel));
        }
    });
    return tabLabel;
}
Also used : Graphics(org.eclipse.draw2d.Graphics) MouseListener(org.eclipse.draw2d.MouseListener) MouseEvent(org.eclipse.draw2d.MouseEvent) LineBorder(org.eclipse.draw2d.LineBorder) Label(org.eclipse.draw2d.Label)

Example 27 with Label

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

the class TabFigure method addTab.

public synchronized void addTab(String title, int index) {
    Label tabLabel = createTabLabel(title, index);
    tabLabelList.add(index, tabLabel);
    tabColorList.add(index, DEFAULT_TABCOLOR);
    tabEnabledList.add(index, true);
    add(tabLabel);
    // if(activeTabIndex <0)
    // setActiveTabIndex(0);
    revalidate();
}
Also used : Label(org.eclipse.draw2d.Label)

Example 28 with Label

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

the class TabFigure method addTab.

public synchronized void addTab(String title) {
    Label tabLabel = createTabLabel(title, tabLabelList.size());
    tabLabelList.add(tabLabel);
    tabColorList.add(DEFAULT_TABCOLOR);
    tabEnabledList.add(true);
    add(tabLabel);
    // if(activeTabIndex <0)
    // setActiveTabIndex(0);
    revalidate();
}
Also used : Label(org.eclipse.draw2d.Label)

Example 29 with Label

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

the class TabFigure method dispose.

private void dispose(int index) {
    Label label = tabLabelList.get(index);
    Image image = label.getIcon();
    if (image != null) {
        image.dispose();
        image = null;
        // only do this if it is in UI thread and the rap session is not end.
        if (Display.getCurrent() != null && !Display.getCurrent().isDisposed())
            label.setIcon(null);
    }
}
Also used : Label(org.eclipse.draw2d.Label) Image(org.eclipse.swt.graphics.Image)

Example 30 with Label

use of org.eclipse.draw2d.Label in project cogtool by cogtool.

the class DesignEditorFrame method addSpeakerBox.

protected void addSpeakerBox() {
    speakerBox.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.setOpaque(true);
    Image speakerIconImg = getSpeakerIconImage();
    // TODO: handle getImage returning null
    org.eclipse.swt.graphics.Rectangle bds = speakerIconImg.getBounds();
    IFigure speakerImgFig = new ImageFigure(speakerIconImg);
    IFigure speakerImgToolTip = new Label(L10N.get("DEF.SpeakerText", "Speaker text"));
    speakerImgFig.setToolTip(speakerImgToolTip);
    speakerImgWidth = bds.width;
    speakerImgHeight = bds.height;
    speakerLayout.setConstraint(speakerImgFig, new Rectangle(0, 0, bds.width, bds.height));
    speakerBox.add(speakerImgFig);
    RectangleFigure speakerEastBorder = new RectangleFigure();
    speakerEastBorder.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerLayout.setConstraint(speakerEastBorder, new Rectangle(speakerImgWidth, 0, SPEAKER_DIVIDER_WIDTH, speakerImgHeight));
    speakerBox.add(speakerEastBorder);
    timeWestBorder = new RectangleFigure();
    timeWestBorder.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.add(timeWestBorder);
    String text = frame.getSpeakerText();
    speakerText = new Label(text);
    speakerText.setLabelAlignment(PositionConstants.LEFT);
    speakerTextToolTip = new Label(text);
    if ((text != null) && !text.equals("")) {
        speakerText.setToolTip(speakerTextToolTip);
    }
    speakerBox.add(speakerText);
    divider = new RectangleFigure();
    divider.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.add(divider);
    double listenTimeInSecs = frame.getListenTimeInSecs();
    listenTime = new Label((listenTimeInSecs == Frame.NO_LISTEN_TIME) ? NO_LISTEN_TIME_LABEL : Double.toString(listenTimeInSecs));
    listenTime.setLabelAlignment(PositionConstants.RIGHT);
    speakerBox.add(listenTime);
    Label listenTimeToolTip = new Label(LISTEN_TIME_TOOLTIP);
    listenTime.setToolTip(listenTimeToolTip);
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) LineBorder(org.eclipse.draw2d.LineBorder) Label(org.eclipse.draw2d.Label) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ImageFigure(org.eclipse.draw2d.ImageFigure) Image(org.eclipse.swt.graphics.Image) IFigure(org.eclipse.draw2d.IFigure)

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