Java Code Examples for org.eclipse.draw2d.Figure#setBackgroundColor()

The following examples show how to use org.eclipse.draw2d.Figure#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: 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 2
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 3
Source File: HexagonalGridEditPart.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the root Figure for the Grid. This is a FreeformLayer that
 * contains a grid of labels and CellFigures.
 */
@Override
protected IFigure createFigure() {

	// Initialize the root figure. We use a FreeformLayer. FIXME - This was
	// in a few tutorials. We should find some links to explain why this is
	// important.
	Figure rootFigure = new FreeformLayer();
	rootFigure.setBackgroundColor(ColorConstants.white);
	rootFigure.setOpaque(true);

	// Set the layout of the root figure to our custom layout.
	Grid grid = ((Grid) getModel());
	HexagonalGridLayout layout = new HexagonalGridLayout(grid.rows,
			grid.columns);
	rootFigure.setLayoutManager(layout);

	// Get the layout's hexagonal PointList.
	hexagonPoints = layout.getPoints();

	return rootFigure;
}
 
Example 4
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 5
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 6
Source File: FunnyStyleSupport.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
public void initTitleBar(Figure top) {
    top.setLayoutManager(new BorderLayout());

    final FlowLayout layout = new FlowLayout();
    layout.setStretchMinorAxis(true);
    final Figure title = new Figure();
    top.add(title, BorderLayout.TOP);
    title.setLayoutManager(layout);

    title.setBorder(new MarginBorder(new Insets(2, 2, 2, 2)));

    final ImageFigure image = new ImageFigure();
    image.setBorder(new MarginBorder(new Insets(0, 0, 0, 0)));
    image.setImage(Activator.getImage(getTableFigure().getImageKey()));
    title.add(image);

    this.nameLabel = new Label();
    nameLabel.setBorder(new MarginBorder(new Insets(0, 0, 0, 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 7
Source File: CustomPaletteEditPartFactory.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected EditPart createMainPaletteEditPart(EditPart parentEditPart,
		Object model) {
	return new SliderPaletteEditPart((PaletteRoot) model){
		@Override
		public IFigure createFigure() {
			Figure figure = new Figure();
			figure.setOpaque(true);
			figure.setForegroundColor(ColorConstants.listForeground);
			figure.setBackgroundColor(ColorConstants.white);
			return figure;
		}
	};
}
 
Example 8
Source File: CustomSubprocessShapeCompartmentFigure.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected AnimatableScrollPane createScrollpane(IMapMode mm) {
	scrollPane = new AnimatableScrollPane() ;
	scrollPane.getViewport().setContentsTracksWidth(true);
	scrollPane.getViewport().setContentsTracksHeight(true);
	scrollPane.setLayoutManager(new OverlayScrollPaneLayout()) ;
	scrollPane.setVerticalScrollBarVisibility(ScrollPane.NEVER);
	scrollPane.setHorizontalScrollBarVisibility(ScrollPane.NEVER);
	Figure f = new Figure() ;
	f.setBackgroundColor(ColorConstants.red) ;
	scrollPane.setContents(f);
	scrollPane.getContents().setBorder(new MarginBorder(0,0,0,0));  
	return (AnimatableScrollPane)scrollPane;

}
 
Example 9
Source File: FunnyStyleSupport.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initTitleBar(Figure top) {
	top.setLayoutManager(new BorderLayout());

	FlowLayout layout = new FlowLayout();
	layout.setStretchMinorAxis(true);
	Figure title = new Figure();
	top.add(title, BorderLayout.TOP);
	title.setLayoutManager(layout);

	if (new BigDecimal("1.5").equals(getSettings().getTitleFontEm())) {
		title.setBorder(new MarginBorder(new Insets(2, 2, 2, 2)));
	} else {
		title.setBorder(new MarginBorder(new Insets(4, 4, 4, 4)));
	}

	ImageFigure image = new ImageFigure();
	image.setBorder(new MarginBorder(new Insets(0, 0, 0, 0)));
	image.setImage(Activator.getImage(this.getTableFigure().getImageKey()));
	title.add(image);

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

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

	top.add(separater, BorderLayout.BOTTOM);
}
 
Example 10
Source File: MethodClassSection.java    From JDeodorant with MIT License 4 votes vote down vote up
public void addFigure(Figure figure){
	this.add(figure);
	figure.setBackgroundColor(DecorationConstants.entityColor);
	figure.setBorder(new CompoundBorder( new LineBorder(1), new MarginBorder(3,3,3,3)));
	numOfMethods++;
}
 
Example 11
Source File: CircularGridEditPart.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the root Figure for the Grid. This is a FreeformLayer that
 * contains a grid of labels and CellFigures.
 */
@Override
protected IFigure createFigure() {

	// Initialize the root figure. We use a FreeformLayer. FIXME - This was
	// in a few tutorials. We should find some links to explain why this is
	// important.
	Figure rootFigure = new FreeformLayer() {
		// FIXME - We may be able to use one of these methods to force
		// anti-aliasing. This would avoid having to override the paint
		// behavior of child Figures.
		// @Override
		// protected void paintClientArea(Graphics graphics) {
		// logger.info("paintClientArea");
		// graphics.setAntialias(SWT.ON);
		// super.paintClientArea(graphics);
		// }
		// @Override
		// protected void paintFigure(Graphics graphics) {
		// logger.info("paintFigure");
		// graphics.setAntialias(SWT.ON);
		// super.paintFigure(graphics);
		// }
		// @Override
		// protected void paintChildren(Graphics graphics) {
		// logger.info("paintChildren");
		// graphics.setAntialias(SWT.ON);
		// super.paintChildren(graphics);
		// }
	};
	rootFigure.setBackgroundColor(ColorConstants.white);
	rootFigure.setOpaque(true);

	// Set the layout of the root figure to our custom layout.
	Grid grid = ((Grid) getModel());
	HexagonalGridLayout layout = new HexagonalGridLayout(grid.rows,
			grid.columns);
	rootFigure.setLayoutManager(layout);

	// We want the left and right sides of the circular cells to touch.
	layout.setRotated(true);

	// For the circular layout, we don't want the borders of the circular
	// cells to overlap.
	layout.setHorizontalSpacing(5);
	layout.setVerticalSpacing(5);
	// FIXME - The above spacings need to be more easily accessible!

	return rootFigure;
}