org.eclipse.draw2d.FreeformLayer Java Examples

The following examples show how to use org.eclipse.draw2d.FreeformLayer. 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: 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 #2
Source File: MenuEventFigure.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public MenuEventFigure(final FreeformLayer parent ,final Map<IElementType, Command> createCmds) {
    super();
    allElements = new ArrayList<IFigure>();
    figureList = new ArrayList<List<IFigure>>();
    registeredListeners = new ArrayList<IEventSelectionListener>();
    this.parent = parent ;
    this.createCmds = createCmds ;
    processPaletteLabelProvider = new ProcessPaletteLabelProvider();
    addEventsFigure(addNoneEventFigures());
    addEventsFigure(addMessageEventFigures());
    addEventsFigure(addTimerEventFigures());
    addEventsFigure(addSignalEventFigures());
    addEventsFigure(addLinkEventFigures());
    addEventsFigure(addErrorEventFigures());
    addEventsFigure(addTerminatedEventFigures());

}
 
Example #3
Source File: ERDiagramEditPart.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    final FreeformLayer layer = new FreeformLayer();
    layer.setLayoutManager(new FreeformLayout());

    return layer;
}
 
Example #4
Source File: CrosstabTableEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the top-most set of layers on the given layered pane.
 * 
 * @param layeredPane
 *            the parent for the created layers
 */
protected void createLayers( LayeredPane layeredPane )
{
	Figure figure = new FreeformLayer( );
	figure.setOpaque( false );
	layeredPane.add( figure, CELL_HANDLE_LAYER );
	layeredPane.add( getPrintableLayers( ), PRINTABLE_LAYERS );
	layeredPane.add( new FreeformLayer( ), HANDLE_LAYER );
	layeredPane.add( new GuideLayer( ), GUIDE_LAYER );
}
 
Example #5
Source File: CubeEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected IFigure createFigure( )
{
	Figure f = new FreeformLayer( );
	f.setLayoutManager( new FreeformLayout( ) );
	f.setBorder( new MarginBorder( 5 ) );
	return f;
}
 
Example #6
Source File: TableEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the top-most set of layers on the given layered pane.
 * 
 * @param layeredPane
 *            the parent for the created layers
 */
protected void createLayers( LayeredPane layeredPane )
{
	layeredPane.add( createGridLayer( ), GRID_LAYER );
	layeredPane.add( getPrintableLayers( ), PRINTABLE_LAYERS );
	layeredPane.add( new FreeformLayer( ), HANDLE_LAYER );
	layeredPane.add( new GuideLayer( ), GUIDE_LAYER );
}
 
Example #7
Source File: AbstractTableEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a layered pane and the layers that should be printed.
 * 
 * @see org.eclipse.gef.print.PrintGraphicalViewerOperation
 * @return a new LayeredPane containing the printable layers
 */
protected LayeredPane createPrintableLayers( )
{
	FreeformLayeredPane layeredPane = new FreeformLayeredPane( );
	FreeformLayer layer = new FreeformLayer( );

	layer.setLayoutManager( new TableLayout( this ) );
	layeredPane.add( layer, PRIMARY_LAYER );
	layeredPane.add( new TableBorderLayer( this ), BORDER_LAYER );
	return layeredPane;
}
 
Example #8
Source File: ReportRootEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @see FreeformGraphicalRootEditPart#createLayers(LayeredPane)
 */
protected void createLayers( LayeredPane layeredPane )
{
	layeredPane.add( getScaledLayers( ), SCALABLE_LAYERS );

	layeredPane.add( new FreeformLayer( ), HANDLE_LAYER );
	layeredPane.add( new FeedbackLayer( ), FEEDBACK_LAYER );
	layeredPane.add( new GuideLayer( ), GUIDE_LAYER );
}
 
Example #9
Source File: ERDiagramEditPart.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
	FreeformLayer layer = new FreeformLayer();
	layer.setLayoutManager(new FreeformLayout());

	return layer;
}
 
Example #10
Source File: ERModelEditPart.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
@Override
	protected IFigure createFigure() {
//		ERModel ermodel = (ERModel) this.getModel();
//		ERModelFigure figure = new ERModelFigure(ermodel.getName());
//		return figure;

		FreeformLayer layer = new FreeformLayer();
		layer.setLayoutManager(new FreeformLayout());
		return layer;
	}
 
Example #11
Source File: SCTRenderedDiagramRootEditPart.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createLayers(LayeredPane layeredPane) {
	super.createLayers(layeredPane);
	layeredPane.add(new FreeformLayer(), WATERMARK_LAYER);
}
 
Example #12
Source File: ERDiagramEditPart.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
protected IFigure createFigure() {
    final FreeformLayer layer = new FreeformLayer();
    layer.setLayoutManager(new FreeformLayout());
    return layer;
}
 
Example #13
Source File: ERVirtualDiagramEditPart.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
protected IFigure createFigure() {
    final FreeformLayer layer = new FreeformLayer();
    layer.setLayoutManager(new FreeformLayout());
    return layer;
}
 
Example #14
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;
}