use of javafx.scene.control.TableView in project jgnash by ccavanaugh.
the class AboutDialogController method dumpPropertiesToClipboard.
private static void dumpPropertiesToClipboard(final TableView<SystemProperty> tableView) {
final StringBuilder buffer = new StringBuilder();
tableView.getSelectionModel().getSelectedItems().stream().filter(systemProperty -> systemProperty.keyProperty().get() != null).forEach(systemProperty -> {
buffer.append(systemProperty.keyProperty().get());
buffer.append("\t");
if (systemProperty.valueProperty().get() != null) {
buffer.append(systemProperty.valueProperty().get());
}
buffer.append("\n");
});
final ClipboardContent content = new ClipboardContent();
content.putString(buffer.toString());
Clipboard.getSystemClipboard().setContent(content);
}
use of javafx.scene.control.TableView in project Gargoyle by callakrsos.
the class ColorPickerExample method start.
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("DockFX");
TableView<Map<String, Object>> tableView = new TableView<Map<String, Object>>();
tableView.setEditable(true);
{
Map<String, Object> map = new HashMap<String, Object>();
map.put("color", Color.RED);
tableView.getItems().add(map);
}
{
Map<String, Object> map = new HashMap<String, Object>();
map.put("color", Color.GREEN);
tableView.getItems().add(map);
}
tableView.setEditable(true);
tableView.getColumns().add(new ColorPickerTableColumn<>(new TableColumn<>(), "color"));
tableView.setOnMouseClicked(event -> {
System.out.println("mouse click event");
});
Button btnAdd = new Button("추가");
btnAdd.setOnMouseClicked(event -> {
HashMap<String, Object> hashMap = new HashMap<String, Object>();
hashMap.put("color", Color.RED);
tableView.getItems().add(hashMap);
});
BorderPane root = new BorderPane(tableView);
root.setTop(new BorderPane(btnAdd));
primaryStage.setScene(new Scene(root, 1100, 700));
// primaryStage.setScene(new Scene(new BorderPane(new
// MysqlPane("sample")), 1100, 700));
primaryStage.sizeToScene();
primaryStage.show();
Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
DockPane.initializeDefaultUserAgentStylesheet();
}
use of javafx.scene.control.TableView in project Gargoyle by callakrsos.
the class ColumnExample method start.
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("DockFX");
TableView<ClassTypeCodeDVO> tableView = new TableView<ClassTypeCodeDVO>();
tableView.setEditable(true);
{
ClassTypeCodeDVO e = new ClassTypeCodeDVO();
e.setCommCode("코드1");
e.setCommCodeNm("데이터 1");
tableView.getItems().add(e);
}
{
ClassTypeCodeDVO e = new ClassTypeCodeDVO();
e.setCommCode("코드1");
e.setCommCodeNm("데이터 2123123123123123123123123112312312331232\n\n\n\n\n\n\n\34534958345093443850934583409583405934850349534095830534098");
tableView.getItems().add(e);
}
{
ClassTypeCodeDVO e = new ClassTypeCodeDVO();
e.setCommCode("코드3");
e.setCommCodeNm("데이터 3");
tableView.getItems().add(e);
}
{
ClassTypeCodeDVO e = new ClassTypeCodeDVO();
e.setCommCode("코드4");
e.setCommCodeNm("데이터 4");
tableView.getItems().add(e);
}
ObservableList<CodeDVO> observableArrayList = FXCollections.observableArrayList(Arrays.asList(new CodeDVO("출력용 코드명1", "코드1"), new CodeDVO("출력용코드명2", "코드2"), new CodeDVO("출력용코드명3", "코드3")));
tableView.getColumns().add(new ComboBoxTableColumn<>("commCode", observableArrayList, "code", "codeNm"));
TableColumn<ClassTypeCodeDVO, Object> e = new TableColumn<>("SAMPLE");
e.setCellValueFactory(new PropertyValueFactory<>("commCodeNm"));
tableView.getColumns().add(e);
tableView.getColumns().add(new TableColumn<>("emptyCol1"));
tableView.getColumns().add(new TableColumn<>("emptyCol2"));
tableView.getColumns().add(new TableColumn<>("emptyCol3"));
tableView.getColumns().add(new TableColumn<>("emptyCol4"));
tableView.getColumns().add(new TableColumn<>("emptyCol5"));
tableView.getColumns().add(new TableColumn<>("emptyCol6"));
tableView.setOnMouseClicked(event -> {
ClassTypeCodeDVO selectedItem = tableView.getSelectionModel().getSelectedItem();
System.out.println("유효성 체크입니다.");
System.out.println("코드 : 데이터 형태로 출력되야합니다.");
System.out.println(selectedItem.getCommCode() + " : " + selectedItem.getCommCodeNm());
});
primaryStage.setScene(new Scene(new BorderPane(tableView), 1100, 700));
// primaryStage.setScene(new Scene(new BorderPane(new
// MysqlPane("sample")), 1100, 700));
primaryStage.sizeToScene();
primaryStage.show();
Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
DockPane.initializeDefaultUserAgentStylesheet();
}
use of javafx.scene.control.TableView in project Gargoyle by callakrsos.
the class ColumnExample2 method start.
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("DockFX");
TableView<Map<String, String>> tableView = new TableView<Map<String, String>>();
tableView.setEditable(true);
{
Map<String, String> hashMap = new HashMap<String, String>();
hashMap.put("commCode", "코드1");
hashMap.put("commCodeNm", "데이터 1");
tableView.getItems().add(hashMap);
}
{
Map<String, String> hashMap = new HashMap<String, String>();
hashMap.put("commCode", "코드1");
hashMap.put("commCodeNm", "데이터 2");
tableView.getItems().add(hashMap);
}
{
Map<String, String> hashMap = new HashMap<String, String>();
hashMap.put("commCode", "코드3");
hashMap.put("commCodeNm", "데이터 3");
tableView.getItems().add(hashMap);
}
{
Map<String, String> hashMap = new HashMap<String, String>();
hashMap.put("commCode", "코드4");
hashMap.put("commCodeNm", "데이터 4");
tableView.getItems().add(hashMap);
}
ObservableList<CodeDVO> observableArrayList = FXCollections.observableArrayList(Arrays.asList(new CodeDVO("출력용 코드명1", "코드1"), new CodeDVO("출력용코드명2", "코드2"), new CodeDVO("출력용코드명3", "코드3")));
tableView.getColumns().add(new ComboBoxTableColumn<>("commCode", observableArrayList, "code", "codeNm"));
TableColumn<Map<String, String>, Object> e = new TableColumn<>("SAMPLE");
e.setCellValueFactory(new MapValueFactory("commCodeNm"));
tableView.getColumns().add(e);
tableView.setOnMouseClicked(event -> {
Map<String, String> selectedItem = tableView.getSelectionModel().getSelectedItem();
System.out.println("유효성 체크입니다.");
System.out.println("코드 : 데이터 형태로 출력되야합니다.");
System.out.println(selectedItem.get("commCode") + " : " + selectedItem.get("commCodeNm"));
});
primaryStage.setScene(new Scene(new BorderPane(tableView), 1100, 700));
// primaryStage.setScene(new Scene(new BorderPane(new
// MysqlPane("sample")), 1100, 700));
primaryStage.sizeToScene();
primaryStage.show();
Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
DockPane.initializeDefaultUserAgentStylesheet();
}
use of javafx.scene.control.TableView in project Gargoyle by callakrsos.
the class CheckBoxTableCellExam method start.
/*
* (non-Javadoc)
*
* @see javafx.application.Application#start(javafx.stage.Stage)
*/
@Override
public void start(Stage primaryStage) throws Exception {
TableView<SampleVO> center = new TableView<>();
center.setEditable(true);
TableColumn<SampleVO, Boolean> e = new TableColumn<SampleVO, Boolean>();
e.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<SampleVO, Boolean>, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(CellDataFeatures<SampleVO, Boolean> param) {
return param.getValue().checked;
}
});
e.setCellFactory(new Callback<TableColumn<SampleVO, Boolean>, TableCell<SampleVO, Boolean>>() {
@Override
public TableCell<SampleVO, Boolean> call(TableColumn<SampleVO, Boolean> param) {
return new CheckBoxTableCell<SampleVO, Boolean>() {
/*
* (non-Javadoc)
*
* @see
* javafx.scene.control.cell.CheckBoxTableCell#updateItem(
* java.lang.Object, boolean)
*/
@Override
public void updateItem(Boolean item, boolean empty) {
super.updateItem(item, empty);
}
/*
* (non-Javadoc)
*
* @see
* javafx.scene.control.Cell#isItemChanged(java.lang.Object,
* java.lang.Object)
*/
@Override
protected boolean isItemChanged(Boolean oldItem, Boolean newItem) {
System.out.println(oldItem + " : " + newItem);
return super.isItemChanged(oldItem, newItem);
}
};
}
});
e.setEditable(true);
TableColumn<SampleVO, String> e2 = new TableColumn<SampleVO, String>();
e2.setCellValueFactory(new PropertyValueFactory<SampleVO, String>("name"));
center.getColumns().add(e);
center.getColumns().add(e2);
center.getItems().add(new SampleVO(true, "kim"));
center.getItems().add(new SampleVO(true, "young"));
BorderPane borderPane = new BorderPane(center);
primaryStage.setScene(new Scene(borderPane));
primaryStage.show();
}
Aggregations