use of com.cubrid.common.ui.er.figures.TableFigure in project cubrid-manager by CUBRID.
the class ERSchemaEditor method searchAndLocate.
/**
* Set matched tables to be selected, and next(or first) finding table to be
* focused
*
* @param keyWord
* @param isChangedKey
* @return
*/
public boolean searchAndLocate(String keyWord, boolean isChangedKey) {
SchemaDiagramPart schemaRootPart = getERSchemaRootPart();
List allParts = schemaRootPart.getChildren();
// set next focus table(focus circularly )
if (!isChangedKey && graphicalViewer.getFocusEditPart() instanceof TablePart) {
TablePart focusedTablePart = (TablePart) graphicalViewer.getFocusEditPart();
int preFocusIndex = allParts.indexOf(focusedTablePart);
int start = preFocusIndex + 1;
for (; start < allParts.size(); start++) {
Object table = allParts.get(start);
if (table instanceof TablePart) {
TablePart nexFocusTable = (TablePart) table;
if (nexFocusTable.getTable().getShownName().contains(keyWord)) {
getViewPort().setViewLocation(nexFocusTable.getFigure().getBounds().x, nexFocusTable.getFigure().getBounds().y);
graphicalViewer.setFocus(nexFocusTable);
return true;
}
}
if (start == allParts.size()) {
start = 0;
}
}
}
// set first focus table and gray tables
Iterator it = allParts.iterator();
List matchedList = new ArrayList();
boolean isFocus = false;
while (it.hasNext()) {
Object obj = it.next();
if (!(obj instanceof TablePart)) {
continue;
}
TablePart tablePart = (TablePart) obj;
ERTable erTable = tablePart.getTable();
if (erTable.getShownName().contains(keyWord)) {
matchedList.add(tablePart);
if (!isFocus) {
getViewPort().setViewLocation(tablePart.getFigure().getBounds().x, tablePart.getFigure().getBounds().y);
graphicalViewer.setFocus(tablePart);
isFocus = true;
}
} else {
TableFigure figure = (TableFigure) tablePart.getFigure();
figure.setDisabled(true);
}
}
StructuredSelection matchedTables = new StructuredSelection(matchedList);
graphicalViewer.setSelection(matchedTables);
return true;
}
use of com.cubrid.common.ui.er.figures.TableFigure in project cubrid-manager by CUBRID.
the class TablePart method setGrayBackground.
/**
* If "set" is true, set the table figure to be disable state
*
* @param set
*/
public void setGrayBackground(boolean set) {
if (set) {
TableFigure tableFigure = (TableFigure) getFigure();
tableFigure.setBackgroundColor(TableFigure.disableBackgroundColor);
} else {
TableFigure tableFigure = (TableFigure) getFigure();
tableFigure.setBackgroundColor(TableFigure.defaultBackgroundColor);
}
}
use of com.cubrid.common.ui.er.figures.TableFigure 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.TableFigure in project cubrid-manager by CUBRID.
the class TablePart method setFocus.
@Override
public void setFocus(boolean hasFocus) {
TableFigure tableFigure = (TableFigure) getFigure();
LineBorder lineBorder = (LineBorder) tableFigure.getBorder();
if (hasFocus) {
lineBorder.setWidth(2);
} else {
lineBorder.setWidth(1);
}
}
use of com.cubrid.common.ui.er.figures.TableFigure 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;
}
Aggregations