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()));
}
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);
}
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));
}
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;
}
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;
}
Aggregations