Module Client, main frame : ajout coloration différente pour le bouton du module affiché

This commit is contained in:
Notmoo 2017-08-15 19:04:47 +02:00
parent 62eccf6528
commit f817ae6ab3
3 changed files with 27 additions and 5 deletions

View File

@ -6,7 +6,9 @@ import com.pqt.client.gui.ressources.components.generics.others.SideBar;
import com.pqt.client.gui.ressources.components.generics.others.listeners.ISideBarListener;
import com.pqt.client.gui.ressources.strings.GUIStringTool;
import com.pqt.core.entities.user_account.Account;
import javafx.application.Platform;
import javafx.geometry.Orientation;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ToolBar;
import javafx.scene.layout.BorderPane;
@ -80,7 +82,19 @@ class MainFrameView implements IFXComponent{
void addGuiModule(String moduleName, Pane moduleContent){
Button button = new Button(moduleName);
button.setOnMouseClicked(event->mainPane.setCenter(moduleContent));
button.getStyleClass().add("menu-button");
button.setOnMouseClicked(event->{
moduleListToolbar.getItems()
.stream()
.filter(Button.class::isInstance)
.map(Button.class::cast)
.forEach(b-> b.getStyleClass().remove("menu-button-selected"));
button.getStyleClass().add("menu-button-selected");
Platform.runLater(()->{
moduleListToolbar.getItems().forEach(Node::applyCss);
mainPane.setCenter(moduleContent);
});
});
moduleListToolbar.getItems().add(button);
}

View File

@ -13,8 +13,6 @@ import java.util.EnumSet;
//TODO faire ça un peu mieux
public class GUIStringTool {
private static String saleIdLabel;
public static String getValidationButtonLabel() {
return "Valider";
}
@ -157,11 +155,11 @@ public class GUIStringTool {
}
public static String getSideBarCollapseButtonLabel() {
return "Hide";
return "Réduire";
}
public static String getSideBarExpandButtonLabel() {
return "Show";
return "Menu";
}
public static String getSaleGuiModuleName() {

View File

@ -173,6 +173,16 @@
-fx-background-color: derive(-fx-focus-color,30%);
}
.menu-button-selected {
-fx-background-color: #d8d8d8;
-fx-text-fill: #1d1d1d;
}
.menu-button-selected:hover {
-fx-background-color: white;
-fx-text-fill: #1d1d1d;
}
.progress-indicator {
-fx-pref-width: 50;
-fx-pref-height: 50;