Java源码示例:org.eclipse.draw2d.LayoutManager
示例1
/**
* 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;
}
}
}
示例2
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;
}
示例3
/**
* 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);
}
示例4
@Override
protected LayoutManager createLayoutManager() {
return new SequenceLayout();
}
示例5
@Override
protected LayoutManager createLayoutManager() {
return new ParallelLayout(ILayoutConstants.CONNECTION_RADIUS);
}
示例6
@Override
protected LayoutManager createLayoutManager() {
ToolbarLayout layout = new ToolbarLayout();
layout.setSpacing(ILayoutConstants.VSPACE_BETWEEN_TRACKS);
return layout;
}
示例7
@Override
protected LayoutManager createLayoutManager() {
return new SequenceLayout(ILayoutConstants.MIN_SEGMENT_HEIGHT);
}
示例8
@Override
protected LayoutManager createLayoutManager() {
return new SequenceLayout();
}
示例9
@Override
protected LayoutManager createLayoutManager() {
return new SequenceLayout();
}
示例10
@Override
protected LayoutManager createLayoutManager() {
return new ParallelLayout();
}
示例11
@Override
protected LayoutManager createLayoutManager() {
return new CompartmentLayout();
}
示例12
@Override
protected LayoutManager createLayoutManager() {
return new ParallelLayout();
}
示例13
protected LayoutManager getLayoutManager() {
return new StackLayout();
}
示例14
protected abstract LayoutManager createLayoutManager();