use of org.eclipse.draw2d.ToolbarLayout in project jbosstools-hibernate by jbosstools.
the class OrmShapeEditPart method createFigure.
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
Object element = getElement();
TitleFigure figure = new TitleFigure();
figure.setLayoutManager(new ToolbarLayout());
String text = getOrmDiagram().getLabelProvider().getText(element);
figure.createTitle(text, getOrmDiagram().getLabelProvider().getImage(element), getColor(), getOrmDiagram().getFontHeight());
figure.setBackgroundColor(getBackgroundColor());
return figure;
}
use of org.eclipse.draw2d.ToolbarLayout in project jbosstools-hibernate by jbosstools.
the class NodeHeaderFigure method addTypeAndNameColumn.
private void addTypeAndNameColumn(String nodeType, String nodeName, boolean hideName) {
ToolbarLayout layout = new ToolbarLayout();
layout.setStretchMinorAxis(false);
layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
typeAndLabelColumn = new Figure();
typeAndLabelColumn.setLayoutManager(layout);
// addTypeLabel(nodeType);
if (!hideName) {
addNameLabel(nodeName);
}
embeddedFigure.add(typeAndLabelColumn);
}
use of org.eclipse.draw2d.ToolbarLayout in project webtools.sourceediting by eclipse.
the class CategoryEditPart method createFigure.
protected IFigure createFigure() {
outerPane = new Figure();
outerPane.setBorder(new RoundedLineBorder(1, 6));
createHeadingFigure();
int minHeight = SWT.DEFAULT;
switch(getType()) {
case CategoryAdapter.DIRECTIVES:
{
minHeight = 80;
break;
}
case CategoryAdapter.ATTRIBUTES:
case CategoryAdapter.GROUPS:
{
minHeight = 100;
break;
}
}
final int theMinHeight = minHeight;
ToolbarLayout outerLayout = new ToolbarLayout(false) {
protected Dimension calculatePreferredSize(IFigure parent, int width, int height) {
Dimension d = super.calculatePreferredSize(parent, width, height);
d.union(new Dimension(250, theMinHeight));
return d;
}
};
outerLayout.setStretchMinorAxis(true);
outerPane.setLayoutManager(outerLayout);
RectangleFigure line = new RectangleFigure() {
public Dimension getPreferredSize(int wHint, int hHint) {
Dimension d = super.getPreferredSize(wHint, hHint);
d.width += 20;
d.height = 1;
return d;
}
};
ToolbarLayout lineLayout = new ToolbarLayout(false);
lineLayout.setVertical(true);
lineLayout.setStretchMinorAxis(true);
line.setLayoutManager(lineLayout);
outerPane.add(line);
scrollpane = new ScrollPane();
// ScrollPane.ALWAYS);
scrollpane.setVerticalScrollBarVisibility(ScrollPane.AUTOMATIC);
outerPane.add(scrollpane);
Figure pane = new Figure();
pane.setBorder(new MarginBorder(5, 8, 5, 8));
ContainerLayout layout = new ContainerLayout();
layout.setHorizontal(false);
layout.setSpacing(0);
pane.setLayoutManager(layout);
Viewport viewport = new Viewport();
viewport.setContentsTracksHeight(true);
ViewportLayout viewportLayout = new ViewportLayout() {
protected Dimension calculatePreferredSize(IFigure parent, int width, int height) {
Dimension d = super.calculatePreferredSize(parent, width, height);
if (theMinHeight > 0)
d.height = Math.min(d.height, theMinHeight);
else {
double factor = getZoomManager().getZoom();
// adjust for other categories and spaces
int scaledHeight = (int) Math.round((getViewer().getControl().getBounds().height - minimumHeight) / factor);
d.height = Math.max(250, scaledHeight);
}
d.width = Math.min(d.width, 300);
return d;
}
};
viewport.setLayoutManager(viewportLayout);
scrollpane.setViewport(viewport);
scrollpane.setContents(pane);
return outerPane;
}
use of org.eclipse.draw2d.ToolbarLayout in project webtools.sourceediting by eclipse.
the class TypeVizFigureFactory method createCompartmentFigure.
public ICompartmentFigure createCompartmentFigure(Object model) {
CompartmentFigure figure = new CompartmentFigure();
figure.setBorder(new MarginBorder(1));
ToolbarLayout toolbarLayout = new ToolbarLayout(false);
toolbarLayout.setStretchMinorAxis(true);
figure.setLayoutManager(toolbarLayout);
return figure;
}
use of org.eclipse.draw2d.ToolbarLayout in project webtools.sourceediting by eclipse.
the class SectionEditPart method createFigure.
protected IFigure createFigure() {
Figure fig = new Figure();
fig.setLayoutManager(new ToolbarLayout());
return fig;
}
Aggregations