List of usage examples for javafx.collections FXCollections observableArrayList
public static <E> ObservableList<E> observableArrayList(Collection<? extends E> col)
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXSchemaDefPickerPane.java
public void setJavaFXDataCollection(Collection<ICFBamSchemaDefObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value;/*from w w w.java2 s. c o m*/ observableListOfSchemaDef = null; if (javafxDataCollection != null) { observableListOfSchemaDef = FXCollections.observableArrayList(javafxDataCollection); observableListOfSchemaDef.sort(compareSchemaDefByQualName); } else { observableListOfSchemaDef = FXCollections.observableArrayList(); } if (dataTable != null) { dataTable.setItems(observableListOfSchemaDef); // 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.CFBamJavaFXTablePickerPane.java
public void setJavaFXDataCollection(Collection<ICFBamTableObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value;/*from w ww .j a v a 2 s . c o m*/ observableListOfTable = null; if (javafxDataCollection != null) { observableListOfTable = FXCollections.observableArrayList(javafxDataCollection); observableListOfTable.sort(compareTableByQualName); } else { observableListOfTable = FXCollections.observableArrayList(); } if (dataTable != null) { dataTable.setItems(observableListOfTable); // 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:slideshow.client.ui.ClientUIController.java
/** * Initializes FXML panel to default/* w w w .j av a 2 s . c om*/ * * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { System.out.println("slideshow.client.ui.ClientUIController.initialize"); //Initializes members assert rootVBox != null : "fx:id=\"rootVBox\" was not injected: check your FXML file 'clientUI.fxml'."; assert songListView != null : "fx:id=\"songListView\" was not injected: check your FXML file 'clientUI.fxml'."; assert spotifyTextField != null : "fx:id=\"spotifyTextField\" was not injected: check your FXML file 'clientUI.fxml'."; assert spotifyLabel != null : "fx:id=\"spotifyLabel\" was not injected: check your FXML file 'clientUI.fxml'."; assert prevSongButton != null : "fx:id=\"prevSongButton\" was not injected: check your FXML file 'clientUI.fxml'."; assert playSongButton != null : "fx:id=\"playSongButton\" was not injected: check your FXML file 'clientUI.fxml'."; assert nextSongButton != null : "fx:id=\"nextSongButton\" was not injected: check your FXML file 'clientUI.fxml'."; assert fullscreenButton != null : "fx:id=\"fullScreenButton\" was not injected: check your FXML file 'clientUI.fxml'."; assert prevPhotoButton != null : "fx:id=\"prevPhotoButton\" was not injected: check your FXML file 'clientUI.fxml'."; assert nextPhotoButton != null : "fx:id=\"nextPhotoButton\" was not injected: check your FXML file 'clientUI.fxml'."; assert photoImageView != null : "fx:id=\"photoImageView\" was not injected: check your FXML file 'clientUI.fxml'."; assert imagePane != null : "fx:id=\"imagePane\" was not injected: check your FXML file 'clientUI.fxml'."; this.mMusic = new Music(); //load information try { System.out.println("Loading Local Directories"); this.mSongsLocal = loadDir(new File(this.getClass().getResource(this.DIRECTORY_MUSIC).toURI())); this.mPhotosLocal = loadDir(new File(this.getClass().getResource(this.DIRECTORY_PHOTOS).toURI())); ObservableList<String> songs = FXCollections.observableArrayList(this.mSongsLocal.keySet()); Collections.sort(songs); this.songListView.setItems(songs); //this.listProperty.set(FXCollections.observableArrayList(this.songsLocal.keySet())); } catch (URISyntaxException e) { System.out.println(e.getMessage()); } this.photoImageView.fitWidthProperty().bind(this.imagePane.widthProperty()); this.photoImageView.fitHeightProperty().bind(this.imagePane.heightProperty()); this.mConnectServer = new Task<Integer>() { @Override protected Integer call() throws Exception { ClientUIController.this.mConnect = new Connect(InetAddress.getLocalHost(), 6001); ClientUIController.this.mBufferedReader = new BufferedReader( new InputStreamReader(ClientUIController.this.mConnect.getSocket().getInputStream())); ClientUIController.this.mPhotoAddress = ClientUIController.this.mBufferedReader.readLine(); ClientUIController.this.photoImageView.setImage(new Image(ClientUIController.this.mPhotoAddress)); int iterations = 0; do { System.out.println("Fetching photo"); ClientUIController.this.mPhotoAddress = ClientUIController.this.mBufferedReader.readLine(); ClientUIController.this.photoImageView .setImage(new Image(ClientUIController.this.mPhotoAddress)); Thread.sleep(10000); } while (ClientUIController.this.mPhotoAddress != null); return 1; } }; Thread th = new Thread(this.mConnectServer); th.setDaemon(true); th.start(); }