use of org.eclipse.draw2d.geometry.Dimension in project tdi-studio-se by Talend.
the class Note method autoAdjustFigureSize.
/**
* It is used for auto-adjust the size of fingure to adapt the text modification.
*
* @param text
*/
private void autoAdjustFigureSize(String text) {
int length = text.length() - this.text.length();
int adjustLength = TalendEditor.GRID_SIZE / 4;
if (length < 0) {
adjustLength = -TalendEditor.GRID_SIZE / 4;
}
if (length != 0 && text.length() != 0) {
this.size.width = this.size.width + length * 3 + adjustLength;
} else {
this.size = new Dimension(TalendEditor.GRID_SIZE * 3, TalendEditor.GRID_SIZE * 2);
}
}
use of org.eclipse.draw2d.geometry.Dimension in project tdi-studio-se by Talend.
the class BusinessTooltipFigure method computePreferedSize.
@SuppressWarnings("unchecked")
private Dimension computePreferedSize() {
Dimension size = new Dimension();
// Vertical path
List<IFigure> children = getChildren();
for (IFigure fv : children) {
// Horizontal path
Dimension sizeH = new Dimension();
List<IFigure> childrenH = fv.getChildren();
for (IFigure fh : childrenH) {
sizeH.width += fh.getPreferredSize().width;
sizeH.height = Math.max(sizeH.height, fh.getPreferredSize().height);
}
size.width = Math.max(size.width, sizeH.width);
size.height += sizeH.height;
}
return size;
}
use of org.eclipse.draw2d.geometry.Dimension in project tdi-studio-se by Talend.
the class TerminalBusinessItemShapeFigure method drawFigure.
private void drawFigure(Rectangle r, Graphics graphics) {
Dimension corner = new Dimension((int) (r.width * 0.15), (int) (r.height * 0.15));
graphics.fillRoundRectangle(r, corner.width, corner.height);
graphics.drawRoundRectangle(r, corner.width, corner.height);
}
use of org.eclipse.draw2d.geometry.Dimension in project cubrid-manager by CUBRID.
the class ERDirectEditManager method initCellEditor.
protected void initCellEditor() {
getCellEditor().setValue(label.getText());
getCellEditor().setValidator(validator);
FontData fontData = label.getFont().getFontData()[0];
Dimension fontSize = new Dimension(0, fontData.getHeight());
label.translateToAbsolute(fontSize);
fontData.setHeight(fontSize.height);
Text text = (Text) getCellEditor().getControl();
text.setFont(new Font(null, fontData));
text.setRedraw(true);
text.setVisible(true);
}
use of org.eclipse.draw2d.geometry.Dimension in project cubrid-manager by CUBRID.
the class ERSchemaEditor method createGraphicalViewer.
private ScrollingGraphicalViewer createGraphicalViewer(IEditorSite editorSite, Composite parent) {
StatusLineValidationMessageHandler messageHandler = new StatusLineValidationMessageHandler(editorSite);
ScrollingGraphicalViewer viewer = new ValidationGraphicalViewer(messageHandler);
viewer.createControl(parent);
viewer.getControl().setBackground(ColorConstants.white);
viewer.setRootEditPart(new ERScalableFreeformRootEditPart());
viewer.setEditPartFactory(new PartFactory());
viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
viewer.setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(10, 10));
viewer.setProperty(SnapToGrid.PROPERTY_GRID_ORIGIN, new Point(5, 5));
return viewer;
}
Aggregations