Search in sources :

Example 1 with TextPositionDelegate

use of com.archimatetool.editor.diagram.figures.TextPositionDelegate in project archi by archimatetool.

the class NoteFigure method setUI.

@Override
protected void setUI() {
    setLayoutManager(new GridLayout());
    FlowPage page = new FlowPage();
    BlockFlow block = new BlockFlow();
    fTextFlow = new TextFlow();
    fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_SOFT));
    block.add(fTextFlow);
    page.add(block);
    setOpaque(true);
    GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, true);
    add(page, gd);
    fTextPositionDelegate = new TextPositionDelegate(this, page, getDiagramModelObject());
}
Also used : GridLayout(org.eclipse.draw2d.GridLayout) FlowPage(org.eclipse.draw2d.text.FlowPage) BlockFlow(org.eclipse.draw2d.text.BlockFlow) 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 2 with TextPositionDelegate

use of com.archimatetool.editor.diagram.figures.TextPositionDelegate in project archi by archimatetool.

the class CanvasBlockFigure method setUI.

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

        public void relocate(IFigure target) {
            Rectangle bounds = getBounds().getCopy();
            translateFromParent(bounds);
            target.setBounds(bounds);
        }
    };
    FlowPage flowPage = new FlowPage();
    BlockFlow block = new BlockFlow();
    fTextFlow = new TextFlow();
    fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    block.add(fTextFlow);
    flowPage.add(block);
    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);
    // Have to add this if we want Animation to work on figures!
    AnimationUtil.addFigureForAnimation(getMainFigure());
    fIconicDelegate = new IconicDelegate(getDiagramModelObject());
    fIconicDelegate.updateImage();
}
Also used : DelegatingLayout(org.eclipse.draw2d.DelegatingLayout) Rectangle(org.eclipse.draw2d.geometry.Rectangle) IFigure(org.eclipse.draw2d.IFigure) AbstractContainerFigure(com.archimatetool.editor.diagram.figures.AbstractContainerFigure) Figure(org.eclipse.draw2d.Figure) Locator(org.eclipse.draw2d.Locator) FlowPage(org.eclipse.draw2d.text.FlowPage) GridLayout(org.eclipse.draw2d.GridLayout) BlockFlow(org.eclipse.draw2d.text.BlockFlow) 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)

Example 3 with TextPositionDelegate

use of com.archimatetool.editor.diagram.figures.TextPositionDelegate in project archi by archimatetool.

the class CanvasStickyFigure method setUI.

@Override
protected void setUI() {
    setLayoutManager(new GridLayout());
    FlowPage flowPage = new FlowPage();
    BlockFlow block = new BlockFlow();
    fTextFlow = new TextFlow();
    fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));
    block.add(fTextFlow);
    flowPage.add(block);
    add(flowPage, new GridData(SWT.CENTER, SWT.CENTER, true, true));
    fTextPositionDelegate = new TextPositionDelegate(this, flowPage, getDiagramModelObject());
    fIconicDelegate = new IconicDelegate(getDiagramModelObject());
    fIconicDelegate.updateImage();
}
Also used : GridLayout(org.eclipse.draw2d.GridLayout) FlowPage(org.eclipse.draw2d.text.FlowPage) BlockFlow(org.eclipse.draw2d.text.BlockFlow) GridData(org.eclipse.draw2d.GridData) TextFlow(org.eclipse.draw2d.text.TextFlow) TextPositionDelegate(com.archimatetool.editor.diagram.figures.TextPositionDelegate) ParagraphTextLayout(org.eclipse.draw2d.text.ParagraphTextLayout)

Aggregations

TextPositionDelegate (com.archimatetool.editor.diagram.figures.TextPositionDelegate)3 GridData (org.eclipse.draw2d.GridData)3 GridLayout (org.eclipse.draw2d.GridLayout)3 BlockFlow (org.eclipse.draw2d.text.BlockFlow)3 FlowPage (org.eclipse.draw2d.text.FlowPage)3 ParagraphTextLayout (org.eclipse.draw2d.text.ParagraphTextLayout)3 TextFlow (org.eclipse.draw2d.text.TextFlow)3 AbstractContainerFigure (com.archimatetool.editor.diagram.figures.AbstractContainerFigure)1 DelegatingLayout (org.eclipse.draw2d.DelegatingLayout)1 Figure (org.eclipse.draw2d.Figure)1 IFigure (org.eclipse.draw2d.IFigure)1 Locator (org.eclipse.draw2d.Locator)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1