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.components.generics.others.listeners.ISideBarListener;
import com.pqt.client.gui.ressources.strings.GUIStringTool; import com.pqt.client.gui.ressources.strings.GUIStringTool;
import com.pqt.core.entities.user_account.Account; import com.pqt.core.entities.user_account.Account;
import javafx.application.Platform;
import javafx.geometry.Orientation; import javafx.geometry.Orientation;
import javafx.scene.Node;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.ToolBar; import javafx.scene.control.ToolBar;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
@ -80,7 +82,19 @@ class MainFrameView implements IFXComponent{
void addGuiModule(String moduleName, Pane moduleContent){ void addGuiModule(String moduleName, Pane moduleContent){
Button button = new Button(moduleName); 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); moduleListToolbar.getItems().add(button);
} }

View File

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

View File

@ -173,6 +173,16 @@
-fx-background-color: derive(-fx-focus-color,30%); -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 { .progress-indicator {
-fx-pref-width: 50; -fx-pref-width: 50;
-fx-pref-height: 50; -fx-pref-height: 50;