List of usage examples for javafx.collections FXCollections observableArrayList
public static <E> ObservableList<E> observableArrayList(Collection<? extends E> col)
From source file:jobhunter.gui.FXMLController.java
private void refreshJobsListView() { List<Job> jobs;/*from w w w . j ava 2s . co m*/ if (orderByRatingMenuItem.isSelected()) { jobs = ProfileRepository.getJobsByRating(deletedMenuItem.isSelected()); } else if (orderByActivityMenuItem.isSelected()) { jobs = ProfileRepository.getJobsByActivity(deletedMenuItem.isSelected()); } else if (orderByStatusMenuItem.isSelected()) { jobs = ProfileRepository.getJobsByStatus(deletedMenuItem.isSelected()); } else { orderByDateMenuItem.setSelected(true); jobs = ProfileRepository.getJobsByDate(deletedMenuItem.isSelected()); } jobsList.getSelectionModel().clearSelection(); jobsList.getItems().clear(); jobsList.setItems(FXCollections.observableArrayList(jobs)); }
From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java
private List<Triple<String, Node, String>> createConfigurationForm() { final List<Triple<String, Node, String>> formItems = new ArrayList<>(); // Headline pattern final TextField textInput = new TextField(this.logReader.getHeadlinePattern()); textInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.logReader.setHeadlinePattern(newValue); this.setChanged(true); });//www . j av a 2s .co m textInput.setStyle("-fx-font-family: monospace"); formItems.add(Triple.of("Headline Pattern", textInput, "The perl style regular expression is used to spot the beginning of" + " log entries in the log file. If a log entry consists of multiple lines, this pattern must only match the first" + " line, called \"head line\". Groups can intentionally be matched to spot values like timestamp or channel name." + " All matching groups are removed from the payload before they are processed by an automaton.")); // Index of timestamp Supplier<Integer> getter = () -> this.logReader.getHeadlinePatternIndexOfTimestamp(); Consumer<Integer> setter = value -> this.logReader.setHeadlinePatternIndexOfTimestamp(value); final TextField indexOfTimestampInput = this.createIntegerInputField(textInput, getter, setter); formItems.add(Triple.of("Timestamp Group", indexOfTimestampInput, "Denotes which matching group in the headline pattern contains" + " the timestamp. Index 0 references the whole pattern match, index 1 is the first matching group etc. The timestamp must" + " always be a valid integer. Currently, this integer is always interpreted as milliseconds. If no value is set, no" + " timestamp will be extracted and timing conditions cannot be used. If the referenced matching group is optional" + " and does not match for a specific head line, the last recent timestamp will be used for the extracted log entry.")); // Index of channel getter = () -> this.logReader.getHeadlinePatternIndexOfChannel(); setter = value -> this.logReader.setHeadlinePatternIndexOfChannel(value); final TextField indexOfChannelInput = this.createIntegerInputField(textInput, getter, setter); formItems.add(Triple.of("Channel Group", indexOfChannelInput, "Denotes which matching group in the headline pattern contains" + " the channel. If the value is empty or the matching group is optional and it did not match, the default channel is used" + " for the extracted log entry.")); // Trim payload CheckBox cb = new CheckBox(); cb.setSelected(this.logReader.getTrimPayload()); cb.selectedProperty().addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> { this.logReader.setTrimPayload(BooleanUtils.toBoolean(newValue)); this.setChanged(true); }); formItems.add(Triple.of("Trim Payload", cb, "Only has effect on multiline payloads." + " If enabled, all leading and trailing whitespaces are removed from the payload" + " after the matching groups are removed. This allows for regular expressions in the automaton that match the beginning" + " and the end of the payload, without having to take care too much for whitespaces in the source log file.")); // Handling of non headline lines this.createInputForHandlingOfNonHeadlineLines(formItems); // Trim payload cb = new CheckBox(); cb.setSelected(this.logReader.getRemoveEmptyPayloadLinesFromMultilineEntry()); cb.selectedProperty().addListener((ChangeListener<Boolean>) (observable, oldValue, newValue) -> { this.logReader.setRemoveEmptyPayloadLinesFromMultilineEntry(BooleanUtils.toBoolean(newValue)); this.setChanged(true); }); formItems.add(Triple.of("Remove Empty Lines", cb, "If enabled, empty lines will be removed from multiline payload entries.")); // Charset final SortedMap<String, Charset> charsets = Charset.availableCharsets(); final ChoiceBox<String> encodingInput = new ChoiceBox<>( FXCollections.observableArrayList(charsets.keySet())); encodingInput.getSelectionModel().select(this.logReader.getLogFileCharset().name()); encodingInput.getSelectionModel().selectedItemProperty() .addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.logReader.setLogFileCharset(charsets.get(newValue)); this.setChanged(true); }); formItems.add(Triple.of("Log File Encoding", encodingInput, "Encoding of the log file. Note that some of the encodings are" + " platform specific such that reading the log on a different platform might fail. Usually, log files are written" + " using UTF-8, UTF-16, ISO-8859-1 or ASCII.")); return formItems; }
From source file:org.sandsoft.acefx.AceEditor.java
private void loadThemeList() { themeListBox.setItems(FXCollections.observableArrayList(Themes.SUPPORTED_THEMES)); themeListBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override/*from w w w. j av a 2 s.c o m*/ public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (newValue != null && oldValue != newValue) { Object data = themeListBox.getSelectionModel().getSelectedItem(); getEditor().setTheme(((ThemeData) data).getAlias()); } } }); }
From source file:jobhunter.gui.FXMLController.java
private void refreshSubscriptionsListView() { subscriptionsList.getItems().clear(); subscriptionsList.setItems(FXCollections.observableArrayList(SubscriptionRepository.getSubscriptions())); subscriptionsListClick(null);/*from ww w.j a v a 2 s .co m*/ }
From source file:org.sandsoft.acefx.AceEditor.java
private void loadModeList() { modeListBox.setItems(FXCollections.observableArrayList(Modes.SUPPORTED_MODES)); modeListBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override/* www.j a va2s .com*/ public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (newValue != null && oldValue != newValue) { Object data = modeListBox.getSelectionModel().getSelectedItem(); getEditor().getSession().setMode(((ModeData) data).getAlias()); } } }); }
From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java
private void createBannedPlayername(ListView<String> to_update) { Stage createBannedPlayername = new Stage(); createBannedPlayername.setTitle("Add Banned Playername"); createBannedPlayername.initModality(Modality.APPLICATION_MODAL); GridPane gp = new GridPane(); gp.setPadding(new Insets(25, 25, 25, 25)); gp.setAlignment(Pos.CENTER);/*from ww w .j a va 2 s . c om*/ gp.setVgap(10); gp.setHgap(10); Text title = new Text("Add Banned Playername"); title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20)); gp.add(title, 0, 0, 2, 1); Label newusername = new Label("Ban Playername"); TextField username = new TextField(); gp.add(newusername, 0, 1); gp.add(username, 1, 1); Button finish = new Button("Finish"); HBox finish_box = new HBox(10); finish_box.setAlignment(Pos.CENTER); finish_box.getChildren().add(finish); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_playernames.remove(username.getText()); banned_playernames.add(username.getText()); to_update.setItems(FXCollections.observableArrayList(banned_playernames)); createBannedPlayername.close(); } }); gp.add(finish_box, 0, 2, 2, 1); Scene sc = new Scene(gp, 300, 175); createBannedPlayername.setScene(sc); createBannedPlayername.show(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXEnumTagPickerPane.java
public void setJavaFXDataCollection(Collection<ICFBamEnumTagObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value;// w w w .j a v a 2 s . co m observableListOfEnumTag = null; if (javafxDataCollection != null) { observableListOfEnumTag = FXCollections.observableArrayList(javafxDataCollection); observableListOfEnumTag.sort(compareEnumTagByQualName); } else { observableListOfEnumTag = FXCollections.observableArrayList(); } if (dataTable != null) { dataTable.setItems(observableListOfEnumTag); // Hack from stackoverflow to fix JavaFX TableView refresh issue ((TableColumn) dataTable.getColumns().get(0)).setVisible(false); ((TableColumn) dataTable.getColumns().get(0)).setVisible(true); } }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXDelDepPickerPane.java
public void setJavaFXDataCollection(Collection<ICFBamDelDepObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value;//from ww w. j av a 2 s. co m observableListOfDelDep = null; if (javafxDataCollection != null) { observableListOfDelDep = FXCollections.observableArrayList(javafxDataCollection); observableListOfDelDep.sort(compareDelDepByQualName); } else { observableListOfDelDep = FXCollections.observableArrayList(); } if (dataTable != null) { dataTable.setItems(observableListOfDelDep); // Hack from stackoverflow to fix JavaFX TableView refresh issue ((TableColumn) dataTable.getColumns().get(0)).setVisible(false); ((TableColumn) dataTable.getColumns().get(0)).setVisible(true); } }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXPopDepPickerPane.java
public void setJavaFXDataCollection(Collection<ICFBamPopDepObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value;//ww w. j a v a 2 s . co m observableListOfPopDep = null; if (javafxDataCollection != null) { observableListOfPopDep = FXCollections.observableArrayList(javafxDataCollection); observableListOfPopDep.sort(comparePopDepByQualName); } else { observableListOfPopDep = FXCollections.observableArrayList(); } if (dataTable != null) { dataTable.setItems(observableListOfPopDep); // Hack from stackoverflow to fix JavaFX TableView refresh issue ((TableColumn) dataTable.getColumns().get(0)).setVisible(false); ((TableColumn) dataTable.getColumns().get(0)).setVisible(true); } }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXClearDepPickerPane.java
public void setJavaFXDataCollection(Collection<ICFBamClearDepObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value;/*w w w. j a v a2 s . c o m*/ observableListOfClearDep = null; if (javafxDataCollection != null) { observableListOfClearDep = FXCollections.observableArrayList(javafxDataCollection); observableListOfClearDep.sort(compareClearDepByQualName); } else { observableListOfClearDep = FXCollections.observableArrayList(); } if (dataTable != null) { dataTable.setItems(observableListOfClearDep); // Hack from stackoverflow to fix JavaFX TableView refresh issue ((TableColumn) dataTable.getColumns().get(0)).setVisible(false); ((TableColumn) dataTable.getColumns().get(0)).setVisible(true); } }