Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.uconn.edu/brp14005/iron-gate int…
Browse files Browse the repository at this point in the history
…o dev

# Conflicts:
#	src/main/java/Controller.java

* Temp omit of call to FolderViewManager.java (produces Null Error)
* add sample disk view
* rename latest StartPage.fxml to Kris_StartPage(merge please).fxml

** Needs proper merge with latest commit**
  • Loading branch information
brp14005 committed Feb 8, 2016
2 parents a50a4a5 + 731105d commit 612a697
Show file tree
Hide file tree
Showing 4 changed files with 240 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class Controller{

@FXML private void initialize() {
createTree();
// FolderViewManager.java calls are done here
}

// Create the directory Tree
Expand Down
60 changes: 60 additions & 0 deletions src/main/java/FolderViewManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package main.java;

import javafx.scene.Scene;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;

import java.io.File;

/**
* Created by kristopherguzman on 2/7/16.
*/

/**
This class handles manipulation of the Folder View. This includes
directory searches, displaying directories, and all things directly changing
the Folder View.
*/
public class FolderViewManager {

public static TreeView<String> treeView;
private static TreeItem<String> root;
private static int NEST_COUNT = 0; //tracks number of nested calls when searching through files, TEMPORARY

private FolderViewManager() { }

public static void setRootDirectory(File file) {

root = new TreeItem<String>(file.getName());
createCellsFromRoot(file, root);
treeView.setRoot(root);
}

private static void createCellsFromRoot(File rootFile, TreeItem<String> rootNode) {

NEST_COUNT++;

if(NEST_COUNT > 6000) { //fixed value, TEMPORARY, must come up with better way to optimize load time of files

return;
}

for(File f : rootFile.listFiles()) {

if(!f.getName().startsWith(".")) { //don't show files that start with dot (ex: .filename .pythonfile)

TreeItem<String> fileNode = new TreeItem<String>(f.getName());
rootNode.getChildren().add(fileNode);

if (f.isDirectory()) {

createCellsFromRoot(f, fileNode);

}
}

}

}

}
21 changes: 19 additions & 2 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TreeView;
import javafx.stage.Screen;
import javafx.stage.Stage;

import java.io.File;

public class Main extends Application {

@Override
Expand All @@ -24,12 +27,26 @@ public void handle(ActionEvent event) {
});*/
Parent root = FXMLLoader.load(getClass().getResource("/main/resources/StartPage.fxml"));
Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds();

primaryStage.setTitle("Iron-gate!");
// primaryStage.setScene(new Scene(root, screenBounds.getWidth(), screenBounds.getHeight())); // a scene is created here
primaryStage.setScene(new Scene(root, 990, 785));

Scene scene = primaryStage.getScene(); // we get the scene from above
scene.getStylesheets().clear(); // clear any styles
// scene.getStylesheets().add("/main/resources/mainStyle.css"); // absolute path
scene.getStylesheets().add("/main/resources/mainStyle.css"); // absolute path

try { //try to set the tree view in the FolderViewManager class

FolderViewManager.treeView = (TreeView<String>) scene.lookup("#folder-view-pane");
File homeDir = new File(System.getProperty("user.home"));

FolderViewManager.setRootDirectory(homeDir);
System.out.println(homeDir.getName() + " set as root directory.");

} catch (Exception e) {
e.printStackTrace();
}

primaryStage.show();
}
public static void main(String[] args) {
Expand Down
160 changes: 160 additions & 0 deletions src/main/resources/Kris_StartPage(merge please).fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--suppress JavaFxDefaultTag, JavaFxDefaultTag, JavaFxDefaultTag, JavaFxDefaultTag, JavaFxDefaultTag, JavaFxDefaultTag -->

<?import javafx.scene.effect.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.shape.*?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="480.0" prefWidth="640.0" type="BorderPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.java.Controller">
<top>
<MenuBar id="menubar-pane" BorderPane.alignment="CENTER">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
</top>
<center>
<TreeView id="folder-view-pane" fx:id="folderView" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
</center>
<left>
<BorderPane prefHeight="200.0" prefWidth="300.0" styleClass="pane-general-style" BorderPane.alignment="CENTER">
<center>
<StackPane id="tool-inspector-pane" prefHeight="150.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<top>
<Label alignment="CENTER" prefHeight="23.0" prefWidth="159.0" text="Tool: Search" BorderPane.alignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Label>
</top>
<StackPane.margin>
<Insets top="5.0" />
</StackPane.margin>
<bottom>
<FlowPane alignment="CENTER" columnHalignment="CENTER" hgap="10.0" prefHeight="51.0" prefWidth="158.0" BorderPane.alignment="CENTER">
<children>
<Button mnemonicParsing="false" prefHeight="13.0" prefWidth="73.0" text="Remove" />
</children>
<BorderPane.margin>
<Insets />
</BorderPane.margin>
</FlowPane>
</bottom>
<center>
<BorderPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<top>
<HBox alignment="CENTER" maxHeight="-Infinity" minHeight="-Infinity" prefHeight="50.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<TextField promptText="Include Tag..." />
<Button mnemonicParsing="false" text="Add">
<HBox.margin>
<Insets left="15.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</top>
<center>
<ListView maxWidth="-Infinity" prefHeight="200.0" prefWidth="250.0" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</center>
</BorderPane>
</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>
<BorderPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<center>
<Accordion maxWidth="-Infinity" prefWidth="250.0" BorderPane.alignment="CENTER">
<panes>
<TitledPane animated="false" text="Tags">
<content>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<center>
<ListView prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<BorderPane.margin>
<Insets top="10.0" />
</BorderPane.margin>
</ListView>
</center>
<bottom>
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" text="Remove" textAlignment="CENTER" BorderPane.alignment="CENTER">
<BorderPane.margin>
<Insets top="10.0" />
</BorderPane.margin>
</Button>
</bottom>
<top>
<HBox prefHeight="25.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<TextField promptText="Add Tag..." />
<Button mnemonicParsing="false" prefWidth="75.0" text="Add" />
</children>
</HBox>
</top>
</BorderPane>
</content>
</TitledPane>
<TitledPane animated="false" text="Directory Info">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
</panes>
</Accordion>
</center>
<top>
<Label alignment="CENTER" prefHeight="25.0" prefWidth="205.0" styleClass="pane-title" text="Inspector" BorderPane.alignment="CENTER">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
</top>
</BorderPane>
</right>
</fx:root>

0 comments on commit 612a697

Please sign in to comment.