Skip to content

Commit

Permalink
Enable Multi-Select
Browse files Browse the repository at this point in the history
* select files with ctrl or shift keys
* IronFile now holds tag variables
  • Loading branch information
brp14005 committed Mar 1, 2016
1 parent 4ae4371 commit 7688899
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 37 deletions.
4 changes: 1 addition & 3 deletions src/main/java/directory/FileTreeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public boolean isLeaf() {
}
private ObservableList<FileTreeItem> buildChildren(TreeItem<IronFile> ironTreeItem) {
IronFile f = ironTreeItem.getValue();

System.out.println("file's parent: " + f.getParent());

System.out.println(f.getTag());
if (f != null && f.isDirectory()) {
IronFile[] files = f.listFiles();
if (files != null) {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/directory/FolderViewManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package directory;

import javafx.collections.ObservableList;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.image.Image;
Expand Down Expand Up @@ -38,10 +39,10 @@ public class FolderViewManager {
public FolderViewManager(TreeView<IronFile> dirTree) {
/*ironVisitor = new directory.IronFileVisitor(); // save this for later
ironVisitor.setRoot(new TreeItem<>());*/ // save this for later

OSDetection.getOS();
// OSDetection.getOS();
view = dirTree;
command = new CmdExecutor();
view.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); // enable multi-select
// command = new CmdExecutor();
}
/**
* Sets the root directory of the file browser to the specified folder.
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/directory/IronFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* This class extends the java File class and returns the filename for toString()
*/
public class IronFile extends File {

private boolean isRoot = true;
public IronFileFilter filter;
private String tag;

public IronFile(String pathname) {
super(pathname);
Expand Down Expand Up @@ -60,4 +60,11 @@ public String toString() {
return this.getName();
}
}

public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
}
21 changes: 12 additions & 9 deletions src/main/java/launcher/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,19 @@ public class Controller{
final FolderViewManager manager = new FolderViewManager(dirTree); // 2 statements in 1 line is best
IronFile[] hardDrives = IronFile.listRoots(); // an array of hard drives
manager.setRootDirectory(hardDrives);
// setEvents(manager);

// DropboxController dbManager = new DropboxController();
/*try {
dbManager.test();
} catch (DbxException e) {
e.printStackTrace();
}*/
// directory.IronFile homeDir = new directory.IronFile(System.getProperty("user.home")); // use this for specific directory
// manager.setRootDirectory(homeDir);
}

private void setEvents(FolderViewManager manager) {
dirTree.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent args) {
Expand All @@ -61,15 +73,6 @@ public void handle(ActionEvent event) {
manager.deleteFileAttrForSelected();
}
});

/* DropboxController dbManager = new DropboxController();
try {
dbManager.test();
} catch (DbxException e) {
e.printStackTrace();
}*/
// directory.IronFile homeDir = new directory.IronFile(System.getProperty("user.home")); // use this for specific directory
// manager.setRootDirectory(homeDir);
}
}

1 change: 1 addition & 0 deletions src/main/java/webapp/DropboxController.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ private void initialize() {

public void test() throws DbxException{
FullAccount account = client.users.getCurrentAccount();
System.out.println(account);
}
}
21 changes: 0 additions & 21 deletions src/main/resources/StartPage.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,6 @@
</children>
</StackPane>
</center>
<top>
<BorderPane prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<center>
<FlowPane id="tool-selector-pane" alignment="CENTER" columnHalignment="CENTER" hgap="10.0" prefHeight="125.0" prefWidth="400.0" prefWrapLength="300.0" vgap="10.0" BorderPane.alignment="CENTER">
<children>
<Label text="Search" underline="true" />
<Label layoutX="215.0" layoutY="64.0" text="Delete Files" underline="true" />
<Label layoutX="242.0" layoutY="64.0" text="Auto Manager" underline="true" />
<Label layoutX="281.0" layoutY="64.0" text="Templates" underline="true" />
</children>
</FlowPane>
</center>
<top>
<Label alignment="CENTER" prefHeight="25.0" prefWidth="300.0" styleClass="pane-title" text="Tools" BorderPane.alignment="CENTER">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
</top>
</BorderPane>
</top>
</BorderPane>
</left>
<right>
Expand Down

0 comments on commit 7688899

Please sign in to comment.