| @@ -5,7 +5,11 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| */ | */ | ||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | import de.uniluebeck.mi.projmi6.db.DBHandler; | ||||
| import de.uniluebeck.mi.projmi6.model.*; | |||||
| import de.uniluebeck.mi.projmi6.model.DiagArt; | |||||
| import de.uniluebeck.mi.projmi6.model.Diagnose; | |||||
| import de.uniluebeck.mi.projmi6.model.Icd10Code; | |||||
| import de.uniluebeck.mi.projmi6.model.Mitarbeiter; | |||||
| import de.uniluebeck.mi.projmi6.view.SelectKeyComboBoxListener; | |||||
| import javafx.beans.property.ReadOnlyObjectProperty; | import javafx.beans.property.ReadOnlyObjectProperty; | ||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| @@ -13,14 +17,43 @@ import javafx.collections.ObservableList; | |||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.*; | import javafx.scene.control.*; | ||||
| import javafx.event.ActionEvent; | |||||
| import javafx.scene.layout.GridPane; | import javafx.scene.layout.GridPane; | ||||
| public class DiagnoseController { | public class DiagnoseController { | ||||
| SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW); | |||||
| @FXML | |||||
| Button btnDiagAbort, btnDiagEdit; | |||||
| private MainController mainController; | private MainController mainController; | ||||
| private SimpleObjectProperty<ObservableList<Diagnose>> diagnosen = new SimpleObjectProperty<>(); | |||||
| @FXML | |||||
| private ListView<Diagnose> diagnoseList; | |||||
| @FXML | |||||
| private GridPane fields; | |||||
| @FXML | |||||
| private ComboBox<Mitarbeiter> diagDiagnoseArzt; | |||||
| @FXML | |||||
| private Label diagCreator; | |||||
| @FXML | |||||
| private Button btnDiagCancel; | |||||
| @FXML | |||||
| private TextArea diagFreitext; | |||||
| @FXML | |||||
| private Button btnDiagSave; | |||||
| @FXML | |||||
| private Label diagCreateTime; | |||||
| @FXML | |||||
| private ComboBox<DiagArt> diagDiagnoseArt; | |||||
| @FXML | |||||
| private Label diagChanger; | |||||
| @FXML | |||||
| private ComboBox<Icd10Code> diagDiagnose; | |||||
| @FXML | |||||
| private Label diagChangeTime; | |||||
| @FXML | |||||
| private Button btnDiagCreate; | |||||
| public DiagnoseController(MainController mainController){ | |||||
| public DiagnoseController(MainController mainController) { | |||||
| this.mainController = mainController; | this.mainController = mainController; | ||||
| } | } | ||||
| @@ -28,24 +61,14 @@ public class DiagnoseController { | |||||
| return diagnosen.get(); | return diagnosen.get(); | ||||
| } | } | ||||
| public SimpleObjectProperty<ObservableList<Diagnose>> diagnosenProperty() { | |||||
| return diagnosen; | |||||
| } | |||||
| public void setDiagnosen(ObservableList<Diagnose> diagnosen) { | public void setDiagnosen(ObservableList<Diagnose> diagnosen) { | ||||
| this.diagnosen.set(diagnosen); | this.diagnosen.set(diagnosen); | ||||
| } | } | ||||
| private SimpleObjectProperty<ObservableList<Diagnose>> diagnosen = new SimpleObjectProperty<>(); | |||||
| public enum State { | |||||
| CREATE, EDIT, VIEW | |||||
| public SimpleObjectProperty<ObservableList<Diagnose>> diagnosenProperty() { | |||||
| return diagnosen; | |||||
| } | } | ||||
| SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW); | |||||
| public State getState() { | public State getState() { | ||||
| return state.get(); | return state.get(); | ||||
| } | } | ||||
| @@ -54,14 +77,13 @@ public class DiagnoseController { | |||||
| return state; | return state; | ||||
| } | } | ||||
| @FXML | |||||
| private ListView<Diagnose> diagnoseList; | |||||
| @FXML | @FXML | ||||
| public void initialize(){ | |||||
| public void initialize() { | |||||
| diagDiagnose.itemsProperty().bind(mainController.getStammdaten().icd10CodesProperty()); | diagDiagnose.itemsProperty().bind(mainController.getStammdaten().icd10CodesProperty()); | ||||
| new SelectKeyComboBoxListener(diagDiagnose); | |||||
| diagDiagnoseArt.setItems(FXCollections.observableArrayList(DiagArt.values())); | diagDiagnoseArt.setItems(FXCollections.observableArrayList(DiagArt.values())); | ||||
| diagDiagnoseArzt.itemsProperty().bind(mainController.getStammdaten().mitarbeiterProperty()); | diagDiagnoseArzt.itemsProperty().bind(mainController.getStammdaten().mitarbeiterProperty()); | ||||
| @@ -73,9 +95,9 @@ public class DiagnoseController { | |||||
| diagnoseList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | diagnoseList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | ||||
| diagnoseList.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { | diagnoseList.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { | ||||
| if(newValue==null){ | |||||
| if (newValue == null) { | |||||
| clearFields(); | clearFields(); | ||||
| }else{ | |||||
| } else { | |||||
| copyDiagnoseDataIntoFields(newValue); | copyDiagnoseDataIntoFields(newValue); | ||||
| } | } | ||||
| }); | }); | ||||
| @@ -83,8 +105,7 @@ public class DiagnoseController { | |||||
| } | } | ||||
| private void initButtons(){ | |||||
| private void initButtons() { | |||||
| btnDiagCreate.disableProperty().bind(mainController.fallProperty().isNull()); | btnDiagCreate.disableProperty().bind(mainController.fallProperty().isNull()); | ||||
| btnDiagEdit.disableProperty().bind(diagnoseList.getSelectionModel().selectedItemProperty().isNull()); | btnDiagEdit.disableProperty().bind(diagnoseList.getSelectionModel().selectedItemProperty().isNull()); | ||||
| @@ -102,62 +123,22 @@ public class DiagnoseController { | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| Button btnDiagAbort, btnDiagEdit; | |||||
| @FXML | |||||
| private void clickedEdit(){ | |||||
| private void clickedEdit() { | |||||
| state.set(State.EDIT); | state.set(State.EDIT); | ||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void clickedAbort(){ | |||||
| private void clickedAbort() { | |||||
| state.set(State.VIEW); | state.set(State.VIEW); | ||||
| Diagnose diagnose = diagnoseList.getSelectionModel().getSelectedItem(); | Diagnose diagnose = diagnoseList.getSelectionModel().getSelectedItem(); | ||||
| if(diagnose==null){ | |||||
| if (diagnose == null) { | |||||
| clearFields(); | clearFields(); | ||||
| }else{ | |||||
| } else { | |||||
| copyDiagnoseDataIntoFields(diagnose); | copyDiagnoseDataIntoFields(diagnose); | ||||
| } | } | ||||
| } | } | ||||
| @FXML | @FXML | ||||
| private GridPane fields; | |||||
| @FXML | |||||
| private ComboBox<Mitarbeiter> diagDiagnoseArzt; | |||||
| @FXML | |||||
| private Label diagCreator; | |||||
| @FXML | |||||
| private Button btnDiagCancel; | |||||
| @FXML | |||||
| private TextArea diagFreitext; | |||||
| @FXML | |||||
| private Button btnDiagSave; | |||||
| @FXML | |||||
| private Label diagCreateTime; | |||||
| @FXML | |||||
| private ComboBox<DiagArt> diagDiagnoseArt; | |||||
| @FXML | |||||
| private Label diagChanger; | |||||
| @FXML | |||||
| private ComboBox<Icd10Code> diagDiagnose; | |||||
| @FXML | |||||
| private Label diagChangeTime; | |||||
| @FXML | |||||
| private Button btnDiagCreate; | |||||
| @FXML | |||||
| void clickedDiagCreate(ActionEvent event) { | void clickedDiagCreate(ActionEvent event) { | ||||
| this.state.set(State.CREATE); | this.state.set(State.CREATE); | ||||
| } | } | ||||
| @@ -185,8 +166,6 @@ public class DiagnoseController { | |||||
| mainController.refreshCaseData(); | mainController.refreshCaseData(); | ||||
| } | } | ||||
| private void copyDiagnoseDataIntoFields(Diagnose diagnose){ | private void copyDiagnoseDataIntoFields(Diagnose diagnose){ | ||||
| diagDiagnoseArzt.setValue(diagnose.getArzt()); | diagDiagnoseArzt.setValue(diagnose.getArzt()); | ||||
| @@ -224,4 +203,8 @@ public class DiagnoseController { | |||||
| diagChanger.setText(""); | diagChanger.setText(""); | ||||
| diagChangeTime.setText(""); | diagChangeTime.setText(""); | ||||
| } | } | ||||
| public enum State { | |||||
| CREATE, EDIT, VIEW | |||||
| } | |||||
| } | } | ||||
| @@ -8,6 +8,7 @@ import de.uniluebeck.mi.projmi6.db.DBHandler; | |||||
| import de.uniluebeck.mi.projmi6.model.Patient; | import de.uniluebeck.mi.projmi6.model.Patient; | ||||
| import de.uniluebeck.mi.projmi6.model.Station; | import de.uniluebeck.mi.projmi6.model.Station; | ||||
| import de.uniluebeck.mi.projmi6.model.StationsUebersichtsItem; | import de.uniluebeck.mi.projmi6.model.StationsUebersichtsItem; | ||||
| import de.uniluebeck.mi.projmi6.view.SelectKeyComboBoxListener; | |||||
| import javafx.beans.binding.Bindings; | import javafx.beans.binding.Bindings; | ||||
| import javafx.beans.binding.ObjectBinding; | import javafx.beans.binding.ObjectBinding; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| @@ -123,6 +124,7 @@ public class PatientTablesController { | |||||
| tblStationOverview.disableProperty().bind(cmbStationenFilter.valueProperty().isNull()); | tblStationOverview.disableProperty().bind(cmbStationenFilter.valueProperty().isNull()); | ||||
| cmbStationenFilter.itemsProperty().bind(mainController.getStammdaten().stationenProperty()); | cmbStationenFilter.itemsProperty().bind(mainController.getStammdaten().stationenProperty()); | ||||
| new SelectKeyComboBoxListener(cmbStationenFilter); | |||||
| patientObjectBinding = Bindings.<Patient>createObjectBinding(() -> { | patientObjectBinding = Bindings.<Patient>createObjectBinding(() -> { | ||||
| @@ -4,6 +4,7 @@ import de.uniluebeck.mi.projmi6.db.DBHandler; | |||||
| import de.uniluebeck.mi.projmi6.model.Station; | import de.uniluebeck.mi.projmi6.model.Station; | ||||
| import de.uniluebeck.mi.projmi6.model.StationsHistorie; | import de.uniluebeck.mi.projmi6.model.StationsHistorie; | ||||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | import de.uniluebeck.mi.projmi6.view.DateTimePicker; | ||||
| import de.uniluebeck.mi.projmi6.view.SelectKeyComboBoxListener; | |||||
| import javafx.beans.binding.Bindings; | import javafx.beans.binding.Bindings; | ||||
| import javafx.beans.property.ReadOnlyObjectProperty; | import javafx.beans.property.ReadOnlyObjectProperty; | ||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| @@ -35,6 +36,8 @@ public class StationsHistorieController { | |||||
| GridPane fields; | GridPane fields; | ||||
| @FXML | @FXML | ||||
| Button btnStatHistEdit; | Button btnStatHistEdit; | ||||
| @FXML | |||||
| Button btnStatHistDelete; | |||||
| /** | /** | ||||
| * The station history that is shown in the edit window, or null if a new station history should be created. | * The station history that is shown in the edit window, or null if a new station history should be created. | ||||
| */ | */ | ||||
| @@ -58,9 +61,10 @@ public class StationsHistorieController { | |||||
| private ComboBox<String> cmbAbteilung; | private ComboBox<String> cmbAbteilung; | ||||
| private SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorie = | private SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorie = | ||||
| new SimpleObjectProperty<>(); | new SimpleObjectProperty<>(); | ||||
| @FXML | |||||
| private Button btnStatHistCreate; | |||||
| public StationsHistorieController(MainController mainController){ | |||||
| public StationsHistorieController(MainController mainController) { | |||||
| this.mainController = mainController; | this.mainController = mainController; | ||||
| } | } | ||||
| @@ -78,9 +82,6 @@ public class StationsHistorieController { | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| private Button btnStatHistCreate; | |||||
| @FXML | |||||
| private void initialize() { | private void initialize() { | ||||
| initColumns(); | initColumns(); | ||||
| @@ -137,6 +138,8 @@ public class StationsHistorieController { | |||||
| cmbAbteilung.getItems().add(0, any); | cmbAbteilung.getItems().add(0, any); | ||||
| cmbAbteilung.getSelectionModel().select(0); | cmbAbteilung.getSelectionModel().select(0); | ||||
| new SelectKeyComboBoxListener(cmbAbteilung); | |||||
| tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { | tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { | ||||
| setStationsHistorieSelected(newValue); | setStationsHistorieSelected(newValue); | ||||
| }); | }); | ||||
| @@ -153,6 +156,7 @@ public class StationsHistorieController { | |||||
| cmbStation.setItems(stationenFiltered); | cmbStation.setItems(stationenFiltered); | ||||
| new SelectKeyComboBoxListener(cmbStation); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| @@ -171,7 +175,7 @@ public class StationsHistorieController { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| mainController.refreshCaseData(); | mainController.refreshCaseData(); | ||||
| }else{ | |||||
| } else { | |||||
| copyFieldDataIntoStationsHistorie(stationsHistorieSelected); | copyFieldDataIntoStationsHistorie(stationsHistorieSelected); | ||||
| try { | try { | ||||
| DBHandler.setStationsHistorie(stationsHistorieSelected, true); | DBHandler.setStationsHistorie(stationsHistorieSelected, true); | ||||
| @@ -190,16 +194,16 @@ public class StationsHistorieController { | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void clickedCreateAufenthalt(){ | |||||
| private void clickedCreateAufenthalt() { | |||||
| this.state.set(State.CREATE); | this.state.set(State.CREATE); | ||||
| setStationsHistorieSelected(null); | setStationsHistorieSelected(null); | ||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void clickedDelete(){ | |||||
| private void clickedDelete() { | |||||
| StationsHistorie selectedItem = tblStationsHistorie.getSelectionModel().getSelectedItem(); | StationsHistorie selectedItem = tblStationsHistorie.getSelectionModel().getSelectedItem(); | ||||
| if(!LocalDateTime.now().isBefore(selectedItem.getAufnahmeDatum())){ | |||||
| if (!LocalDateTime.now().isBefore(selectedItem.getAufnahmeDatum())) { | |||||
| Alert alert = new Alert(Alert.AlertType.WARNING); | Alert alert = new Alert(Alert.AlertType.WARNING); | ||||
| alert.setTitle("Stationsaufenthalt kann nicht entfernt werden!"); | alert.setTitle("Stationsaufenthalt kann nicht entfernt werden!"); | ||||
| alert.setHeaderText(null); | alert.setHeaderText(null); | ||||
| @@ -210,9 +214,9 @@ public class StationsHistorieController { | |||||
| return; | return; | ||||
| } | } | ||||
| try{ | |||||
| try { | |||||
| DBHandler.delStationsHistorie(selectedItem); | DBHandler.delStationsHistorie(selectedItem); | ||||
| }catch (Exception e){ | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| @@ -221,9 +225,6 @@ public class StationsHistorieController { | |||||
| } | } | ||||
| @FXML | |||||
| Button btnStatHistDelete; | |||||
| public ObservableList<StationsHistorie> getStationsHistorie() { | public ObservableList<StationsHistorie> getStationsHistorie() { | ||||
| return stationsHistorie.get(); | return stationsHistorie.get(); | ||||
| } | } | ||||
| @@ -4,10 +4,12 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| * Created by 626947 on 12.11.15. | * Created by 626947 on 12.11.15. | ||||
| */ | */ | ||||
| import de.uniluebeck.mi.projmi6.Main; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | import de.uniluebeck.mi.projmi6.db.DBHandler; | ||||
| import de.uniluebeck.mi.projmi6.model.*; | |||||
| import de.uniluebeck.mi.projmi6.model.Mitarbeiter; | |||||
| import de.uniluebeck.mi.projmi6.model.OpsCode; | |||||
| import de.uniluebeck.mi.projmi6.model.Untersuchung; | |||||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | import de.uniluebeck.mi.projmi6.view.DateTimePicker; | ||||
| import de.uniluebeck.mi.projmi6.view.SelectKeyComboBoxListener; | |||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| @@ -61,28 +63,30 @@ public class UntersuchungenController { | |||||
| @FXML | @FXML | ||||
| private ComboBox<Mitarbeiter> untsArzt; | private ComboBox<Mitarbeiter> untsArzt; | ||||
| private SimpleObjectProperty<ObservableList<Untersuchung>> untersuchungen = new SimpleObjectProperty<>(); | |||||
| public ObservableList<Untersuchung> getUntersuchungen() { | |||||
| return untersuchungen.get(); | |||||
| public UntersuchungenController(MainController mainController) { | |||||
| this.mainController = mainController; | |||||
| } | } | ||||
| public SimpleObjectProperty<ObservableList<Untersuchung>> untersuchungenProperty() { | |||||
| return untersuchungen; | |||||
| public ObservableList<Untersuchung> getUntersuchungen() { | |||||
| return untersuchungen.get(); | |||||
| } | } | ||||
| public void setUntersuchungen(ObservableList<Untersuchung> untersuchungen) { | public void setUntersuchungen(ObservableList<Untersuchung> untersuchungen) { | ||||
| this.untersuchungen.set(untersuchungen); | this.untersuchungen.set(untersuchungen); | ||||
| } | } | ||||
| private SimpleObjectProperty<ObservableList<Untersuchung>> untersuchungen = new SimpleObjectProperty<>(); | |||||
| public UntersuchungenController (MainController mainController){ | |||||
| this.mainController = mainController; | |||||
| public SimpleObjectProperty<ObservableList<Untersuchung>> untersuchungenProperty() { | |||||
| return untersuchungen; | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| public void initialize(){ | public void initialize(){ | ||||
| untsOpsCode.itemsProperty().bind(mainController.getStammdaten().opsCodesProperty()); | untsOpsCode.itemsProperty().bind(mainController.getStammdaten().opsCodesProperty()); | ||||
| new SelectKeyComboBoxListener(untsOpsCode); | |||||
| untsList.itemsProperty().bind(untersuchungen); | untsList.itemsProperty().bind(untersuchungen); | ||||
| untsArzt.setItems(mainController.getStammdaten().getMitarbeiter()); | untsArzt.setItems(mainController.getStammdaten().getMitarbeiter()); | ||||
| @@ -0,0 +1,87 @@ | |||||
| package de.uniluebeck.mi.projmi6.view; | |||||
| import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; | |||||
| import javafx.beans.value.ChangeListener; | |||||
| import javafx.beans.value.ObservableValue; | |||||
| import javafx.collections.ObservableList; | |||||
| import javafx.event.EventHandler; | |||||
| import javafx.scene.control.ComboBox; | |||||
| import javafx.scene.control.ListView; | |||||
| import javafx.scene.input.KeyCode; | |||||
| import javafx.scene.input.KeyEvent; | |||||
| import javafx.scene.input.MouseEvent; | |||||
| /** | |||||
| * Created by nils on 19.11.2015. | |||||
| * <p/> | |||||
| * Geklaut von <a href="http://tech.chitgoks.com/2013/07/19/how-to-go-to-item-in-combobox-on-keypress-in-java-fx-2/">hier</a> | |||||
| */ | |||||
| public class SelectKeyComboBoxListener implements EventHandler<KeyEvent> { | |||||
| private ComboBox comboBox; | |||||
| private StringBuilder sb = new StringBuilder(); | |||||
| public SelectKeyComboBoxListener(ComboBox comboBox) { | |||||
| this.comboBox = comboBox; | |||||
| this.comboBox.setOnKeyReleased(SelectKeyComboBoxListener.this); | |||||
| this.comboBox.addEventFilter(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() { | |||||
| @Override | |||||
| public void handle(KeyEvent event) { | |||||
| if (event.getCode() == KeyCode.ESCAPE && sb.length() > 0) { | |||||
| sb.delete(0, sb.length()); | |||||
| } | |||||
| } | |||||
| }); | |||||
| // add a focus listener such that if not in focus, reset the filtered typed keys | |||||
| this.comboBox.focusedProperty().addListener(new ChangeListener() { | |||||
| @Override | |||||
| public void changed(ObservableValue observable, Object oldValue, Object newValue) { | |||||
| if (newValue instanceof Boolean && !((Boolean) newValue).booleanValue()) | |||||
| sb.delete(0, sb.length()); | |||||
| else { | |||||
| ListView lv = ((ComboBoxListViewSkin) SelectKeyComboBoxListener.this.comboBox.getSkin()).getListView(); | |||||
| lv.scrollTo(lv.getSelectionModel().getSelectedIndex()); | |||||
| } | |||||
| } | |||||
| }); | |||||
| this.comboBox.setOnMouseClicked(new EventHandler<MouseEvent>() { | |||||
| @Override | |||||
| public void handle(MouseEvent event) { | |||||
| ListView lv = ((ComboBoxListViewSkin) SelectKeyComboBoxListener.this.comboBox.getSkin()).getListView(); | |||||
| lv.scrollTo(lv.getSelectionModel().getSelectedIndex()); | |||||
| } | |||||
| }); | |||||
| } | |||||
| @Override | |||||
| public void handle(KeyEvent event) { | |||||
| if (event.getCode() == KeyCode.DOWN || event.getCode() == KeyCode.UP || event.getCode() == KeyCode.TAB) { | |||||
| return; | |||||
| } else if (event.getCode() == KeyCode.BACK_SPACE && sb.length() > 0) { | |||||
| sb.deleteCharAt(sb.length() - 1); | |||||
| } else { | |||||
| sb.append(event.getText()); | |||||
| } | |||||
| if (sb.length() == 0) | |||||
| return; | |||||
| boolean found = false; | |||||
| ObservableList items = comboBox.getItems(); | |||||
| for (int i = 0; i < items.size(); i++) { | |||||
| if (event.getCode() != KeyCode.BACK_SPACE && items.get(i).toString().toLowerCase().startsWith(sb.toString().toLowerCase())) { | |||||
| ListView lv = ((ComboBoxListViewSkin) comboBox.getSkin()).getListView(); | |||||
| lv.getSelectionModel().clearAndSelect(i); | |||||
| lv.scrollTo(lv.getSelectionModel().getSelectedIndex()); | |||||
| found = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if (!found && sb.length() > 0) | |||||
| sb.deleteCharAt(sb.length() - 1); | |||||
| } | |||||
| } | |||||