Search in sources :

Example 1 with ComboBoxTableColumn

use of com.kyj.fx.voeditor.visual.component.ComboBoxTableColumn 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 2 with ComboBoxTableColumn

use of com.kyj.fx.voeditor.visual.component.ComboBoxTableColumn 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 3 with ComboBoxTableColumn

use of com.kyj.fx.voeditor.visual.component.ComboBoxTableColumn in project Gargoyle by callakrsos.

the class DatabaseUrlManagementView method initialize.

@SuppressWarnings({ "rawtypes", "unchecked" })
@FXML
public void initialize() {
    // /tbDatabase.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    colKey.setCellValueFactory(param -> {
        Object object = param.getValue().get("seqNum");
        return new SimpleObjectProperty<>(object);
    });
    String property = ResourceLoader.getInstance().get(ResourceLoader.DBMS_SUPPORT);
    // 사용되지않은 코드
    // String colOrder =
    // ResourceLoader.getInstance().get(ResourceLoader.DATABASE_COLUMN_ORDER);
    // 2015.11.30 데이터에 []코드를 삭제하면서 아래 코드존재가 불필요해서 주석
    // 오류가 발생하여 임시 처리.
    // if (colOrder != null) {
    // colOrder = colOrder.replace("[", "");
    // colOrder = colOrder.replace("]", "");
    // }
    List<Code> dbms = Stream.of(StringUtils.tokenizeToStringArray(property, ",")).map(t -> new Code(t, t)).collect(Collectors.toList());
    colDbms = new ComboBoxTableColumn<>("dbms", FXCollections.observableArrayList(dbms), "code", "codeNm");
    tbDatabase.getColumns().add(1, colDbms);
    tbDatabase.getColumns().get(1).setText("DBMS");
    tbDatabase.getColumns().get(1).setId("colDbms");
    colColor = new ColorPickerTableColumn<Map<String, Object>>(colColor, "color");
    colColor.setMaxWidth(50);
    tbDatabase.getColumns().add(1, colColor);
    tbDatabase.getColumns().get(1).setText("Color");
    tbDatabase.getColumns().get(1).setId("colColor");
    /*********************************************************/
    // 파일 DagDrop 이벤트. URL에 새 데이터 add.
    tbDatabase.setOnDragDropped(ev -> {
        if (ev.getDragboard().hasFiles()) {
            List<File> files = ev.getDragboard().getFiles();
            files.stream().map(v -> {
                return v.getAbsolutePath();
            }).forEach(str -> {
                Map<String, Object> map = new HashMap<String, Object>();
                map.put(ResourceLoader.BASE_KEY_JDBC_URL, str);
                tbDatabase.getItems().add(map);
            });
            ev.setDropCompleted(true);
            ev.consume();
        }
    });
    tbDatabase.setOnDragOver(ev -> {
        if (ev.getDragboard().hasFiles()) {
            ev.acceptTransferModes(TransferMode.LINK);
            ev.consume();
        }
    });
    /*********************************************************/
    colPopup = new ButtonTableColumn() {

        @Override
        public void clickHandle(int nRow) {
            try {
                showSqlPane(nRow);
            } catch (Exception e) {
                DialogUtil.showExceptionDailog(e);
                LOGGER.error(ValueUtil.toString(e));
            }
        }
    };
    colPing = new ButtonTableColumn("Ping") {

        @Override
        public void clickHandle(int nRow) {
            try {
                ping(nRow);
            } catch (Exception e) {
                DialogUtil.showExceptionDailog(e);
                LOGGER.error(ValueUtil.toString(e));
            }
        }
    };
    colPopup.setMaxWidth(50);
    tbDatabase.getColumns().add(1, colPopup);
    tbDatabase.getColumns().get(1).setText("Popup");
    tbDatabase.getColumns().get(1).setId("colPopup");
    tbDatabase.getColumns().add(colPing);
    setColumnText(colAlias, "alias");
    colUrl.setPrefWidth(300);
    setColumnText(colUrl, ResourceLoader.BASE_KEY_JDBC_URL);
    setColumnText(colUserName, ResourceLoader.BASE_KEY_JDBC_ID);
    setColumnText(colUserPassword, ResourceLoader.BASE_KEY_JDBC_PASS, param -> new PasswordTextFieldTableCell());
    // colUserPassword.setCellValueFactory(param -> {
    // Object initialValue =
    // param.getValue().get(ResourceLoader.BASE_KEY_JDBC_PASS);
    // SimpleObjectProperty<Object> simpleObjectProperty = new
    // SimpleObjectProperty<>(initialValue);
    // simpleObjectProperty.addListener((oba, oldval, newval) ->
    // param.getValue().put(ResourceLoader.BASE_KEY_JDBC_PASS, newval));
    // return simpleObjectProperty;
    // });
    // colUserPassword.setCellFactory(param -> new
    // PasswordTextFieldTableCell());
    observableArrayList = loadResource();
    tbDatabase.getItems().addAll(observableArrayList);
}
Also used : Button(javafx.scene.control.Button) DbUtil(com.kyj.fx.voeditor.visual.util.DbUtil) Enumeration(java.util.Enumeration) LoggerFactory(org.slf4j.LoggerFactory) PoolProperties(org.apache.tomcat.jdbc.pool.PoolProperties) EncrypUtil(com.kyj.fx.voeditor.visual.util.EncrypUtil) Map(java.util.Map) CommonsSqllPan(com.kyj.fx.voeditor.visual.component.sql.view.CommonsSqllPan) ColorPickerTableColumn(com.kyj.fx.voeditor.visual.component.ColorPickerTableColumn) TableView(javafx.scene.control.TableView) ButtonTableColumn(com.kyj.fx.voeditor.visual.component.ButtonTableColumn) RuntimeException(com.sun.star.uno.RuntimeException) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) ConfigResourceLoader(com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader) Collectors(java.util.stream.Collectors) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) Stream(java.util.stream.Stream) JSONObject(org.json.simple.JSONObject) ComboBoxTableColumn(com.kyj.fx.voeditor.visual.component.ComboBoxTableColumn) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) Code(com.kyj.fx.voeditor.visual.main.model.vo.Code) MouseEvent(javafx.scene.input.MouseEvent) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) DockNode(com.kyj.fx.voeditor.visual.component.dock.pane.DockNode) DialogUtil(com.kyj.fx.voeditor.visual.util.DialogUtil) TransferMode(javafx.scene.input.TransferMode) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) Callback(javafx.util.Callback) Color(javafx.scene.paint.Color) Logger(org.slf4j.Logger) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) StringConverter(javafx.util.StringConverter) File(java.io.File) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) NotYetSupportException(com.kyj.fx.voeditor.visual.exceptions.NotYetSupportException) PasswordTextFieldTableCell(com.kyj.fx.voeditor.visual.component.PasswordTextFieldTableCell) ChangeListener(javafx.beans.value.ChangeListener) StringUtils(org.springframework.util.StringUtils) HashMap(java.util.HashMap) Code(com.kyj.fx.voeditor.visual.main.model.vo.Code) RuntimeException(com.sun.star.uno.RuntimeException) IOException(java.io.IOException) NotYetSupportException(com.kyj.fx.voeditor.visual.exceptions.NotYetSupportException) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) JSONObject(org.json.simple.JSONObject) PasswordTextFieldTableCell(com.kyj.fx.voeditor.visual.component.PasswordTextFieldTableCell) Map(java.util.Map) HashMap(java.util.HashMap) File(java.io.File) ButtonTableColumn(com.kyj.fx.voeditor.visual.component.ButtonTableColumn) FXML(javafx.fxml.FXML)

Aggregations

ComboBoxTableColumn (com.kyj.fx.voeditor.visual.component.ComboBoxTableColumn)3 TableColumn (javafx.scene.control.TableColumn)3 TableView (javafx.scene.control.TableView)3 BorderPane (javafx.scene.layout.BorderPane)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Scene (javafx.scene.Scene)2 ButtonTableColumn (com.kyj.fx.voeditor.visual.component.ButtonTableColumn)1 ColorPickerTableColumn (com.kyj.fx.voeditor.visual.component.ColorPickerTableColumn)1 PasswordTextFieldTableCell (com.kyj.fx.voeditor.visual.component.PasswordTextFieldTableCell)1 DockNode (com.kyj.fx.voeditor.visual.component.dock.pane.DockNode)1 CommonsSqllPan (com.kyj.fx.voeditor.visual.component.sql.view.CommonsSqllPan)1 NotYetSupportException (com.kyj.fx.voeditor.visual.exceptions.NotYetSupportException)1 FXMLController (com.kyj.fx.voeditor.visual.framework.annotation.FXMLController)1 ClassTypeCodeDVO (com.kyj.fx.voeditor.visual.main.model.vo.ClassTypeCodeDVO)1 Code (com.kyj.fx.voeditor.visual.main.model.vo.Code)1 ConfigResourceLoader (com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader)1 ResourceLoader (com.kyj.fx.voeditor.visual.momory.ResourceLoader)1 DbUtil (com.kyj.fx.voeditor.visual.util.DbUtil)1 DialogUtil (com.kyj.fx.voeditor.visual.util.DialogUtil)1