org.eclipse.draw2d.LayeredPane Java Examples

The following examples show how to use org.eclipse.draw2d.LayeredPane. 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: GenericLevelPresets.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected IFigure createMain ()
{
    final Figure baseFigure = new LayeredPane ();

    final Layer rootFigure = new Layer ();

    this.connLayer = new ConnectionLayer ();
    this.connLayer.setAntialias ( 1 );
    this.connLayer.setConnectionRouter ( ConnectionRouter.NULL );

    baseFigure.add ( this.connLayer );
    baseFigure.add ( rootFigure );

    rootFigure.setLayoutManager ( new BorderLayout () );
    rootFigure.setBackgroundColor ( ColorConstants.white );

    rootFigure.add ( createArrowFigure (), BorderLayout.RIGHT );
    rootFigure.add ( createEntryGrid ( this.connLayer ), BorderLayout.CENTER );

    return baseFigure;
}
 
Example #2
Source File: AbstractBaseDraw2DDetailsPart.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
protected IFigure createRoot ()
{
    this.rootFigure = createMain ();
    this.naFigure = createNaPanel ();

    final Figure baseFigure = new LayeredPane ();

    baseFigure.add ( this.rootFigure );
    baseFigure.add ( this.naFigure );

    return baseFigure;
}
 
Example #3
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 #4
Source File: CrosstabTableEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * this layer may be a un-useful layer.
 * 
 * @return the layered pane containing all printable content
 */
protected LayeredPane getPrintableLayers( )
{
	if ( printableLayers == null )
		printableLayers = createPrintableLayers( );
	return printableLayers;
}
 
Example #5
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 #6
Source File: AbstractTableEditPart.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * this layer may be a un-useful layer.
 * 
 * @return the layered pane containing all printable content
 */
protected LayeredPane getPrintableLayers( )
{
	if ( printableLayers == null )
		printableLayers = createPrintableLayers( );
	return printableLayers;
}
 
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: MultipleLayout.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Dimension calculatePreferredSize( IFigure container, int wHint,
		int hHint )
{		
	Rectangle rect = container.getParent( ).getClientArea( ).getCopy( );
	List list = container.getChildren( );
	if (list.size( ) == 0)
	{
		return Dimension.SINGLETON;
	}
	
	Figure child = (Figure)list.get( 0 );
	
	wHint = Math.max( -1, wHint - container.getInsets( ).getWidth( ) );
	hHint = Math.max( -1, hHint - container.getInsets( ).getHeight( ) );
	
	wHint = Math.max( wHint,rect.width - container.getInsets( ).getWidth( ) );
	hHint = Math.max( hHint, rect.height - container.getInsets( ).getHeight( ) );
	
	if (child instanceof TableFigure && needlayout)
	{
		IFigure tablePane = ( (LayeredPane) ( (LayeredPane) ( (TableFigure) child ).getContents( ) ).getLayer( LayerConstants.PRINTABLE_LAYERS ) ).getLayer( LayerConstants.PRIMARY_LAYER );
		LayoutManager layoutManager = tablePane.getLayoutManager( );
		
		( (TableLayout) layoutManager ).markDirty( );
		container.getBounds( ).width = wHint;
		container.getBounds( ).height = hHint;
		//child.invalidateTree( );
		child.validate( );
		
		//dim = getPreferredSize( container, wHint, hHint ).expand( container.getInsets( ).getWidth( ), container.getInsets( ).getHeight( ) );;
		needlayout = false;
	}
	
	Dimension dim = child.getPreferredSize(wHint, hHint ).expand( container.getInsets( ).getWidth( ), container.getInsets( ).getHeight( ) );

	return dim;
}
 
Example #10
Source File: ManualOverride.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IFigure createMain ()
{
    final LayeredPane root = new LayeredPane ();

    final Layer figureLayer = new Layer ();
    figureLayer.setLayoutManager ( new FlowLayout () );

    final ConnectionLayer connectionLayer = new ConnectionLayer ();
    connectionLayer.setAntialias ( SWT.ON );

    final Figure figure = new Figure ();
    figureLayer.add ( figure );

    final GridLayout gridLayout = new GridLayout ( 3, true );
    gridLayout.horizontalSpacing = 50;
    gridLayout.verticalSpacing = 50;
    figure.setLayoutManager ( gridLayout );

    final Figure rpvFigure = createRPV ();
    final Figure pvFigure = createPV ();
    final Figure rmvFigure = createRMV ();
    final Figure mvFigure = createMV ();
    final Figure rvFigure = createRV ();

    figure.add ( rpvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 1 ) );
    figure.add ( pvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 2 ) );
    figure.add ( rvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 3 ) );

    figure.add ( rmvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 1 ) );

    figure.add ( mvFigure, new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 1 ) );
    figure.add ( new Figure (), new GridData ( GridData.CENTER, GridData.CENTER, true, true, 1, 1 ) ); // placeholder

    connectionLayer.add ( this.p2rConnection = createConnection ( this.pvRect, this.rvRect ) );
    connectionLayer.add ( this.m2rConnection = createConnection ( this.mvRect, this.rvRect ) );

    connectionLayer.add ( this.rp2pConnection = createConnection ( this.rpvRect, this.pvRect ) );
    connectionLayer.add ( this.rm2pConnection = createConnection ( this.rmvRect, this.pvRect ) );

    root.add ( figureLayer );
    root.add ( connectionLayer );

    return root;
}
 
Example #11
Source File: SymbolReferenceController.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public SymbolReferenceController ( final SymbolController controller, final SymbolReference symbolReference, final BasicViewElementFactory factory, final ResourceManager manager, final FactoryContext factoryContext )
{
    if ( symbolReference.getZoom () != null )
    {
        this.figure = new org.eclipse.draw2d.ScalableLayeredPane ();
        ( (org.eclipse.draw2d.ScalableLayeredPane)this.figure ).setScale ( symbolReference.getZoom () );
    }
    else
    {
        this.figure = new LayeredPane ();
    }

    final Layer layer = new Layer ();
    layer.setLayoutManager ( new StackLayout () );

    layer.setOpaque ( false );
    this.figure.setOpaque ( false );

    this.figure.add ( layer );

    try
    {
        final SymbolLoader symbolLoader = factory.getRoot ();

        final Map<String, String> properties = new HashMap<String, String> ( convert ( symbolReference.getProperties () ) );
        createProperties ( controller, symbolReference, properties );

        final SymbolController childController = new SymbolController ( controller.getShell (), controller, symbolLoader, properties, controller.getScriptObjects (), factoryContext );

        final Symbol symbol = symbolLoader.loadSymbol ();
        final Controller elementController = factory.create ( childController, symbol.getRoot () );
        final IFigure rootFigure = elementController.getFigure ();
        layer.add ( rootFigure );

        final RGB color = org.eclipse.scada.vi.ui.draw2d.primitives.Helper.makeColor ( symbol.getBackgroundColor () );
        if ( color != null )
        {
            layer.setBackgroundColor ( manager.createColor ( color ) );
        }

        // register the symbol element controller
        controller.addElement ( symbolReference, elementController );
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to create symbol", e ); //$NON-NLS-1$
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.LOG );
        layer.add ( Helper.createErrorFigure ( e ) );
    }
}
 
Example #12
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 #13
Source File: TableFigure.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Dimension getMinimumSize( int wHint, int hHint )
{
	getContents( ).invalidate( );
	return ( (LayeredPane) ( (LayeredPane) getContents( ) ).getLayer( LayerConstants.PRINTABLE_LAYERS ) ).getLayer( LayerConstants.PRIMARY_LAYER )
			.getMinimumSize( wHint, hHint );
}