Search in sources :

Example 1 with EditableLabel

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()) {
    }
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel)

Example 2 with EditableLabel

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

Example 3 with EditableLabel

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);
}
Also used : TableFigure(com.cubrid.common.ui.er.figures.TableFigure) EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel)

Example 4 with EditableLabel

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;
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) TableFigure(com.cubrid.common.ui.er.figures.TableFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 5 with EditableLabel

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));
        }
    }
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel)

Aggregations

EditableLabel (com.cubrid.common.ui.er.figures.EditableLabel)16 TableFigure (com.cubrid.common.ui.er.figures.TableFigure)6 ERTableColumn (com.cubrid.common.ui.er.model.ERTableColumn)5 ERTable (com.cubrid.common.ui.er.model.ERTable)2 Relationship (com.cubrid.common.ui.er.model.Relationship)2 EditPart (org.eclipse.gef.EditPart)2 ValidationGraphicalViewer (com.cubrid.common.ui.er.ValidationGraphicalViewer)1 ValidationMessageHandler (com.cubrid.common.ui.er.ValidationMessageHandler)1 ERDirectEditManager (com.cubrid.common.ui.er.directedit.ERDirectEditManager)1 LabelCellEditorLocator (com.cubrid.common.ui.er.directedit.LabelCellEditorLocator)1 TableNameCellEditorValidator (com.cubrid.common.ui.er.directedit.TableNameCellEditorValidator)1 TableNameCellEditor (com.cubrid.common.ui.er.editor.TableNameCellEditor)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1