Now new icons + category choose

This commit is contained in:
xdrm-brackets 2017-12-12 15:02:37 +01:00
parent e52280bc21
commit 08afc7b1e8
17 changed files with 45 additions and 28 deletions

View File

@ -94,6 +94,11 @@ 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") );
NewsListModel.getInstance().addObserver("MainClass", this);
NewsListModel.getInstance().setCategory(Category.all);
NewsListModel.getInstance().setSortType(SortTypes.relevancy);
this.handleMainLayoutChange("magazines"); this.handleMainLayoutChange("magazines");
} }
@ -208,6 +213,7 @@ public class RootLayout extends Application implements EventObserver {
case "changeMagCategory": case "changeMagCategory":
NewsListModel.getInstance().setCategory(Category.valueOf(e.getObjectId().toLowerCase())); NewsListModel.getInstance().setCategory(Category.valueOf(e.getObjectId().toLowerCase()));
break;
} }
} }
@ -237,19 +243,22 @@ public class RootLayout extends Application implements EventObserver {
p.setOnMousePressed(new EventHandler<MouseEvent>() { p.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override @Override
public void handle(MouseEvent event) { public void handle(MouseEvent event) {
//horreur...malheur
p.setStyle("-fx-background-color: #DDDDDD"); // De-active last gui category (TODO: make this line work)
RootLayout.this.root_layout.lookup("#"+NewsListModel.getInstance().getCategory().getLabel()).setStyle("fx-background-color: #F3F3F3"); RootLayout.this.root_layout.lookup("#"+NewsListModel.getInstance().getCategory().getLabel()).getStyleClass().clear();
RootLayout.this.handleEvent(new Classes.Event(p.getChildren().get(0).getId(), "changeMagCategory"));
// Change category
NewsListModel.getInstance().setCategory(Category.valueOf(p.getChildren().get(0).getId().toLowerCase()));
// Active gui category
p.getStyleClass().add("active");
// Re-launch request
NewsListModel.getInstance().query(NewsListModel.getInstance().getQuery());
} }
}); });
} }
NewsListModel.getInstance().addObserver("MainClass", this);
NewsListModel.getInstance().setCategory(Category.gaming);
NewsListModel.getInstance().setSortType(SortTypes.relevancy);
NewsListModel.getInstance().query("the evil within");
break; break;
} }

View File

@ -42,7 +42,3 @@
-fx-border-width: 0 1 0 0; -fx-border-width: 0 1 0 0;
-fx-border-color: #eeeeee; -fx-border-color: #eeeeee;
} }
#submenu{
-fx-background-color: null;
}

7
css/submenu.css Normal file
View File

@ -0,0 +1,7 @@
@import "./constants.css";
#submenu .active{
-fx-fill: #000000;
-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;" AnchorPane.bottomAnchor="0.0" AnchorPane.topAnchor="50.0"> <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">
<children> <children>
<FlowPane alignment="CENTER_RIGHT" columnHalignment="CENTER" prefHeight="35.0" prefWidth="234.0" styleClass="menu_item"> <FlowPane alignment="CENTER_RIGHT" columnHalignment="CENTER" prefHeight="35.0" prefWidth="234.0" styleClass="active">
<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">
@ -124,7 +124,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/all.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -140,7 +140,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/science.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -156,7 +156,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/business.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -166,13 +166,13 @@
</FlowPane> </FlowPane>
<FlowPane alignment="CENTER_RIGHT" columnHalignment="CENTER" layoutX="30.0" layoutY="130.0" prefHeight="35.0" prefWidth="234.0" styleClass="menu_item"> <FlowPane alignment="CENTER_RIGHT" columnHalignment="CENTER" layoutX="30.0" layoutY="130.0" prefHeight="35.0" prefWidth="234.0" styleClass="menu_item">
<children> <children>
<Text fx:id="entertainment" fill="#656565" strokeType="OUTSIDE" strokeWidth="0.0" text="Entertainement" /> <Text fx:id="entertainment" fill="#656565" strokeType="OUTSIDE" strokeWidth="0.0" text="Entertainment" />
<ImageView fitHeight="15.0" fitWidth="15.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="15.0" fitWidth="15.0" pickOnBounds="true" preserveRatio="true">
<FlowPane.margin> <FlowPane.margin>
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/entertainment.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -188,7 +188,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/gaming.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -204,7 +204,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/health.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -220,7 +220,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/music.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -236,7 +236,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/sport.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -252,7 +252,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/nature.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -268,7 +268,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/economics.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -284,7 +284,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/politics.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>
@ -300,7 +300,7 @@
<Insets left="15.0" /> <Insets left="15.0" />
</FlowPane.margin> </FlowPane.margin>
<image> <image>
<Image url="@../src/menu/dictionary.png" /> <Image url="@../src/submenu/technology.png" />
</image> </image>
</ImageView> </ImageView>
</children> </children>

View File

@ -243,6 +243,11 @@ public class NewsListModel implements Observable{
} }
} }
public String getQuery() {
return this.query;
}
public ArrayList<NewsModel> getNews(){ public ArrayList<NewsModel> getNews(){
return this.news; return this.news;
} }

BIN
src/submenu/all.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

BIN
src/submenu/business.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

BIN
src/submenu/economics.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

BIN
src/submenu/gaming.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

BIN
src/submenu/health.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

BIN
src/submenu/music.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
src/submenu/nature.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

BIN
src/submenu/politics.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
src/submenu/science.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

BIN
src/submenu/sport.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

BIN
src/submenu/technology.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B