Search in sources :

Example 16 with EntityFigure

use of org.jkiss.dbeaver.erd.ui.figures.EntityFigure in project dbeaver by serge-rider.

the class EntityPart method createFigure.

// ******************* Layout related methods *********************/
/**
 * Creates a figure which represents the table
 */
@Override
protected EntityFigure createFigure() {
    final EntityDiagram diagram = getDiagram();
    final EntityFigure figure = createFigureImpl();
    EntityDiagram.NodeVisualInfo visualInfo = diagram.getVisualInfo(getEntity().getObject());
    if (visualInfo != null) {
        if (visualInfo.initBounds != null) {
            figure.setLocation(visualInfo.initBounds.getLocation());
        }
        if (visualInfo.bgColor != null) {
            figure.setBackgroundColor(visualInfo.bgColor);
        }
        if (getEntity().getAttributeVisibility() == null && visualInfo.attributeVisibility != null) {
            getEntity().setAttributeVisibility(visualInfo.attributeVisibility);
        }
    }
    return figure;
}
Also used : EntityDiagram(org.jkiss.dbeaver.erd.ui.model.EntityDiagram) EntityFigure(org.jkiss.dbeaver.erd.ui.figures.EntityFigure)

Example 17 with EntityFigure

use of org.jkiss.dbeaver.erd.ui.figures.EntityFigure in project dbeaver by serge-rider.

the class EntityPart method performDirectEdit.

protected void performDirectEdit() {
    if (manager == null) {
        ERDGraphicalViewer viewer = getViewer();
        ValidationMessageHandler handler = viewer.getValidationHandler();
        EntityFigure figure = getFigure();
        EditableLabel nameLabel = figure.getNameLabel();
        manager = new ExtendedDirectEditManager(this, TextCellEditor.class, new LabelCellEditorLocator(nameLabel), nameLabel, new TableNameCellEditorValidator(handler));
    }
    manager.show();
}
Also used : EditableLabel(org.jkiss.dbeaver.erd.ui.figures.EditableLabel) EntityFigure(org.jkiss.dbeaver.erd.ui.figures.EntityFigure) ExtendedDirectEditManager(org.jkiss.dbeaver.erd.ui.directedit.ExtendedDirectEditManager) LabelCellEditorLocator(org.jkiss.dbeaver.erd.ui.directedit.LabelCellEditorLocator) ValidationMessageHandler(org.jkiss.dbeaver.erd.ui.directedit.ValidationMessageHandler) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableNameCellEditorValidator(org.jkiss.dbeaver.erd.ui.directedit.TableNameCellEditorValidator) ERDGraphicalViewer(org.jkiss.dbeaver.erd.ui.editor.ERDGraphicalViewer)

Example 18 with EntityFigure

use of org.jkiss.dbeaver.erd.ui.figures.EntityFigure in project dbeaver by serge-rider.

the class EntityPart method refreshVisuals.

/**
 * Reset the layout constraint, and revalidate the content pane
 */
@Override
protected void refreshVisuals() {
    EntityFigure entityFigure = getFigure();
    Point location = entityFigure.getLocation();
    Rectangle constraint = new Rectangle(location.x, location.y, -1, -1);
    getDiagramPart().setLayoutConstraint(this, entityFigure, constraint);
}
Also used : EntityFigure(org.jkiss.dbeaver.erd.ui.figures.EntityFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

EntityFigure (org.jkiss.dbeaver.erd.ui.figures.EntityFigure)18 EditableLabel (org.jkiss.dbeaver.erd.ui.figures.EditableLabel)10 Rectangle (org.eclipse.draw2d.geometry.Rectangle)4 ERDEntity (org.jkiss.dbeaver.erd.model.ERDEntity)4 FileOutputStream (java.io.FileOutputStream)2 HashMap (java.util.HashMap)2 Bendpoint (org.eclipse.draw2d.Bendpoint)2 Point (org.eclipse.draw2d.geometry.Point)2 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)2 DBException (org.jkiss.dbeaver.DBException)2 ERDAssociation (org.jkiss.dbeaver.erd.model.ERDAssociation)2 ERDEntityAttribute (org.jkiss.dbeaver.erd.model.ERDEntityAttribute)2 ExtendedDirectEditManager (org.jkiss.dbeaver.erd.ui.directedit.ExtendedDirectEditManager)2 LabelCellEditorLocator (org.jkiss.dbeaver.erd.ui.directedit.LabelCellEditorLocator)2 TableNameCellEditorValidator (org.jkiss.dbeaver.erd.ui.directedit.TableNameCellEditorValidator)2 ValidationMessageHandler (org.jkiss.dbeaver.erd.ui.directedit.ValidationMessageHandler)2 ERDGraphicalViewer (org.jkiss.dbeaver.erd.ui.editor.ERDGraphicalViewer)2 AttributeListFigure (org.jkiss.dbeaver.erd.ui.figures.AttributeListFigure)2 EntityDiagram (org.jkiss.dbeaver.erd.ui.model.EntityDiagram)2 AssociationPart (org.jkiss.dbeaver.erd.ui.part.AssociationPart)2