From 2e78af3d52b0ab51a61c2a148dfccbcb80f1a81f Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 12 Dec 2017 08:58:26 +0100 Subject: [PATCH] added scroller + global layout fixes --- Classes/css/user/ContextBuilder.java | 4 +- Classes/css/user/SubMenuStyleSheet.java | 30 +-- controller/MainMenu.java | 47 ++++ css/menu.css | 15 +- fxml/model.fxml | 327 +++++++++++++++++++----- src/icon.png | Bin 0 -> 2268 bytes 6 files changed, 344 insertions(+), 79 deletions(-) create mode 100644 controller/MainMenu.java create mode 100644 src/icon.png diff --git a/Classes/css/user/ContextBuilder.java b/Classes/css/user/ContextBuilder.java index 85111b0..527f2f9 100644 --- a/Classes/css/user/ContextBuilder.java +++ b/Classes/css/user/ContextBuilder.java @@ -13,14 +13,14 @@ public class ContextBuilder{ /* (2) Base layout dimension */ Context.bind("header-height", 50); Context.bind("menu-width", 237); - Context.bind("submenu-width", 200); + Context.bind("submenu-width", 166); Context.bind("article-width", 800); Context.bind("article-height", 96); /* (3) Colors */ Context.bind("main-color", 63, 81, 181); Context.bind("menu-bg", 255, 255, 253); - Context.bind("submenu-bg", 255, 0, 0); + Context.bind("submenu-bg", 250, 250, 250); } diff --git a/Classes/css/user/SubMenuStyleSheet.java b/Classes/css/user/SubMenuStyleSheet.java index 16bdd8e..742b319 100644 --- a/Classes/css/user/SubMenuStyleSheet.java +++ b/Classes/css/user/SubMenuStyleSheet.java @@ -10,22 +10,22 @@ public class SubMenuStyleSheet{ public SubMenuStyleSheet(Node target) throws Exception{ /* (1) Set rules */ - Ruleset.load(target) - .add("top", Context.getInt("header-height")) - .add("left", Context.getInt("menu-width")-3) - .add("bottom", 0) - - .add("min-width", Context.getInt("submenu-width")) - .add("max-width", Context.getInt("submenu-width")) - - .add("min-height", Context.getInt("screen-height") - Context.getInt("header-height")) - .add("max-height", Context.getInt("screen-height") - Context.getInt("header-height")) +// Ruleset.load(target) +// .add("top", Context.getInt("header-height")) +// .add("left", Context.getInt("menu-width")-3) +// .add("bottom", 0) +// +// .add("min-width", Context.getInt("submenu-width")) +// .add("max-width", Context.getInt("submenu-width")) +// +// .add("min-height", Context.getInt("screen-height") - Context.getInt("header-height")) +// .add("max-height", Context.getInt("screen-height") - Context.getInt("header-height")) +// +// .add("pref-width", Context.getInt("submenu-width")) +// .add("pref-height", Context.getInt("screen-height") - Context.getInt("header-height")) - .add("pref-width", Context.getInt("submenu-width")) - .add("pref-height", Context.getInt("screen-height") - Context.getInt("header-height")) - - .add("background-color", Context.getString("submenu-bg")) - .apply(); +// .add("background-color", Context.getString("submenu-bg")) +// .apply(); } } diff --git a/controller/MainMenu.java b/controller/MainMenu.java new file mode 100644 index 0000000..c5cb475 --- /dev/null +++ b/controller/MainMenu.java @@ -0,0 +1,47 @@ +package controller; + +import java.util.ArrayList; + +import Interfaces.EventObserver; +import javafx.event.EventHandler; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.FlowPane; + +public class MainMenu{ + + /* Data */ + private ArrayList items; + private FlowPane parent; + private EventObserver observer; + + + /* Constructor */ + public MainMenu(FlowPane p_parent, EventObserver observer){ + this.parent = p_parent; + this.items = new ArrayList(); + this.observer = observer; + } + + public void addItem(String p_name, String p_image_uri) { + + ImageView menuItem = new ImageView(); + + menuItem.setImage(new Image(p_image_uri)); + menuItem.setId("header_menu_item_"+p_name); + menuItem.getStyleClass().add("header_menu_item"); + + menuItem.setOnMousePressed(new EventHandler() { + @Override + public void handle(MouseEvent event) { + MainMenu.this.observer.handleEvent(new Classes.Event(menuItem.getId(), "changeMainLayout")); + } + }); + + this.items.add(menuItem); + // Add to parent + parent.getChildren().add(menuItem); + } + +} diff --git a/css/menu.css b/css/menu.css index 4dd938e..a442f4c 100644 --- a/css/menu.css +++ b/css/menu.css @@ -27,11 +27,22 @@ -fx-min-height: -vn-header-height; -fx-max-height: -vn-header-height; - -fx-background-color: #fffffd; + -fx-background-color: #ffffff; } .menu_item{ -fx-border-width: 0 0 1 0; - -fx-border-color: #dddddd + -fx-border-color: #eeeeee; +} + +#menu{ + -fx-background-color: #ffffff; + + -fx-border-width: 0 1 0 0; + -fx-border-color: #eeeeee; +} + +#submenu{ + -fx-background-color: null; } \ No newline at end of file diff --git a/fxml/model.fxml b/fxml/model.fxml index a3c2e74..27d63c8 100644 --- a/fxml/model.fxml +++ b/fxml/model.fxml @@ -2,6 +2,7 @@ + @@ -21,10 +22,17 @@ - + + + + + + + + - + @@ -105,64 +113,263 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/icon.png b/src/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b875ecdb52a1d9a6e9747acbdd493876988217c3 GIT binary patch literal 2268 zcmV<22qX82P)gzS*4Anis(n}=wG88QYHL;O3;RMkzNS-W#84k&Eu|KS)jzD#3bvR8YFd$MBcedS zn8zlY&E9)|{Uan~NtQ&(CfVp`=FIH5_nb4|^Sk%l^E_5PMf^ z(amS5EGseLO1*FK1^?nUBfUqpQVqTcJ$+D!JNzXsQ( z{l*`TWFL+Sg%={Z!Ly*x6t8ua%Rp9ww00I;@~^J^1*d@+fZ)1^aHf=#sF>HUF-gSn zZ>ml*Oa`EMdRjP~{ZjIBcw6PyP`MxQV|=eW!C7x5a%N`JnH%wPLYec94*}z~*9Q09 zv$EgkU27}LG3Fgb~&@(l{XNU6&th`^&@ieQ!v`g;&k`{`Ft4EX>cFGg|7> z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