use of com.cubrid.common.ui.er.model.ERTable in project cubrid-manager by CUBRID.
the class PartFactory method createEditPart.
public EditPart createEditPart(EditPart context, Object model) {
EditPart part = null;
if (model instanceof ERSchema) {
part = new SchemaDiagramPart();
} else if (model instanceof ERTable) {
part = new TablePart();
} else if (model instanceof Relationship) {
part = new RelationshipPart();
} else if (model instanceof ERTableColumn) {
part = new ColumnPart();
}
if (null == part) {
LOGGER.error("Part is null :" + context + "," + model);
}
part.setModel(model);
return part;
}
use of com.cubrid.common.ui.er.model.ERTable in project cubrid-manager by CUBRID.
the class TablePart method handleViewModelChange.
@Override
protected void handleViewModelChange(PropertyChangeEvent evt) {
Object newValue = evt.getNewValue();
Object oldValue = evt.getOldValue();
if (oldValue == null || newValue == null) {
throw new IllegalStateException(Messages.errOldNewValueBothNull);
}
if (newValue.equals(oldValue)) {
return;
}
ERTable table = getTable();
if (newValue.equals(PropertyChangeProvider.LOGIC_MODEL)) {
setName(table.getLogicName());
} else if (newValue.equals(PropertyChangeProvider.PHYSICAL_MODEL)) {
setName(table.getName());
}
List<EditPart> children = getChildren();
for (EditPart part : children) {
if (part instanceof ColumnPart) {
ColumnPart columnPart = (ColumnPart) part;
columnPart.handleViewModelChange(evt);
}
}
refreshVisuals();
}
use of com.cubrid.common.ui.er.model.ERTable 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.model.ERTable in project cubrid-manager by CUBRID.
the class SchemaDiagramPart method setTableFigureBounds.
public boolean setTableFigureBounds(boolean updateConstraint) {
List tableParts = getChildren();
for (Iterator iter = tableParts.iterator(); iter.hasNext(); ) {
TablePart tablePart = (TablePart) iter.next();
ERTable erTable = tablePart.getTable();
Rectangle bounds = erTable.getBounds();
if (bounds == null) {
return false;
} else {
TableFigure tableFigure = (TableFigure) tablePart.getFigure();
if (tableFigure == null) {
return false;
} else if (updateConstraint) {
delegatingLayoutManager.setXYLayoutConstraint(tableFigure, new Rectangle(bounds.x, bounds.y, -1, -1));
}
}
}
return true;
}
use of com.cubrid.common.ui.er.model.ERTable in project cubrid-manager by CUBRID.
the class AbstractSelectionAction method getERTable.
protected ERTable getERTable() {
ERTable table = null;
PropertyChangeProvider node = getSelectedNode();
if (node instanceof ERTable) {
table = (ERTable) node;
} else if (node instanceof ERTableColumn) {
ERTableColumn col = (ERTableColumn) node;
table = col.getTable();
}
return table;
}
Aggregations