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

项目: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;
}
项目:neoscada    文件:XYContainerController.java   
public XYContainerController ( final SymbolController controller, final XYContainer element, final BasicViewElementFactory factory ) throws Exception
{
    this.figure = new Layer ();
    this.figure.setOpaque ( false );

    this.figure.setLayoutManager ( new XYLayout () );

    for ( final XYChild child : element.getChildren () )
    {
        final Controller elementController = factory.create ( controller, child.getElement () );
        final IFigure childFigure = elementController.getFigure ();

        final Rectangle rect = factory.create ( child.getPosition (), child.getDimension () );
        controller.addRawElement ( child.getName (), new XYChildController ( childFigure, rect ) );
        this.figure.add ( childFigure, rect );
    }

    controller.addElement ( element, this );
}
项目:neoscada    文件:BorderContainerController.java   
public BorderContainerController ( final SymbolController controller, final BorderContainer element, final BasicViewElementFactory factory ) throws Exception
{
    this.figure = new Layer ();
    this.figure.setOpaque ( false );

    this.figure.setLayoutManager ( this.layout = new BorderLayout () );

    this.layout.setHorizontalSpacing ( element.getHorizontalSpacing () );
    this.layout.setVerticalSpacing ( element.getVerticalSpacing () );

    for ( final BorderChild child : element.getChildren () )
    {
        final Controller elementController = factory.create ( controller, child.getElement () );
        final IFigure childFigure = elementController.getFigure ();

        controller.addRawElement ( child.getName (), new BorderChildController ( childFigure ) );

        this.figure.add ( childFigure, convert ( child.getAlignment () ) );
    }

    controller.addElement ( element, this );
}
项目:neoscada    文件:StackContainerController.java   
public StackContainerController ( final SymbolController controller, final StackContainer element, final BasicViewElementFactory factory ) throws Exception
{
    this.figure = new Layer ();
    this.figure.setOpaque ( false );

    this.figure.setLayoutManager ( this.layout = new StackLayout () );

    this.layout.setObserveVisibility ( true );

    for ( final Primitive child : element.getChildren () )
    {
        final Controller elementController = factory.create ( controller, child );
        final IFigure childFigure = elementController.getFigure ();

        controller.addRawElement ( child.getName (), elementController );

        this.figure.add ( childFigure );
    }

    controller.addElement ( element, this );
}
项目:neoscada    文件:BasicViewElementFactory.java   
public void createConnections ( final Layer layer, final SymbolController controller, final EList<Connection> connections )
{
    if ( connections == null )
    {
        return;
    }

    for ( final Connection connection : connections )
    {
        final Controller start = AdapterHelper.adapt ( controller.getElement ( connection.getStart () ), Controller.class );
        final Controller end = AdapterHelper.adapt ( controller.getElement ( connection.getEnd () ), Controller.class );

        if ( start != null && end != null )
        {
            final PolylineConnection c = new PolylineConnection ();
            c.setSourceAnchor ( new ChopboxAnchor ( start.getFigure () ) );
            c.setTargetAnchor ( new ChopboxAnchor ( end.getFigure () ) );
            c.setAntialias ( SWT.ON );
            layer.add ( c );
        }
    }
}
项目: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);
}
项目: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    文件:TreeTimelineDataEditPart.java   
@Override
protected Layer createPrimaryFigure() {
    Layer primaryLayer = new Layer();
    primaryLayer.setOpaque(false);
    primaryLayer.setLayoutManager(new ToolbarLayout(false));
    primaryLayer.setBackgroundColor(ColorConstants.white);
    return primaryLayer;
}
项目: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);
}
项目: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 ) );
    }
}