simplified date format + some categories do not work + design issues

This commit is contained in:
xdrm-brackets 2017-12-13 15:35:39 +01:00
parent 08afc7b1e8
commit e6fd1f038a
7 changed files with 43 additions and 21 deletions

View File

@ -0,0 +1,21 @@
package Classes.css.user;
import Classes.css.core.Context;
import Classes.css.core.Ruleset;
import javafx.scene.Node;
public class ContainerScrollStyleSheet{
/* Builds all necessary CSS/layout rules */
public ContainerScrollStyleSheet(Node target) throws Exception{
/* (1) Set rules */
Ruleset.load(target)
.add("top", Context.getInt("header-height") )
.add("left", Context.getInt("submenu-width") + Context.getInt("menu-width") - 3)
.add("right", 0)
// .add("pref-height", )
.apply();
}
}

View File

@ -13,7 +13,7 @@ public class ContextBuilder{
/* (2) Base layout dimension */ /* (2) Base layout dimension */
Context.bind("header-height", 50); Context.bind("header-height", 50);
Context.bind("menu-width", 237); Context.bind("menu-width", 237);
Context.bind("submenu-width", 2); Context.bind("submenu-width", 200);
Context.bind("article-width", 800); Context.bind("article-width", 800);
Context.bind("article-height", 96); Context.bind("article-height", 96);

View File

@ -18,12 +18,12 @@ public class SubMenuStyleSheet{
.add("min-width", Context.getInt("submenu-width")) .add("min-width", Context.getInt("submenu-width"))
.add("max-width", Context.getInt("submenu-width")) .add("max-width", Context.getInt("submenu-width"))
.add("min-height", Context.getInt("screen-height") - Context.getInt("header-height")) // .add("min-height", Context.getInt("screen-height") - Context.getInt("header-height"))
.add("max-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-width", Context.getInt("submenu-width"))
.add("pref-height", Context.getInt("screen-height") - Context.getInt("header-height")) // .add("pref-height", Context.getInt("screen-height") - Context.getInt("header-height"))
.add("background-color", Context.getString("submenu-bg")) .add("background-color", Context.getString("submenu-bg"))
.apply(); .apply();
} }

View File

@ -1,15 +1,14 @@
package controller; package controller;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import Classes.Category; import Classes.Category;
import Interfaces.EventObserver; import Interfaces.EventObserver;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
@ -105,7 +104,7 @@ public class Article{
Text g_date = (Text) p_parent.getChildren().get(2); Text g_date = (Text) p_parent.getChildren().get(2);
/* (2) Update content */ /* (2) Update content */
g_date.setText(p_date.toString()); g_date.setText(new SimpleDateFormat("dd-MM-yyyy HH:mm").format(p_date));
} }

View File

@ -1,11 +1,10 @@
package controller; package controller;
import java.awt.Color;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import Classes.Category; import Classes.Category;
import Classes.SortTypes; import Classes.SortTypes;
import Classes.css.user.ContainerScrollStyleSheet;
import Classes.css.user.ContextBuilder; import Classes.css.user.ContextBuilder;
import Classes.css.user.HeaderIconStyleSheet; import Classes.css.user.HeaderIconStyleSheet;
import Classes.css.user.HeaderStyleSheet; import Classes.css.user.HeaderStyleSheet;
@ -15,8 +14,6 @@ import Interfaces.Event;
import Interfaces.EventObserver; import Interfaces.EventObserver;
import javafx.application.Application; import javafx.application.Application;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Node; import javafx.scene.Node;
@ -26,14 +23,11 @@ import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent; import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Background;
import javafx.scene.layout.FlowPane; import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import javafx.stage.Stage; import javafx.stage.Stage;
import model.DictionaryModel; import model.DictionaryModel;
import model.NewsListModel; import model.NewsListModel;
import model.NewsModel; import model.NewsModel;
@ -94,6 +88,9 @@ public class RootLayout extends Application implements EventObserver {
/* (4) #header_icon*/ /* (4) #header_icon*/
new HeaderIconStyleSheet( this.root_scene.lookup("#header_icon") ); new HeaderIconStyleSheet( this.root_scene.lookup("#header_icon") );
/* (4) #scroll_container*/
new ContainerScrollStyleSheet( this.root_scene.lookup("#scroll_container") );
NewsListModel.getInstance().addObserver("MainClass", this); NewsListModel.getInstance().addObserver("MainClass", this);
@ -244,8 +241,9 @@ public class RootLayout extends Application implements EventObserver {
@Override @Override
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
// De-active last gui category (TODO: make this line work) // De-active all items before activating current one
RootLayout.this.root_layout.lookup("#"+NewsListModel.getInstance().getCategory().getLabel()).getStyleClass().clear(); for( Node n2 : subMenuContainer.getChildren() )
n2.getStyleClass().clear();
// Change category // Change category
NewsListModel.getInstance().setCategory(Category.valueOf(p.getChildren().get(0).getId().toLowerCase())); NewsListModel.getInstance().setCategory(Category.valueOf(p.getChildren().get(0).getId().toLowerCase()));

View File

@ -1,6 +1,10 @@
@import "./constants.css"; @import "./constants.css";
#submenu{
-fx-background-color: #ff0000;
}
#submenu .active{ #submenu .active{
-fx-fill: #000000; -fx-fill: #000000;
-fx-font-weight: bold; -fx-font-weight: bold;

View File

@ -114,9 +114,9 @@
</VBox> </VBox>
</children> </children>
</AnchorPane> </AnchorPane>
<VBox id="submenu" fx:id="submenu" layoutX="234.0" layoutY="50.0" prefHeight="650.0" prefWidth="166.0" style="-fx-background-color: #F3F3F3;" stylesheets="@../css/submenu.css" AnchorPane.bottomAnchor="0.0" AnchorPane.topAnchor="50.0"> <VBox id="submenu" fx:id="submenu" layoutX="234.0" layoutY="50.0" prefWidth="200.0" stylesheets="@../css/submenu.css" AnchorPane.bottomAnchor="0.0" AnchorPane.topAnchor="50.0">
<children> <children>
<FlowPane alignment="CENTER_RIGHT" columnHalignment="CENTER" prefHeight="35.0" prefWidth="234.0" styleClass="active"> <FlowPane alignment="CENTER_RIGHT" columnHalignment="CENTER" prefHeight="35.0" prefWidth="234.0">
<children> <children>
<Text fx:id="all" fill="#656565" strokeType="OUTSIDE" strokeWidth="0.0" text="Tout afficher" /> <Text fx:id="all" fill="#656565" strokeType="OUTSIDE" strokeWidth="0.0" text="Tout afficher" />
<ImageView fitHeight="15.0" fitWidth="15.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="15.0" fitWidth="15.0" pickOnBounds="true" preserveRatio="true">
@ -309,9 +309,9 @@
</VBox.margin> </VBox.margin>
</FlowPane> </FlowPane>
</children></VBox> </children></VBox>
<ScrollPane id="scroll_container" hbarPolicy="NEVER" pickOnBounds="false" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: transparent;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="400.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="50.0"> <ScrollPane id="scroll_container" fx:id="scroll_container" hbarPolicy="NEVER" pickOnBounds="false" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: transparent;" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="49.0">
<content> <content>
<FlowPane id="container" fx:id="container" alignment="TOP_CENTER" columnHalignment="CENTER" prefHeight="650.0" prefWrapLength="1000.0" stylesheets="@../css/container.css"> <FlowPane id="container" fx:id="container" alignment="TOP_CENTER" columnHalignment="CENTER" prefHeight="650.0" prefWidth="1000.0" prefWrapLength="1000.0" stylesheets="@../css/container.css">
<children> <children>
<TextField id="mag_searchbar" fx:id="mag_searchbar" prefHeight="26.0" prefWidth="759.0" promptText="Search..."> <TextField id="mag_searchbar" fx:id="mag_searchbar" prefHeight="26.0" prefWidth="759.0" promptText="Search...">
<FlowPane.margin> <FlowPane.margin>