use of com.cubrid.common.ui.er.figures.EditableLabel in project cubrid-manager by CUBRID.
the class ColumnPart method setSelected.
/**
* Sets the view of column label when it is selected
*/
@Override
public void setSelected(int value) {
super.setSelected(value);
EditableLabel columnLabel = (EditableLabel) getFigure();
if (value != EditPart.SELECTED_NONE) {
columnLabel.setSelected(true);
} else {
columnLabel.setSelected(false);
}
columnLabel.repaint();
if (value == EditPart.SELECTED_PRIMARY && !columnLabel.isPK()) {
}
}
use of com.cubrid.common.ui.er.figures.EditableLabel in project cubrid-manager by CUBRID.
the class RelationshipPart method setRelationColumnProtrude.
/**
* Set foreign columns relation with the line to be protruded.
*
* @param focus
*/
@SuppressWarnings("unchecked")
public void setRelationColumnProtrude(boolean focus) {
Relationship relations = (Relationship) this.getModel();
TablePart sourceTablePart = (TablePart) this.getSource();
TablePart targetTablePart = (TablePart) this.getTarget();
if (sourceTablePart == null || targetTablePart == null) {
return;
}
// set source and target columns
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();
if (this.isSelected() || sourceTablePart.isSelected() || targetTablePart.isSelected()) {
columnLable.setFontProtrude(true);
} else {
columnLable.setFontProtrude(focus);
}
}
}
// target
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();
if (this.isSelected() || sourceTablePart.isSelected() || targetTablePart.isSelected()) {
columnLable.setFontProtrude(true);
} else {
columnLable.setFontProtrude(focus);
}
}
}
}
use of com.cubrid.common.ui.er.figures.EditableLabel in project cubrid-manager by CUBRID.
the class TablePart method setName.
private void setName(String name) {
TableFigure tableFigure = (TableFigure) getFigure();
EditableLabel label = tableFigure.getNameLabel();
label.setText(name);
label.setVisible(true);
}
use of com.cubrid.common.ui.er.figures.EditableLabel in project cubrid-manager by CUBRID.
the class TablePart method createFigure.
protected IFigure createFigure() {
ERTable erTable = getTable();
EditableLabel label = new EditableLabel(erTable.getShownName());
TableFigure tableFigure = new TableFigure(label);
Rectangle rec = erTable.getBounds();
if (rec != null) {
tableFigure.setBounds(rec);
}
return tableFigure;
}
use of com.cubrid.common.ui.er.figures.EditableLabel in project cubrid-manager by CUBRID.
the class ColumnPart method freshBorder.
private void freshBorder() {
EditableLabel label = (EditableLabel) getFigure();
ColumnLabelBorder border = (ColumnLabelBorder) label.getBorder();
if (label.isPK()) {
if (border.getType() != InsetsType.ICON) {
label.setBorder(new ColumnLabelBorder(InsetsType.ICON));
}
} else {
if (border.getType() != InsetsType.TEXT) {
label.setBorder(new ColumnLabelBorder(InsetsType.TEXT));
}
}
}
Aggregations