use of javafx.event.ActionEvent in project Gargoyle by callakrsos.
the class CommonsSqllPan method menuExportInsertScriptOnAction.
@Override
public void menuExportInsertScriptOnAction(ActionEvent e) {
Optional<Pair<String, String[]>> showTableInputDialog = showTableInputDialog(f -> f.getName());
// Optional<Pair<String, String>> showInputDialog = DialogUtil.showInputDialog("table Name", "테이블명을 입력하세요.");
if (showTableInputDialog == null)
return;
showTableInputDialog.ifPresent(op -> {
if (op == null || op.getValue() == null)
return;
String schemaName = op.getValue()[0];
String _tableName = op.getValue()[1];
String tableName = "";
if (ValueUtil.isNotEmpty(schemaName)) {
tableName = String.format("%s.%s", schemaName, _tableName);
} else {
tableName = _tableName;
}
List<Map<String, Object>> items = getSelectedTabResultItems();
Map<String, Object> map = items.get(0);
final Set<String> keySet = map.keySet();
StringBuilder clip = new StringBuilder();
String insertPreffix = "insert into " + tableName;
String collect = keySet.stream().collect(Collectors.joining(",", "(", ")"));
String insertMiddle = " values ";
List<String> valueList = items.stream().map(v -> {
return ValueUtil.toJSONObject(v);
}).map(v -> {
Iterator<String> iterator = keySet.iterator();
List<Object> values = new ArrayList<>();
while (iterator.hasNext()) {
String columnName = iterator.next();
Object value = v.get(columnName);
values.add(value);
}
return values;
}).map(list -> {
return list.stream().map(str -> {
if (str == null)
return null;
else {
String convert = str.toString();
convert = convert.substring(1, convert.length() - 1);
if (convert.indexOf("'") >= 0) {
try {
convert = StringUtils.replace(convert, "'", "''");
} catch (Exception e1) {
e1.printStackTrace();
}
}
return "'".concat(convert).concat("'");
}
}).collect(Collectors.joining(",", "(", ")"));
}).map(str -> {
return new StringBuilder().append(insertPreffix).append(collect).append(insertMiddle).append(str).append(";\n").toString();
}).collect(Collectors.toList());
valueList.forEach(str -> {
clip.append(str);
});
SimpleTextView parent = new SimpleTextView(clip.toString());
parent.setWrapText(false);
FxUtil.createStageAndShow(String.format("[InsertScript] Table : %s", tableName), parent, stage -> {
});
});
}
use of javafx.event.ActionEvent in project Gargoyle by callakrsos.
the class DaoWizardViewController method menuToVoEditorOnAction.
/********************************
* 작성일 : 2016. 2. 27. 작성자 : KYJ
*
* 내용 : VO에티터로 결과내용을 전달처리한다.
*******************************/
public void menuToVoEditorOnAction(ActionEvent e) {
ObservableList<TbpSysDaoColumnsDVO> items = tbMappings.getItems();
if (items.isEmpty())
return;
DatabaseTypeMappingFunction typeConverter = new DatabaseTypeMappingFunction();
try {
FXMLLoader loader = FxUtil.createNewFxmlLoader();
loader.setLocation(getClass().getResource("VoEditorView.fxml"));
BorderPane root = loader.load();
VoEditorController controller = loader.getController();
List<TableModelDVO> resultItems = items.stream().map(m -> {
TableModelDVO dvo = new TableModelDVO();
dvo.setName(ValueUtil.getPrefixLowerTextMyEdit(m.getColumnName()));
String programType = m.getProgramType();
if (programType == null || programType.isEmpty()) {
programType = typeConverter.apply(m.getColumnType());
}
dvo.setType(programType);
return dvo;
}).collect(Collectors.toList());
controller.addItem(resultItems);
SharedMemory.getSystemLayoutViewController().loadNewSystemTab("New VO", root);
} catch (IOException e1) {
LOGGER.error(ValueUtil.toString(e1));
}
}
use of javafx.event.ActionEvent in project bitsquare by bitsquare.
the class CandleStickChart method dataItemRemoved.
@Override
protected void dataItemRemoved(XYChart.Data<Number, Number> item, XYChart.Series<Number, Number> series) {
if (series.getNode() instanceof Path) {
Path seriesPath = (Path) series.getNode();
seriesPath.getElements().clear();
}
final Node node = item.getNode();
if (shouldAnimate()) {
// fade out old candle
FadeTransition ft = new FadeTransition(Duration.millis(500), node);
ft.setToValue(0);
ft.setOnFinished((ActionEvent actionEvent) -> {
getPlotChildren().remove(node);
});
ft.play();
} else {
getPlotChildren().remove(node);
}
}
use of javafx.event.ActionEvent in project bitsquare by bitsquare.
the class VolumeChart method dataItemRemoved.
@Override
protected void dataItemRemoved(XYChart.Data<Number, Number> item, XYChart.Series<Number, Number> series) {
final Node node = item.getNode();
if (shouldAnimate()) {
FadeTransition ft = new FadeTransition(Duration.millis(500), node);
ft.setToValue(0);
ft.setOnFinished((ActionEvent actionEvent) -> getPlotChildren().remove(node));
ft.play();
} else {
getPlotChildren().remove(node);
}
}
use of javafx.event.ActionEvent in project arquivoProject by fader-azevedo.
the class ListaEstanteController method setAnimacao.
private void setAnimacao() {
/* Initial position setting for Top Pane*/
clipRectNovoEstante = new Rectangle();
clipRectNovoEstante.setWidth(boxBounds.getWidth());
clipRectNovoEstante.setHeight(ACTION_BOX_HGT);
clipRectNovoEstante.translateYProperty().set(boxBounds.getHeight() - ACTION_BOX_HGT);
paneRegistarEstante.setClip(clipRectNovoEstante);
paneRegistarEstante.translateYProperty().set(-(boxBounds.getHeight() - ACTION_BOX_HGT));
final Timeline timelineDown1 = new Timeline();
timelineDown1.setCycleCount(2);
timelineDown1.setAutoReverse(true);
final KeyValue kv1 = new KeyValue(clipRectNovoEstante.heightProperty(), (boxBounds.getHeight() - 15));
final KeyValue kv2 = new KeyValue(clipRectNovoEstante.translateYProperty(), 15);
final KeyValue kv3 = new KeyValue(paneRegistarEstante.translateYProperty(), -15);
final KeyFrame kf1 = new KeyFrame(Duration.millis(100), kv1, kv2, kv3);
timelineDown1.getKeyFrames().add(kf1);
EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
timelineDown1.play();
}
};
timelineDown = new Timeline();
timelineUp = new Timeline();
/* Animation for scroll down. */
timelineDown.setCycleCount(1);
timelineDown.setAutoReverse(true);
final KeyValue kvDwn1 = new KeyValue(clipRectNovoEstante.heightProperty(), boxBounds.getHeight());
final KeyValue kvDwn2 = new KeyValue(clipRectNovoEstante.translateYProperty(), 0);
final KeyValue kvDwn3 = new KeyValue(paneRegistarEstante.translateYProperty(), 0);
final KeyFrame kfDwn = new KeyFrame(Duration.millis(200), onFinished, kvDwn1, kvDwn2, kvDwn3);
timelineDown.getKeyFrames().add(kfDwn);
/* Animation for scroll up. */
timelineUp.setCycleCount(1);
timelineUp.setAutoReverse(true);
final KeyValue kvUp1 = new KeyValue(clipRectNovoEstante.heightProperty(), ACTION_BOX_HGT);
final KeyValue kvUp2 = new KeyValue(clipRectNovoEstante.translateYProperty(), boxBounds.getHeight() - ACTION_BOX_HGT);
final KeyValue kvUp3 = new KeyValue(paneRegistarEstante.translateYProperty(), -(boxBounds.getHeight() - ACTION_BOX_HGT));
final KeyFrame kfUp = new KeyFrame(Duration.millis(200), kvUp1, kvUp2, kvUp3);
timelineUp.getKeyFrames().add(kfUp);
}
Aggregations