org.eclipse.draw2d.ToolbarLayout Java Examples

The following examples show how to use org.eclipse.draw2d.ToolbarLayout. 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 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 #2
Source File: SimpleStyleSupport.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(Figure top) {
	ToolbarLayout topLayout = new ToolbarLayout();

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

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

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

	top.add(separater);
}
 
Example #3
Source File: PMClassFigure.java    From JDeodorant with MIT License 6 votes vote down vote up
public PMClassFigure(String name, int numOfAttributes, int numOfMethods){
	this.numOfAttributes = numOfAttributes;
	this.numOfMethods= numOfMethods;
	this.name = name;
	Label classLabel = new Label(name , DecorationConstants.CLASS);
	Label infoLabel = new Label(" Number Of Methods: "+ numOfMethods + "\n Number Of Attributes: "+ numOfAttributes);
	originalTooltip.setLayoutManager(new ToolbarLayout());
	originalTooltip.add(classLabel);
	originalTooltip.add(infoLabel);
	setToolTip(originalTooltip);
	
	originalBorder.setColor(originalColor);
	setBorder(originalBorder);
	
	setBackgroundColor(originalColor);
}
 
Example #4
Source File: ClassFigure.java    From JDeodorant with MIT License 6 votes vote down vote up
public ClassFigure(String name, Color color) {
	ToolbarLayout layout = new ToolbarLayout();
	layout.setSpacing(5);
	setLayoutManager(layout);	
	setBorder(new CompoundBorder( new LineBorder(1), new MarginBorder(0, 0, 0, 0)));
	setBackgroundColor(color);
	setOpaque(true);

	Label className = new Label(name, DecorationConstants.CLASS);
	className.setToolTip(new Label(name));
	className.setFont(DecorationConstants.classFont);

	add(className);

	new ClassFigureMover(this);

}
 
Example #5
Source File: SimpleStyleSupport.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void initTitleBar(Figure top) {
    final ToolbarLayout topLayout = new ToolbarLayout();

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

    this.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 #6
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 #7
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 #8
Source File: AbstractStyleSupport.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
protected void initColumnArea(final IFigure columns) {
    final ToolbarLayout layout = new ToolbarLayout();
    layout.setMinorAlignment(OrderedLayout.ALIGN_TOPLEFT);
    layout.setStretchMinorAxis(true);
    layout.setSpacing(0);

    columns.setBorder(new MarginBorder(0, 2, 2, 2));
    columns.setLayoutManager(layout);

    columns.setBackgroundColor(null);
    columns.setOpaque(false);
}
 
Example #9
Source File: AbstractStyleSupport.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
protected void initColumnArea(IFigure columns) {
	ToolbarLayout layout = new ToolbarLayout();
	layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
	layout.setStretchMinorAxis(true);
	layout.setSpacing(0);

	columns.setBorder(new MarginBorder(0, 2, 2, 2));
	columns.setLayoutManager(layout);

	columns.setBackgroundColor(null);
	columns.setOpaque(false);
}
 
Example #10
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 #11
Source File: ERModelFigure.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public ERModelFigure(String name) {
	this.setOpaque(true);

	ToolbarLayout layout = new ToolbarLayout();
	this.setLayoutManager(layout);

	this.label = new Label();
	this.label.setText(name);
	this.label.setBorder(new MarginBorder(7));
	this.add(this.label);
}
 
Example #12
Source File: CategoryFigure.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public CategoryFigure(String name) {
	this.setOpaque(true);

	ToolbarLayout layout = new ToolbarLayout();
	this.setLayoutManager(layout);

	this.label = new Label();
	this.label.setText(name);
	this.label.setBorder(new MarginBorder(7));
	this.add(this.label);
}
 
Example #13
Source File: VGroupFigure.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public VGroupFigure(String name) {
	this.setOpaque(true);

	ToolbarLayout layout = new ToolbarLayout();
	this.setLayoutManager(layout);

	this.label = new Label();
	this.label.setText(name);
	this.label.setBorder(new MarginBorder(7));
	this.add(this.label);
}
 
Example #14
Source File: ImageTest.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private static void main() throws FileNotFoundException {
	// �f�t�H���gDisplay���g�p���ăV�F�����쐬
	try {
		shell.setSize(100, 100); // �V�F���̃T�C�Y���w��

		// �쐬�����V�F�����g�p����LightweightSystem�̍쐬
		LightweightSystem lws = new LightweightSystem(shell);

		// ���[�g�E�t�B�M���A�̍쐬
		IFigure panel = new Figure();
		panel.setLayoutManager(new ToolbarLayout());

		initialize(panel);

		// ���[�g�E�t�B�M���A�̓o�^
		lws.setContents(panel);

		// �ȉ��́A���̑���SWT�A�v���P�[�V�����Ɠ��l
		shell.open();

		Display display = Display.getDefault();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}

	} finally {
		if (image != null) {
			image.dispose();
		}
	}
}
 
Example #15
Source File: TableNodeFigure.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public TableNodeFigure( String name )
{
	ToolbarLayout mainLayout = new ToolbarLayout( );
	mainLayout.setStretchMinorAxis( true );
	mainLayout.setVertical( true );
	mainLayout.setSpacing( 1 );
	this.setLayoutManager( mainLayout );
	this.setOpaque( true );

}
 
Example #16
Source File: MethodClassSection.java    From JDeodorant with MIT License 5 votes vote down vote up
public MethodClassSection(){
	//setFont( Display.getCurrent().getSystemFont() ); 
	ToolbarLayout layout = new ToolbarLayout();
	layout.setSpacing(5);
	layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
	layout.setStretchMinorAxis(true);
	setLayoutManager(layout);

}
 
Example #17
Source File: TrackFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public TrackFigure(String title, ITimelineStyleProvider styleProvider) {

		fTitle = title;
		final ToolbarLayout layout = new ToolbarLayout(false);
		layout.setStretchMinorAxis(true);
		layout.setSpacing(5);
		setLayoutManager(layout);

		updateStyle(styleProvider);
	}
 
Example #18
Source File: AbstractStyleSupport.java    From erflute with Apache License 2.0 5 votes vote down vote up
protected void initColumnArea(IFigure columns) {
    final ToolbarLayout layout = new ToolbarLayout();
    layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
    layout.setStretchMinorAxis(true);
    layout.setSpacing(0);

    columns.setBorder(new MarginBorder(0, 2, 2, 2));
    columns.setLayoutManager(layout);

    columns.setBackgroundColor(null);
    columns.setOpaque(false);
}
 
Example #19
Source File: AbstractNode.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected AbstractNode(EObject eObject, String text, Font font, Region textRegion) {
	if (eObject != null)
		grammarElementURI = EcoreUtil.getURI(eObject);
	setLayoutManager(new ToolbarLayout());
	setBackgroundColor(getUnselectedBackgroundColor());
	label = new Label(text);
	add(label);
	setBorder(createBorder());
	setFont(font);
	this.textRegion = textRegion;
}
 
Example #20
Source File: WalkerGroupFigure.java    From erflute with Apache License 2.0 5 votes vote down vote up
public WalkerGroupFigure(String name) {
    setOpaque(true);

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

    this.label = new Label();
    label.setText(name);
    label.setBorder(new MarginBorder(7));
    add(label);
}
 
Example #21
Source File: ERModelFigure.java    From erflute with Apache License 2.0 5 votes vote down vote up
public ERModelFigure(String name) {
    setOpaque(true);

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

    this.label = new Label();
    label.setText(name);
    label.setBorder(new MarginBorder(7));
    add(label);
}
 
Example #22
Source File: CategoryFigure.java    From erflute with Apache License 2.0 5 votes vote down vote up
public CategoryFigure(String name) {
    setOpaque(true);

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

    this.label = new Label();
    label.setText(name);
    label.setBorder(new MarginBorder(7));
    add(label);
}
 
Example #23
Source File: ImageTest.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private static void main() throws FileNotFoundException {
    try {
        shell.setSize(100, 100);

        final LightweightSystem lws = new LightweightSystem(shell);

        final IFigure panel = new Figure();
        panel.setLayoutManager(new ToolbarLayout());

        initialize(panel);

        lws.setContents(panel);

        shell.open();

        final Display display = Display.getDefault();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }

    } finally {
        if (image != null) {
            image.dispose();
        }
    }
}
 
Example #24
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 #25
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 #26
Source File: CursorTimingsLayer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public CursorTimingsLayer() {
	setLayoutManager(new ToolbarLayout(false));

	setVisible(false);
}
 
Example #27
Source File: RailroadDiagram.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	ToolbarLayout layout = new ToolbarLayout();
	layout.setSpacing(ILayoutConstants.VSPACE_BETWEEN_TRACKS);
	return layout;
}
 
Example #28
Source File: CompartmentChildCreationEditPolicy.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected boolean isHorizontal() {
	IFigure figure = ((GraphicalEditPart)getHost()).getContentPane();
	return ((ToolbarLayout)figure.getLayoutManager()).isHorizontal();
}
 
Example #29
Source File: TracksLayer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public TracksLayer() {
	final ToolbarLayout layout = new ToolbarLayout(false);
	layout.setStretchMinorAxis(true);
	setLayoutManager(layout);
}