fix affichage dictionnaire
This commit is contained in:
parent
c0668ab41e
commit
72623d228a
|
@ -103,6 +103,32 @@ public class RootLayout extends Application implements EventObserver {
|
||||||
NewsListModel.getInstance().setSortType(SortTypes.relevancy);
|
NewsListModel.getInstance().setSortType(SortTypes.relevancy);
|
||||||
|
|
||||||
DictionaryModel.getInstance().addObserver("MainClass", this);
|
DictionaryModel.getInstance().addObserver("MainClass", this);
|
||||||
|
|
||||||
|
VBox subMenuContainer = (VBox) this.root_layout.lookup("#submenu");
|
||||||
|
|
||||||
|
for(Node n : subMenuContainer.getChildren()) {
|
||||||
|
FlowPane p = (FlowPane) n;
|
||||||
|
p.setOnMousePressed(new EventHandler<MouseEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(MouseEvent event) {
|
||||||
|
|
||||||
|
// De-active all items before activating current one
|
||||||
|
for( Node n2 : subMenuContainer.getChildren() )
|
||||||
|
n2.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());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.handleMainLayoutChange("magazines");
|
this.handleMainLayoutChange("magazines");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,6 +186,7 @@ public class RootLayout extends Application implements EventObserver {
|
||||||
case "NewsQuerySuccess":
|
case "NewsQuerySuccess":
|
||||||
System.out.println(NewsListModel.getInstance().getNews().size()+" News ont été trouvé");
|
System.out.println(NewsListModel.getInstance().getNews().size()+" News ont été trouvé");
|
||||||
|
|
||||||
|
this.root_layout.lookup("#submenu").setVisible(true);
|
||||||
this.articles.clearContent();
|
this.articles.clearContent();
|
||||||
|
|
||||||
TextField tx = new TextField();
|
TextField tx = new TextField();
|
||||||
|
@ -226,6 +253,8 @@ public class RootLayout extends Application implements EventObserver {
|
||||||
|
|
||||||
this.dico.clearContent();
|
this.dico.clearContent();
|
||||||
|
|
||||||
|
this.root_layout.lookup("#submenu").setVisible(false);
|
||||||
|
|
||||||
TextField tx1 = new TextField();
|
TextField tx1 = new TextField();
|
||||||
tx1.setPromptText("search...");
|
tx1.setPromptText("search...");
|
||||||
tx1.setId("mag_searchbar");
|
tx1.setId("mag_searchbar");
|
||||||
|
@ -296,31 +325,7 @@ public class RootLayout extends Application implements EventObserver {
|
||||||
container.getChildren().add(new Text("translator"));
|
container.getChildren().add(new Text("translator"));
|
||||||
break;
|
break;
|
||||||
case "magazines" :
|
case "magazines" :
|
||||||
|
NewsListModel.getInstance().query("");
|
||||||
VBox subMenuContainer = (VBox) this.root_layout.lookup("#submenu");
|
|
||||||
|
|
||||||
for(Node n : subMenuContainer.getChildren()) {
|
|
||||||
FlowPane p = (FlowPane) n;
|
|
||||||
p.setOnMousePressed(new EventHandler<MouseEvent>() {
|
|
||||||
@Override
|
|
||||||
public void handle(MouseEvent event) {
|
|
||||||
|
|
||||||
// De-active all items before activating current one
|
|
||||||
for( Node n2 : subMenuContainer.getChildren() )
|
|
||||||
n2.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());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue