Search in sources :

Example 6 with NoteFigure

use of org.jkiss.dbeaver.erd.ui.figures.NoteFigure in project dbeaver by dbeaver.

the class NotePart method commitNameChange.

/**
 * Handles change in name when committing a direct edit
 */
@Override
protected void commitNameChange(PropertyChangeEvent evt) {
    NoteFigure noteFigure = (NoteFigure) getFigure();
    noteFigure.setText(getNote().getObject());
    noteFigure.setVisible(true);
    refreshVisuals();
}
Also used : NoteFigure(org.jkiss.dbeaver.erd.ui.figures.NoteFigure)

Example 7 with NoteFigure

use of org.jkiss.dbeaver.erd.ui.figures.NoteFigure in project dbeaver by dbeaver.

the class NotePart method handleNameChange.

public void handleNameChange(String value) {
    NoteFigure noteFigure = (NoteFigure) getFigure();
    noteFigure.setVisible(false);
    refreshVisuals();
}
Also used : NoteFigure(org.jkiss.dbeaver.erd.ui.figures.NoteFigure)

Example 8 with NoteFigure

use of org.jkiss.dbeaver.erd.ui.figures.NoteFigure in project dbeaver by dbeaver.

the class NotePart method createFigure.

// ******************* Layout related methods *********************/
/**
 * Creates a figure which represents the table
 */
@Override
protected NoteFigure createFigure() {
    final NoteFigure noteFigure = new NoteFigure(getNote());
    EntityDiagram.NodeVisualInfo visualInfo = ((DiagramPart) getParent()).getDiagram().getVisualInfo(getNote(), true);
    Rectangle bounds = visualInfo.initBounds;
    if (bounds != null) {
        noteFigure.setBounds(bounds);
        noteFigure.setPreferredSize(bounds.getSize());
    // noteFigure.setLocation(bounds.getLocation());
    // noteFigure.setSize(bounds.getSize());
    } else if (noteFigure.getSize().isEmpty()) {
        noteFigure.setPreferredSize(new Dimension(100, 50));
    }
    if (visualInfo.transparent) {
        noteFigure.setOpaque(false);
    }
    if (visualInfo.bgColor != null) {
        noteFigure.setBackgroundColor(visualInfo.bgColor);
    }
    if (visualInfo.fgColor != null) {
        noteFigure.setForegroundColor(visualInfo.fgColor);
    }
    if (visualInfo.borderWidth != ERDUIConstants.DEFAULT_NOTE_BORDER_WIDTH) {
        noteFigure.setBorder(createBorder(visualInfo.borderWidth));
    }
    if (visualInfo.font != null) {
        noteFigure.setFont(visualInfo.font);
    }
    return noteFigure;
}
Also used : EntityDiagram(org.jkiss.dbeaver.erd.ui.model.EntityDiagram) NoteFigure(org.jkiss.dbeaver.erd.ui.figures.NoteFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Dimension(org.eclipse.draw2d.geometry.Dimension)

Example 9 with NoteFigure

use of org.jkiss.dbeaver.erd.ui.figures.NoteFigure in project dbeaver by dbeaver.

the class NotePart method performDirectEdit.

protected void performDirectEdit() {
    if (manager == null) {
        NoteFigure figure = (NoteFigure) getFigure();
        manager = new ExtendedDirectEditManager(this, MultilineTextCellEditor.class, new FigureEditorLocator(figure), figure, value -> null);
    }
    manager.show();
}
Also used : FigureEditorLocator(org.jkiss.dbeaver.erd.ui.directedit.FigureEditorLocator) FigureEditorLocator(org.jkiss.dbeaver.erd.ui.directedit.FigureEditorLocator) ConnectionAnchor(org.eclipse.draw2d.ConnectionAnchor) DirectEditRequest(org.eclipse.gef.requests.DirectEditRequest) Dimension(org.eclipse.draw2d.geometry.Dimension) ERDElement(org.jkiss.dbeaver.erd.model.ERDElement) Point(org.eclipse.draw2d.geometry.Point) ERDUIConstants(org.jkiss.dbeaver.erd.ui.ERDUIConstants) ExtendedDirectEditManager(org.jkiss.dbeaver.erd.ui.directedit.ExtendedDirectEditManager) ChopboxAnchor(org.eclipse.draw2d.ChopboxAnchor) EntityDiagram(org.jkiss.dbeaver.erd.ui.model.EntityDiagram) NoteDirectEditPolicy(org.jkiss.dbeaver.erd.ui.policy.NoteDirectEditPolicy) DirectEditManager(org.eclipse.gef.tools.DirectEditManager) ERDNote(org.jkiss.dbeaver.erd.model.ERDNote) Rectangle(org.eclipse.draw2d.geometry.Rectangle) org.eclipse.gef(org.eclipse.gef) NoteFigure(org.jkiss.dbeaver.erd.ui.figures.NoteFigure) MultilineTextCellEditor(org.jkiss.dbeaver.ui.controls.MultilineTextCellEditor) NoteEditPolicy(org.jkiss.dbeaver.erd.ui.policy.NoteEditPolicy) Command(org.eclipse.gef.commands.Command) DBPNamedObject(org.jkiss.dbeaver.model.DBPNamedObject) PropertyChangeEvent(java.beans.PropertyChangeEvent) EntityConnectionEditPolicy(org.jkiss.dbeaver.erd.ui.policy.EntityConnectionEditPolicy) NoteFigure(org.jkiss.dbeaver.erd.ui.figures.NoteFigure) ExtendedDirectEditManager(org.jkiss.dbeaver.erd.ui.directedit.ExtendedDirectEditManager) MultilineTextCellEditor(org.jkiss.dbeaver.ui.controls.MultilineTextCellEditor)

Example 10 with NoteFigure

use of org.jkiss.dbeaver.erd.ui.figures.NoteFigure in project dbeaver by dbeaver.

the class NotePart method directEditHitTest.

private boolean directEditHitTest(Point requestLoc) {
    NoteFigure figure = (NoteFigure) getFigure();
    figure.translateToRelative(requestLoc);
    return figure.containsPoint(requestLoc);
}
Also used : NoteFigure(org.jkiss.dbeaver.erd.ui.figures.NoteFigure)

Aggregations

NoteFigure (org.jkiss.dbeaver.erd.ui.figures.NoteFigure)14 Rectangle (org.eclipse.draw2d.geometry.Rectangle)6 Dimension (org.eclipse.draw2d.geometry.Dimension)4 Point (org.eclipse.draw2d.geometry.Point)4 EntityDiagram (org.jkiss.dbeaver.erd.ui.model.EntityDiagram)4 PropertyChangeEvent (java.beans.PropertyChangeEvent)2 ChopboxAnchor (org.eclipse.draw2d.ChopboxAnchor)2 ConnectionAnchor (org.eclipse.draw2d.ConnectionAnchor)2 org.eclipse.gef (org.eclipse.gef)2 Command (org.eclipse.gef.commands.Command)2 DirectEditRequest (org.eclipse.gef.requests.DirectEditRequest)2 DirectEditManager (org.eclipse.gef.tools.DirectEditManager)2 ERDElement (org.jkiss.dbeaver.erd.model.ERDElement)2 ERDNote (org.jkiss.dbeaver.erd.model.ERDNote)2 ERDUIConstants (org.jkiss.dbeaver.erd.ui.ERDUIConstants)2 ExtendedDirectEditManager (org.jkiss.dbeaver.erd.ui.directedit.ExtendedDirectEditManager)2 FigureEditorLocator (org.jkiss.dbeaver.erd.ui.directedit.FigureEditorLocator)2 EntityConnectionEditPolicy (org.jkiss.dbeaver.erd.ui.policy.EntityConnectionEditPolicy)2 NoteDirectEditPolicy (org.jkiss.dbeaver.erd.ui.policy.NoteDirectEditPolicy)2 NoteEditPolicy (org.jkiss.dbeaver.erd.ui.policy.NoteEditPolicy)2