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

The following examples show how to use org.eclipse.draw2d.Label#setForegroundColor() . 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: EventFigure.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public EventFigure(ITimelineEvent event) {

		final ToolbarLayout layout = new ToolbarLayout(false);
		layout.setMinorAlignment(OrderedLayout.ALIGN_CENTER);
		layout.setStretchMinorAxis(true);
		setLayoutManager(layout);
		setLayoutManager(new CenterLayout());

		setLineWidth(2);

		fLabel = new Label(event.getTitle());
		fLabel.setForegroundColor(ColorConstants.black);
		add(fLabel);

		if (event.getMessage() != null)
			setToolTip(new EventTooltip(event.getMessage()));
	}
 
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: 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 4
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 5
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 6
Source File: CursorTimingsLayer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public CursorLabel(String text) {
	setLayoutManager(new StackLayout());

	setForegroundColor(ColorConstants.yellow);
	setBackgroundColor(ColorConstants.yellow);
	setOpaque(true);

	setCornerDimensions(new Dimension(5, 5));

	setBorder(new MarginBorder(VERTICAL_INDENT, HORIZONTAL_INDENT, VERTICAL_INDENT, HORIZONTAL_INDENT));
	final Label label = new Label(text);
	label.setForegroundColor(ColorConstants.black);
	add(label);
}
 
Example 7
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 8
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 9
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 10
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 11
Source File: StatisticFigure.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private Label initLabel(String text) {
	Label textLabel = new Label(text + ":");
	textLabel.setForegroundColor(ColorConstants.blue);
	Label valueLabel = new Label("0");
	valueLabel.setForegroundColor(ColorConstants.black);
	add(textLabel);
	add(valueLabel);
	return valueLabel;
}
 
Example 12
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 13
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 14
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 15
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);
}
 
Example 16
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 17
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 18
Source File: AbstractStyleSupport.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
@Override
public void addColumnGroup(final GroupColumnFigure columnFigure, final int viewMode, final String name, final boolean isAdded, final boolean isUpdated, final 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: FrameStyleSupport.java    From ermasterr with Apache License 2.0 3 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)");
        }
    }

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

    label.setText(text.toString());

    columnFigure.add(label);
}