use of org.eclipse.draw2d.text.ParagraphTextLayout in project archi by archimatetool.
the class AbstractTextControlContainerFigure method createTextFlowControl.
protected TextFlow createTextFlowControl(Locator textLocator) {
TextFlow textFlow = new TextFlow();
int wordWrapStyle = Preferences.STORE.getInt(IPreferenceConstants.ARCHIMATE_FIGURE_WORD_WRAP_STYLE);
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, wordWrapStyle));
BlockFlow block = new BlockFlow();
block.add(textFlow);
FlowPage page = new FlowPage();
page.add(block);
Figure textWrapperFigure = new Figure();
GridLayout layout = new GridLayout();
layout.marginWidth = getTextControlMarginWidth();
layout.marginHeight = 5;
textWrapperFigure.setLayoutManager(layout);
GridData gd = new GridData(SWT.CENTER, SWT.TOP, true, true);
textWrapperFigure.add(page, gd);
if (getDiagramModelObject() instanceof ITextPosition) {
fTextPositionDelegate = new TextPositionDelegate(textWrapperFigure, page, (ITextPosition) getDiagramModelObject());
}
add(textWrapperFigure, textLocator);
return textFlow;
}
use of org.eclipse.draw2d.text.ParagraphTextLayout 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());
}
use of org.eclipse.draw2d.text.ParagraphTextLayout 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();
}
use of org.eclipse.draw2d.text.ParagraphTextLayout 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();
}
Aggregations