-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Filmaluco/ClientBranch-TableViewColumns
Added: Initial Columns for File and Transfer Views Updated: Settings View
- Loading branch information
Showing
12 changed files
with
258 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
package Controllers.View; | ||
|
||
public class BrowseController { | ||
import Models.View.File; | ||
import com.jfoenix.controls.JFXTreeTableView; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
|
||
import java.net.URL; | ||
import java.util.ResourceBundle; | ||
|
||
public class BrowseController implements Initializable { | ||
|
||
@FXML | ||
private JFXTreeTableView<File> ttvBrowse; | ||
|
||
@Override | ||
public void initialize(URL location, ResourceBundle resources) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,64 @@ | ||
package Controllers.View; | ||
|
||
public class FileController { | ||
import Models.View.File; | ||
import com.jfoenix.controls.JFXTreeTableColumn; | ||
import com.jfoenix.controls.JFXTreeTableView; | ||
import com.jfoenix.controls.RecursiveTreeItem; | ||
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject; | ||
import javafx.beans.value.ObservableValue; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.event.ActionEvent; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.control.TreeItem; | ||
import javafx.scene.control.TreeTableColumn; | ||
import javafx.util.Callback; | ||
|
||
import java.net.URL; | ||
import java.util.ResourceBundle; | ||
|
||
public class FileController implements Initializable { | ||
|
||
@FXML | ||
private JFXTreeTableView<File> ttvFiles; | ||
|
||
public ObservableList<File> files = FXCollections.observableArrayList(); | ||
|
||
@Override | ||
public void initialize(URL location, ResourceBundle resources) { | ||
ttvFiles.getStyleClass().add("noheader"); | ||
|
||
//Setting up columns | ||
JFXTreeTableColumn<File, String> filename = new JFXTreeTableColumn<>("Filename"); | ||
filename.setPrefWidth(400); | ||
filename.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<File, String>, ObservableValue<String>>() { | ||
@Override | ||
public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<File, String> param) { | ||
return param.getValue().getValue().filenameProperty(); | ||
} | ||
}); | ||
|
||
|
||
JFXTreeTableColumn<File, String> fileSize = new JFXTreeTableColumn<>("FileSize"); | ||
fileSize.setPrefWidth(400); | ||
fileSize.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<File, String>, ObservableValue<String>>() { | ||
@Override | ||
public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<File, String> param) { | ||
return param.getValue().getValue().sizeProperty(); | ||
} | ||
}); | ||
|
||
//Adding files to observable array | ||
//files.add(new File("Test","1GB", "JohnDoe", "21/11/2018")); | ||
|
||
final TreeItem<File> root = new RecursiveTreeItem<File>(files, RecursiveTreeObject::getChildren); | ||
ttvFiles.getColumns().setAll(filename, fileSize); | ||
ttvFiles.setRoot(root); | ||
ttvFiles.setShowRoot(false); | ||
} | ||
|
||
public void addFile(ActionEvent event) { | ||
//TODO: Show file chooser and get the file to send | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,77 @@ | ||
package Controllers.View; | ||
|
||
public class TransferController { | ||
import Models.View.File; | ||
import com.jfoenix.controls.JFXTreeTableColumn; | ||
import com.jfoenix.controls.JFXTreeTableView; | ||
import com.jfoenix.controls.RecursiveTreeItem; | ||
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject; | ||
import javafx.beans.value.ObservableValue; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.control.TreeItem; | ||
import javafx.scene.control.TreeTableColumn; | ||
import javafx.util.Callback; | ||
|
||
import java.net.URL; | ||
import java.util.ResourceBundle; | ||
|
||
public class TransferController implements Initializable { | ||
@FXML | ||
private JFXTreeTableView<File> ttvTransfers; | ||
|
||
public ObservableList<File> transfers = FXCollections.observableArrayList(); | ||
|
||
|
||
@Override | ||
public void initialize(URL location, ResourceBundle resources) { | ||
ttvTransfers.getStyleClass().add("noheader"); | ||
|
||
//Setting up columns | ||
JFXTreeTableColumn<File, String> filename = new JFXTreeTableColumn<>("Filename"); | ||
filename.setPrefWidth(170); | ||
filename.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<File, String>, ObservableValue<String>>() { | ||
@Override | ||
public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<File, String> param) { | ||
return param.getValue().getValue().filenameProperty(); | ||
} | ||
}); | ||
|
||
|
||
JFXTreeTableColumn<File, String> fileSize = new JFXTreeTableColumn<>("FileSize"); | ||
fileSize.setPrefWidth(170); | ||
fileSize.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<File, String>, ObservableValue<String>>() { | ||
@Override | ||
public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<File, String> param) { | ||
return param.getValue().getValue().sizeProperty(); | ||
} | ||
}); | ||
|
||
JFXTreeTableColumn<File, String> downloadedFrom = new JFXTreeTableColumn<>("DownloadedFrom"); | ||
downloadedFrom.setPrefWidth(170); | ||
downloadedFrom.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<File, String>, ObservableValue<String>>() { | ||
@Override | ||
public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<File, String> param) { | ||
return param.getValue().getValue().downloadedFromProperty(); | ||
} | ||
}); | ||
|
||
JFXTreeTableColumn<File, String> downloadedDate = new JFXTreeTableColumn<>("DownloadedDate"); | ||
downloadedDate.setPrefWidth(170); | ||
downloadedDate.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<File, String>, ObservableValue<String>>() { | ||
@Override | ||
public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<File, String> param) { | ||
return param.getValue().getValue().downloadDateProperty(); | ||
} | ||
}); | ||
|
||
//Adding files to observable array | ||
//transfers.add(new File("Test","1GB", "JohnDoe", "21/11/2018")); | ||
|
||
final TreeItem<File> root = new RecursiveTreeItem<File>(transfers, RecursiveTreeObject::getChildren); | ||
ttvTransfers.getColumns().setAll(filename, fileSize, downloadedFrom, downloadedDate); | ||
ttvTransfers.setRoot(root); | ||
ttvTransfers.setShowRoot(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package Models.View; | ||
|
||
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject; | ||
import javafx.beans.property.SimpleStringProperty; | ||
import javafx.beans.property.StringProperty; | ||
|
||
public class File extends RecursiveTreeObject<File> { | ||
StringProperty filename; | ||
StringProperty size; | ||
StringProperty downloadedFrom; | ||
StringProperty downloadDate; | ||
|
||
|
||
public File(String filename, String size, String downloadedFrom, String downloadDate) { | ||
this.filename = new SimpleStringProperty(filename); | ||
this.size = new SimpleStringProperty(size); | ||
this.downloadedFrom = new SimpleStringProperty(downloadedFrom); | ||
this.downloadDate = new SimpleStringProperty(downloadDate); | ||
} | ||
|
||
public File(String filename, String size) { | ||
this.filename = new SimpleStringProperty(filename); | ||
this.size = new SimpleStringProperty(size); | ||
} | ||
|
||
|
||
public String getFilename() { | ||
return filename.get(); | ||
} | ||
|
||
public StringProperty filenameProperty() { | ||
return filename; | ||
} | ||
|
||
public String getSize() { | ||
return size.get(); | ||
} | ||
|
||
public StringProperty sizeProperty() { | ||
return size; | ||
} | ||
|
||
public String getDownloadedFrom() { | ||
return downloadedFrom.get(); | ||
} | ||
|
||
public StringProperty downloadedFromProperty() { | ||
return downloadedFrom; | ||
} | ||
|
||
public String getDownloadDate() { | ||
return downloadDate.get(); | ||
} | ||
|
||
public StringProperty downloadDateProperty() { | ||
return downloadDate; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.