Search in sources :

Example 16 with ERTableColumn

use of com.cubrid.common.ui.er.model.ERTableColumn in project cubrid-manager by CUBRID.

the class ColumnPart method createFigure.

@Override
protected IFigure createFigure() {
    ERTableColumn column = (ERTableColumn) getModel();
    String label = column.getLabelText();
    EditableLabel columnLabel = new EditableLabel(label);
    columnLabel.setPK(column.isPrimaryKey());
    if (column.isPrimaryKey()) {
        columnLabel.setIcon(pkImage);
        columnLabel.setBorder(new ColumnLabelBorder(InsetsType.ICON));
    } else {
        columnLabel.setIcon(null);
        columnLabel.setBorder(new ColumnLabelBorder(InsetsType.TEXT));
    }
    return columnLabel;
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn)

Example 17 with ERTableColumn

use of com.cubrid.common.ui.er.model.ERTableColumn in project cubrid-manager by CUBRID.

the class ColumnPart method refreshVisuals.

/**
	 * We don't need to explicitly handle refresh visuals because the times when
	 * this needs to be done it is handled by the table e.g. handleNameChange()
	 */
@Override
protected void refreshVisuals() {
    ERTableColumn column = (ERTableColumn) getModel();
    EditableLabel columnLabel = (EditableLabel) getFigure();
    columnLabel.setText(column.getLabelText());
    columnLabel.setPK(column.isPrimaryKey());
    freshIcon();
    freshBorder();
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn)

Example 18 with ERTableColumn

use of com.cubrid.common.ui.er.model.ERTableColumn in project cubrid-manager by CUBRID.

the class ColumnPart method getColumn.

public ERTableColumn getColumn() {
    ERTableColumn col = (ERTableColumn) getModel();
    ERTableColumn ref = col.getTable().getColumn(col.getName());
    if (col != ref) {
        setModel(ref);
    }
    return ref;
}
Also used : ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn)

Example 19 with ERTableColumn

use of com.cubrid.common.ui.er.model.ERTableColumn in project cubrid-manager by CUBRID.

the class ColumnPart method handleLabelChange.

/**
	 * Handles when successfully applying direct edit
	 */
@Override
protected void handleLabelChange(PropertyChangeEvent evt) {
    ERTableColumn newColumn = getColumn();
    EditableLabel label = (EditableLabel) getFigure();
    label.setText(newColumn.getLabelText());
    label.setPK(newColumn.isPrimaryKey());
    freshIcon();
    freshBorder();
    label.revalidate();
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn)

Example 20 with ERTableColumn

use of com.cubrid.common.ui.er.model.ERTableColumn in project cubrid-manager by CUBRID.

the class RelationshipPart method handleDeleteConnection.

public void handleDeleteConnection() {
    Relationship relations = (Relationship) this.getModel();
    TablePart sourceTablePart = (TablePart) this.getSource();
    TablePart targetTablePart = (TablePart) this.getTarget();
    // set source and target columns
    if (sourceTablePart != null) {
        List<EditPart> children = sourceTablePart.getChildren();
        for (EditPart child : children) {
            if (!(child instanceof ColumnPart)) {
                continue;
            }
            ColumnPart columnPart = (ColumnPart) child;
            ERTableColumn column = (ERTableColumn) columnPart.getModel();
            if (relations.getReferenceColumns().contains(column.getName())) {
                EditableLabel columnLable = (EditableLabel) columnPart.getFigure();
                columnLable.setFontProtrude(false);
            }
        }
    }
    // target
    if (targetTablePart != null) {
        List<EditPart> children = targetTablePart.getChildren();
        for (EditPart child : children) {
            if (!(child instanceof ColumnPart)) {
                continue;
            }
            ColumnPart columnPart = (ColumnPart) child;
            ERTableColumn column = (ERTableColumn) columnPart.getModel();
            if (relations.getReferencedPKs().contains(column.getName())) {
                EditableLabel columnLable = (EditableLabel) columnPart.getFigure();
                columnLable.setFontProtrude(false);
            }
        }
    }
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) Relationship(com.cubrid.common.ui.er.model.Relationship) ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn) EditPart(org.eclipse.gef.EditPart)

Aggregations

ERTableColumn (com.cubrid.common.ui.er.model.ERTableColumn)32 DBAttribute (com.cubrid.common.core.common.model.DBAttribute)11 ERTable (com.cubrid.common.ui.er.model.ERTable)11 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)10 Constraint (com.cubrid.common.core.common.model.Constraint)9 List (java.util.List)6 EditableLabel (com.cubrid.common.ui.er.figures.EditableLabel)5 CubridTableParser (com.cubrid.common.ui.er.model.CubridTableParser)4 ArrayList (java.util.ArrayList)4 SerialInfo (com.cubrid.common.core.common.model.SerialInfo)3 ERSchema (com.cubrid.common.ui.er.model.ERSchema)3 Relationship (com.cubrid.common.ui.er.model.Relationship)3 EditPart (org.eclipse.gef.EditPart)3 TableItem (org.eclipse.swt.widgets.TableItem)3 TablePart (com.cubrid.common.ui.er.part.TablePart)2 HashSet (java.util.HashSet)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 ITask (com.cubrid.common.core.task.ITask)1 ERWinDBAttribute (com.cubrid.common.ui.cubrid.database.erwin.model.ERWinDBAttribute)1 ERWinSchemaInfo (com.cubrid.common.ui.cubrid.database.erwin.model.ERWinSchemaInfo)1