Search in sources :

Example 31 with TableView

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);
}
Also used : SimpleStringProperty(javafx.beans.property.SimpleStringProperty) FXCollections(javafx.collections.FXCollections) TableViewManager(jgnash.uifx.util.TableViewManager) HTMLResource(jgnash.resource.util.HTMLResource) TableColumn(javafx.scene.control.TableColumn) TabPane(javafx.scene.control.TabPane) ResourceBundle(java.util.ResourceBundle) ContextMenu(javafx.scene.control.ContextMenu) Pair(jgnash.uifx.util.FXMLUtils.Pair) TableView(javafx.scene.control.TableView) WebView(javafx.scene.web.WebView) Properties(java.util.Properties) MenuItem(javafx.scene.control.MenuItem) NotNull(jgnash.util.NotNull) FXMLUtils(jgnash.uifx.util.FXMLUtils) Collectors(java.util.stream.Collectors) JavaFXUtils(jgnash.uifx.util.JavaFXUtils) Objects(java.util.Objects) FXML(javafx.fxml.FXML) ResourceUtils(jgnash.resource.util.ResourceUtils) SelectionMode(javafx.scene.control.SelectionMode) Clipboard(javafx.scene.input.Clipboard) Stage(javafx.stage.Stage) Tab(javafx.scene.control.Tab) ObservableList(javafx.collections.ObservableList) ClipboardContent(javafx.scene.input.ClipboardContent) StringProperty(javafx.beans.property.StringProperty) ClipboardContent(javafx.scene.input.ClipboardContent)

Example 32 with TableView

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();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Button(javafx.scene.control.Button) HashMap(java.util.HashMap) Scene(javafx.scene.Scene) Map(java.util.Map) HashMap(java.util.HashMap) ColorPickerTableColumn(com.kyj.fx.voeditor.visual.component.ColorPickerTableColumn) TableColumn(javafx.scene.control.TableColumn) TableView(javafx.scene.control.TableView)

Example 33 with TableView

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();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) ClassTypeCodeDVO(com.kyj.fx.voeditor.visual.main.model.vo.ClassTypeCodeDVO) ClassTypeCodeDVO(com.kyj.fx.voeditor.visual.main.model.vo.ClassTypeCodeDVO) Scene(javafx.scene.Scene) TableColumn(javafx.scene.control.TableColumn) ComboBoxTableColumn(com.kyj.fx.voeditor.visual.component.ComboBoxTableColumn) TableView(javafx.scene.control.TableView)

Example 34 with TableView

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();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Scene(javafx.scene.Scene) TableColumn(javafx.scene.control.TableColumn) ComboBoxTableColumn(com.kyj.fx.voeditor.visual.component.ComboBoxTableColumn) MapValueFactory(javafx.scene.control.cell.MapValueFactory) HashMap(java.util.HashMap) Map(java.util.Map) TableView(javafx.scene.control.TableView)

Example 35 with TableView

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();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) ObservableValue(javafx.beans.value.ObservableValue) Scene(javafx.scene.Scene) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) CheckBoxTableCell(javafx.scene.control.cell.CheckBoxTableCell) SampleVO(com.kyj.fx.voeditor.visual.example.CheckBoxTableCellExam.SampleVO) TableView(javafx.scene.control.TableView)

Aggregations

TableView (javafx.scene.control.TableView)70 TableColumn (javafx.scene.control.TableColumn)60 Map (java.util.Map)40 List (java.util.List)39 ArrayList (java.util.ArrayList)38 Button (javafx.scene.control.Button)38 Label (javafx.scene.control.Label)38 FXCollections (javafx.collections.FXCollections)37 Insets (javafx.geometry.Insets)36 Collectors (java.util.stream.Collectors)33 Scene (javafx.scene.Scene)33 Tab (javafx.scene.control.Tab)33 BorderPane (javafx.scene.layout.BorderPane)32 Optional (java.util.Optional)31 ObservableValue (javafx.beans.value.ObservableValue)30 VBox (javafx.scene.layout.VBox)29 Collections (java.util.Collections)28 MenuItem (javafx.scene.control.MenuItem)28 HashMap (java.util.HashMap)27 Set (java.util.Set)27