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;
}
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();
}
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;
}
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();
}
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);
}
}
}
}
Aggregations