Example usage for javafx.scene.control TableView CONSTRAINED_RESIZE_POLICY

List of usage examples for javafx.scene.control TableView CONSTRAINED_RESIZE_POLICY

Introduction

In this page you can find the example usage for javafx.scene.control TableView CONSTRAINED_RESIZE_POLICY.

Prototype

Callback CONSTRAINED_RESIZE_POLICY

To view the source code for javafx.scene.control TableView CONSTRAINED_RESIZE_POLICY.

Click Source Link

Document

Simple policy that ensures the width of all visible leaf columns in this table sum up to equal the width of the table itself.

Usage

From source file:de.digiway.rapidbreeze.client.controller.LinkCollectorController.java

@Override
public void initialize(URL url, ResourceBundle rb) {
    this.resourceBundle = rb;
    this.list = new CollectorModelList();
    this.tableView.setItems(list);
    this.tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    this.executor = ThreadPoolService.getQueuedPool();

    this.filenameColumn.setCellValueFactory(
            new PropertyValueFactory<CollectorModel, String>(CollectorModel.PROP_FILENAME));
    this.cloudProviderColumn.setCellValueFactory(
            new PropertyValueFactory<CollectorModel, String>(CollectorModel.PROP_CLOUD_PROVIDER));
    this.filesizeColumn
            .setCellValueFactory(new PropertyValueFactory<CollectorModel, Long>(CollectorModel.PROP_FILESIZE));
    this.statusColumn
            .setCellValueFactory(new PropertyValueFactory<CollectorModel, String>(CollectorModel.PROP_STATUS));
}

From source file:com.QuarkLabs.BTCeClientJavaFX.OrdersBookController.java

@FXML
void initialize() {

    assert asksTable != null : "fx:id=\"asksTable\" was not injected: check your FXML file 'ordersbooklayout.fxml'.";
    assert asksTablePriceColumn != null : "fx:id=\"asksTablePriceColumn\" was not injected: check your FXML file 'ordersbooklayout.fxml'.";
    assert asksTableVolumeColumn != null : "fx:id=\"asksTableVolumeColumn\" was not injected: check your FXML file 'ordersbooklayout.fxml'.";
    assert bidsTable != null : "fx:id=\"bidsTable\" was not injected: check your FXML file 'ordersbooklayout.fxml'.";
    assert bidsTablePriceColumn != null : "fx:id=\"bidsTablePriceColumn\" was not injected: check your FXML file 'ordersbooklayout.fxml'.";
    assert bidsTableVolumeColumn != null : "fx:id=\"bidsTableVolumeColumn\" was not injected: check your FXML file 'ordersbooklayout.fxml'.";

    asksTable.setItems(asks);/*from   w  w  w .  j  a  va  2  s  .  c o m*/
    bidsTable.setItems(bids);

    asksTablePriceColumn.setCellValueFactory(new PropertyValueFactory<OrdersBookEntry, Double>("price"));
    asksTableVolumeColumn.setCellValueFactory(new PropertyValueFactory<OrdersBookEntry, Double>("volume"));

    asksTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    bidsTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    bidsTablePriceColumn.setCellValueFactory(new PropertyValueFactory<OrdersBookEntry, Double>("price"));
    bidsTableVolumeColumn.setCellValueFactory(new PropertyValueFactory<OrdersBookEntry, Double>("volume"));

    Task<JSONObject> loadOrdersBook = new Task<JSONObject>() {
        @Override
        protected JSONObject call() throws Exception {
            return App.getOrdersBook(pair);
        }
    };
    loadOrdersBook.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent workerStateEvent) {
            JSONObject jsonObject = (JSONObject) workerStateEvent.getSource().getValue();
            JSONArray asksArray = jsonObject.optJSONArray("asks");
            JSONArray bidsArray = jsonObject.optJSONArray("bids");
            for (int i = 0; i < asksArray.length(); i++) {
                JSONArray item = asksArray.optJSONArray(i);
                OrdersBookEntry ordersBookEntry = new OrdersBookEntry();
                ordersBookEntry.setPrice(item.optDouble(0));
                ordersBookEntry.setVolume(item.optDouble(1));
                asks.add(ordersBookEntry);
            }
            for (int i = 0; i < bidsArray.length(); i++) {
                JSONArray item = bidsArray.optJSONArray(i);
                OrdersBookEntry ordersBookEntry = new OrdersBookEntry();
                ordersBookEntry.setPrice(item.optDouble(0));
                ordersBookEntry.setVolume(item.optDouble(1));
                bids.add(ordersBookEntry);
            }
        }
    });
    Thread thread = new Thread(loadOrdersBook);
    thread.start();

}

From source file:context.ui.control.tabular.TabularViewController.java

private void initialTableData() {
    data.loadTableData();//w ww  .  j a  va2s  .c  o  m
    //        double minWidth = tableView.getWidth() / data.getHeaders().size();
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    int index = 0;
    for (String header : data.getHeaders()) {
        final int j = index;
        TableColumn tableColumn = new TableColumn(header);

        tableColumn.setComparator(new Comparator<String>() {
            @Override
            public int compare(String s1, String s2) {
                if (NumberUtils.isNumber(s1) && NumberUtils.isNumber(s2)) {
                    return Double.compare(Double.parseDouble(s1), Double.parseDouble(s2));
                }
                return Collator.getInstance().compare(s1, s2);
            }
        });
        tableColumn.setCellValueFactory(
                new Callback<TableColumn.CellDataFeatures<List<String>, String>, ObservableValue<String>>() {
                    public ObservableValue<String> call(TableColumn.CellDataFeatures<List<String>, String> p) {
                        final String val = p.getValue().get(j);
                        if (isRoundDoubles() && NumberUtils.isNumber(val) && val.contains(".")) {
                            DecimalFormat df = new DecimalFormat("#.##");
                            Double d = Double.parseDouble(val);
                            return new SimpleStringProperty(df.format(d));
                        } else {
                            return new SimpleStringProperty(val);
                        }
                    }
                });
        index++;
        tableView.getColumns().add(tableColumn);
        //            if (index < data.getHeaders().size() - 1) {
        //                tableColumn.setMinWidth(minWidth);
        //            }
        //            System.out.println("width=" + tableColumn.getMinWidth());
    }
    System.out.println("columns Count:" + tableView.getColumns().size());
    //  which will make your table view dynamic 
    //        ObservableList<ObservableList> csvData = FXCollections.observableArrayList();
    //
    //        for (List<StringProperty> dataList : data.getRows()) {
    //            ObservableList<String> row = FXCollections.observableArrayList();
    //            for (StringProperty rowData : dataList) {
    //                row.add(rowData.get());
    //            }
    //            csvData.add(row); // add each row to cvsData
    //        }
    System.out.println("Rows Count=" + data.getRows().size());
    tableView.setItems(data.getRows()); // finally add data to tableview
    System.out.println("after Rows Count=" + tableView.getItems().size());

}

From source file:org.sleuthkit.autopsy.imagegallery.gui.MetaDataPane.java

@FXML
void initialize() {
    assert attributeColumn != null : "fx:id=\"attributeColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert imageView != null : "fx:id=\"imageView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert tableView != null : "fx:id=\"tableView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert valueColumn != null : "fx:id=\"valueColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    TagUtils.registerListener(this);
    ImageGalleryController.getDefault().getCategoryManager().registerListener(this);

    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new Label("Select a file to show its details here."));

    attributeColumn.setCellValueFactory((param) -> new SimpleObjectProperty<>(param.getValue().getKey()));
    attributeColumn.setCellFactory(/*from  w ww .  j  a  va 2s.  c om*/
            (param) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, DrawableAttribute<?>>() {
                @Override
                protected void updateItem(DrawableAttribute<?> item, boolean empty) {
                    super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates.
                    if (item != null) {
                        setText(item.getDisplayName());
                        setGraphic(new ImageView(item.getIcon()));
                    } else {
                        setGraphic(null);
                        setText(null);
                    }
                }
            });

    attributeColumn.setPrefWidth(USE_COMPUTED_SIZE);

    valueColumn.setCellValueFactory((p) -> {
        if (p.getValue().getKey() == DrawableAttribute.TAGS) {
            return new SimpleStringProperty(
                    ((Collection<TagName>) p.getValue().getValue()).stream().map(TagName::getDisplayName)
                            .filter((String t) -> t.startsWith(Category.CATEGORY_PREFIX) == false)
                            .collect(Collectors.joining(" ; ", "", "")));
        } else {
            return new SimpleStringProperty(StringUtils.join((Iterable<?>) p.getValue().getValue(), " ; "));
        }
    });
    valueColumn.setPrefWidth(USE_COMPUTED_SIZE);
    valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() {
        @Override
        public void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);
            if (!isEmpty()) {
                Text text = new Text(item);
                text.wrappingWidthProperty().bind(getTableColumn().widthProperty());
                setGraphic(text);
            } else {
                setGraphic(null);
            }
        }
    });
    tableView.getColumns().setAll(Arrays.asList(attributeColumn, valueColumn));

    //listen for selection change
    controller.getSelectionModel().lastSelectedProperty().addListener((observable, oldFileID, newFileID) -> {
        setFile(newFileID);
    });

    //        MetaDataPane.this.visibleProperty().bind(controller.getMetaDataCollapsed().not());
    //        MetaDataPane.this.managedProperty().bind(controller.getMetaDataCollapsed().not());
}

From source file:com.QuarkLabs.BTCeClientJavaFX.PublicTradesController.java

@FXML
void initialize() {
    assert publicTradesTable != null : "fx:id=\"publicTradesTable\" was not injected: check your FXML file 'markettrades.fxml'.";
    assert publicTradesTableAmountColumn != null : "fx:id=\"publicTradesTableAmountColumn\" was not injected: check your FXML file 'markettrades.fxml'.";
    assert publicTradesTableDateColumn != null : "fx:id=\"publicTradesTableDateColumn\" was not injected: check your FXML file 'markettrades.fxml'.";
    assert publicTradesTableItemColumn != null : "fx:id=\"publicTradesTableItemColumn\" was not injected: check your FXML file 'markettrades.fxml'.";
    assert publicTradesTablePriceColumn != null : "fx:id=\"publicTradesTablePriceColumn\" was not injected: check your FXML file 'markettrades.fxml'.";
    assert publicTradesTablePriceCurrencyColumn != null : "fx:id=\"publicTradesTablePriceCurrencyColumn\" was not injected: check your FXML file 'markettrades.fxml'.";
    assert publicTradesTableTIDColumn != null : "fx:id=\"publicTradesTableTIDColumn\" was not injected: check your FXML file 'markettrades.fxml'.";
    assert publicTradesTableTradeTypeColumn != null : "fx:id=\"publicTradesTableTradeTypeColumn\" was not injected: check your FXML file 'markettrades.fxml'.";

    publicTradesTable.setItems(publicTrades);
    publicTradesTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    publicTradesTableAmountColumn.setCellValueFactory(new PropertyValueFactory<PublicTrade, Double>("amount"));
    publicTradesTableDateColumn.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<PublicTrade, String>, ObservableValue<String>>() {
                @Override/*w  w  w.j a v a  2 s  .c  om*/
                public ObservableValue<String> call(
                        TableColumn.CellDataFeatures<PublicTrade, String> publicTradeStringCellDataFeatures) {
                    PublicTrade publicTrade = publicTradeStringCellDataFeatures.getValue();
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(publicTrade.getDate() * 1000);
                    DateFormat dateFormat = DateFormat.getDateTimeInstance();
                    return new SimpleStringProperty(dateFormat.format(calendar.getTime()));
                }
            });
    publicTradesTableItemColumn.setCellValueFactory(new PropertyValueFactory<PublicTrade, String>("item"));
    publicTradesTablePriceColumn.setCellValueFactory(new PropertyValueFactory<PublicTrade, Double>("price"));
    publicTradesTablePriceCurrencyColumn
            .setCellValueFactory(new PropertyValueFactory<PublicTrade, String>("priceCurrency"));
    publicTradesTableTIDColumn.setCellValueFactory(new PropertyValueFactory<PublicTrade, Long>("tid"));
    publicTradesTableTradeTypeColumn
            .setCellValueFactory(new PropertyValueFactory<PublicTrade, String>("tradeType"));

    Task<JSONArray> loadPublicTrades = new Task<JSONArray>() {
        @Override
        protected JSONArray call() throws Exception {
            return App.getPublicTrades(pair);
        }
    };
    loadPublicTrades.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent workerStateEvent) {
            JSONArray jsonArray = (JSONArray) workerStateEvent.getSource().getValue();
            publicTrades.clear();
            for (int i = 0; i < jsonArray.length(); i++) {
                JSONObject item = jsonArray.getJSONObject(i);
                PublicTrade publicTrade = new PublicTrade();
                publicTrade.setDate(item.getLong("date"));
                publicTrade.setAmount(item.getDouble("amount"));
                publicTrade.setItem(item.getString("item"));
                publicTrade.setPrice(item.getDouble("price"));
                publicTrade.setPriceCurrency(item.getString("price_currency"));
                publicTrade.setTid(item.getLong("tid"));
                publicTrade.setTradeType(item.getString("trade_type"));
                publicTrades.add(publicTrade);
            }
        }
    });
    Thread thread = new Thread(loadPublicTrades);
    thread.start();
}

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.MetaDataPane.java

@FXML
void initialize() {
    assert attributeColumn != null : "fx:id=\"attributeColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert imageView != null : "fx:id=\"imageView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert tableView != null : "fx:id=\"tableView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    assert valueColumn != null : "fx:id=\"valueColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
    TagUtils.registerListener(this);
    Category.registerListener(this);

    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new Label("Select a file to show its details here."));

    attributeColumn.setCellValueFactory((param) -> new SimpleObjectProperty<>(param.getValue().getKey()));
    attributeColumn.setCellFactory(//from   w  w  w.j  ava 2s .c  o  m
            (param) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, DrawableAttribute<?>>() {
                @Override
                protected void updateItem(DrawableAttribute<?> item, boolean empty) {
                    super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates.
                    if (item != null) {
                        setText(item.getDisplayName());
                        setGraphic(new ImageView(item.getIcon()));
                    } else {
                        setGraphic(null);
                        setText(null);
                    }
                }
            });

    attributeColumn.setPrefWidth(USE_COMPUTED_SIZE);

    valueColumn.setCellValueFactory((p) -> {
        if (p.getValue().getKey() == DrawableAttribute.TAGS) {
            return new SimpleStringProperty(
                    ((Collection<TagName>) p.getValue().getValue()).stream().map(TagName::getDisplayName)
                            .filter((String t) -> t.startsWith(Category.CATEGORY_PREFIX) == false)
                            .collect(Collectors.joining(" ; ", "", "")));
        } else {
            return new SimpleStringProperty(StringUtils.join((Collection<?>) p.getValue().getValue(), " ; "));
        }
    });
    valueColumn.setPrefWidth(USE_COMPUTED_SIZE);
    valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() {
        @Override
        public void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);
            if (!isEmpty()) {
                Text text = new Text(item);
                text.wrappingWidthProperty().bind(getTableColumn().widthProperty());
                setGraphic(text);
            } else {
                setGraphic(null);
            }
        }
    });
    tableView.getColumns().setAll(Arrays.asList(attributeColumn, valueColumn));

    //listen for selection change
    controller.getSelectionModel().lastSelectedProperty().addListener((observable, oldFileID, newFileID) -> {
        setFile(newFileID);
    });

    //        MetaDataPane.this.visibleProperty().bind(controller.getMetaDataCollapsed().not());
    //        MetaDataPane.this.managedProperty().bind(controller.getMetaDataCollapsed().not());
}

From source file:io.bitsquare.gui.main.funds.withdrawal.WithdrawalView.java

@Override
public void initialize() {
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new Label("No funds are available for withdrawal"));
    tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    setAddressColumnCellFactory();/*from  ww  w . j  av  a 2s. c  o m*/
    setBalanceColumnCellFactory();
    setSelectColumnCellFactory();

    addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
    balanceColumn.setComparator((o1, o2) -> o1.getBalance().compareTo(o2.getBalance()));
    balanceColumn.setSortType(TableColumn.SortType.DESCENDING);
    tableView.getSortOrder().add(balanceColumn);

    balanceListener = new BalanceListener() {
        @Override
        public void onBalanceChanged(Coin balance, Transaction tx) {
            updateList();
        }
    };
    amountListener = (observable, oldValue, newValue) -> {
        if (amountTextField.focusedProperty().get()) {
            try {
                senderAmountAsCoinProperty.set(formatter.parseToCoin(amountTextField.getText()));
            } catch (Throwable t) {
                log.error("Error at amountTextField input. " + t.toString());
            }
        }
    };
    amountFocusListener = (observable, oldValue, newValue) -> {
        if (oldValue && !newValue) {
            if (senderAmountAsCoinProperty.get().isPositive())
                amountTextField.setText(formatter.formatCoin(senderAmountAsCoinProperty.get()));
            else
                amountTextField.setText("");
        }
    };
}

From source file:de.perdian.apps.tagtiger.fx.handlers.batchupdate.UpdateFileNamesFromTagsActionEventHandler.java

private TableView<?> createNewFileNamesPane(ObservableList<UpdateFileNamesFromTagsItem> items) {

    TableColumn<UpdateFileNamesFromTagsItem, String> currentFileNameColumn = new TableColumn<>(
            this.getLocalization().currentFileName());
    currentFileNameColumn.setSortable(false);
    currentFileNameColumn.setCellValueFactory(p -> p.getValue().getCurrentFileName());
    TableColumn<UpdateFileNamesFromTagsItem, String> newFileNameColumn = new TableColumn<>(
            this.getLocalization().newFileName());
    newFileNameColumn.setSortable(false);
    newFileNameColumn.setCellValueFactory(p -> p.getValue().getNewFileName());

    TableView<UpdateFileNamesFromTagsItem> tableView = new TableView<>(items);
    tableView.getColumns().addAll(Arrays.asList(currentFileNameColumn, newFileNameColumn));
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    return tableView;

}

From source file:poe.trade.assist.SearchPane.java

private void setupSearchTable() {
    searchTable = new TableViewPlus<>(ImmutableMap.of("Name", "name", "Result", "result", "Auto", "autoSearch",
            "Tags", "tags", "URL", "url"), new double[] { 130, 60, 40, 150, 200 }, data);

    searchTable.setEditable(false);// www .  j a v a2  s  .  c o m
    searchTable.setPrefWidth(500);
    searchTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    //      modMappingTable.setMaxHeight(Double.MAX_VALUE);
    //      modMappingTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    //      modMappingTable.setId("modMappingTable");
}

From source file:open.dolphin.client.MainWindowController.java

/**
 * Initializes the controller class.//from w  w w.j  a v  a2  s. c  o  m
 *
 * @param url
 * @param rb
 */
@Override
public void initialize(URL url, ResourceBundle rb) {

    //- Init TableView
    ReceptView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    PatientSearchView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    PatientFutureView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    LabRecieverView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    //        mainTab.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
    //            @Override
    //            public void changed(ObservableValue<? extends Number> ov, Number oldValue, Number newValue) {
    //                SingleSelectionModel<Tab> selectionModel = mainTab.getSelectionModel();
    //                if(mainTab.getTabs() != null){
    //                    if(selectionModel.isSelected(0)){
    //                        karteTabPane.getTabs().clear();
    //                    }
    //                }
    //            }
    //        }); 

    // ?????
    TableColumn colId = new TableColumn("ID");
    recept.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("recept"));
    visitTime.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("visitTime"));
    tableCellAlignRight(visitTime);
    clientId.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("clientId"));
    name.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("name"));
    sex.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("sex"));
    tableCellAlignCenter(sex);
    insurance.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("insurance"));
    birthDay.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("birthDay"));
    physicianInCharge.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("physicianInCharge"));
    clinicalDepartments
            .setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("clinicalDepartments"));
    reservation.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("reservation"));
    memo.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("memo"));
    status.setCellValueFactory(new PropertyValueFactory<ReceptInfo, String>("status"));
    tableCellImageAlignCenter(status);
    // ????
    ReceptView.getItems().setAll(fetchDataFromServer());

    // ???(?)
    ReceptView.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                if (mouseEvent.getClickCount() == 2) {
                    System.out.println("Double clicked");
                    ReceptInfo selectedUser = ((TableView<ReceptInfo>) mouseEvent.getSource())
                            .getSelectionModel().getSelectedItem();
                    // ??????????
                    for (ReceptInfo info : receptList) {
                        if (info.getName().equals(selectedUser.getName())) {
                            return;
                        }
                    }
                    System.out.println(selectedUser.getClientId());
                    receptList.add(selectedUser);
                    // ??
                    final ContextMenu contextMenu = new ContextMenu();
                    MenuItem item1 = new MenuItem("?");
                    item1.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Reserve Karte?");
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item2 = new MenuItem("???");
                    item2.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab and Preservation???");
                            karteTabPane.getTabs().remove(karteTabPane.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item3 = new MenuItem("?");
                    item3.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab?");
                            karteTabPane.getTabs().remove(karteTabPane.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    contextMenu.getItems().addAll(item1, item2, item3);

                    Tab tab = new Tab(selectedUser.getName());
                    tab.setOnClosed(new EventHandler<Event>() {
                        @Override
                        public void handle(Event t) {
                            Tab tab = (Tab) t.getSource();
                            for (int i = 0; i < receptList.size(); i++) {
                                if (tab.getText().equals(receptList.get(i).getName())) {
                                    receptList.remove(i);
                                }
                            }
                            System.out.println("Closed!");
                        }
                    });
                    tab.setContextMenu(contextMenu); // Right-click mouse button menu
                    try {
                        // Loading content on demand
                        Parent root = (Parent) new FXMLLoader()
                                .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream());
                        tab.setContent(root);
                        karteTabPane.getSelectionModel().select(tab);
                        karteTabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
                        karteTabPane.getTabs().add(tab);
                        karteTabPane.setPrefSize(kartePane.getPrefWidth(), kartePane.getPrefHeight());
                        kartePane.getChildren().retainAll();
                        kartePane.getChildren().add(karteTabPane);
                    } catch (IOException ex) {
                        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                }
            }
        }
    });

    // ????
    clientId1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("clientId1"));
    name1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("name1"));
    kana1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("kana1"));
    sex1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("sex1"));
    birthDay1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("birthDay1"));
    receiveDay1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("receiveDay1"));
    status1.setCellValueFactory(new PropertyValueFactory<PatientSearchInfo, String>("status1"));
    // dummy?
    PatientSearchView.getItems().setAll(fetchDataFromPatientInfo());

    // ??(?)
    PatientSearchView.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                if (mouseEvent.getClickCount() == 2) {
                    System.out.println("Double clicked");
                    PatientSearchInfo selectedUser = ((TableView<PatientSearchInfo>) mouseEvent.getSource())
                            .getSelectionModel().getSelectedItem();
                    // ??????????
                    for (PatientSearchInfo info : patientSearchList) {
                        if (info.getName1().equals(selectedUser.getName1())) {
                            return;
                        }
                    }
                    System.out.println(selectedUser.getKana1());
                    patientSearchList.add(selectedUser);
                    // ??
                    final ContextMenu contextMenu = new ContextMenu();
                    MenuItem item1 = new MenuItem("?");
                    item1.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Reserve Karte?");
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item2 = new MenuItem("???");
                    item2.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab and Preservation???");
                            karteTabPane1.getTabs().remove(karteTabPane1.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item3 = new MenuItem("?");
                    item3.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab?");
                            karteTabPane1.getTabs().remove(karteTabPane1.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    contextMenu.getItems().addAll(item1, item2, item3);

                    Tab tab = new Tab(selectedUser.getName1());
                    tab.setOnClosed(new EventHandler<Event>() {
                        @Override
                        public void handle(Event t) {
                            Tab tab = (Tab) t.getSource();
                            for (int i = 0; i < patientSearchList.size(); i++) {
                                if (tab.getText().equals(patientSearchList.get(i).getName1())) {
                                    patientSearchList.remove(i);
                                }
                            }
                            System.out.println("Closed!");
                        }
                    });
                    tab.setContextMenu(contextMenu); // Right-click mouse button menu
                    try {
                        // Loading content on demand
                        Parent root = (Parent) new FXMLLoader()
                                .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream());
                        tab.setContent(root);
                        karteTabPane1.getSelectionModel().select(tab);
                        karteTabPane1.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
                        karteTabPane1.getTabs().add(tab);
                        karteTabPane1.setPrefSize(kartePane1.getPrefWidth(), kartePane1.getPrefHeight());
                        kartePane1.getChildren().retainAll();
                        kartePane1.getChildren().add(karteTabPane1);
                    } catch (IOException ex) {
                        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }
    });

    // ????
    clientId2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("clientId2"));
    name2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("name2"));
    kana2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("kana2"));
    insurance2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("insurance2"));
    sex2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("sex2"));
    birthDay2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("birthDay2"));
    physicianInCharge2
            .setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("physicianInCharge2"));
    clinicalDepartments2
            .setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("clinicalDepartments2"));
    karte2.setCellValueFactory(new PropertyValueFactory<PatientFutureInfo, String>("karte2"));
    // dummy?
    PatientFutureView.getItems().setAll(fetchDataFromPatientFutureInfo());

    // ??(?)
    PatientFutureView.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                if (mouseEvent.getClickCount() == 2) {
                    System.out.println("Double clicked");
                    PatientFutureInfo selectedUser = ((TableView<PatientFutureInfo>) mouseEvent.getSource())
                            .getSelectionModel().getSelectedItem();
                    System.out.println(selectedUser.getName2());
                    // ??
                    final ContextMenu contextMenu = new ContextMenu();
                    MenuItem item1 = new MenuItem("?");
                    item1.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Reserve Karte?");
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item2 = new MenuItem("???");
                    item2.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab and Preservation???");
                            karteTabPane2.getTabs().remove(karteTabPane2.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item3 = new MenuItem("?");
                    item3.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab?");
                            karteTabPane2.getTabs().remove(karteTabPane2.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    contextMenu.getItems().addAll(item1, item2, item3);

                    Tab tab = new Tab(selectedUser.getName2());
                    tab.setContextMenu(contextMenu); // Right-click mouse button menu
                    try {
                        // Loading content on demand
                        Parent root = (Parent) new FXMLLoader()
                                .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream());
                        tab.setContent(root);
                        karteTabPane2.getSelectionModel().select(tab);
                        karteTabPane2.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
                        karteTabPane2.getTabs().add(tab);
                        karteTabPane2.setPrefSize(kartePane2.getPrefWidth(), kartePane2.getPrefHeight());
                        kartePane2.getChildren().retainAll();
                        kartePane2.getChildren().add(karteTabPane2);
                    } catch (IOException ex) {
                        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                }
            }
        }
    });

    // ?????
    lab3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("lab3"));
    clientId3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("clientId3"));
    kana3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("kana3"));
    karteKana3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("karteKana3"));
    sex3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("sex3"));
    karteSex3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("karteSex3"));
    sampleGetDay3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("sampleGetDay3"));
    register3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("register3"));
    status3.setCellValueFactory(new PropertyValueFactory<LabReceiverInfo, String>("status3"));
    // dummy?
    LabRecieverView.getItems().setAll(fetchDataFromLabRecieverInfo());

    // ???(?)
    LabRecieverView.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
                if (mouseEvent.getClickCount() == 2) {
                    System.out.println("Double clicked");
                    LabReceiverInfo selectedUser = ((TableView<LabReceiverInfo>) mouseEvent.getSource())
                            .getSelectionModel().getSelectedItem();
                    System.out.println(selectedUser.getKana3());
                    // ??
                    final ContextMenu contextMenu = new ContextMenu();
                    MenuItem item1 = new MenuItem("?");
                    item1.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Reserve Karte?");
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item2 = new MenuItem("???");
                    item2.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab and Preservation???");
                            karteTabPane3.getTabs().remove(karteTabPane3.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    MenuItem item3 = new MenuItem("?");
                    item3.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent e) {
                            System.out.println("Close Tab?");
                            karteTabPane3.getTabs().remove(karteTabPane3.getSelectionModel().getSelectedItem());
                            // ??
                            // e.getSource();
                        }
                    });
                    contextMenu.getItems().addAll(item1, item2, item3);

                    Tab tab = new Tab(selectedUser.getKana3());
                    tab.setContextMenu(contextMenu); // Right-click mouse button menu
                    try {
                        // Loading content on demand
                        Parent root = (Parent) new FXMLLoader()
                                .load(this.getClass().getResource("/resources/fxml/Karte.fxml").openStream());
                        tab.setContent(root);
                        karteTabPane3.getSelectionModel().select(tab);
                        karteTabPane3.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
                        karteTabPane3.getTabs().add(tab);
                        karteTabPane3.setPrefSize(kartePane3.getPrefWidth(), kartePane3.getPrefHeight());
                        kartePane3.getChildren().retainAll();
                        kartePane3.getChildren().add(karteTabPane3);
                    } catch (IOException ex) {
                        Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                }
            }
        }
    });

    // ??5??????
    Timer exeTimer = new Timer();
    Calendar cal = Calendar.getInstance();
    final int sec = cal.get(Calendar.SECOND);
    int delay = (60 - sec) * 1000;
    int interval = 5 * 1000;
    TimerTask task = new TimerTask() {
        @Override
        public void run() {
            if (!stopFlag) {
                System.out.println("this is called every 5 seconds on UI thread");
                receptUpdate();
            } else {
                this.cancel();
            }
        }
    };
    exeTimer.schedule(task, delay, interval);

}