Java 类org.eclipse.draw2d.LayeredPane 实例源码

项目:neoscada    文件:GenericLevelPresets.java   
@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;
}
项目:OpenSPIFe    文件:AbstractTimelineDataEditPart.java   
protected void createLayers(LayeredPane layeredPane) {
    TickIntervalsFigure f = new TickIntervalsFigure();
    f.setLayoutManager(new DataLayerLayoutManager());
    f.setTickManager(getTimeline().getTickManager());
    layeredPane.add(f, "ticks");
    getViewer().registerLayer("ticks", f);

    Layer markerLayer = new Layer();
    markerLayer.setOpaque(false);
    markerLayer.setLayoutManager(new DataLayerLayoutManager());
    layeredPane.add(markerLayer, LAYER_DATA_MARKER_LAYER);
    getViewer().registerLayer(LAYER_DATA_MARKER_LAYER, markerLayer);

    IFigure primaryLayer = createPrimaryFigure();
    layeredPane.add(primaryLayer, LAYER_DATA_PRIMARY_LAYER);
    getViewer().registerLayer(LAYER_DATA_PRIMARY_LAYER, primaryLayer);
}
项目:neoscada    文件:AbstractBaseDraw2DDetailsPart.java   
protected IFigure createRoot ()
{
    this.rootFigure = createMain ();
    this.naFigure = createNaPanel ();

    final Figure baseFigure = new LayeredPane ();

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

    return baseFigure;
}
项目:OpenSPIFe    文件:AbstractTimelineDataEditPart.java   
@Override
protected IFigure createFigure() {
    LayeredPane layeredPane = new LayeredPane() { /* Inner class to aid debugging */ };
    layeredPane.setOpaque(false);
    layeredPane.setPreferredSize(computeFigureBounds());

    createLayers(layeredPane);

    return layeredPane;
}
项目:OpenSPIFe    文件:TreeTimelineDataEditPart.java   
@Override
protected void createLayers(LayeredPane layeredPane) {
    Layer rowsLayer = new Layer();
    rowsLayer.setLayoutManager(new XYLayout());
    rowsLayer.setOpaque(false);
    layeredPane.add(rowsLayer, LAYER_DATA_ROWS_LAYER);
    getViewer().registerLayer(LAYER_DATA_ROWS_LAYER, rowsLayer);
    super.createLayers(layeredPane);
}
项目:OpenSPIFe    文件:ChartDataEditPart.java   
@Override
protected void createLayers(LayeredPane layeredPane) {
    super.createLayers(layeredPane);
    legendLayer.setLayoutManager(new DataLayerLayoutManager());
    legendLayer.setOpaque(false);
    layeredPane.add(legendLayer, ChartFigureLegendLayer.ID);
    getViewer().registerLayer(ChartFigureLegendLayer.ID, legendLayer);
}
项目:gef-gwt    文件:ScalableFreeformRootEditPart.java   
/**
 * @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);
}
项目:gef-gwt    文件:FreeformGraphicalRootEditPart.java   
/**
 * 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 FeedbackLayer(), FEEDBACK_LAYER);
    layeredPane.add(new GuideLayer(), GUIDE_LAYER);
}
项目:gef-gwt    文件:FreeformGraphicalRootEditPart.java   
/**
 * 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();
    layeredPane.add(new FreeformLayer(), PRIMARY_LAYER);
    layeredPane.add(new ConnectionLayer(), CONNECTION_LAYER);
    return layeredPane;
}
项目:gef-gwt    文件:ScalableRootEditPart.java   
/**
 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
 */
protected IFigure createFigure() {
    Viewport viewport = createViewport();

    innerLayers = new LayeredPane();
    createLayers(innerLayers);

    viewport.setContents(innerLayers);
    return viewport;
}
项目:gef-gwt    文件:ScalableRootEditPart.java   
/**
 * 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(getScaledLayers(), SCALABLE_LAYERS);
    layeredPane.add(new Layer() {
        public Dimension getPreferredSize(int wHint, int hHint) {
            return new Dimension();
        }
    }, HANDLE_LAYER);
    layeredPane.add(new FeedbackLayer(), FEEDBACK_LAYER);
    layeredPane.add(new GuideLayer(), GUIDE_LAYER);
}
项目:birt    文件:CrosstabTableEditPart.java   
/**
 * 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 );
}
项目:birt    文件:CrosstabTableEditPart.java   
/**
 * 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;
}
项目:birt    文件:TableEditPart.java   
/**
 * 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 );
}
项目:birt    文件:AbstractTableEditPart.java   
/**
 * 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;
}
项目:birt    文件:AbstractTableEditPart.java   
/**
 * 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;
}
项目:birt    文件:ReportRootEditPart.java   
/**
 * @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 );
}
项目:birt    文件:MultipleLayout.java   
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;
}
项目:seg.jUCMNav    文件:GrlConnectionOnBottomRootEditPart.java   
/**
 * Overwrite this function and add the connection layer before the primary layer. This will make the nodes display on top of the connections.
 */
protected LayeredPane createPrintableLayers() {
    FreeformLayeredPane layeredPane = new FreeformLayeredPane();

    FreeformLayer comp = new FreeformLayer();
    comp.setLayoutManager(new FreeformLayout());

    layeredPane.add(comp, COMPONENT_LAYER);

    layeredPane.add(new FreeformLayer(), PRIMARY_LAYER);
    layeredPane.add(new ConnectionLayer(), CONNECTION_LAYER);
    return layeredPane;

}
项目:seg.jUCMNav    文件:UCMConnectionOnBottomRootEditPart.java   
/**
 * Overwrite this function and add the connection layer before the primary layer. This will make the nodes display on top of the connections.
 */
protected LayeredPane createPrintableLayers() {
    FreeformLayeredPane layeredPane = new FreeformLayeredPane();

    FreeformLayer comp = new FreeformLayer();
    comp.setLayoutManager(new FreeformLayout());

    layeredPane.add(comp, COMPONENT_LAYER);
    layeredPane.add(new ConnectionLayer(), CONNECTION_LAYER);
    layeredPane.add(new FreeformLayer(), PRIMARY_LAYER);
    return layeredPane;
}
项目:seg.jUCMNav    文件:CopyAction.java   
public static ImageData buildScreenshot(IWorkbenchPart part) {
    ImageData screenshot = null;

    if (part instanceof UCMNavMultiPageEditor) {
        UCMNavMultiPageEditor multi = (UCMNavMultiPageEditor) part;
        if (multi.getCurrentPage() != null) {
            UrnEditor editor = (UrnEditor) multi.getCurrentPage();
            LayeredPane pane = ((URNRootEditPart) (editor.getGraphicalViewer().getRootEditPart())).getScaledLayers();

            IFigure figure = pane;
            int w = figure.getSize().width;
            int h = figure.getSize().height;
            Image image = new Image(Display.getDefault(), w, h);

            GC gc = new GC(image);
            SWTGraphics graphics = new SWTGraphics(gc);
            graphics.translate(-pane.getBounds().x, -pane.getBounds().y);
            figure.paint(graphics);

            // TODO: Improve crop to make use of current selection.
            screenshot = ReportUtils.cropImage(image.getImageData());

            graphics.dispose();
            gc.dispose();
        }
    }
    return screenshot;
}
项目:relations    文件:RelationsRootEditPart.java   
@Override
protected LayeredPane createPrintableLayers() {
    final FreeformLayeredPane layeredPane = new FreeformLayeredPane();
    layeredPane.add(new ConnectionLayer(), CONNECTION_LAYER);
    layeredPane.add(new FreeformLayer(), PRIMARY_LAYER);
    return layeredPane;
}
项目:neoscada    文件:ManualOverride.java   
@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;
}
项目:neoscada    文件:SymbolReferenceController.java   
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 ) );
    }
}
项目:statecharts    文件:SCTRenderedDiagramRootEditPart.java   
@Override
protected void createLayers(LayeredPane layeredPane) {
    super.createLayers(layeredPane);
    layeredPane.add(new FreeformLayer(), WATERMARK_LAYER);
}
项目:OpenSPIFe    文件:TimelineRootEditPart.java   
@Override
protected void createLayers(LayeredPane layeredPane) {
    super.createLayers(layeredPane);
    layeredPane.add(new TimelineDataFeedbackLayer(), LAYER_FEEDBACK_DATA);
    layeredPane.add(new TimelineHeaderFeedbackLayer(), LAYER_FEEDBACK_HEADER);
}
项目:gef-gwt    文件:ScalableFreeformRootEditPart.java   
/**
 * Returns the scalable layers of this EditPart
 * 
 * @return LayeredPane
 */
protected LayeredPane getScaledLayers() {
    if (scaledLayers == null)
        scaledLayers = createScaledLayers();
    return scaledLayers;
}
项目:gef-gwt    文件:ScalableRootEditPart.java   
/**
 * Returns the scalable layers of this EditPart
 * 
 * @return LayeredPane
 */
protected LayeredPane getScaledLayers() {
    if (scaledLayers == null)
        scaledLayers = createScaledLayers();
    return scaledLayers;
}
项目:birt    文件:TableFigure.java   
public Dimension getMinimumSize( int wHint, int hHint )
{
    getContents( ).invalidate( );
    return ( (LayeredPane) ( (LayeredPane) getContents( ) ).getLayer( LayerConstants.PRINTABLE_LAYERS ) ).getLayer( LayerConstants.PRIMARY_LAYER )
            .getMinimumSize( wHint, hHint );
}
项目:seg.jUCMNav    文件:URNRootEditPart.java   
/**
 * Overridden to allow access from export image wizard.
 */
public LayeredPane getScaledLayers() {
    return super.getScaledLayers();
}
项目:seg.jUCMNav    文件:ReportWizard.java   
/**
 * Exports a diagram to a PDF file. Uses mapsToExport to find the editor and the preference store to build the file name.
 * 
 * @param diagram
 */
private void ExportDiagramtoPDF(IURNDiagram diagram) throws Exception {

    try {

        // given the export type, get the exporter id
        int imgtype = ReportPreferenceHelper.getPreferenceStore().getInt(ReportPreferenceHelper.PREF_REPORTYPE);
        String id = ReportExtensionPointHelper.getExporterFromLabelIndex(imgtype);

        // generate the path.
        Path genericPath = new Path(ReportPreferenceHelper.getPreferenceStore().getString(ReportPreferenceHelper.PREF_PATH));
        genericPath = (Path) genericPath.append("/" + ReportPreferenceHelper.getFilenamePrefix()); //$NON-NLS-1$
        genericPath = (Path) genericPath.addFileExtension(ReportExtensionPointHelper.getFilenameExtension(id));

        // get the simple editor
         UCMNavMultiPageEditor editor = (UCMNavMultiPageEditor) mapsToEditor.get(diagram);

        // get exporter
         IURNReport exporter = ReportExtensionPointHelper.getExporter(id);

         HashMap mapDiagrams = new HashMap();

        for (int i = 0; i < mapsToExport.size(); i++) {
            IURNDiagram diag = (IURNDiagram) mapsToExport.get(i);
            UrnEditor editor2 = ((UrnEditor) mapsToSpecificEditor.get(diag));
            LayeredPane pane = ((URNRootEditPart) (editor2.getGraphicalViewer().getRootEditPart())).getScaledLayers();
            mapDiagrams.put(diag, pane);
        }

       File f;

        if (ReportExtensionPointHelper.getFilenameExtension(id).equals("html")){ //$NON-NLS-1$
            String htmlIndex = ReportPreferenceHelper.getPreferenceStore().getString(ReportPreferenceHelper.PREF_PATH) + "/index.html"; //$NON-NLS-1$
            System.out.println(htmlIndex);
            f = new File(htmlIndex);
        }else{

            f = new File(genericPath.toString());
        }                      

        //if file already exists, launch warning 
        if(f.exists()){
            fileExists = true;
            Display.getDefault().syncExec(new Runnable() {public void run() {
            userChoice = MessageDialog.openQuestion(getShell(), Messages.getString("ReportWizard.OverwriteFile"), Messages.getString("ReportWizard.FileAlreadyExists")); //$NON-NLS-1$ //$NON-NLS-2$
            }
            });

        }else{
            fileExists = false;
        }

        if(!(fileExists) || userChoice){
exporter.export(editor.getModel(), mapDiagrams, genericPath.toOSString());
        }

    } catch (Exception e) {
        IStatus error = new Status(IStatus.ERROR, JUCMNavPlugin.PLUGIN_ID, 1, e.toString(), e);
        System.out.println( getStackTrace(e) );
        ErrorDialog.openError(getShell(), Messages.getString("ExportWizard.ErrorOccurred"), e.getMessage(), error); //$NON-NLS-1$
        return;

    }


}
项目:gef-gwt    文件:FreeformGraphicalRootEditPart.java   
/**
 * Returns the LayeredPane that should be used during printing. This layer
 * will be identified using {@link LayerConstants#PRINTABLE_LAYERS}.
 * 
 * @return the layered pane containing all printable content
 */
protected LayeredPane getPrintableLayers() {
    if (printableLayers == null)
        printableLayers = createPrintableLayers();
    return printableLayers;
}
项目:gef-gwt    文件:ScalableRootEditPart.java   
/**
 * Returns the LayeredPane that should be used during printing. This layer
 * will be identified using {@link LayerConstants#PRINTABLE_LAYERS}.
 * 
 * @return the layered pane containing all printable content
 */
protected LayeredPane getPrintableLayers() {
    if (printableLayers == null)
        printableLayers = createPrintableLayers();
    return printableLayers;
}