Search in sources :

Example 21 with ToolbarLayout

use of org.eclipse.draw2d.ToolbarLayout in project tdi-studio-se by Talend.

the class TalendDrawerFigure method setLayoutMode.

@Override
public void setLayoutMode(int layoutMode) {
    if (this.talendLayoutMode == layoutMode) {
        return;
    }
    this.talendLayoutMode = layoutMode;
    LayoutManager manager;
    if (layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
        manager = new ColumnsLayout();
        getContentPane().setBorder(customizedCSSStyleSetting.getScrollPaneBorder());
    } else if (layoutMode == PaletteViewerPreferences.LAYOUT_ICONS) {
        PaletteContainerFlowLayout fl = new PaletteContainerFlowLayout();
        fl.setMinorSpacing(0);
        fl.setMajorSpacing(0);
        manager = fl;
        getContentPane().setBorder(customizedCSSStyleSetting.getScrollPaneBorder());
    } else {
        manager = new ToolbarLayout();
        getContentPane().setBorder(customizedCSSStyleSetting.getScrollPaneListBorder());
    }
    getContentPane().setLayoutManager(manager);
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) LayoutManager(org.eclipse.draw2d.LayoutManager) ColumnsLayout(org.eclipse.gef.internal.ui.palette.editparts.ColumnsLayout) PaletteContainerFlowLayout(org.eclipse.gef.internal.ui.palette.editparts.PaletteContainerFlowLayout)

Example 22 with ToolbarLayout

use of org.eclipse.draw2d.ToolbarLayout in project tdi-studio-se by Talend.

the class MapperRootEditPart method createFigure.

@Override
protected IFigure createFigure() {
    Figure mainFigure = new Figure();
    XmlMapDataLayout manager2 = new XmlMapDataLayout(getRootModelManager().getGraphicalViewer());
    mainFigure.setLayoutManager(manager2);
    // input
    Figure inputZone = new Figure();
    inputZone.setLayoutManager(new ZoneLayout());
    inputToolBar = createInputZoneToolBar();
    inputToolBar.setBorder(new LineBorder(ColorProviderMapper.getColor(ColorInfo.COLOR_TREE_BORDER)));
    inputZone.add(inputToolBar);
    inputScroll = new ScrollPane();
    inputScroll.setHorizontalScrollBarVisibility(ScrollPane.NEVER);
    leftFigure = new Figure();
    // ToolbarLayout subManager = new ToolbarLayout();
    ToolbarLayout subManager = createZoneContentLayout();
    subManager.setSpacing(20);
    subManager.setVertical(true);
    leftFigure.setLayoutManager(subManager);
    leftFigure.setBorder(new MarginBorder(20, 40, 20, 40));
    inputScroll.getViewport().setContents(leftFigure);
    inputScroll.getViewport().setContentsTracksWidth(true);
    inputZone.add(inputScroll);
    mainFigure.add(inputZone);
    // separator 1
    SashSeparator separatorLeft = new SashSeparator();
    separatorLeft.setImage(ImageProviderMapper.getImage(ImageInfo.ZONE_SASH));
    mainFigure.add(separatorLeft);
    // search , var
    searchToolBar = createSearchZoneToolBar();
    searchToolBar.setBorder(new LineBorder(ColorProviderMapper.getColor(ColorInfo.COLOR_TREE_BORDER)));
    varScroll = new ScrollPane();
    varScroll.setHorizontalScrollBarVisibility(ScrollPane.NEVER);
    centerFigure = new Figure();
    subManager = createZoneContentLayout();
    subManager.setSpacing(20);
    subManager.setVertical(true);
    centerFigure.setLayoutManager(subManager);
    centerFigure.setBorder(new MarginBorder(10, 40, 10, 40));
    varScroll.getViewport().setContents(centerFigure);
    varScroll.getViewport().setContentsTracksWidth(true);
    centerFigure.add(searchToolBar);
    mainFigure.add(varScroll);
    // separetor 2
    SashSeparator separatorRight = new SashSeparator();
    separatorRight.setImage(ImageProviderMapper.getImage(ImageInfo.ZONE_SASH));
    mainFigure.add(separatorRight);
    // output
    Figure outputZone = new Figure();
    outputZone.setLayoutManager(new ZoneLayout());
    outputToolBar = createOutputZoneToolBar();
    outputToolBar.setBorder(new LineBorder(ColorProviderMapper.getColor(ColorInfo.COLOR_TREE_BORDER)));
    outputZone.add(outputToolBar);
    outputScroll = new ScrollPane();
    outputScroll.setHorizontalScrollBarVisibility(ScrollPane.NEVER);
    rightFigure = new Figure();
    subManager = createZoneContentLayout();
    subManager.setSpacing(20);
    subManager.setVertical(true);
    rightFigure.setLayoutManager(subManager);
    rightFigure.setBorder(new MarginBorder(20, 40, 20, 40));
    outputScroll.getViewport().setContents(rightFigure);
    outputScroll.getViewport().setContentsTracksWidth(true);
    outputZone.add(outputScroll);
    mainFigure.add(outputZone);
    mainFigure.setOpaque(true);
    mainFigure.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_BACKGROUND_LINKS_ZONE));
    separatorLeft.setLeftFigure(inputZone);
    separatorLeft.setRightFigure(varScroll);
    separatorLeft.setParentFigure(mainFigure);
    separatorRight.setLeftFigure(varScroll);
    separatorRight.setRightFigure(outputZone);
    separatorRight.setParentFigure(mainFigure);
    return mainFigure;
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) XmlMapDataLayout(org.talend.designer.gefabstractmap.figures.layout.XmlMapDataLayout) ScrollPane(org.eclipse.draw2d.ScrollPane) LineBorder(org.eclipse.draw2d.LineBorder) MarginBorder(org.eclipse.draw2d.MarginBorder) SashSeparator(org.talend.designer.gefabstractmap.figures.sash.SashSeparator) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure)

Example 23 with ToolbarLayout

use of org.eclipse.draw2d.ToolbarLayout in project tdi-studio-se by Talend.

the class VarEntityFigure method createVariableContainer.

protected Figure createVariableContainer() {
    Figure container = new Figure();
    // container.setBorder(new RowBorder());
    ToolbarLayout manager = new ToolbarLayout() {

        @Override
        public void layout(IFigure parent) {
            super.layout(parent);
            List children = parent.getChildren();
            if (children.size() == 2) {
                Figure checkImageFigure = (Figure) children.get(0);
                Figure variableFigure = (Figure) children.get(1);
                Rectangle varFigureBounds = variableFigure.getBounds().getCopy();
                int avialableWith = parent.getBounds().width - checkImageFigure.getBounds().width;
                if (avialableWith > varFigureBounds.width) {
                    varFigureBounds.width = avialableWith;
                }
                variableFigure.setBounds(varFigureBounds);
            }
        }
    };
    manager.setVertical(false);
    manager.setStretchMinorAxis(false);
    container.setLayoutManager(manager);
    // if(varNode.)
    Label nullableToolTip = new Label("Nullable");
    if (!isNullable()) {
        checkImage = new ImageFigure(ImageProvider.getImage(EImage.UNCHECKED_ICON));
    } else {
        checkImage = new ImageFigure(ImageProvider.getImage(EImage.CHECKED_ICON));
    }
    checkImage.setToolTip(nullableToolTip);
    variableLabel = new VarNodeTextLabel();
    variableLabel.setText(getVarName());
    variableLabel.setLabelAlignment(PositionConstants.LEFT);
    variableLabel.setBorder(new MarginBorder(2, 5, 2, -1));
    container.add(checkImage);
    container.add(variableLabel);
    addCheckListener();
    return container;
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) VarNodeTextLabel(org.talend.designer.gefabstractmap.figures.VarNodeTextLabel) MarginBorder(org.eclipse.draw2d.MarginBorder) Rectangle(org.eclipse.draw2d.geometry.Rectangle) VarNodeTextLabel(org.talend.designer.gefabstractmap.figures.VarNodeTextLabel) ComboCellLabel(org.talend.designer.gefabstractmap.figures.ComboCellLabel) Label(org.eclipse.draw2d.Label) List(java.util.List) ImageFigure(org.eclipse.draw2d.ImageFigure) IFigure(org.eclipse.draw2d.IFigure) ImageFigure(org.eclipse.draw2d.ImageFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) Figure(org.eclipse.draw2d.Figure) IFigure(org.eclipse.draw2d.IFigure)

Example 24 with ToolbarLayout

use of org.eclipse.draw2d.ToolbarLayout in project xtext-eclipse by eclipse.

the class RailroadDiagram method createLayoutManager.

@Override
protected LayoutManager createLayoutManager() {
    ToolbarLayout layout = new ToolbarLayout();
    layout.setSpacing(ILayoutConstants.VSPACE_BETWEEN_TRACKS);
    return layout;
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout)

Example 25 with ToolbarLayout

use of org.eclipse.draw2d.ToolbarLayout in project webtools.sourceediting by eclipse.

the class XSDSchemaEditPart method createFigure.

protected IFigure createFigure() {
    outer = new Figure();
    outer.setBorder(new LineBorder(1));
    FillLayout fillLayout = new FillLayout(4);
    outer.setLayoutManager(fillLayout);
    headingFigure = new HeadingFigure();
    outer.add(headingFigure);
    RectangleFigure line = new RectangleFigure() {

        public Dimension getPreferredSize(int wHint, int hHint) {
            Dimension d = super.getPreferredSize(wHint, hHint);
            d.height = 1;
            return d;
        }
    };
    ToolbarLayout lineLayout = new ToolbarLayout(false);
    lineLayout.setVertical(true);
    lineLayout.setStretchMinorAxis(true);
    line.setLayoutManager(lineLayout);
    outer.add(line);
    contentFigure = new Figure();
    contentFigure.setBorder(new MarginBorder(4));
    fillLayout = new FillLayout(4);
    contentFigure.setLayoutManager(fillLayout);
    outer.add(contentFigure);
    return outer;
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) RectangleFigure(org.eclipse.draw2d.RectangleFigure) LineBorder(org.eclipse.draw2d.LineBorder) MarginBorder(org.eclipse.draw2d.MarginBorder) FillLayout(org.eclipse.wst.xsd.ui.internal.design.layouts.FillLayout) Dimension(org.eclipse.draw2d.geometry.Dimension) HeadingFigure(org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure) 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)

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