/** Load the groups of a contact. */ public final void setupGroups() { for (Group g : c.getGroups()) { String name = g.getName(); if (!ACTIVEDATA.contains("Arbeit") && name.equals("Arbeit")) { ACTIVEDATA.add("Arbeit"); } else { if (!INACTIVEDATA.contains("Arbeit") && !ACTIVEDATA.contains("Arbeit")) { INACTIVEDATA.add("Arbeit"); } } if (!ACTIVEDATA.contains("Familie") && name.equals("Familie")) { ACTIVEDATA.add("Familie"); } else { if (!INACTIVEDATA.contains("Familie") && !ACTIVEDATA.contains("Familie")) { INACTIVEDATA.add("Familie"); } } if (!ACTIVEDATA.contains("Freunde") && name.equals("Freunde")) { ACTIVEDATA.add("Freunde"); } else { if (!INACTIVEDATA.contains("Freunde") && !ACTIVEDATA.contains("Freunde")) { INACTIVEDATA.add("Freunde"); } } } enabled.setItems(ACTIVEDATA); disabled.setItems(INACTIVEDATA); }
private void updateScores() { switch (selectedGame) { case "wordex": game = "ΛΕΞΟΜΑΝΤΕΙΑ"; break; case "wordsearch": game = "ΚΡΥΠΤΟΛΕΞΟ"; break; case "splitwords": game = "ΑΝΤΙΣΤΟΙΧΙΣΗ"; break; case "wordsFromALetter": game = "ΛΕΞΕΙΣ ΑΠΟ ΓΡΑΜΜΑ"; break; case "correctSpelling": game = "ΣΩΣΤΗ ΟΡΘΟΓΡΑΦΙΑ"; break; case "correctSpelling2": game = "ΣΩΣΤΗ ΟΡΘΟΓΡΑΦΙΑ 2"; break; case "namesAnimalsPlants": game = "ΟΝΟΜΑTA, ΖΩΑ, ΦΥΤΑ"; break; case "coloredBoxes": game = "ΧΡΩΜΑΤΙΣΤΑ ΚΟΥΤΙΑ"; break; case "matchCards": game = "ΤΑΙΡΙΑΞΕ ΚΑΡΤΕΣ"; break; case "faceNameHouse": game = "Face Name House"; break; } try { gameScores = db.getScores(game); gScoresContents = FXCollections.observableArrayList(); Collections.sort(gameScores, Collections.reverseOrder()); for (int i = 0; i < Math.min(gameScores.size(), 5); i++) { gScoresContents.add(gameScores.get(i)); } gScores.setItems(gScoresContents); personalScores = db.getScores(player, game); pScoresContents = FXCollections.observableArrayList(); Collections.sort(personalScores, Collections.reverseOrder()); for (int i = 0; i < Math.min(personalScores.size(), 5); i++) { pScoresContents.add(personalScores.get(i)); } pScores.setItems(pScoresContents); } catch (SQLException ex) { // TODO handle score exceptions } }
/** * updates the items we search for with the text in the searchbox and the currently selected * Searchradiobutton * * @param newVal */ public void renewSearch(String newVal) { listView.getSelectionModel().clearSelection(); searchItems.clear(); if (newVal.equals("")) { listView.setItems(items); log.info("All items are displayed"); } else { if (searchToggle.getSelectedToggle().equals(nameSearch)) { itemsMap.forEach( (a, b) -> { if (b.getName().toLowerCase().contains(newVal.toLowerCase())) { searchItems.add(b); } }); log.info("Only items with '" + newVal + "' in their name are displayed"); } else if (searchToggle.getSelectedToggle().equals(amountSearch)) { itemsMap.forEach( (a, b) -> { if (String.valueOf(b.getAmount()).contains(newVal)) { searchItems.add(b); } }); log.info("Only items with '" + newVal + "' as their amount are displayed"); } else if (searchToggle.getSelectedToggle().equals(barcodeSearch)) { itemsMap.forEach( (a, b) -> { if (b.getGtin().contains(newVal)) { searchItems.add(b); } }); log.info("Only items with '" + newVal + "' in their barcode are displayed"); } else if (searchToggle.getSelectedToggle().equals(categorieSearch)) { itemsMap.forEach( (a, b) -> { for (String cat : b.getCategories()) { if (cat.toLowerCase().contains(newVal.toLowerCase())) { searchItems.add(b); break; } } }); log.info("Only items with '" + newVal + "' in their categories are displayed"); } listView.setItems(searchItems); } }
public void btnRemoveAssistantOrProfessor_Pressed() { if (!listAssistantsOrProfessors.getSelectionModel().isEmpty()) { ObservableList<String> updatedElements = listAssistantsOrProfessors.getItems(); String valueSelected = listAssistantsOrProfessors.getSelectionModel().getSelectedItem(); String rut = valueSelected.split("-")[1]; for (Professor professor : Manager.INSTANCE.professors) { if (rut.equals(professor.getRut())) { if (((Lecture) Manager.INSTANCE.currentEditignICourse) .getProfessors() .contains(professor)) { ((Lecture) Manager.INSTANCE.currentEditignICourse).removeProfessor(professor); updatedElements.remove(valueSelected); listAssistantsOrProfessors.setItems(updatedElements); break; } else { ViewUtilities.showAlert("El profesor no se encuentra registrado en la clase"); break; } } } } else { ViewUtilities.showAlert("Primero debes seleccionar un profesor para quitar"); } }
private void showPersoon(Persoon persoon) { if (persoon == null) { clearTabPersoon(); } else { tfPersoonNr.setText(persoon.getNr() + ""); tfVoornamen.setText(persoon.getVoornamen()); tfTussenvoegsel.setText(persoon.getTussenvoegsel()); tfAchternaam.setText(persoon.getAchternaam()); tfGeslacht.setText(persoon.getGeslacht().toString()); tfGebDatum.setText(StringUtilities.datumString(persoon.getGebDat())); tfGebPlaats.setText(persoon.getGebPlaats()); if (persoon.getOuderlijkGezin() != null) { cbOuderlijkGezin.getSelectionModel().select(persoon.getOuderlijkGezin()); } else { cbOuderlijkGezin.getSelectionModel().clearSelection(); } // todo opgave 3 this.alsOuderBetrokkenIn = FXCollections.observableArrayList(persoon.getAlsOuderBetrokkenIn()); ArrayList<Persoon> pList = new ArrayList<Persoon>(); for (Gezin g : persoon.getAlsOuderBetrokkenIn()) { pList.addAll(g.getKinderen()); } this.kinderen = FXCollections.observableArrayList(pList); lvAlsOuderBetrokkenBij.setItems(this.getAlsOuderBetrokkenIn()); } }
/** Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { handeller = new hang(); switch (hang.lang) { case "AR": handeller.loadWords(hang.wordpathAR); break; case "FR": handeller.loadWords(hang.wordpathFR); break; case "EN": handeller.loadWords(hang.wordpathEN); break; case "ES": handeller.loadWords(hang.wordpathES); break; default: handeller.loadWords(hang.wordpathEN); } handeller.loadWords(hang.wordpathEN); Breload.setDisable(true); Btest.setDisable(true); Rword.setDisable(true); LHisto.setItems(data); Toption.setText("............"); Image image = new Image("/resource/original.gif"); img.setImage(image); // Set languag Menu imglang.setImage(new Image("/resource/en.png")); }
/** Loads the name of all ingredients and puts them in ingredientlist. */ public void updateIngredients() { ArrayList<ArrayList<String>> dataSet; ObservableList<String> itemList = FXCollections.observableArrayList(); // Observable arraylist for the listview try { System.out.println("- Main updateIngredientsRecipList"); dataSet = fetchData("Ingredients", "Name"); // Gives the arraylist the ingredientnames for (ArrayList<String> element : dataSet) { itemList.add(element.get(0)); // For every element in the array, get name } System.out.println("- end of Main updateIngredientsRecipList"); } catch (SQLException e) { e.printStackTrace(); } recipeIngredients.setItems(itemList); // Sets the Listview to show the obs arraylist itemList.clear(); try { dataSet = fetchData("Units", "*"); for (ArrayList<String> element : dataSet) { itemList.add(element.get(1)); } } catch (SQLException e) { e.printStackTrace(); } ingredientUnit.setItems(itemList); }
/** Mètode que s'inicia automaticament al començament */ public void initialize() { setData(city, units); llista.setItems(data); llista.setCellFactory( new Callback<ListView<String>, ListCell<String>>() { @Override public ListCell<String> call(ListView<String> llista) { return new TempsCell(); } }); inicialitzarDialog(); llista.setOnMouseClicked( new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { String fname = llista.getSelectionModel().getSelectedItem(); String icon = ""; int p = fname.lastIndexOf('#'); if (p >= 0) { icon = fname.substring(0, p); } String[] temps = fname.split("-"); createDialog(icon, temps[1].replace("\t", "")); dialog.show(); } }); }
@Override public void start(Stage primaryStage) { primaryStage.setTitle("http://java-buddy.blogspot.com/"); prepareMyList(); ListView<MyObject> listView = new ListView<MyObject>(); ObservableList<MyObject> myObservableList = FXCollections.observableList(myList); listView.setItems(myObservableList); listView.setCellFactory( new Callback<ListView<MyObject>, ListCell<MyObject>>() { @Override public ListCell<MyObject> call(ListView<MyObject> p) { ListCell<MyObject> cell = new ListCell<MyObject>() { @Override protected void updateItem(MyObject t, boolean bln) { super.updateItem(t, bln); if (t != null) { setText(t.getDay() + ":" + t.getNumber()); } } }; return cell; } }); StackPane root = new StackPane(); root.getChildren().add(listView); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }
@FXML protected void formationClickedOn(MouseEvent E) { formComposition = FXCollections.observableArrayList( formationList.getSelectionModel().getSelectedItem().getComposition()); currentFormationComposition.setItems(formComposition); }
public void initialize() { bookList.setItems(store.books()); bookList.setCellFactory( param -> new ListCell<Book>() { @Override protected void updateItem(Book item, boolean empty) { super.updateItem(item, empty); final String newTitle = Optional.ofNullable(item).map(Book::getTitle).orElse(""); setText(newTitle); } }); bookList .getSelectionModel() .selectedItemProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue != null) { publishAction(new SelectAction(newValue)); } }); }
/** * Sets up the GUI, ensuring that everything is loaded nicely. * * @param location * @param resources */ public void initialize(URL location, ResourceBundle resources) { filter = new Filter(); Set<String> books = new HashSet<>(); for (Book book : Book.values()) { books.add(book.toString()); } filter.setBooks(books); results.setItems(listItems); String index = "java_ebook_search/index"; String home = "/java_ebook_search/view/index.html"; try { search = new Search(index); commonTerms = TextFields.bindAutoCompletion(query, search.getAutocomplete()); commonTerms.setVisibleRowCount(10); sc = new SpellCheck(); webEngine = webView.getEngine(); webEngine.load(getClass().getResource(home).toString()); results .getSelectionModel() .selectedItemProperty() .addListener((observable, oldValue, newValue) -> loadResult(newValue)); } catch (NullPointerException e) { System.out.println("It's happened again, ignore it"); e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }
public void updateRobotList() { HashMap<String, RobotViewModel> robots = RobotRepository.getInstance().getRobots(); ObservableList<RobotViewModel> observableRobots = FXCollections.observableArrayList(); observableRobots.addAll(robots.values()); list_robots.setItems(observableRobots); }
public void btnAddAssistantOrProfessor_Pressed() { if (!chBxAssistantsOrProfessors.getSelectionModel().isEmpty()) { ObservableList<String> updatedElements = listAssistantsOrProfessors.getItems(); String valueSelected = chBxAssistantsOrProfessors.getSelectionModel().getSelectedItem(); String rut = valueSelected.split("-")[valueSelected.split("-").length - 1]; for (Professor professor : Manager.INSTANCE.professors) { if (rut.equals(professor.getRut())) { if (!((Lecture) Manager.INSTANCE.currentEditignICourse) .getProfessors() .contains(professor)) { ((Lecture) Manager.INSTANCE.currentEditignICourse).addProfessor(professor); updatedElements.add(valueSelected); listAssistantsOrProfessors.setItems(FXCollections.observableArrayList(updatedElements)); break; } else { ViewUtilities.showAlert("El profesor ya se encuentra en ese curso"); break; } } } } else { ViewUtilities.showAlert("Select a professor to add"); } }
@Override protected void activate() { paymentAccountsListView.setItems(model.getPaymentAccounts()); paymentAccountsListView .getSelectionModel() .selectedItemProperty() .addListener(paymentAccountChangeListener); }
@FXML protected void initialize() { menuList.setCellFactory(param -> new CustomerMenuItemCell()); menuList.setItems(menuItems); orderList.setCellFactory(param -> new CustomerOrderItemCell()); orderList.setItems(orderItems); /* * this creates a system withing the system.. commenting out... //fill menu here MenuItem testItem = new MenuItem(1.00, "Test Name", "Test Descr"); menuItems.add(testItem); * **/ }
@SuppressWarnings("unchecked") @FXML protected void mechListClickedOn(MouseEvent E) throws InterruptedException { // Varient check = application.getMechs().get("JR7-F").getVarients().get("testy"); Mech test = mechList.getSelectionModel().getSelectedItem(); currentVarients = FXCollections.observableArrayList(test.getVarients()); // TODO update table varientList.setItems(currentVarients); }
private void clearTabGezin() { // todo opgave 3 cbGezinnen.getSelectionModel().clearSelection(); tfGezinNr.clear(); tfOuder1.clear(); tfOuder2.clear(); tfHuwelijk.clear(); tfScheiding.clear(); lvKinderen.setItems(FXCollections.emptyObservableList()); }
private void populate() { try { allStrokes = new FilteredList<>( FXCollections.observableArrayList(db.getTblSetStroke().getAllStrokes())); strokes.setItems(allStrokes); } catch (Exception e) { ExceptionAlert.showError(LOGGER, lang.format("error.load", "error.subj.stroke"), e); } }
// REQ#10 private void populateSalaryEmployee() { ArrayList<String> empName = new ArrayList<>(); for (Employee e : employee) { if (e instanceof SalaryEmployee) { empName.add(e.getName() + " - " + e.getId()); } } ObservableList<String> list = FXCollections.observableArrayList(empName); lvEmployees.setItems(list); }
/** * Creates a translation part of word card, it corresponds to one meaning. * * @return true if there are any translations in this translation block. */ public boolean create(Connect conn, TTranslation _ttranslation, TLang _lang) { meaning_summary = _ttranslation.getMeaningSummary(); TTranslationEntry[] trans_entries = TTranslationEntry.getByTranslation(conn, _ttranslation); // System.out.println("WCTranslation.create() _lang=" + _lang.getLanguage().toString() + "; // trans_entries.length=" + trans_entries); List<TranslationEntryItem> data_trans = new ArrayList(); // listview_trans.items length =" + trans_entries.length); trans_entry_items_size = trans_entries.length; // trans_entry_items = new TranslationEntryItem[trans_entries.length]; for (int i = 0; i < trans_entries.length; i++) { TTranslationEntry e = trans_entries[i]; LanguageType l = e.getLang().getLanguage(); String lang_name_value = l.getName(); String lang_code_value = l.getCode(); String translation_text = e.getWikiText().getText(); TranslationEntryItem item = new TranslationEntryItem(); item.create(lang_name_value, lang_code_value, translation_text); data_trans.add(item); } // TranslationEntryItem[] trans_entry_items = data_trans.toArray(); // insert trans_entry_items into listview_trans.items; ObservableList<TranslationEntryItem> data = FXCollections.observableArrayList(data_trans); listview_trans.setCellFactory( new Callback< ListView<wiwordik.word_card.TranslationEntryItem>, ListCell<wiwordik.word_card.TranslationEntryItem>>() { @Override public ListCell<wiwordik.word_card.TranslationEntryItem> call( ListView<wiwordik.word_card.TranslationEntryItem> list) { return new wiwordik.word_card.TranslationCell(); } }); listview_trans.setItems(data); setMinMaxTranslationBoxHeight(listview_trans, data.size()); // GUI right - indent for translation list words // top right bottom left group.setPadding(new Insets(0, 20, 0, 0)); Text t_meaning_summary = new Text(); t_meaning_summary.setText(meaning_summary); group.getChildren().addAll(t_meaning_summary); group.getChildren().addAll(listview_trans); return trans_entries.length > 0; }
@FXML private void deleteList(ActionEvent event) { if (mp != null) { mp.dispose(); } if (!fileList.isEmpty() || !listName.isEmpty()) { fileList.clear(); listName.clear(); listView.setItems(listName); } }
/** * It's responsible for refreshing the application's task list when the "Refresh" button is * pressed. * * @throws ClassNotFoundException * @throws SQLException * @throws IOException */ @FXML public void refreshList() throws ClassNotFoundException, SQLException, IOException { super.loadShell(); super.loadLog(); lstView.setItems(FXCollections.observableArrayList(shl.mapToSet())); // lstView.setCellFactory(ComboBoxListCell.forListView(FXCollections.observableArrayList(data))); // lstView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); lstView.setEditable(true); lstView.setOnMouseClicked( new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { System.out.println("clicked on " + lstView.getSelectionModel().getSelectedItem()); shl.setCurrentTab((Task) lstView.getSelectionModel().getSelectedItem()); whatever(); taskName.setText(shl.getCurrentTab().getName()); description.setText(shl.getCurrentTaskDescription()); name.setText(shl.getCurrentTab().getAssignee()); authorname.setText(shl.getCurrentTab().getAuthor()); comment.setText(shl.getCurrentTab().getComment()); lastEditor.setText(shl.getCurrentTab().getLastEditor().getID()); status.setText(statusCheck()); statusV.setText(statusVCheck()); lastEditDate.setText(shl.getCurrentTab().getLastEditDate()); creationDate.setText(shl.getCurrentTab().getCreationDate()); verificationDate.setText(shl.getCurrentTab().getVerificationDate()); completionDate.setText(shl.getCurrentTab().getCompletionDate()); // authorname.setText(shl.getCurrentTab().getAuthor().getName()); if (shl.getCurrentTab().getFileDemo() != null) { fileLabel.setText(shl.getCurrentTab().getFileDemo().toString()); } else fileLabel.setText("No file uploaded"); if (shl.getCurrentTab().isLOCKED()) { comment.setDisable(true); } else comment.setDisable(false); /*if(shl.getCurrentTab().getStatus()==true && shl.getCurrentTab().getStatusV()==true){ set background color green }*/ } }); }
@Override public void update(Observable arg0, Object arg1) { ObservableList<String> liste = FXCollections.observableArrayList(); for (Mot m : (ArrayList<Mot>) arg1) { liste.add(m.getLibelle()); } liste.sort(null); listViewResultats.setItems(liste); }
private void clearTabPersoon() { cbPersonen.getSelectionModel().clearSelection(); tfPersoonNr.clear(); tfVoornamen.clear(); tfTussenvoegsel.clear(); tfAchternaam.clear(); tfGeslacht.clear(); tfGebDatum.clear(); tfGebPlaats.clear(); cbOuderlijkGezin.getSelectionModel().clearSelection(); lvAlsOuderBetrokkenBij.setItems(FXCollections.emptyObservableList()); }
@Override public void initialize(URL location, ResourceBundle resources) { indicatorMyo.setIndicatorStyle(SimpleIndicator.IndicatorStyle.RED); indicatorMyo.setOn(true); indicatorServer.setIndicatorStyle(SimpleIndicator.IndicatorStyle.GREEN); indicatorServer.setOn(true); statusUpdate(""); stopButton.setDisable(true); startButton.setDisable(true); hub = new Hub(this.getClass().getCanonicalName()); inboundConnections.setItems(observableList); LOGGER.info("Initialized"); }
/** defines what happens, before the GUI is started */ public void initialize(URL location, ResourceBundle resources) { // set the controller var in the Main class to this Controller Main.controller = this; updateList(); log.debug("List updated"); // Formatting of the listView listView.setFixedCellSize(60); listView.setItems(items); addButton.setSelected(true); log.debug("ListView cellSize changed, items assigned"); // is activated if the text in the searchbox is changed searchBox .textProperty() .addListener( (observable, oldVal, newVal) -> { renewSearch(newVal); }); // is called when the selected Search Radiobutton is changed searchToggle .selectedToggleProperty() .addListener( new ChangeListener<Toggle>() { public void changed( ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) { renewSearch(searchBox.getText()); } }); // gets called if an item in the listview is selected -> will load the // currently selected item // in the overview on the left listView .getSelectionModel() .getSelectedItems() .addListener( new ListChangeListener<ItemBox>() { @Override public void onChanged( javafx.collections.ListChangeListener.Change<? extends ItemBox> c) { // Update the overview section on the left side of the GUI updateOverview(); } }); setupMenuItems(); }
@Override public void start(Stage primaryStage) throws IOException { ListView<Question> listView = new ListView<>(); listView.setItems(getObservableList()); listView.setCellFactory(l -> new QuestionCell()); StackPane root = new StackPane(); root.getChildren().add(listView); Scene scene = new Scene(root, 500, 300); primaryStage.setTitle("StackOverflow List"); primaryStage.setScene(scene); primaryStage.show(); }
public void createAppointmentsView(User user, AppointmentViewController parentController) { VBox vbox = new VBox(); vbox.setPadding(new Insets(25)); vbox.setSpacing(8); HBox hbox = new HBox(); hbox.setSpacing(10); Text title = new Text("Appoinments"); title.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); hbox.getChildren().add(title); Button mainMenuBtn = new Button("Main Menu"); mainMenuBtn.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { parentController.goBack(); } }); hbox.getChildren().add(mainMenuBtn); vbox.getChildren().add(hbox); // Show schedule appointment if patient or HSP staff if (user.getUsertype() == UserType.PATIENT || user.getUsertype() == UserType.HSPSTAFF) { vbox.getChildren().add(addScheduleAppoinment(null, parentController)); } Text subTitle = new Text("Manage/View Appoinments"); title.setFont(Font.font("Tahoma", FontWeight.NORMAL, 15)); vbox.getChildren().add(subTitle); listView = new ListView<String>(); listView.setItems(parentController.getAppoinmentList()); listView .getSelectionModel() .selectedItemProperty() .addListener( (ObservableValue<? extends String> observable, String oldValue, String newValue) -> { System.out.println(newValue); int index = listView.getSelectionModel().getSelectedIndex(); parentController.didSelectItem(index); }); vbox.getChildren().add(listView); createScene(vbox); }
// List of banned usernames public void testList() { ArrayList<ArrayList<String>> bannedSet; ObservableList<String> bannedList = FXCollections.observableArrayList(); try { bannedSet = fetchData("Users", "Username", "Privilege = 9"); System.out.println(bannedSet); for (ArrayList<String> element : bannedSet) { bannedList.add(element.get(0)); } } catch (SQLException e) { e.printStackTrace(); } adminbannedUsers.setItems(bannedList); }