org.eclipse.draw2d.LayoutManager Java Examples

The following examples show how to use org.eclipse.draw2d.LayoutManager. 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: RootFigure.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Delete a cursor.
 *
 * @param cursor
 *            cursor to delete
 */
public void deleteCursor(ICursor cursor) {
	final IFigure cursorLayer = getFigure(this, CursorLayer.class);
	final LayoutManager layoutManager = cursorLayer.getLayoutManager();
	for (final Object child : cursorLayer.getChildren()) {
		if (cursor.equals(layoutManager.getConstraint((IFigure) child))) {
			deleteCursorFigure((CursorFigure) child);

			for (final ICursorListener listener : fCursorListener) {
				try {
					listener.notifyCursorDeleted(cursor);
				} catch (final Throwable t) {
					// silently ignore
				}
			}

			break;
		}
	}
}
 
Example #2
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 #3
Source File: VerticalLabel.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invalidate should be called whenever visual attributes change
 */
public void invalidate() {
    disposeImage();
    prefSize = null;
    // minSize = null;
    LayoutManager manager = getLayoutManager();
    if (manager != null) {
        manager.invalidate();
    }
    setValid(false);
}
 
Example #4
Source File: RailroadTrack.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	return new SequenceLayout();
}
 
Example #5
Source File: LoopSegment.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	return new ParallelLayout(ILayoutConstants.CONNECTION_RADIUS);
}
 
Example #6
Source File: RailroadDiagram.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	ToolbarLayout layout = new ToolbarLayout();
	layout.setSpacing(ILayoutConstants.VSPACE_BETWEEN_TRACKS);
	return layout;
}
 
Example #7
Source File: CrossPointSegment.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	return new SequenceLayout(ILayoutConstants.MIN_SEGMENT_HEIGHT);
}
 
Example #8
Source File: SequenceSegment.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	return new SequenceLayout();
}
 
Example #9
Source File: NodeSegment.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	return new SequenceLayout();
}
 
Example #10
Source File: ParallelSegment.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	return new ParallelLayout();
}
 
Example #11
Source File: CompartmentSegment.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	return new CompartmentLayout();
}
 
Example #12
Source File: BypassSegment.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected LayoutManager createLayoutManager() {
	return new ParallelLayout();
}
 
Example #13
Source File: FixedSizeShapeNodeEditPart.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
protected LayoutManager getLayoutManager() {
	return new StackLayout();
}
 
Example #14
Source File: AbstractSegmentFigure.java    From xtext-eclipse with Eclipse Public License 2.0 votes vote down vote up
protected abstract LayoutManager createLayoutManager();