org.eclipse.draw2d.XYLayout Java Examples

The following examples show how to use org.eclipse.draw2d.XYLayout. 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: XYContainerController.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
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 );
}
 
Example #2
Source File: CrosstabTableEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createEditPolicies( )
{
	installEditPolicy( EditPolicy.COMPONENT_ROLE,
			new ReportComponentEditPolicy( ) {

				public boolean understandsRequest( Request request )
				{
					if ( RequestConstants.REQ_DIRECT_EDIT.equals( request.getType( ) )
							|| RequestConstants.REQ_OPEN.equals( request.getType( ) )
							|| ReportRequest.CREATE_ELEMENT.equals( request.getType( ) ) )
						return true;
					return super.understandsRequest( request );
				}
			} );
	installEditPolicy( EditPolicy.CONTAINER_ROLE,
			new ReportContainerEditPolicy( ) );

	installEditPolicy( EditPolicy.LAYOUT_ROLE,
			new CrosstabXYLayoutEditPolicy( (XYLayout) getContentPane( ).getLayoutManager( ) ) );
}
 
Example #3
Source File: TableEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createEditPolicies( )
{
	installEditPolicy( EditPolicy.COMPONENT_ROLE,
			new ReportComponentEditPolicy( ) {

				public boolean understandsRequest( Request request )
				{
					if ( RequestConstants.REQ_DIRECT_EDIT.equals( request.getType( ) )
							|| RequestConstants.REQ_OPEN.equals( request.getType( ) )
							|| ReportRequest.CREATE_ELEMENT.equals( request.getType( ) ) )
						return true;
					return super.understandsRequest( request );
				}
			} );
	installEditPolicy( EditPolicy.CONTAINER_ROLE,
			new ReportContainerEditPolicy( ) );
	// should add highlight policy
	// installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
	// ContainerHighlightEditPolicy());
	installEditPolicy( EditPolicy.LAYOUT_ROLE,
			new TableXYLayoutEditPolicy( (XYLayout) getContentPane( ).getLayoutManager( ) ) );
}
 
Example #4
Source File: ImageTest.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private static Figure createContents() {
	Figure contents = new Figure();
	XYLayout layout = new XYLayout();
	contents.setLayoutManager(layout);

	Button button = new Button("Hello World");
	layout.setConstraint(button, new Rectangle(0, 0, -1, -1));
	contents.add(button);

	button.addActionListener(new ActionListener() {

		public void actionPerformed(ActionEvent actionevent) {
			setBrightness();
		}
	});

	String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg";
	image = new Image(Display.getDefault(), path);
	imageFigure = new ImageFigure(image);

	layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1));

	contents.add(imageFigure);

	return contents;
}
 
Example #5
Source File: ImageTest.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private static Figure createContents() {
    final Figure contents = new Figure();
    final XYLayout layout = new XYLayout();
    contents.setLayoutManager(layout);

    final Button button = new Button("Hello World");
    layout.setConstraint(button, new Rectangle(0, 0, -1, -1));
    contents.add(button);

    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent actionevent) {
            setBrightness();
        }
    });

    final String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg";
    image = new Image(Display.getDefault(), path);
    imageFigure = new ImageFigure(image);

    layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1));

    contents.add(imageFigure);

    return contents;
}
 
Example #6
Source File: CrosstabXYLayoutEditPolicy.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Constructor
 * 
 * @param layout
 */
public CrosstabXYLayoutEditPolicy( XYLayout layout )
{
	super( );
	setXyLayout( layout );
}
 
Example #7
Source File: CubeFigure.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public CubeFigure()
{
	setLayoutManager(new XYLayout());
}
 
Example #8
Source File: TableXYLayoutEditPolicy.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Constructor
 * 
 * @param layout
 */
public TableXYLayoutEditPolicy( XYLayout layout )
{
	super( );
	setXyLayout( layout );
}