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*/
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");
}
@ -208,6 +213,7 @@ public class RootLayout extends Application implements EventObserver {
case "changeMagCategory":
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>() {
@Override
public void handle(MouseEvent event) {
//horreur...malheur
p.setStyle("-fx-background-color: #DDDDDD");
RootLayout.this.root_layout.lookup("#"+NewsListModel.getInstance().getCategory().getLabel()).setStyle("fx-background-color: #F3F3F3");
RootLayout.this.handleEvent(new Classes.Event(p.getChildren().get(0).getId(), "changeMagCategory"));
// De-active last gui category (TODO: make this line work)
RootLayout.this.root_layout.lookup("#"+NewsListModel.getInstance().getCategory().getLabel()).getStyleClass().clear();
// 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;
}

View File

@ -41,8 +41,4 @@
-fx-border-width: 0 1 0 0;
-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>
</children>
</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>
<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>
<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">
@ -124,7 +124,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/all.png" />
</image>
</ImageView>
</children>
@ -140,7 +140,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/science.png" />
</image>
</ImageView>
</children>
@ -156,7 +156,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/business.png" />
</image>
</ImageView>
</children>
@ -166,13 +166,13 @@
</FlowPane>
<FlowPane alignment="CENTER_RIGHT" columnHalignment="CENTER" layoutX="30.0" layoutY="130.0" prefHeight="35.0" prefWidth="234.0" styleClass="menu_item">
<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">
<FlowPane.margin>
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/entertainment.png" />
</image>
</ImageView>
</children>
@ -188,7 +188,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/gaming.png" />
</image>
</ImageView>
</children>
@ -204,7 +204,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/health.png" />
</image>
</ImageView>
</children>
@ -220,7 +220,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/music.png" />
</image>
</ImageView>
</children>
@ -236,7 +236,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/sport.png" />
</image>
</ImageView>
</children>
@ -252,7 +252,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/nature.png" />
</image>
</ImageView>
</children>
@ -268,7 +268,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/economics.png" />
</image>
</ImageView>
</children>
@ -284,7 +284,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/politics.png" />
</image>
</ImageView>
</children>
@ -300,7 +300,7 @@
<Insets left="15.0" />
</FlowPane.margin>
<image>
<Image url="@../src/menu/dictionary.png" />
<Image url="@../src/submenu/technology.png" />
</image>
</ImageView>
</children>

View File

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