Search in sources :

Example 16 with Figure

use of org.eclipse.draw2d.Figure in project tdi-studio-se by Talend.

the class TableEntityFigure method paintLines.

protected void paintLines(TableEntityFigure entity, Graphics graphics) {
    graphics.drawLine(entity.getElementBounds().x, entity.getElementBounds().getBottom().y - 1, entity.getElementBounds().getRight().x, entity.getElementBounds().getBottom().y - 1);
    List children = entity.getElement().getChildren();
    for (int i = 0; i < children.size() - 1; i++) {
        Figure child = (Figure) children.get(i);
        Rectangle childBounds = child.getBounds();
        graphics.drawLine(childBounds.getTopRight(), childBounds.getBottomRight());
    }
// final Rectangle expBounds = getElementBounds();
// graphics.drawLine(expBounds.x + expBounds.width, expBounds.y, expBounds.x + expBounds.width, getBounds().y
// + getBounds().height);
// paintChildrenLines(this, graphics);
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) List(java.util.List) Figure(org.eclipse.draw2d.Figure)

Example 17 with Figure

use of org.eclipse.draw2d.Figure in project tdi-studio-se by Talend.

the class RowSelectionEditPolicy method getLocatorFigure.

private IFigure getLocatorFigure(GraphicalEditPart owner) {
    IFigure figure = owner.getFigure();
    if (owner instanceof TableEntityPart) {
        TableEntityFigure treeNodeFigure = (TableEntityFigure) figure;
        // table figure to restrict the width
        MapperTablePart abstractInOutTreePart = MapperUtils.getMapperTablePart((TableEntityPart) owner);
        IFigure parentFigure = ((GraphicalEditPart) abstractInOutTreePart).getFigure();
        Rectangle treeBounds = parentFigure.getBounds();
        Rectangle rowBounds = treeNodeFigure.getElement().getBounds();
        Rectangle treeNodeBounds = figure.getBounds();
        figure = new Figure();
        if (treeBounds.x + 1 != treeNodeBounds.x || treeNodeBounds.width > treeBounds.width) {
            figure.setBounds(new Rectangle(treeBounds.x + 1, treeNodeBounds.y, treeBounds.width - 2, rowBounds.height));
            return figure;
        } else {
            figure.setBounds(owner.getFigure().getBounds().getCopy());
            figure.getBounds().height = rowBounds.height;
            return figure;
        }
    } else if (figure instanceof VarEntityFigure) {
        Rectangle copy = figure.getBounds().getCopy();
        figure = new Figure();
        figure.setBounds(copy);
        return figure;
    }
    return owner.getFigure();
}
Also used : VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) MapperTablePart(org.talend.designer.gefabstractmap.part.MapperTablePart) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IFigure(org.eclipse.draw2d.IFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) IFigure(org.eclipse.draw2d.IFigure) VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) Figure(org.eclipse.draw2d.Figure)

Example 18 with Figure

use of org.eclipse.draw2d.Figure in project tdi-studio-se by Talend.

the class ErDiagramPart method createFigure.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
     */
@Override
protected IFigure createFigure() {
    Figure figure = new FreeformLayer();
    figure.setLayoutManager(new FreeformLayout());
    fig2 = new FreeformLayer();
    getLayer(ErDiagramRootEditPart.PROCESS_BACKGROUND_LAYER).add(fig2);
    return figure;
}
Also used : FreeformLayout(org.eclipse.draw2d.FreeformLayout) FreeformLayer(org.eclipse.draw2d.FreeformLayer) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure)

Example 19 with Figure

use of org.eclipse.draw2d.Figure in project dbeaver by serge-rider.

the class DiagramXYLayoutPolicy method createChangeConstraintCommand.

/**
	 * Creates command to move table. Does not allow table to be resized
	 */
@Override
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
    if (!(child instanceof NodePart))
        return null;
    if (!(constraint instanceof Rectangle))
        return null;
    NodePart nodePart = (NodePart) child;
    Figure figure = (Figure) nodePart.getFigure();
    Rectangle oldBounds = figure.getBounds();
    Rectangle newBounds = (Rectangle) constraint;
    // Restrict resize for entities
    if (nodePart instanceof EntityPart) {
        if (oldBounds.width != newBounds.width && newBounds.width != -1)
            return null;
        if (oldBounds.height != newBounds.height && newBounds.height != -1)
            return null;
    }
    return new NodeMoveCommand(nodePart, oldBounds.getCopy(), newBounds.getCopy());
}
Also used : NodeMoveCommand(org.jkiss.dbeaver.ext.erd.command.NodeMoveCommand) Rectangle(org.eclipse.draw2d.geometry.Rectangle) NodePart(org.jkiss.dbeaver.ext.erd.part.NodePart) EntityPart(org.jkiss.dbeaver.ext.erd.part.EntityPart) Figure(org.eclipse.draw2d.Figure) IFigure(org.eclipse.draw2d.IFigure)

Example 20 with Figure

use of org.eclipse.draw2d.Figure in project cubrid-manager by CUBRID.

the class SchemaDiagramPart method createFigure.

protected IFigure createFigure() {
    Figure figure = new SchemaFigure();
    delegatingLayoutManager = new DelegatingLayoutManager(this);
    figure.setLayoutManager(delegatingLayoutManager);
    return figure;
}
Also used : SchemaFigure(com.cubrid.common.ui.er.figures.SchemaFigure) DelegatingLayoutManager(com.cubrid.common.ui.er.layout.DelegatingLayoutManager) SchemaFigure(com.cubrid.common.ui.er.figures.SchemaFigure) TableFigure(com.cubrid.common.ui.er.figures.TableFigure) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure)

Aggregations

Figure (org.eclipse.draw2d.Figure)33 IFigure (org.eclipse.draw2d.IFigure)25 List (java.util.List)6 ImageFigure (org.eclipse.draw2d.ImageFigure)6 Point (org.eclipse.draw2d.geometry.Point)6 Rectangle (org.eclipse.draw2d.geometry.Rectangle)6 TableEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure)6 VarEntityFigure (org.talend.designer.gefabstractmap.figures.var.VarEntityFigure)6 FreeformLayer (org.eclipse.draw2d.FreeformLayer)5 FreeformLayout (org.eclipse.draw2d.FreeformLayout)5 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)5 VarNodeFigure (org.talend.designer.xmlmap.figures.varnode.VarNodeFigure)5 HashMap (java.util.HashMap)4 Label (org.eclipse.draw2d.Label)4 SimpleHtmlFigure (org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)4 XmlmapTreeNodeFigure (org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)4 Iterator (java.util.Iterator)3 Map (java.util.Map)3 LineBorder (org.eclipse.draw2d.LineBorder)3 MarginBorder (org.eclipse.draw2d.MarginBorder)3