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;
}
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();
}
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();
}
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);
}
}
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);
}
Aggregations