Java Code Examples for org.eclipse.gef.GraphicalEditPart#getFigure()

The following examples show how to use org.eclipse.gef.GraphicalEditPart#getFigure() . 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: ReportFlowLayoutEditPolicy.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Generates a draw2d constraint object derived from the specified child
 * EditPart using the provided Request. The returned constraint will be
 * translated to the application's model later using
 * {@link #translateToModelConstraint(Object)}.
 * 
 * @param request
 *            the ChangeBoundsRequest
 * @param child
 *            the child EditPart for which the constraint should be
 *            generated
 * @return the draw2d constraint
 */
protected Object getConstraintFor( ChangeBoundsRequest request,
		GraphicalEditPart child )
{
	IFigure figure = child.getFigure( );
	Rectangle rect = new PrecisionRectangle(figure.getBounds());
	figure.translateToAbsolute(rect);
	rect = request.getTransformedRectangle( rect );
	
	figure.translateToRelative(rect);
	rect.translate( getLayoutOrigin( ).getNegated( ) );
	if (figure instanceof IOutsideBorder)
	{
		Border border = ((IOutsideBorder)figure).getOutsideBorder( );
		if (border !=  null)
		{
			Insets insets = border.getInsets( figure );
			rect.shrink( insets.right, insets.bottom );
		}
	}

	return getConstraintFor( rect );
}
 
Example 2
Source File: CustomResizeHandle.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public CustomResizeHandle(GraphicalEditPart owner, int direction) {
	setOwner(owner);

	RelativeHandleLocator locator = new RelativeHandleLocator(owner.getFigure(), direction){
		protected Rectangle getReferenceBox() {
			IFigure f = getReferenceFigure();
			if (f instanceof HandleBounds){
				Rectangle r = ((HandleBounds) f).getHandleBounds() ;
				return r;
			}
			return super.getReferenceBox();
		}
	};

	setLocator(locator);
	setCursor(Cursors.getDirectionalCursor(direction, owner.getFigure()
			.isMirrored()));
	cursorDirection = direction;
}
 
Example 3
Source File: TableSelectionHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor
 * @param owner
 * @param rect
 */
public TableSelectionHandle( GraphicalEditPart owner, Rectangle rect )
{
	super( owner, new TableRelativeLocator( owner.getFigure( ), -1 ) );

	setOpaque( false );

	setPreferredSize( rect.getSize( ) );
	setLocation( rect.getLocation( ) );
	setSize( rect.getSize( ) );
	
	setBorder( new SelectionBorder(2) );
}
 
Example 4
Source File: ProcessPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent evt) {
	if (evt.getPropertyName().equals(ProcessNode.CONNECTION))
		refreshConnections(evt);
	else {
		GraphicalEditPart part = (GraphicalEditPart) getViewer().getContents();
		IFigure figure = part.getFigure();
		figure.revalidate();
	}
}
 
Example 5
Source File: MultipleGuideHandle.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param ref
 */
public MutipleLocator( GraphicalEditPart part )
{
	super( part.getFigure( ) );
}
 
Example 6
Source File: ListBandHandle.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param owner
 */
public ListBandHandle( GraphicalEditPart owner )
{
	super( owner, new ListBandLocator( owner.getFigure( ) ) );
	setBorder( new SelectionBorder( 2 ) );
}
 
Example 7
Source File: TableGuideHandle.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param ref
 */
public TableGuideHandleLocator( GraphicalEditPart part )
{
	super( part.getFigure( ) );
	setOwner( part );
}
 
Example 8
Source File: FigureDirectEditManager.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public FigureDirectEditManager( GraphicalEditPart source )
{
	super( source,
			TextCellEditor.class,
			new FigureCellEditorLocator( source.getFigure( ) ) );
}