use of com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.ColumnItemTree in project Gargoyle by callakrsos.
the class DatabaseTreeCell method updateItem.
/*
* (non-Javadoc)
*
* @see
* javafx.scene.control.cell.TextFieldTreeCell#updateItem(java.lang.Object,
* boolean)
*/
@SuppressWarnings("rawtypes")
@Override
public void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setGraphic(null);
setStyle(null);
} else {
if (item instanceof ColumnItemTree) {
ColumnItemTree columnItemTree = (ColumnItemTree) item;
if (columnItemTree.isPrimaryKey()) {
// setTextFill(Color.RED);
setStyle("-fx-text-fill:RED");
} else {
// setTextFill(Color.BLACK);
setStyle("-fx-text-fill:BLACK");
}
} else {
// setTextFill(Color.BLACK);
setStyle("-fx-text-fill:BLACK");
}
setText(item.toString());
}
}
use of com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.ColumnItemTree in project Gargoyle by callakrsos.
the class DatabaseTreeNode method createNode.
/**
* 파일 트리를 생성하기 위한 노드를 반환한다.
*
* @Date 2015. 10. 14.
* @param f
* @return
* @User KYJ
*/
public TreeItem<DatabaseItemTree<String>> createNode(final DatabaseItemTree<String> f) {
TreeItem<DatabaseItemTree<String>> treeItem = new TreeItem<DatabaseItemTree<String>>(f) {
private boolean isLeaf;
private boolean isFirstTimeChildren = true;
private boolean isFirstTimeLeaf = true;
@Override
public ObservableList<TreeItem<DatabaseItemTree<String>>> getChildren() {
if (isFirstTimeChildren) {
isFirstTimeChildren = false;
super.getChildren().setAll(buildChildren(this));
}
return super.getChildren();
}
@Override
public boolean isLeaf() {
if (isFirstTimeLeaf) {
isFirstTimeLeaf = false;
DatabaseItemTree<String> f = getValue();
isLeaf = (f instanceof ColumnItemTree);
}
return isLeaf;
}
private ObservableList<TreeItem<DatabaseItemTree<String>>> buildChildren(TreeItem<DatabaseItemTree<String>> treeItem) {
DatabaseItemTree<String> f = treeItem.getValue();
// if (treeItem.getChildren().isEmpty()) {
if (f == null) {
return FXCollections.emptyObservableList();
} else {
try {
f.read();
} catch (GargoyleConnectionFailException e) {
LOGGER.error(ValueUtil.toString(e));
DialogUtil.showExceptionDailog(e);
} catch (Exception e) {
LOGGER.error(ValueUtil.toString(e));
return FXCollections.emptyObservableList();
}
}
if (f == null) {
return FXCollections.emptyObservableList();
}
if (f instanceof ColumnItemTree) {
return FXCollections.emptyObservableList();
}
ObservableList<TreeItem<DatabaseItemTree<String>>> files = f.getChildrens();
if (files != null) {
ObservableList<TreeItem<DatabaseItemTree<String>>> children = FXCollections.observableArrayList();
for (TreeItem<DatabaseItemTree<String>> childFile : files) {
DatabaseItemTree<String> value = childFile.getValue();
TreeItem<DatabaseItemTree<String>> createNode = createNode(value);
children.add(createNode);
}
return children;
}
return FXCollections.emptyObservableList();
}
};
Node imageNode = getGraphics(f);
treeItem.setGraphic(imageNode);
return treeItem;
}
Aggregations