Java Code Examples for org.eclipse.draw2d.Label#setBackgroundColor()
The following examples show how to use
org.eclipse.draw2d.Label#setBackgroundColor() .
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: ModelPropertiesFigure.java From erflute with Apache License 2.0 | 6 votes |
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 2
Source File: ModelPropertiesFigure.java From ermasterr with Apache License 2.0 | 5 votes |
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 3
Source File: TableViewGraphicalNodeEditPolicy.java From ermasterr with Apache License 2.0 | 5 votes |
@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 4
Source File: TableViewGraphicalNodeEditPolicy.java From erflute with Apache License 2.0 | 5 votes |
@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 5
Source File: EditorDragGuidePolicy.java From birt with Eclipse Public License 1.0 | 5 votes |
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 6
Source File: ModelPropertiesFigure.java From ermaster-b with Apache License 2.0 | 5 votes |
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 7
Source File: TableViewGraphicalNodeEditPolicy.java From ermaster-b with Apache License 2.0 | 5 votes |
@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); }