Search in sources :

Example 11 with GridData

use of org.eclipse.draw2d.GridData in project archi by archimatetool.

the class NoteFigure method setUI.

@Override
protected void setUI() {
    setLayoutManager(new GridLayout());
    FlowPage page = new FlowPage();
    fTextFlow = new TextFlow();
    fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_SOFT));
    page.add(fTextFlow);
    setOpaque(true);
    GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, true);
    add(page, gd);
    fTextPositionDelegate = new TextPositionDelegate(this, page, getDiagramModelObject());
    setIconicDelegate(new IconicDelegate(getDiagramModelObject()));
}
Also used : GridLayout(org.eclipse.draw2d.GridLayout) FlowPage(org.eclipse.draw2d.text.FlowPage) IconicDelegate(com.archimatetool.editor.diagram.figures.IconicDelegate) GridData(org.eclipse.draw2d.GridData) TextFlow(org.eclipse.draw2d.text.TextFlow) TextPositionDelegate(com.archimatetool.editor.diagram.figures.TextPositionDelegate) ParagraphTextLayout(org.eclipse.draw2d.text.ParagraphTextLayout)

Example 12 with GridData

use of org.eclipse.draw2d.GridData in project archi by archimatetool.

the class TextPositionDelegate method updateTextPosition.

public void updateTextPosition() {
    int textPosition = SWT.CENTER;
    switch(fTextPositionObject.getTextPosition()) {
        case ITextPosition.TEXT_POSITION_TOP:
            textPosition = SWT.TOP;
            break;
        case ITextPosition.TEXT_POSITION_CENTRE:
            textPosition = SWT.CENTER;
            break;
        case ITextPosition.TEXT_POSITION_BOTTOM:
            textPosition = SWT.BOTTOM;
            break;
        default:
            break;
    }
    int textAlignment = SWT.CENTER;
    if (fTextPositionObject instanceof ITextAlignment) {
        switch(((ITextAlignment) fTextPositionObject).getTextAlignment()) {
            case ITextAlignment.TEXT_ALIGNMENT_LEFT:
                textAlignment = SWT.LEFT;
                break;
            case ITextAlignment.TEXT_ALIGNMENT_CENTER:
                textAlignment = SWT.CENTER;
                break;
            case ITextAlignment.TEXT_ALIGNMENT_RIGHT:
                textAlignment = SWT.RIGHT;
                break;
            default:
                break;
        }
    }
    GridData gd = new GridData(textAlignment, textPosition, true, true);
    fParentFigure.setConstraint(fChildFigure, gd);
}
Also used : ITextAlignment(com.archimatetool.model.ITextAlignment) GridData(org.eclipse.draw2d.GridData)

Example 13 with GridData

use of org.eclipse.draw2d.GridData in project archi by archimatetool.

the class CanvasBlockFigure method setUI.

@Override
protected void setUI() {
    setLayoutManager(new DelegatingLayout());
    Locator mainLocator = new Locator() {

        @Override
        public void relocate(IFigure target) {
            Rectangle bounds = getBounds().getCopy();
            translateFromParent(bounds);
            target.setBounds(bounds);
        }
    };
    FlowPage flowPage = new FlowPage();
    fTextFlow = new TextFlow();
    fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    flowPage.add(fTextFlow);
    Figure textWrapperFigure = new Figure();
    textWrapperFigure.setLayoutManager(new GridLayout());
    textWrapperFigure.add(flowPage, new GridData(SWT.CENTER, SWT.CENTER, true, true));
    add(textWrapperFigure, mainLocator);
    fTextPositionDelegate = new TextPositionDelegate(textWrapperFigure, flowPage, getDiagramModelObject());
    // This last
    add(getMainFigure(), mainLocator);
    setIconicDelegate(new IconicDelegate(getDiagramModelObject(), MAX_ICON_SIZE));
}
Also used : Locator(org.eclipse.draw2d.Locator) FlowPage(org.eclipse.draw2d.text.FlowPage) GridLayout(org.eclipse.draw2d.GridLayout) DelegatingLayout(org.eclipse.draw2d.DelegatingLayout) IconicDelegate(com.archimatetool.editor.diagram.figures.IconicDelegate) Rectangle(org.eclipse.draw2d.geometry.Rectangle) GridData(org.eclipse.draw2d.GridData) TextFlow(org.eclipse.draw2d.text.TextFlow) TextPositionDelegate(com.archimatetool.editor.diagram.figures.TextPositionDelegate) ParagraphTextLayout(org.eclipse.draw2d.text.ParagraphTextLayout) IFigure(org.eclipse.draw2d.IFigure) IFigure(org.eclipse.draw2d.IFigure) AbstractContainerFigure(com.archimatetool.editor.diagram.figures.AbstractContainerFigure) Figure(org.eclipse.draw2d.Figure) ITextFigure(com.archimatetool.editor.diagram.figures.ITextFigure)

Example 14 with GridData

use of org.eclipse.draw2d.GridData in project archi by archimatetool.

the class AbstractTextControlContainerFigure method createTextFlowControl.

protected TextFlow createTextFlowControl(Locator textLocator) {
    TextFlow textFlow = new TextFlow();
    int wordWrapStyle = ArchiPlugin.PREFERENCES.getInt(IPreferenceConstants.ARCHIMATE_FIGURE_WORD_WRAP_STYLE);
    textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, wordWrapStyle));
    FlowPage page = new FlowPage();
    page.add(textFlow);
    Figure textWrapperFigure = new Figure();
    GridLayout layout = new GridLayout();
    layout.marginWidth = getTextControlMarginWidth();
    layout.marginHeight = getTextControlMarginHeight();
    textWrapperFigure.setLayoutManager(layout);
    textWrapperFigure.add(page, new GridData(SWT.CENTER, SWT.TOP, true, true));
    if (getDiagramModelObject() instanceof ITextPosition) {
        fTextPositionDelegate = new TextPositionDelegate(textWrapperFigure, page, (ITextPosition) getDiagramModelObject());
    }
    add(textWrapperFigure, textLocator);
    return textFlow;
}
Also used : FlowPage(org.eclipse.draw2d.text.FlowPage) GridLayout(org.eclipse.draw2d.GridLayout) ITextPosition(com.archimatetool.model.ITextPosition) GridData(org.eclipse.draw2d.GridData) TextFlow(org.eclipse.draw2d.text.TextFlow) ParagraphTextLayout(org.eclipse.draw2d.text.ParagraphTextLayout) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure)

Example 15 with GridData

use of org.eclipse.draw2d.GridData in project yamcs-studio by yamcs.

the class ThumbWheelFigure method createGridData.

public GridData createGridData() {
    GridData data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.verticalAlignment = GridData.FILL;
    data.grabExcessVerticalSpace = true;
    data.grabExcessHorizontalSpace = true;
    return data;
}
Also used : GridData(org.eclipse.draw2d.GridData)

Aggregations

GridData (org.eclipse.draw2d.GridData)20 GridLayout (org.eclipse.draw2d.GridLayout)6 IFigure (org.eclipse.draw2d.IFigure)4 FlowPage (org.eclipse.draw2d.text.FlowPage)4 ParagraphTextLayout (org.eclipse.draw2d.text.ParagraphTextLayout)4 TextFlow (org.eclipse.draw2d.text.TextFlow)4 IconicDelegate (com.archimatetool.editor.diagram.figures.IconicDelegate)3 TextPositionDelegate (com.archimatetool.editor.diagram.figures.TextPositionDelegate)3 Figure (org.eclipse.draw2d.Figure)3 Label (org.eclipse.draw2d.Label)3 RectangleFigure (org.eclipse.draw2d.RectangleFigure)2 StackLayout (org.eclipse.draw2d.StackLayout)2 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)2 AbstractContainerFigure (com.archimatetool.editor.diagram.figures.AbstractContainerFigure)1 ITextFigure (com.archimatetool.editor.diagram.figures.ITextFigure)1 ITextAlignment (com.archimatetool.model.ITextAlignment)1 ITextPosition (com.archimatetool.model.ITextPosition)1 PortletColumnElement (com.liferay.ide.layouttpl.core.model.PortletColumnElement)1 ColumnFigure (com.liferay.ide.layouttpl.ui.draw2d.ColumnFigure)1 PortletLayoutPanel (com.liferay.ide.layouttpl.ui.draw2d.PortletLayoutPanel)1