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

The following examples show how to use org.eclipse.draw2d.Label#setBorder() . 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: FunnyStyleSupport.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
public void addIndex(IndexFigure indexFigure, String name, boolean isFirst) {

		ImageFigure image = new ImageFigure();
		image.setBorder(new MarginBorder(new Insets(0, 0, 0, 19)));
		image.setImage(Activator.getImage(ImageKey.BLANK_WHITE));
		image.setOpaque(true);
		indexFigure.add(image);
//		Label filler = new Label();
//		filler.setBorder(new MarginBorder(new Insets(0, 0, 0, 16)));
//		filler.setBorder(new MarginBorder(new Insets(1, 4, 0, 16)));
//		indexFigure.add(filler);

		StringBuilder text = new StringBuilder();
		text.append(name);
		Label label = this.createColumnLabel();
		label.setBorder(new MarginBorder(new Insets(1, 0, 0, 4)));
		label.setForegroundColor(ColorConstants.black);
		label.setText(text.toString());

		indexFigure.add(label);
	}
 
Example 2
Source File: SimpleStyleSupport.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(final Figure top) {
    final ToolbarLayout topLayout = new ToolbarLayout();

    topLayout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
    topLayout.setStretchMinorAxis(true);
    top.setLayoutManager(topLayout);

    nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(5, 20, 5, 20)));
    top.add(nameLabel);

    final Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(getTextColor());
    separater.setOpaque(true);

    top.add(separater);
}
 
Example 3
Source File: RowHandle.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Initializes the handle. Sets the {@link DragTracker}and DragCursor.
 */
protected void initialize( )
{
	setOpaque( true );
	LineBorder bd = new LineBorder( 1 );
	bd.setColor( ReportColorConstants.HandleBorderColor );
	setBorder( bd );

	String tp = getTooltipText( );
	if ( tp != null )
	{
		Label tooltip = new Label( tp );
		tooltip.setBorder( new MarginBorder( 0, 2, 0, 2 ) );
		setToolTip( tooltip );
	}

	setCursor( Cursors.ARROW );
}
 
Example 4
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 5
Source File: FunnyStyleSupport.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void addColumnGroup(GroupColumnFigure columnFigure, int viewMode,
        String name, boolean isAdded, boolean isUpdated, boolean isRemoved) {
    columnFigure.setBorder(new MarginBorder(new Insets(1, 0, 1, 0)));

    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(0, 4, 0, 7)));
    image.setImage(Activator.getImage(ImageKey.GROUP));
    columnFigure.add(image);

    final StringBuilder text = new StringBuilder();
    text.append(name);
    text.append(" (GROUP)");

    setColumnFigureColor(columnFigure, false, false, isAdded, isUpdated, isRemoved);

    final Label label = createColumnLabel();

    label.setForegroundColor(ColorConstants.black);
    label.setLabelAlignment(PositionConstants.RIGHT);
    label.setBorder(new MarginBorder(new Insets(1, 3, 0, 4)));

    label.setText(text.toString());

    columnFigure.add(label);
}
 
Example 6
Source File: FunnyStyleSupport.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void addIndex(IndexFigure indexFigure, String name, boolean isFirst) {
    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(0, 0, 0, 19)));
    image.setImage(Activator.getImage(ImageKey.BLANK_WHITE));
    image.setOpaque(true);
    indexFigure.add(image);

    final StringBuilder text = new StringBuilder();
    text.append(name);
    final Label label = createColumnLabel();
    label.setBorder(new MarginBorder(new Insets(1, 0, 0, 4)));
    label.setForegroundColor(ColorConstants.black);
    label.setText(text.toString());

    indexFigure.add(label);
}
 
Example 7
Source File: FunnyStyleSupport.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
@Override
	public void addColumnGroup(GroupColumnFigure columnFigure, int viewMode,
			String name, boolean isAdded, boolean isUpdated, boolean isRemoved) {

		columnFigure.setBorder(new MarginBorder(new Insets(1, 0, 1, 0)));

		ImageFigure image = new ImageFigure();
		image.setBorder(new MarginBorder(new Insets(0, 4, 0, 7)));
		image.setImage(Activator.getImage(ImageKey.GROUP));
		columnFigure.add(image);

//		Label filler = new Label();
//		filler.setBorder(new MarginBorder(new Insets(0, 0, 0, 16)));
//		filler.setBorder(new MarginBorder(new Insets(0, 0, 0, 6)));
//		columnFigure.add(filler);

//		filler = new Label();
//		filler.setBorder(new MarginBorder(new Insets(0, 0, 0, 16)));
//		columnFigure.add(filler);

		StringBuilder text = new StringBuilder();
		text.append(name);
		text.append(" (GROUP)");

		this.setColumnFigureColor(columnFigure, false, false, isAdded,
				isUpdated, isRemoved);

		Label label = this.createColumnLabel();

		label.setForegroundColor(ColorConstants.black);
		label.setLabelAlignment(PositionConstants.RIGHT);
		label.setBorder(new MarginBorder(new Insets(1, 3, 0, 4)));

		label.setText(text.toString());

		columnFigure.add(label);
	}
 
Example 8
Source File: FunnyStyleSupport.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
@Override
protected Label createColumnLabel() {
	Label label = new Label();
	label.setBorder(new MarginBorder(new Insets(1, 5, 1, 5)));
	label.setLabelAlignment(PositionConstants.LEFT);
	return label;
}
 
Example 9
Source File: AbstractStyleSupport.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
protected Label createColumnLabel() {
	Label label = new Label();
	label.setBorder(new MarginBorder(new Insets(3, 5, 3, 5)));
	label.setLabelAlignment(PositionConstants.LEFT);

	return label;
}
 
Example 10
Source File: ListBandControlFigure.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public ListBandControlFigure( ListBandEditPart owner )
{
	this.owner = owner;

	String tp = getTooltipText( );
	if ( tp != null )
	{
		Label tooltip = new Label( tp );
		tooltip.setBorder( new MarginBorder( 0, 2, 0, 2 ) );
		setToolTip( tooltip );
	}
}
 
Example 11
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 12
Source File: IndexEditPart.java    From erflute with Apache License 2.0 5 votes vote down vote up
public void refreshTableColumns() {
    final ERDiagram diagram = getDiagram();
    final IndexFigure indexFigure = (IndexFigure) getFigure();
    final ERIndex index = (ERIndex) getModel();
    final int notationLevel = diagram.getDiagramContents().getSettings().getNotationLevel();

    final TableViewEditPart parent = (TableViewEditPart) getParent();
    final List<?> figures = parent.getContentPane().getChildren();
    boolean isFirst = false;
    if (!(figures.get(figures.size() - 1) instanceof IndexFigure)) {
        if (notationLevel != DiagramSettings.NOTATION_LEVLE_TITLE) {
            isFirst = true;
            parent.getContentPane().add(new GuideEditPart.GuideLineFigure());
            final Label indexHeader = new Label();
            indexHeader.setLabelAlignment(PositionConstants.LEFT);
            indexHeader.setText("<< index >>");
            indexHeader.setBorder(new MarginBorder(new Insets(4, 3, 0, 0)));

            parent.getContentPane().add(indexHeader);
        }
    }
    parent.getContentPane().add(figure);
    if (notationLevel != DiagramSettings.NOTATION_LEVLE_TITLE) {
        final TableFigure tableFigure = (TableFigure) parent.getFigure();

        addColumnFigure(diagram, tableFigure, indexFigure, index, isFirst, false);

        if (selected) {
            indexFigure.setBackgroundColor(ColorConstants.titleBackground);
            indexFigure.setForegroundColor(ColorConstants.titleForeground);
        }
    } else {
        indexFigure.clearLabel();
        return;
    }
}
 
Example 13
Source File: AbstractStyleSupport.java    From erflute with Apache License 2.0 5 votes vote down vote up
protected Label createColumnLabel() {
    final Label label = new Label();
    label.setBorder(new MarginBorder(new Insets(3, 5, 3, 5)));
    label.setLabelAlignment(PositionConstants.LEFT);

    return label;
}
 
Example 14
Source File: FunnyStyleSupport.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
protected Label createColumnLabel() {
    final Label label = new Label();
    label.setBorder(new MarginBorder(new Insets(1, 5, 1, 5)));
    label.setLabelAlignment(PositionConstants.LEFT);
    return label;
}
 
Example 15
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 16
Source File: AbstractStyleSupport.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
protected Label createColumnLabel() {
    final Label label = new Label();
    label.setBorder(new MarginBorder(new Insets(3, 5, 3, 5)));
    label.setLabelAlignment(PositionConstants.LEFT);

    return label;
}
 
Example 17
Source File: FunnyStyleSupport.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(final Figure top) {
    top.setLayoutManager(new BorderLayout());

    final Figure title = new Figure();
    top.add(title, BorderLayout.TOP);
    final FlowLayout titleLayout = new FlowLayout();
    titleLayout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
    title.setLayoutManager(titleLayout);

    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(5, 10, 5, 2)));
    image.setImage(ERDiagramActivator.getImage(getTableFigure().getImageKey()));
    title.add(image);

    nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(5, 0, 5, 20)));
    title.add(nameLabel);

    final Figure separater = new Figure();
    separater.setSize(-1, 1);
    separater.setBackgroundColor(ColorConstants.black);
    separater.setOpaque(true);

    top.add(separater, BorderLayout.BOTTOM);
}
 
Example 18
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 19
Source File: CategoryFigure.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public CategoryFigure(final String name) {
    setOpaque(true);

    final ToolbarLayout layout = new ToolbarLayout();
    setLayoutManager(layout);

    label = new Label();
    label.setText(name);
    label.setBorder(new MarginBorder(7));
    this.add(label);
}
 
Example 20
Source File: IndexEditPart.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public void refreshTableColumns(UpdatedNodeElement updated) {
		ERDiagram diagram = this.getDiagram();

		IndexFigure indexFigure = (IndexFigure) this.getFigure();

		Index index = (Index) this.getModel();

		if (diagram.isShowMainColumn()) {
			// �C���f�b�N�X�͏�ɕ\��
		}

		int notationLevel = diagram.getDiagramContents().getSettings().getNotationLevel();

		TableViewEditPart parent = (TableViewEditPart) this.getParent();
		List figures = parent.getContentPane().getChildren();
		boolean isFirst = false;
		if (! (figures.get(figures.size() - 1) instanceof IndexFigure)) {
			// Index �̐擪�̓{�[�_�[��t����
			if (notationLevel != Settings.NOTATION_LEVLE_TITLE) {
				isFirst = true;
				parent.getContentPane().add(new GuideEditPart.GuideLineFigure());
				Label indexHeader = new Label();
				indexHeader.setLabelAlignment(PositionConstants.LEFT);
				indexHeader.setText("<< index >>");
				indexHeader.setBorder(new MarginBorder(new Insets(4, 3, 0, 0)));

				parent.getContentPane().add(indexHeader);
			}
		}
		parent.getContentPane().add(figure);

		if (notationLevel != Settings.NOTATION_LEVLE_TITLE) {
			TableFigure tableFigure = (TableFigure) parent.getFigure();

//			List<NormalColumn> selectedReferencedColulmnList = this
//					.getSelectedReferencedColulmnList();
//			List<NormalColumn> selectedForeignKeyColulmnList = this
//					.getSelectedForeignKeyColulmnList();
//
//			boolean isSelectedReferenced = selectedReferencedColulmnList
//					.contains(index);
//			boolean isSelectedForeignKey = selectedForeignKeyColulmnList
//					.contains(index);
//
//			boolean isAdded = false;
//			boolean isUpdated = false;
//			if (updated != null) {
//				isAdded = updated.isAdded(index);
//				isUpdated = updated.isUpdated(index);
//			}
//
//			if ((notationLevel == Settings.NOTATION_LEVLE_KEY)
//					&& !index.isPrimaryKey()
//					&& !index.isForeignKey()
//					&& !index.isReferedStrictly()) {
//				indexFigure.clearLabel();
//				return;
//			}

			addColumnFigure(diagram, tableFigure, indexFigure, index,
					isFirst,
					/* isSelectedReferenced, isSelectedForeignKey, isAdded, isUpdated, */
					false);

			if (selected) {
				indexFigure.setBackgroundColor(ColorConstants.titleBackground);
				indexFigure.setForegroundColor(ColorConstants.titleForeground);
			}

		} else {
			indexFigure.clearLabel();
			return;
		}
	}