JavaFX/Classes/css/user/MenuContainer.java

33 lines
832 B
Java

package Classes.css.user;
import Classes.css.core.Context;
import Classes.css.core.Ruleset;
import javafx.scene.Node;
public class MenuContainer{
/* Builds all necessary CSS/layout rules */
public MenuContainer(Node target) throws Exception{
/* (1) Calculate menu height (screen.height - header.height) */
Integer menu_height = Integer.valueOf( Context.get("screen-height").toString() );
menu_height -= Integer.valueOf( Context.get("header-height").toString() );
/* (2) Set rules */
Ruleset.load(target)
.add("top", Context.get("header-height"))
.add("left", 0)
.add("min-width", Context.get("menu-width"))
.add("max-width", Context.get("menu-width"))
.add("min-height", menu_height)
.add("max-height", menu_height)
.add("background-color", "#fffffd")
.apply();
}
}