Search in sources :

Example 6 with ToolbarLayout

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;
}
Also used : TitleFigure(org.jboss.tools.hibernate.ui.diagram.editors.figures.TitleFigure) ToolbarLayout(org.eclipse.draw2d.ToolbarLayout)

Example 7 with ToolbarLayout

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);
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) Figure(org.eclipse.draw2d.Figure)

Example 8 with ToolbarLayout

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;
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) ContainerLayout(org.eclipse.wst.xsd.ui.internal.design.layouts.ContainerLayout) Viewport(org.eclipse.draw2d.Viewport) Dimension(org.eclipse.draw2d.geometry.Dimension) IFigure(org.eclipse.draw2d.IFigure) RectangleFigure(org.eclipse.draw2d.RectangleFigure) Figure(org.eclipse.draw2d.Figure) HeadingFigure(org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure) ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) RoundedLineBorder(org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.RoundedLineBorder) ScrollPane(org.eclipse.draw2d.ScrollPane) MarginBorder(org.eclipse.draw2d.MarginBorder) ViewportLayout(org.eclipse.draw2d.ViewportLayout) IFigure(org.eclipse.draw2d.IFigure)

Example 9 with ToolbarLayout

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;
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) MarginBorder(org.eclipse.draw2d.MarginBorder) ICompartmentFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure)

Example 10 with ToolbarLayout

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;
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) Figure(org.eclipse.draw2d.Figure) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)30 Figure (org.eclipse.draw2d.Figure)14 IFigure (org.eclipse.draw2d.IFigure)11 MarginBorder (org.eclipse.draw2d.MarginBorder)7 LineBorder (org.eclipse.draw2d.LineBorder)6 Rectangle (org.eclipse.draw2d.geometry.Rectangle)5 List (java.util.List)3 ImageFigure (org.eclipse.draw2d.ImageFigure)3 Label (org.eclipse.draw2d.Label)3 Panel (org.eclipse.draw2d.Panel)3 RectangleFigure (org.eclipse.draw2d.RectangleFigure)3 Dimension (org.eclipse.draw2d.geometry.Dimension)3 Point (org.eclipse.draw2d.geometry.Point)3 Image (org.eclipse.swt.graphics.Image)3 ECoreImage (org.talend.commons.ui.runtime.image.ECoreImage)3 SimpleHtmlFigure (org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)3 ScrollPane (org.eclipse.draw2d.ScrollPane)2 IStructureFigure (org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure)2 ITreeElement (org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement)2 HeadingFigure (org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure)2