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

The following examples show how to use org.eclipse.draw2d.Label#setText() . 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: 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 3
Source File: IDEF1XZeroOneSourceDecoration.java    From erflute with Apache License 2.0 6 votes vote down vote up
public IDEF1XZeroOneSourceDecoration() {
    super();

    final PointList pointList = new PointList();

    pointList.addPoint(-1, 0);
    pointList.addPoint(-8, -7);
    pointList.addPoint(-15, 0);
    pointList.addPoint(-8, 7);
    pointList.addPoint(-1, 0);

    setTemplate(pointList);
    setScale(1, 1);

    final Label label = new Label();
    label.setText("Z");

    add(label);
}
 
Example 4
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 5
Source File: FrameStyleSupport.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
public void addColumn(ERTable table, NormalColumn normalColumn, NormalColumnFigure columnFigure, int viewMode, String physicalName,
        String logicalName, String type, boolean primaryKey, boolean foreignKey, boolean isNotNull, boolean uniqueKey,
        boolean displayKey, boolean displayDetail, boolean displayType, boolean isSelectedReferenced, boolean isSelectedForeignKey,
        boolean isAdded, boolean isUpdated, boolean isRemoved) {

    final Label label = createColumnLabel();
    label.setForegroundColor(getTextColor());

    final StringBuilder text = new StringBuilder();
    text.append(getColumnText(table, normalColumn, viewMode, physicalName, logicalName,
            type, isNotNull, uniqueKey, displayDetail, displayType));

    if (displayKey) {
        if (primaryKey && foreignKey) {
            label.setForegroundColor(ColorConstants.blue);

            text.append(" ");
            text.append("(PFK)");
        } else if (primaryKey) {
            label.setForegroundColor(ColorConstants.red);

            text.append(" ");
            text.append("(PK)");
        } else if (foreignKey) {
            label.setForegroundColor(ColorConstants.darkGreen);

            text.append(" ");
            text.append("(FK)");
        }
    }

    setColumnFigureColor(columnFigure, isSelectedReferenced, isSelectedForeignKey, isAdded, isUpdated, isRemoved);

    label.setText(text.toString());

    columnFigure.add(label);
}
 
Example 6
Source File: SimpleStyleSupport.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
public void addColumn(ERTable table, NormalColumn normalColumn, NormalColumnFigure columnFigure, int viewMode, String physicalName,
        String logicalName, String type, boolean primaryKey, boolean foreignKey, boolean isNotNull, boolean uniqueKey,
        boolean displayKey, boolean displayDetail, boolean displayType, boolean isSelectedReferenced, boolean isSelectedForeignKey,
        boolean isAdded, boolean isUpdated, boolean isRemoved) {
    final Label label = createColumnLabel();
    label.setForegroundColor(getTextColor());

    final StringBuilder text = new StringBuilder();
    text.append(getColumnText(table, normalColumn, viewMode, physicalName, logicalName,
            type, isNotNull, uniqueKey, displayDetail, displayType));

    if (displayKey) {
        if (primaryKey && foreignKey) {
            label.setForegroundColor(ColorConstants.blue);

            text.append(" ");
            text.append("(PFK)");
        } else if (primaryKey) {
            label.setForegroundColor(ColorConstants.red);

            text.append(" ");
            text.append("(PK)");
        } else if (foreignKey) {
            label.setForegroundColor(ColorConstants.darkGreen);

            text.append(" ");
            text.append("(FK)");
        }
    }

    label.setText(text.toString());

    setColumnFigureColor(columnFigure, isSelectedReferenced, isSelectedForeignKey, isAdded, isUpdated, isRemoved);

    columnFigure.add(label);
}
 
Example 7
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 8
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 9
Source File: SimpleStyleSupport.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
@Override
public void addColumn(final NormalColumnFigure columnFigure, final int viewMode, final String physicalName, final String logicalName, final String type, final boolean primaryKey, final boolean foreignKey, final boolean isNotNull, final boolean uniqueKey, final boolean displayKey, final boolean displayDetail, final boolean displayType, final boolean isSelectedReferenced, final boolean isSelectedForeignKey, final boolean isAdded, final boolean isUpdated, final boolean isRemoved) {
    final Label label = createColumnLabel();
    label.setForegroundColor(getTextColor());

    final StringBuilder text = new StringBuilder();
    text.append(getColumnText(viewMode, physicalName, logicalName, type, isNotNull, uniqueKey, displayDetail, displayType));

    if (displayKey) {
        if (primaryKey && foreignKey) {
            label.setForegroundColor(ColorConstants.blue);

            text.append(" ");
            text.append("(PFK)");

        } else if (primaryKey) {
            label.setForegroundColor(ColorConstants.red);

            text.append(" ");
            text.append("(PK)");

        } else if (foreignKey) {
            label.setForegroundColor(ColorConstants.darkGreen);

            text.append(" ");
            text.append("(FK)");
        }
    }

    label.setText(text.toString());

    setColumnFigureColor(columnFigure, isSelectedReferenced, isSelectedForeignKey, isAdded, isUpdated, isRemoved);

    columnFigure.add(label);
}
 
Example 10
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);
}
 
Example 11
Source File: ProcessTextSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void updateLabel(Label target) {
	Label source = (Label) getHostFigure();
	target.setText(source.getText());
	target.setTextAlignment(source.getTextAlignment());
	target.setFont(source.getFont());
}
 
Example 12
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 13
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 14
Source File: CrossflowTextNonResizableEditPolicy.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void updateLabel(Label target) {
	Label source = (Label) getHostFigure();
	target.setText(source.getText());
	target.setTextAlignment(source.getTextAlignment());
	target.setFont(source.getFont());
}
 
Example 15
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 16
Source File: CursorTimingsLayer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void setText(String text) {
	final Label label = (Label) getChildren().get(0);
	label.setText(text);
}
 
Example 17
Source File: FrameStyleSupport.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public void addColumn(ERTable table, NormalColumn normalColumn, NormalColumnFigure columnFigure, int viewMode,
		String physicalName, String logicalName, String type,
		boolean primaryKey, boolean foreignKey, boolean isNotNull,
		boolean uniqueKey, boolean displayKey, boolean displayDetail,
		boolean displayType, boolean isSelectedReferenced,
		boolean isSelectedForeignKey, boolean isAdded, boolean isUpdated,
		boolean isRemoved) {

	Label label = this.createColumnLabel();

	label.setForegroundColor(this.getTextColor());

	StringBuilder text = new StringBuilder();
	text.append(this.getColumnText(table, normalColumn, viewMode, physicalName, logicalName,
			type, isNotNull, uniqueKey, displayDetail, displayType));

	if (displayKey) {
		if (primaryKey && foreignKey) {
			label.setForegroundColor(ColorConstants.blue);

			text.append(" ");
			text.append("(PFK)");

		} else if (primaryKey) {
			label.setForegroundColor(ColorConstants.red);

			text.append(" ");
			text.append("(PK)");

		} else if (foreignKey) {
			label.setForegroundColor(ColorConstants.darkGreen);

			text.append(" ");
			text.append("(FK)");
		}
	}

	this.setColumnFigureColor(columnFigure, isSelectedReferenced,
			isSelectedForeignKey, isAdded, isUpdated, isRemoved);

	label.setText(text.toString());

	columnFigure.add(label);
}
 
Example 18
Source File: AbstractStyleSupport.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
public void addColumnGroup(GroupColumnFigure columnFigure, int viewMode, String name, boolean isAdded, boolean isUpdated,
        boolean isRemoved) {

    final Label label = createColumnLabel();

    label.setForegroundColor(getTextColor());

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

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

    label.setText(text.toString());

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

	Label label = this.createColumnLabel();

	label.setForegroundColor(this.getTextColor());

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

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

	label.setText(text.toString());

	columnFigure.add(label);
}
 
Example 20
Source File: SimpleStyleSupport.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public void addColumn(ERTable table, NormalColumn normalColumn, NormalColumnFigure columnFigure, int viewMode,
		String physicalName, String logicalName, String type,
		boolean primaryKey, boolean foreignKey, boolean isNotNull,
		boolean uniqueKey, boolean displayKey, boolean displayDetail,
		boolean displayType, boolean isSelectedReferenced,
		boolean isSelectedForeignKey, boolean isAdded, boolean isUpdated,
		boolean isRemoved) {
	Label label = this.createColumnLabel();
	label.setForegroundColor(this.getTextColor());

	StringBuilder text = new StringBuilder();
	text.append(this.getColumnText(table, normalColumn, viewMode, physicalName, logicalName,
			type, isNotNull, uniqueKey, displayDetail, displayType));

	if (displayKey) {
		if (primaryKey && foreignKey) {
			label.setForegroundColor(ColorConstants.blue);

			text.append(" ");
			text.append("(PFK)");

		} else if (primaryKey) {
			label.setForegroundColor(ColorConstants.red);

			text.append(" ");
			text.append("(PK)");

		} else if (foreignKey) {
			label.setForegroundColor(ColorConstants.darkGreen);

			text.append(" ");
			text.append("(FK)");
		}
	}

	label.setText(text.toString());

	this.setColumnFigureColor(columnFigure, isSelectedReferenced,
			isSelectedForeignKey, isAdded, isUpdated, isRemoved);

	columnFigure.add(label);
}