Skip to content

Commit

Permalink
Changed NewsPane back
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreywwang committed Mar 23, 2017
1 parent 6d532ee commit 8c71e44
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 86 deletions.
2 changes: 1 addition & 1 deletion src/main/java/WHS_planner/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void start(Stage stage) throws Exception {

//WITH HOME
stage.setMinHeight(CalendarBox.CALENDAR_BOX_MIN_HEIGHT * 5 + 198 + 110); //Set the minimum height of the window
stage.setMinWidth(CalendarBox.CALENDAR_BOX_MIN_WIDTH*7+90+280-280); //Set the minimum width of the window
stage.setMinWidth(CalendarBox.CALENDAR_BOX_MIN_WIDTH*7+90+280); //Set the minimum width of the window
//Width: 1140
//Height: 708

Expand Down
35 changes: 18 additions & 17 deletions src/main/java/WHS_planner/UI/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import javafx.geometry.Insets;
import javafx.scene.Cursor;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
Expand Down Expand Up @@ -66,19 +67,19 @@ class Home extends Pane {
// String currentClass = calendar.getSchedule().getToday(globalTime.getLetterDay())[classIndex].getClassName();

//Initialize NEWS
// ScrollPane newsScroll = new ScrollPane();
// newsScroll.setContent(newsUI);
// newsScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
// newsScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
// //NEWS Style
// newsScroll.setStyle("-fx-background-color: transparent;");
// newsScroll.getStylesheets().add("News" + File.separator + "NewsUI.css");
// newsScroll.getStyleClass().setAll("scroll-bar");
// //NEWS Scaling
// newsScroll.setFitToWidth(true);
// newsScroll.setMinWidth(280);
// newsScroll.setMaxWidth(280);
// newsScroll.setPrefHeight(this.getPrefHeight());
ScrollPane newsScroll = new ScrollPane();
newsScroll.setContent(newsUI);
newsScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
newsScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
//NEWS Style
newsScroll.setStyle("-fx-background-color: transparent;");
newsScroll.getStylesheets().add("News" + File.separator + "NewsUI.css");
newsScroll.getStyleClass().setAll("scroll-bar");
//NEWS Scaling
newsScroll.setFitToWidth(true);
newsScroll.setMinWidth(280);
newsScroll.setMaxWidth(280);
newsScroll.setPrefHeight(this.getPrefHeight());

insidePane.setPadding(new Insets(0, 5, 5, 5)); //top, right, bottom, left

Expand All @@ -87,7 +88,7 @@ class Home extends Pane {
// outsidePane.getChildren().addAll(insidePane,newsScroll);

//Need to remove News to blackmail WSPN? uncomment this line
outsidePane.getChildren().setAll(insidePane/*,newsScroll*/);
outsidePane.getChildren().setAll(insidePane,newsScroll);


//Resizing stuff
Expand All @@ -97,9 +98,9 @@ class Home extends Pane {
VBox.setVgrow(progressBar, Priority.NEVER);
insidePane.prefHeightProperty().bind(outsidePane.heightProperty());
insidePane.prefWidthProperty().bind(outsidePane.widthProperty());
// newsScroll.prefHeightProperty().bind(outsidePane.heightProperty());
// newsScroll.prefWidthProperty().bind(outsidePane.widthProperty());
// HBox.setHgrow(newsScroll, Priority.NEVER);
newsScroll.prefHeightProperty().bind(outsidePane.heightProperty());
newsScroll.prefWidthProperty().bind(outsidePane.widthProperty());
HBox.setHgrow(newsScroll, Priority.NEVER);
HBox.setHgrow(insidePane, Priority.ALWAYS);
outsidePane.prefHeightProperty().bind(this.heightProperty());
outsidePane.prefWidthProperty().bind(this.widthProperty());
Expand Down
134 changes: 67 additions & 67 deletions src/main/java/WHS_planner/UI/MainPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ private VBox createPane() {


//Make a stack pane with the drawer and content in it
StackPane stackPane = new StackPane(content,createDrawer((JFXHamburger)navBar.getChildren().get(0),1440,48), createNewsDrawer((Button)navBar.getChildren().get(1)));
// StackPane stackPane = new StackPane(content,createDrawer((JFXHamburger)navBar.getChildren().get(0),1440,48));
// StackPane stackPane = new StackPane(content,createDrawer((JFXHamburger)navBar.getChildren().get(0),1440,48), createNewsDrawer((Button)navBar.getChildren().get(1)));
StackPane stackPane = new StackPane(content,createDrawer((JFXHamburger)navBar.getChildren().get(0),1440,48));


// StackPane stackPane = new StackPane(content,fab,createDrawer((JFXHamburger)navBar.getChildren().get(0),1440,48), createNewsDrawer(fab));


// createNewsDrawer((Button)navBar.getChildren().get(1));
initiateDropDown((Button)navBar.getChildren().get(2));
initiateDropDown((Button)navBar.getChildren().get(1));

//Set the content the base pane to have the nav bar on top and content under it
vBox.getChildren().setAll(navBar,stackPane);
Expand Down Expand Up @@ -387,71 +387,71 @@ private void initiateDropDown(Button bigButton) {
}


private JFXDrawer createNewsDrawer(Button button){
Pane parent = (Pane)(button.getParent());
button.prefHeightProperty().bind(parent.heightProperty());
button.setText(ICON_NEWS);
button.setCursor(Cursor.HAND);
// button.getStylesheets().setAll("UI" + File.separator + "dropDown.css");
// button.getStyleClass().addAll("big-button");
button.setStyle("-fx-font-family: 'FontAwesome Regular'; -fx-font-size: 24; -fx-text-fill: #FFFFFF;");
button.setTextOverrun(OverrunStyle.CLIP);

javafx.scene.control.ScrollPane newsScroll = new javafx.scene.control.ScrollPane();
newsScroll.setContent(news.getCardView());
newsScroll.setVbarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy.AS_NEEDED);
newsScroll.setHbarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy.NEVER);
//NEWS Style
newsScroll.setStyle("-fx-background-color: transparent;");
newsScroll.getStylesheets().add("News" + File.separator + "NewsUI.css");
newsScroll.getStyleClass().setAll("scroll-bar");
//NEWS Scaling
newsScroll.setFitToWidth(true);
newsScroll.setMinWidth(280);
newsScroll.setMaxWidth(280);
newsScroll.setPrefHeight(this.getPrefHeight());

newsDrawer = new JFXDrawer();
newsDrawer.setDirection(JFXDrawer.DrawerDirection.RIGHT);
newsDrawer.setStyle("-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.25), 15, 0, 1, 5, 0);");
newsDrawer.setDefaultDrawerSize(280);
newsDrawer.setSidePane(newsScroll);
newsDrawer.setPickOnBounds(false);
newsDrawer.setMouseTransparent(true);


button.setOnMouseClicked(event -> {
if (newsDrawer.isShown()) {
newsDrawer.setMouseTransparent(true);

newsDrawer.close();
} else {
newsDrawer.setMouseTransparent(false);
// private JFXDrawer createNewsDrawer(Button button){
// Pane parent = (Pane)(button.getParent());
// button.prefHeightProperty().bind(parent.heightProperty());
// button.setText(ICON_NEWS);
// button.setCursor(Cursor.HAND);
//// button.getStylesheets().setAll("UI" + File.separator + "dropDown.css");
//// button.getStyleClass().addAll("big-button");
// button.setStyle("-fx-font-family: 'FontAwesome Regular'; -fx-font-size: 24; -fx-text-fill: #FFFFFF;");
// button.setTextOverrun(OverrunStyle.CLIP);
//
// javafx.scene.control.ScrollPane newsScroll = new javafx.scene.control.ScrollPane();
// newsScroll.setContent(news.getCardView());
// newsScroll.setVbarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy.AS_NEEDED);
// newsScroll.setHbarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy.NEVER);
// //NEWS Style
// newsScroll.setStyle("-fx-background-color: transparent;");
// newsScroll.getStylesheets().add("News" + File.separator + "NewsUI.css");
// newsScroll.getStyleClass().setAll("scroll-bar");
// //NEWS Scaling
// newsScroll.setFitToWidth(true);
// newsScroll.setMinWidth(280);
// newsScroll.setMaxWidth(280);
// newsScroll.setPrefHeight(this.getPrefHeight());
//
// newsDrawer = new JFXDrawer();
// newsDrawer.setDirection(JFXDrawer.DrawerDirection.RIGHT);
// newsDrawer.setStyle("-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.25), 15, 0, 1, 5, 0);");
// newsDrawer.setDefaultDrawerSize(280);
// newsDrawer.setSidePane(newsScroll);
// newsDrawer.setPickOnBounds(false);
// newsDrawer.setMouseTransparent(true);
//
//
// button.setOnMouseClicked(event -> {
// if (newsDrawer.isShown()) {
// newsDrawer.setMouseTransparent(true);

newsDrawer.open();
}
});

this.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.ESCAPE) {
if (newsDrawer.isShown()) {
newsDrawer.setMouseTransparent(true);
newsDrawer.close();
}
}
}
});

newsDrawer.setOnDrawerClosing(event -> {
newsDrawer.setMouseTransparent(true);

});

return newsDrawer;
}
//
// newsDrawer.close();
// } else {
// newsDrawer.setMouseTransparent(false);
//// newsDrawer.setMouseTransparent(true);
//
// newsDrawer.open();
// }
// });
//
// this.setOnKeyPressed(new EventHandler<KeyEvent>() {
// @Override
// public void handle(KeyEvent event) {
// if (event.getCode() == KeyCode.ESCAPE) {
// if (newsDrawer.isShown()) {
// newsDrawer.setMouseTransparent(true);
// newsDrawer.close();
// }
// }
// }
// });
//
// newsDrawer.setOnDrawerClosing(event -> {
// newsDrawer.setMouseTransparent(true);
//
// });
//
// return newsDrawer;
// }

/**
* Generates a drawer initiated by the hamburger, defined by the width and height
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/UI/NavBar.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AnchorPane fx:id="navBar" maxHeight="48.0" minHeight="48.0" minWidth="256.0" prefHeight="48.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
<children>
<JFXHamburger alignment="CENTER" layoutX="14.0" layoutY="14.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
<JFXButton alignment="CENTER" layoutX="156.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="50.0" text="NEWS" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="0.0" />
<!--<JFXButton alignment="CENTER" layoutX="156.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="50.0" text="NEWS" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="0.0" />-->
<JFXButton alignment="CENTER" layoutX="47.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="50.0" text="3DOT" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>

0 comments on commit 8c71e44

Please sign in to comment.