Search in sources :

Example 16 with ERDAssociation

use of org.jkiss.dbeaver.erd.model.ERDAssociation in project dbeaver by dbeaver.

the class AssociationPart method createFigure.

@Override
protected IFigure createFigure() {
    PolylineConnection conn = new PolylineConnection();
    conn.setForegroundColor(UIUtils.getColorRegistry().get(ERDUIConstants.COLOR_ERD_LINES_FOREGROUND));
    boolean showComments = getDiagramPart().getDiagram().hasAttributeStyle(ERDViewStyle.COMMENTS);
    if (showComments) {
        ERDAssociation association = getAssociation();
        if (association != null && association.getObject() != null && !CommonUtils.isEmpty(association.getObject().getDescription())) {
            ConnectionLocator descLabelLocator = new ConnectionLocator(conn, ConnectionLocator.MIDDLE);
            // descLabelLocator.setRelativePosition(50);
            // descLabelLocator.setGap(50);
            Label descLabel = new Label(association.getObject().getDescription());
            descLabel.setForegroundColor(UIUtils.getColorRegistry().get(ERDUIConstants.COLOR_ERD_ATTR_FOREGROUND));
            // Border border = new MarginBorder(20, 0, 0, 0);
            // descLabel.setBorder(border);
            conn.add(descLabel, descLabelLocator);
        }
    }
    setConnectionStyles(conn);
    setConnectionRouting(conn);
    setConnectionToolTip(conn);
    return conn;
}
Also used : ERDAssociation(org.jkiss.dbeaver.erd.model.ERDAssociation)

Aggregations

ERDAssociation (org.jkiss.dbeaver.erd.model.ERDAssociation)16 ERDElement (org.jkiss.dbeaver.erd.model.ERDElement)4 FileOutputStream (java.io.FileOutputStream)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Bendpoint (org.eclipse.draw2d.Bendpoint)2 Dimension (org.eclipse.draw2d.geometry.Dimension)2 PointList (org.eclipse.draw2d.geometry.PointList)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 DBException (org.jkiss.dbeaver.DBException)2 ERDEntity (org.jkiss.dbeaver.erd.model.ERDEntity)2 ERDEntityAttribute (org.jkiss.dbeaver.erd.model.ERDEntityAttribute)2 AttributeListFigure (org.jkiss.dbeaver.erd.ui.figures.AttributeListFigure)2 EntityFigure (org.jkiss.dbeaver.erd.ui.figures.EntityFigure)2 AssociationPart (org.jkiss.dbeaver.erd.ui.part.AssociationPart)2 EntityPart (org.jkiss.dbeaver.erd.ui.part.EntityPart)2 DBSEntityConstraintType (org.jkiss.dbeaver.model.struct.DBSEntityConstraintType)2 XMLBuilder (org.jkiss.utils.xml.XMLBuilder)2