use of com.kyj.fx.voeditor.visual.component.popup.TableOpenResourceView in project Gargoyle by callakrsos.
the class SqlPane method showTableResourceView.
/**
* 테이블을 찾는 리소스 뷰를 오픈
*
* @작성자 : KYJ
* @작성일 : 2016. 10. 20.
*/
protected void showTableResourceView() {
try {
TableOpenResourceView tableOpenResourceView = new TableOpenResourceView(connectionSupplier);
ResultDialog<Map<String, Object>> show = tableOpenResourceView.show(this);
Map<String, Object> data = show.getData();
if (ValueUtil.isNotEmpty(data)) {
String schema = tableOpenResourceView.getSchema(data);
String databaseName = tableOpenResourceView.getDatabaseName(data);
String tableName = tableOpenResourceView.getTableName(data);
TreeItem<K> search = search(schema, databaseName, tableName);
if (search != null) {
TreeView<K> schemaTree = getSchemaTree();
schemaTree.getSelectionModel().select(search);
schemaTree.getFocusModel().focus(schemaTree.getSelectionModel().getSelectedIndex());
schemaTree.scrollTo(schemaTree.getSelectionModel().getSelectedIndex());
LOGGER.debug(search.toString());
LOGGER.debug(data.toString());
} else {
LOGGER.debug("search result empty.");
}
}
} catch (Exception e1) {
LOGGER.error(ValueUtil.toString(e1));
}
}
use of com.kyj.fx.voeditor.visual.component.popup.TableOpenResourceView in project Gargoyle by callakrsos.
the class ASTSqlCodeAreaHelper method createResourceView.
@Override
public ResourceView<Map<String, Object>> createResourceView() {
TableOpenResourceView tableOpenResourceView = new TableOpenResourceView(connectionSupplier) {
/* (non-Javadoc)
* @see com.kyj.fx.voeditor.visual.component.popup.TableOpenResourceView#close()
*/
@Override
public void close() {
super.close();
codeArea.getPopupWindow().hide();
ResultDialog<Map<String, Object>> result = getResult();
if (result.getStatus() == ResultDialog.SELECT) {
Map<String, Object> data = result.getData();
if (data == null)
return;
String tableName = getTableName(data);
if (tableName == null)
return;
// Object object = data.get("table_name");
// if (object == null)
// return;
String string = currentPragraph(codeArea);
int markTextColumnIndex = getIndexOfValideWhiteSpace(string);
if (markTextColumnIndex == -1) {
codeArea.getUndoManager().mark();
codeArea.appendText(tableName);
} else {
int anchor = codeArea.getAnchor();
int start = anchor - string.length() + markTextColumnIndex;
IndexRange normalize = IndexRange.normalize(start, anchor);
codeArea.getUndoManager().mark();
codeArea.replaceText(normalize, tableName);
}
}
}
};
return tableOpenResourceView.getView();
}
Aggregations