Java Code Examples for org.eclipse.draw2d.Label#setOpaque()

The following examples show how to use org.eclipse.draw2d.Label#setOpaque() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Annotation.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Construct a free annotation.
 * 
 * @param xAxis
 *            the xAxis of the annotation.
 * @param yAxis
 *            the yAxis of the annotation.
 * @param name
 *            the name of the annotation.
 */
public Annotation(String name, Axis xAxis, Axis yAxis) {
	this.xAxis = xAxis;
	this.yAxis = yAxis;
	this.name = name;
	trace = null;
	infoLabel = new Label();
	infoLabel.setOpaque(false);
	infoLabel.setCursor(Cursors.SIZEALL);
	add(infoLabel);
	InfoLabelDragger infoLabelDragger = new InfoLabelDragger();
	infoLabel.addMouseMotionListener(infoLabelDragger);
	infoLabel.addMouseListener(infoLabelDragger);
	pointer = new Pointer();
	add(pointer);
	updateToDefaultPosition();
	xAxis.addListener(this);
	yAxis.addListener(this);
}
 
Example 2
Source File: ModelPropertiesFigure.java    From erflute with Apache License 2.0 6 votes vote down vote up
private void addRow(String name, String value, String tableStyle) {
    final Border border = new MarginBorder(5);
    final ToolbarLayout layout = new ToolbarLayout();
    layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
    layout.setStretchMinorAxis(true);
    final Label nameLabel = new Label();
    final Label valueLabel = new Label();
    nameLabel.setBorder(border);
    nameLabel.setText(name);
    nameLabel.setLabelAlignment(PositionConstants.LEFT);
    nameLabel.setForegroundColor(foregroundColor);
    add(nameLabel);
    if (!DisplayMessages.getMessage("action.title.change.design.simple").equals(tableStyle)
            && !DisplayMessages.getMessage("action.title.change.design.frame").equals(tableStyle)) {
        valueLabel.setBackgroundColor(ColorConstants.white);
        valueLabel.setOpaque(true);
        valueLabel.setForegroundColor(ColorConstants.black);
    } else {
        valueLabel.setOpaque(false);
        valueLabel.setForegroundColor(foregroundColor);
    }
    valueLabel.setBorder(border);
    valueLabel.setText(value);
    valueLabel.setLabelAlignment(PositionConstants.LEFT);
    add(valueLabel);
}
 
Example 3
Source File: ProgressBarFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public ProgressBarFigure() {
	
	super();
	scale.setScaleLineVisible(false);
	scale.setTickLabelSide(LabelSide.Secondary);
	
	if(horizontal) {
		((LinearScale)scale).setOrientation(Orientation.HORIZONTAL);
		scale.setTickLabelSide(LabelSide.Primary);		
		marker.setLabelSide(LabelSide.Secondary);			
	}else {
		((LinearScale)scale).setOrientation(Orientation.VERTICAL);
		scale.setTickLabelSide(LabelSide.Primary);		
		marker.setLabelSide(LabelSide.Secondary);	
	}		
	
	track = new Track();		

	label = new Label();
	label.setOpaque(false);		
	
	thumb = new Thumb();
	thumb.setVisible(indicatorMode);
	
	setLayoutManager(new ProgressBarLayout());
	add(scale, ProgressBarLayout.SCALE);
	add(marker, ProgressBarLayout.MARKERS);
	add(track, ProgressBarLayout.TRACK);
	add(thumb, ProgressBarLayout.THUMB);
	add(label, ProgressBarLayout.LABEL);

	addFigureListener(new FigureListener() {			
		public void figureMoved(IFigure source) {
			revalidate();				
		}
	});	
}
 
Example 4
Source File: ModelPropertiesFigure.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private void addRow(final String name, final String value, final String tableStyle) {
    final Border border = new MarginBorder(5);

    final ToolbarLayout layout = new ToolbarLayout();
    layout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
    layout.setStretchMinorAxis(true);

    final Label nameLabel = new Label();

    final Label valueLabel = new Label();

    nameLabel.setBorder(border);
    nameLabel.setText(name);
    nameLabel.setLabelAlignment(PositionConstants.LEFT);
    nameLabel.setForegroundColor(foregroundColor);

    this.add(nameLabel);

    if (!ResourceString.getResourceString("action.title.change.design.simple").equals(tableStyle) && !ResourceString.getResourceString("action.title.change.design.frame").equals(tableStyle)) {
        valueLabel.setBackgroundColor(ColorConstants.white);
        valueLabel.setOpaque(true);
        valueLabel.setForegroundColor(ColorConstants.black);

    } else {
        valueLabel.setOpaque(false);
        valueLabel.setForegroundColor(foregroundColor);
    }

    valueLabel.setBorder(border);
    valueLabel.setText(value);
    valueLabel.setLabelAlignment(PositionConstants.LEFT);

    this.add(valueLabel);
}
 
Example 5
Source File: TableViewGraphicalNodeEditPolicy.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
@Override
public void showTargetFeedback(final Request request) {
    final ERDiagram diagram = (ERDiagram) getHost().getRoot().getContents().getModel();

    if (diagram.isTooltip()) {
        final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
        final double zoom = zoomManager.getZoom();

        final TableView tableView = (TableView) getHost().getModel();
        final Rectangle tableBounds = getHostFigure().getBounds();

        final String name = TableViewEditPart.getTableViewName(tableView, diagram);

        final Label label = new Label();
        label.setText(name);
        label.setBorder(new SimpleRaisedBorder());
        label.setBackgroundColor(ColorConstants.orange);
        label.setOpaque(true);

        final Dimension dim = FigureUtilities.getTextExtents(name, Display.getCurrent().getSystemFont());

        label.setBounds(new Rectangle((int) (zoom * (tableBounds.x + 33)), (int) (zoom * (tableBounds.y + 5)), (int) (dim.width * 1.5), 20));

        addFeedback(label);
    }
    super.showTargetFeedback(request);
}
 
Example 6
Source File: TableViewGraphicalNodeEditPolicy.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
public void showTargetFeedback(Request request) {
    final ERDiagram diagram = ERModelUtil.getDiagram(getHost().getRoot().getContents());

    if (diagram.isTooltip()) {
        final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
        final double zoom = zoomManager.getZoom();

        final TableView tableView = (TableView) getHost().getModel();
        final Rectangle tableBounds = getHostFigure().getBounds();

        final String name = TableViewEditPart.getTableViewName(tableView, diagram);

        final Label label = new Label();
        label.setText(name);
        label.setBorder(new SimpleRaisedBorder());
        label.setBackgroundColor(ColorConstants.orange);
        label.setOpaque(true);

        final Dimension dim = FigureUtilities.getTextExtents(name, Display.getCurrent().getSystemFont());

        label.setBounds(new Rectangle(
                (int) (zoom * (tableBounds.x + 33)),
                (int) (zoom * (tableBounds.y + 5)),
                (int) (dim.width * 1.5), 20));

        addFeedback(label);
    }
    super.showTargetFeedback(request);
}
 
Example 7
Source File: EditorDragGuidePolicy.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Label createInfoLabel()
{
	Label labelFigure = new Label( );
	
	labelFigure.setBorder( new MarginBorder(new Insets(0,3,0,0)) 
	{
		public void paint(IFigure figure, Graphics graphics, Insets insets) 
		{ 
			tempRect.setBounds(getPaintRectangle(figure, insets));
			if (getWidth() % 2 != 0) {
				tempRect.width--;
				tempRect.height--;
			}
			tempRect.shrink(getWidth() / 2, getWidth() / 2);
			graphics.setLineWidth(getWidth());
			
			graphics.drawRectangle(tempRect);
		}
		
		private int getWidth()
		{
			return 1;
		}
	});
	labelFigure.setLabelAlignment( PositionConstants.LEFT );
	labelFigure.setOpaque( true );
	labelFigure.setBackgroundColor( ReportColorConstants.TableGuideFillColor );
	return labelFigure;
}
 
Example 8
Source File: ModelPropertiesFigure.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void addRow(String name, String value, String tableStyle) {
	Border border = new MarginBorder(5);

	ToolbarLayout layout = new ToolbarLayout();
	layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
	layout.setStretchMinorAxis(true);

	Label nameLabel = new Label();

	Label valueLabel = new Label();

	nameLabel.setBorder(border);
	nameLabel.setText(name);
	nameLabel.setLabelAlignment(PositionConstants.LEFT);
	nameLabel.setForegroundColor(this.foregroundColor);

	this.add(nameLabel);

	if (!ResourceString.getResourceString(
			"action.title.change.design.simple").equals(tableStyle)
			&& !ResourceString.getResourceString(
					"action.title.change.design.frame").equals(tableStyle)) {
		valueLabel.setBackgroundColor(ColorConstants.white);
		valueLabel.setOpaque(true);
		valueLabel.setForegroundColor(ColorConstants.black);

	} else {
		valueLabel.setOpaque(false);
		valueLabel.setForegroundColor(this.foregroundColor);
	}

	valueLabel.setBorder(border);
	valueLabel.setText(value);
	valueLabel.setLabelAlignment(PositionConstants.LEFT);

	this.add(valueLabel);
}
 
Example 9
Source File: TableViewGraphicalNodeEditPolicy.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
@Override
public void showTargetFeedback(Request request) {
	ERDiagram diagram = ERModelUtil.getDiagram(this.getHost().getRoot().getContents());

	if (diagram.isTooltip()) {
		ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
				.getHost().getRoot()).getZoomManager();
		double zoom = zoomManager.getZoom();

		TableView tableView = (TableView) this.getHost().getModel();
		Rectangle tableBounds = this.getHostFigure().getBounds();

		String name = TableViewEditPart.getTableViewName(tableView, diagram);

		Label label = new Label();
		label.setText(name);
		label.setBorder(new SimpleRaisedBorder());
		label.setBackgroundColor(ColorConstants.orange);
		label.setOpaque(true);

		Dimension dim = FigureUtilities.getTextExtents(name, Display
				.getCurrent().getSystemFont());

		label.setBounds(new Rectangle((int) (zoom * (tableBounds.x + 33)),
				(int) (zoom * (tableBounds.y + 5)),
				(int) (dim.width * 1.5), 20));

		this.addFeedback(label);
	}
	super.showTargetFeedback(request);
}