Search in sources :

Example 1 with CustomerTaskService

use of eu.ggnet.dwoss.customer.ui.CustomerTaskService in project dwoss by gg-net.

the class CustomerSearchController method initialize.

@Override
public void initialize(URL url, ResourceBundle rb) {
    resultListView.setCellFactory(listView -> {
        return new ListCell<PicoCustomer>() {

            @Override
            protected void updateItem(PicoCustomer item, boolean empty) {
                super.updateItem(item, empty);
                // Platform.runLater(() -> { // WTF i need this, i don't know, but otherwise
                if (item == null || empty) {
                    setText("");
                } else {
                    setText(item.getShortDescription());
                }
            // });
            }
        };
    });
    // bind the checkboxes to the Set of SearchField
    bindCheckBoxes();
    // add contextmenu to listview
    resultListView.setContextMenu(buildContextMenu());
    CUSTOMER_TASK_SERVICE = new CustomerTaskService();
    observableCustomers = CUSTOMER_TASK_SERVICE.getPartialResults();
    resultListView.setItems(observableCustomers);
    searchButton.setOnAction((ActionEvent event) -> search());
    searchField.setOnKeyPressed((ke) -> {
        if (ke.getCode() == KeyCode.ENTER) {
            search();
        }
    });
    SEARCH_PROPERTY.bind(searchField.textProperty());
    // Needed, so the bar will fill the space, otherwise it keeps beeing small
    progressBar.setMaxWidth(MAX_VALUE);
    progressBar.setMaxHeight(MAX_VALUE);
    // hidde the HBox
    progressBar.visibleProperty().bind(CUSTOMER_TASK_SERVICE.runningProperty());
    progressIndicator.visibleProperty().bind(CUSTOMER_TASK_SERVICE.runningProperty());
    statusHbox.visibleProperty().bind(CUSTOMER_TASK_SERVICE.runningProperty());
    progressIndicator.setProgress(0);
    progressBar.setProgress(0);
    progressBar.progressProperty().bind(CUSTOMER_TASK_SERVICE.progressProperty());
    progressIndicator.progressProperty().bind(CUSTOMER_TASK_SERVICE.progressProperty());
    Ui.progress().observe(CUSTOMER_TASK_SERVICE);
}
Also used : CustomerTaskService(eu.ggnet.dwoss.customer.ui.CustomerTaskService) ActionEvent(javafx.event.ActionEvent) PicoCustomer(eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer)

Aggregations

PicoCustomer (eu.ggnet.dwoss.customer.ee.entity.projection.PicoCustomer)1 CustomerTaskService (eu.ggnet.dwoss.customer.ui.CustomerTaskService)1 ActionEvent (javafx.event.ActionEvent)1