Search in sources :

Example 1 with AttributeItemFigure

use of org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure in project dbeaver by serge-rider.

the class AttributePart method revertNameChange.

/**
	 * Reverts state back to prior edit state
	 */
public void revertNameChange(String oldValue) {
    AttributeItemFigure label = getFigure();
    label.setVisible(true);
    setSelected(EditPart.SELECTED_PRIMARY);
    label.revalidate();
}
Also used : AttributeItemFigure(org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure)

Example 2 with AttributeItemFigure

use of org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure in project dbeaver by serge-rider.

the class AttributePart method createFigure.

/**
	 * @return the ColumnLabel representing the Column
	 */
@Override
protected AttributeItemFigure createFigure() {
    ERDEntityAttribute column = (ERDEntityAttribute) getModel();
    AttributeItemFigure attributeFigure = new AttributeItemFigure(column);
    DiagramPart diagramPart = (DiagramPart) getParent().getParent();
    boolean showNullability = diagramPart.getDiagram().hasAttributeStyle(ERDAttributeStyle.NULLABILITY);
    Font columnFont = diagramPart.getNormalFont();
    Color columnColor = diagramPart.getContentPane().getForegroundColor();
    if (column.isInPrimaryKey()) {
        columnFont = diagramPart.getBoldFont();
        if (showNullability && !column.getObject().isRequired()) {
            columnFont = diagramPart.getBoldItalicFont();
        }
    /*
            if (!column.isInForeignKey()) {
                columnFont = diagramPart.getBoldFont();
            } else {
                columnFont = diagramPart.getBoldItalicFont();
            }
*/
    } else {
        if (showNullability && !column.getObject().isRequired()) {
            columnFont = diagramPart.getItalicFont();
        }
    }
    if (column.isInForeignKey()) {
    //columnColor = Display.getDefault().getSystemColor(SWT.COLOR_DARK_BLUE);
    }
    attributeFigure.setFont(columnFont);
    attributeFigure.setForegroundColor(columnColor);
    return attributeFigure;
}
Also used : ERDEntityAttribute(org.jkiss.dbeaver.ext.erd.model.ERDEntityAttribute) Color(org.eclipse.swt.graphics.Color) AttributeItemFigure(org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure) Font(org.eclipse.swt.graphics.Font)

Example 3 with AttributeItemFigure

use of org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure in project dbeaver by serge-rider.

the class AttributePart method commitNameChange.

/**
	 * Handles when successfully applying direct edit
	 */
@Override
protected void commitNameChange(PropertyChangeEvent evt) {
    AttributeItemFigure label = getFigure();
    label.setText(getAttribute().getLabelText());
    setSelected(EditPart.SELECTED_PRIMARY);
    label.revalidate();
}
Also used : AttributeItemFigure(org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure)

Example 4 with AttributeItemFigure

use of org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure in project dbeaver by dbeaver.

the class AttributePart method createFigure.

/**
 * @return the ColumnLabel representing the Column
 */
@Override
protected AttributeItemFigure createFigure() {
    ERDEntityAttribute column = (ERDEntityAttribute) getModel();
    AttributeItemFigure attributeFigure = new AttributeItemFigure(column);
    DiagramPart diagramPart = (DiagramPart) getParent().getParent();
    boolean showNullability = diagramPart.getDiagram().hasAttributeStyle(ERDAttributeStyle.NULLABILITY);
    Font columnFont = diagramPart.getNormalFont();
    Color columnColor = diagramPart.getContentPane().getForegroundColor();
    if (column.isInPrimaryKey()) {
        columnFont = diagramPart.getBoldFont();
        if (showNullability && !column.getObject().isRequired()) {
            columnFont = diagramPart.getBoldItalicFont();
        }
    /*
            if (!column.isInForeignKey()) {
                columnFont = diagramPart.getBoldFont();
            } else {
                columnFont = diagramPart.getBoldItalicFont();
            }
*/
    } else {
        if (showNullability && !column.getObject().isRequired()) {
            columnFont = diagramPart.getItalicFont();
        }
    }
    if (column.isInForeignKey()) {
    // columnColor = Display.getDefault().getSystemColor(SWT.COLOR_DARK_BLUE);
    }
    attributeFigure.setFont(columnFont);
    attributeFigure.setForegroundColor(columnColor);
    return attributeFigure;
}
Also used : ERDEntityAttribute(org.jkiss.dbeaver.ext.erd.model.ERDEntityAttribute) Color(org.eclipse.swt.graphics.Color) AttributeItemFigure(org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure) Font(org.eclipse.swt.graphics.Font)

Example 5 with AttributeItemFigure

use of org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure in project dbeaver by dbeaver.

the class AttributePart method revertNameChange.

/**
 * Reverts state back to prior edit state
 */
public void revertNameChange(String oldValue) {
    AttributeItemFigure label = getFigure();
    label.setVisible(true);
    setSelected(EditPart.SELECTED_PRIMARY);
    label.revalidate();
}
Also used : AttributeItemFigure(org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure)

Aggregations

AttributeItemFigure (org.jkiss.dbeaver.ext.erd.figures.AttributeItemFigure)6 Color (org.eclipse.swt.graphics.Color)2 Font (org.eclipse.swt.graphics.Font)2 ERDEntityAttribute (org.jkiss.dbeaver.ext.erd.model.ERDEntityAttribute)2