Search in sources :

Example 36 with Dimension

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);
    }
}
Also used : Dimension(org.eclipse.draw2d.geometry.Dimension) Point(org.eclipse.draw2d.geometry.Point)

Example 37 with Dimension

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;
}
Also used : Dimension(org.eclipse.draw2d.geometry.Dimension) IFigure(org.eclipse.draw2d.IFigure)

Example 38 with Dimension

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);
}
Also used : Dimension(org.eclipse.draw2d.geometry.Dimension)

Example 39 with Dimension

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);
}
Also used : FontData(org.eclipse.swt.graphics.FontData) Text(org.eclipse.swt.widgets.Text) Dimension(org.eclipse.draw2d.geometry.Dimension) Font(org.eclipse.swt.graphics.Font)

Example 40 with Dimension

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;
}
Also used : ScrollingGraphicalViewer(org.eclipse.gef.ui.parts.ScrollingGraphicalViewer) ValidationGraphicalViewer(com.cubrid.common.ui.er.ValidationGraphicalViewer) StatusLineValidationMessageHandler(com.cubrid.common.ui.er.directedit.StatusLineValidationMessageHandler) PartFactory(com.cubrid.common.ui.er.part.PartFactory) GraphicalViewerKeyHandler(org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler) Dimension(org.eclipse.draw2d.geometry.Dimension) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

Dimension (org.eclipse.draw2d.geometry.Dimension)180 Rectangle (org.eclipse.draw2d.geometry.Rectangle)80 Point (org.eclipse.draw2d.geometry.Point)70 IFigure (org.eclipse.draw2d.IFigure)31 List (java.util.List)16 Insets (org.eclipse.draw2d.geometry.Insets)10 AbstractWidgetModel (org.csstudio.opibuilder.model.AbstractWidgetModel)8 PointList (org.eclipse.draw2d.geometry.PointList)6 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)6 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)6 PrecisionRectangle (org.eclipse.draw2d.geometry.PrecisionRectangle)5 ArrayList (java.util.ArrayList)4 PrecisionPoint (org.eclipse.draw2d.geometry.PrecisionPoint)4 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)4 Font (org.eclipse.swt.graphics.Font)4 Point (org.eclipse.swt.graphics.Point)4 AbstractContainerModel (org.csstudio.opibuilder.model.AbstractContainerModel)3 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)3 Label (org.eclipse.draw2d.Label)3 SimpleHtmlFigure (org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)3