Skip to content

Commit

Permalink
Update fxid fields to match Controller
Browse files Browse the repository at this point in the history
* fix tag display to work with new layout
* clean up misc code
  • Loading branch information
brp14005 committed Mar 4, 2016
1 parent 13b6ab9 commit ddb4628
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
11 changes: 8 additions & 3 deletions src/main/java/launcher/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Controller{
@FXML private ResourceBundle resources;
@FXML private Button btnAddTag;
@FXML private TextField txtAddTag;
@FXML private TextField txtTagSearch;
@FXML private TextField txtSearchTag;
@FXML private Button btnSearchTag;
@FXML private ListView<IronFile> viewTags;
private FolderViewManager manager;
Expand All @@ -52,7 +52,8 @@ public class Controller{
manager = new FolderViewManager(dirTree); // 2 statements in 1 line is best
IronFile[] hardDrives = IronFile.listRoots(); // an array of hard drives
menubar.setUseSystemMenuBar(true); //allows use of native menu bars, luckily an easy 1 liner
// manager.setRootDirectory(hardDrives); Ideally only show tree view of files the user drags in
// manager.setRootDirectory(hardDrives); //Ideally only show tree view of files the user drags in
// initializeSceneEvents(); // initialize Drag and Drop feature
}
/**
* Action event triggered when user clicks. This method will add tag directly to IronFile
Expand All @@ -69,7 +70,7 @@ public class Controller{
* On Click event that will search and display files based on entered tag
* */
@FXML private void eventSearchTag() {
ObservableList<IronFile> taggedItems = manager.getTaggedItems(txtTagSearch.getText());
ObservableList<IronFile> taggedItems = manager.getTaggedItems(txtSearchTag.getText());
viewTags.setItems(taggedItems);
}
/**
Expand Down Expand Up @@ -103,5 +104,9 @@ public void initializeSceneEvents() {
args.setDropCompleted(success);
});
}

/* public void setScene(Scene scene) {
this.scene = scene;
}*/
}

11 changes: 5 additions & 6 deletions src/main/java/launcher/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
// setUserAgentStylesheet(STYLESHEET_CASPIAN);

FXMLLoader loader = new FXMLLoader();
Parent root = loader.load(getClass().getResource("/StartPage.fxml").openStream());
Controller controller = loader.getController();
primaryStage.setTitle("Iron-gate!");
primaryStage.setScene(new Scene(root, 990, 700));
Scene scene = primaryStage.getScene(); // we get the scene from above
Scene scene = new Scene(root, 990, 700);
primaryStage.setScene(scene);
controller.initializeSceneEvents(); // called after primary stage has been set
scene.getStylesheets().clear(); // clear any styles
// scene.getStylesheets().add("/main/resources/mainStyle.css"); // absolute path
primaryStage.show();
Controller controller = loader.getController();
controller.initializeSceneEvents();
primaryStage.show(); // show the initialized stage

}
public static void main(String[] args) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/StartPage.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@
<top>
<HBox prefHeight="33.0" prefWidth="178.0" BorderPane.alignment="CENTER">
<children>
<TextField prefHeight="27.0" prefWidth="133.0" promptText="Include Tags..." />
<Button mnemonicParsing="false" text="Add" />
<TextField fx:id="txtSearchTag" prefHeight="27.0" prefWidth="133.0" promptText="Include Tags..." />
<Button fx:id="btnSearchTag" mnemonicParsing="false" onAction="#eventSearchTag" text="Add" />
</children>
<BorderPane.margin>
<Insets top="5.0" />
</BorderPane.margin>
</HBox>
</top>
<center>
<ListView prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
<ListView fx:id="viewTags" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
</center>
<bottom>
<Button mnemonicParsing="false" text="Remove Tag" BorderPane.alignment="CENTER">
Expand Down Expand Up @@ -285,7 +285,7 @@
<children>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<TextField prefHeight="27.0" prefWidth="190.0" promptText="Tag Name...">
<TextField fx:id="txtAddTag" prefHeight="27.0" prefWidth="190.0" promptText="Tag Name...">
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
Expand All @@ -306,7 +306,7 @@
<bottom>
<HBox alignment="CENTER" prefHeight="36.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<Button mnemonicParsing="false" prefHeight="27.0" prefWidth="70.0" text="Add Tag" />
<Button fx:id="btnAddTag" mnemonicParsing="false" onAction="#eventAddTag" prefHeight="27.0" prefWidth="70.0" text="Add Tag" />
</children>
<BorderPane.margin>
<Insets bottom="5.0" />
Expand Down

0 comments on commit ddb4628

Please sign in to comment.