增加明暗主题切换
@@ -53,7 +53,7 @@ public class AppStartup extends Application {
|
||||
String keyPrefix = "";
|
||||
// //全局样式
|
||||
// setUserAgentStylesheet(null);
|
||||
// StyleManager.getInstance().addUserAgentStylesheet("css/app.css");
|
||||
// StyleManager.getInstance().addUserAgentStylesheet("css/app-light.css");
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
@@ -87,7 +87,7 @@ public class AppStartup extends Application {
|
||||
stage.show();
|
||||
|
||||
|
||||
scene.getStylesheets().addAll(JFoenixResources.load("/css/app-fonts.css").toExternalForm(),AppStartup.class.getResource("/css/login.css").toExternalForm(),AppStartup.class.getResource("/css/app.css").toExternalForm());
|
||||
scene.getStylesheets().addAll(JFoenixResources.load("/css/app-fonts.css").toExternalForm(),AppStartup.class.getResource("/css/login.css").toExternalForm(),AppStartup.class.getResource("/css/app-light.css").toExternalForm());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.epri.fx.client.gui.uicomponents.home;
|
||||
|
||||
import com.epri.fx.client.bean.CountryPath;
|
||||
import com.epri.fx.client.store.ApplicatonStore;
|
||||
import eu.hansolo.tilesfx.Tile;
|
||||
import eu.hansolo.tilesfx.TileBuilder;
|
||||
import eu.hansolo.tilesfx.TimeSection;
|
||||
@@ -60,8 +61,10 @@ public class HomeController {
|
||||
@ActionHandler
|
||||
private FlowActionHandler actionHandler;
|
||||
|
||||
public static final Color BACKGROUND = Color.rgb(39, 49, 66); // #2a2a2a
|
||||
public static final Color BORDERCOLOR = Color.rgb(49, 61, 79); // #2a2a2a
|
||||
public static final Color BACKGROUND_DARK = Color.rgb(39, 49, 66); // #2a2a2a
|
||||
public static final Color BACKGROUND_LIGHT = Color.rgb(255, 255, 255); // #2a2a2a
|
||||
public static final Color BORDERCOLOR_DARK = Color.rgb(49, 61, 79); // #2a2a2a
|
||||
public static final Color BORDERCOLOR_LIGHT = Color.rgb(185, 185, 185, 0.3f); // #2a2a2a
|
||||
|
||||
|
||||
private static final Random RND = new Random();
|
||||
@@ -227,13 +230,13 @@ public class HomeController {
|
||||
new Stop(0.5, Tile.YELLOW),
|
||||
new Stop(1.0, Tile.RED))
|
||||
.strokeWithGradient(true)
|
||||
.backgroundColor(BACKGROUND).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.backgroundColor(BACKGROUND_DARK).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
//.smoothing(true)
|
||||
.build();
|
||||
|
||||
|
||||
areaChartTile = TileBuilder.create()
|
||||
.skinType(Tile.SkinType.SMOOTHED_CHART).backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.skinType(Tile.SkinType.SMOOTHED_CHART).backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.title("SmoothedChart Tile")
|
||||
.chartType(Tile.ChartType.AREA)
|
||||
//.animated(true)
|
||||
@@ -248,7 +251,7 @@ public class HomeController {
|
||||
.build();
|
||||
|
||||
lineChartTile = TileBuilder.create()
|
||||
.skinType(Tile.SkinType.SMOOTHED_CHART).backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.skinType(Tile.SkinType.SMOOTHED_CHART).backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.title("SmoothedChart Tile")
|
||||
//.animated(true)
|
||||
.smoothing(false)
|
||||
@@ -257,7 +260,7 @@ public class HomeController {
|
||||
|
||||
|
||||
worldTile = TileBuilder.create()
|
||||
.skinType(Tile.SkinType.WORLDMAP).backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.skinType(Tile.SkinType.WORLDMAP).backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.title("WorldMap Tile")
|
||||
.text("Whatever text")
|
||||
.textVisible(false)
|
||||
@@ -265,7 +268,7 @@ public class HomeController {
|
||||
|
||||
|
||||
radialChartTile = TileBuilder.create()
|
||||
.skinType(Tile.SkinType.RADIAL_CHART).backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.skinType(Tile.SkinType.RADIAL_CHART).backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.title("RadialChart")
|
||||
.text("Some text")
|
||||
.textVisible(false)
|
||||
@@ -274,7 +277,7 @@ public class HomeController {
|
||||
|
||||
donutChartTile = TileBuilder.create()
|
||||
.skinType(Tile.SkinType.DONUT_CHART)
|
||||
.title("DonutChart").backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.title("DonutChart").backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.text("Some text")
|
||||
.textVisible(false)
|
||||
.chartData(chartData1, chartData2, chartData3, chartData4)
|
||||
@@ -282,7 +285,7 @@ public class HomeController {
|
||||
|
||||
circularProgressTile = TileBuilder.create()
|
||||
.skinType(Tile.SkinType.CIRCULAR_PROGRESS)
|
||||
.title("CircularProgress").backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.title("CircularProgress").backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.text("Some text")
|
||||
.unit("\u0025")
|
||||
//.graphic(new WeatherSymbol(ConditionAndIcon.CLEAR_DAY, 48, Color.WHITE))
|
||||
@@ -291,7 +294,7 @@ public class HomeController {
|
||||
|
||||
radarChartTile1 = TileBuilder.create().skinType(Tile.SkinType.RADAR_CHART)
|
||||
.minValue(0)
|
||||
.maxValue(50).backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.maxValue(50).backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.title("RadarChart Sector")
|
||||
.unit("Unit")
|
||||
.radarChartMode(RadarChart.Mode.SECTOR)
|
||||
@@ -315,7 +318,7 @@ public class HomeController {
|
||||
|
||||
|
||||
ephemerisTile = TileBuilder.create().skinType(Tile.SkinType.EPHEMERIS)
|
||||
.title("Ephemeris").backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.title("Ephemeris").backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.currentLocation(new Location(51.911515, 7.6340026, "Hiltrup"))
|
||||
.text("Hiltrup")
|
||||
.build();
|
||||
@@ -332,7 +335,7 @@ public class HomeController {
|
||||
|
||||
statusTile = TileBuilder.create()
|
||||
.skinType(Tile.SkinType.STATUS)
|
||||
.title("Status Tile").borderWidth(0.8d).backgroundColor(BACKGROUND).borderRadius(14).borderColor(BORDERCOLOR).borderWidth(0.8d)
|
||||
.title("Status Tile").borderWidth(0.8d).backgroundColor(BACKGROUND_DARK).borderRadius(14).borderColor(BORDERCOLOR_DARK).borderWidth(0.8d)
|
||||
.description("Notifications")
|
||||
.leftText("CRITICAL")
|
||||
.middleText("WARNING")
|
||||
@@ -402,23 +405,41 @@ public class HomeController {
|
||||
}
|
||||
};
|
||||
|
||||
System.out.println("Initialization: " + (System.currentTimeMillis() - start) + "ms");
|
||||
|
||||
|
||||
centerPane.add(radialChartTile, 0, 0);
|
||||
centerPane.add(donutChartTile, 1, 0);
|
||||
centerPane.add(circularProgressTile, 2, 0);
|
||||
centerPane.add(radarChartTile1, 3, 0);
|
||||
|
||||
centerPane.add(worldTile, 0, 1, 2, 1);
|
||||
centerPane.add(ephemerisTile, 2, 1);
|
||||
centerPane.add(statusTile, 3, 1);
|
||||
|
||||
centerPane.add(sparkLineTile, 0, 2);
|
||||
centerPane.add(areaChartTile, 1, 2);
|
||||
centerPane.add(lineChartTile, 2, 2, 2, 1);
|
||||
|
||||
System.out.println("Nodes in Scene: " + noOfNodes);
|
||||
|
||||
ApplicatonStore.styleProperty().addListener((observable, oldValue, newValue) -> {
|
||||
|
||||
centerPane.getChildren().forEach(node -> {
|
||||
|
||||
if (node instanceof Tile) {
|
||||
if (newValue) {
|
||||
((Tile) node).setBackgroundColor(BACKGROUND_DARK);
|
||||
((Tile) node).setBorderColor(BORDERCOLOR_DARK);
|
||||
((Tile) node).setForegroundColor(Color.rgb(223, 223, 223));
|
||||
} else {
|
||||
((Tile) node).setBackgroundColor(BACKGROUND_LIGHT);
|
||||
((Tile) node).setBorderColor(BORDERCOLOR_LIGHT);
|
||||
((Tile) node).setForegroundColor(Color.rgb(84, 84, 84));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
timer.start();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.epri.fx.client.gui.uicomponents.main;
|
||||
|
||||
import com.epri.fx.client.AppStartup;
|
||||
import com.epri.fx.client.bean.MenuVoCell;
|
||||
import com.epri.fx.client.gui.feature.FeatureResourceConsumer;
|
||||
import com.epri.fx.client.gui.uicomponents.home.HomeController;
|
||||
@@ -7,6 +8,7 @@ import com.epri.fx.client.gui.uicomponents.login.LoginController;
|
||||
import com.epri.fx.client.gui.uicomponents.main.components.UserInfoController;
|
||||
import com.epri.fx.client.store.ApplicatonStore;
|
||||
import com.epri.fx.server.vo.MenuVO;
|
||||
import com.jfoenix.assets.JFoenixResources;
|
||||
import com.jfoenix.controls.*;
|
||||
import com.jfoenix.svg.SVGGlyphLoader;
|
||||
import io.datafx.controller.ViewController;
|
||||
@@ -84,7 +86,7 @@ public class MainController {
|
||||
private JFXButton homeButton;
|
||||
@FXML
|
||||
@ActionTrigger("showSkinPane")
|
||||
private JFXButton skinButton;
|
||||
private JFXToggleButton styleBut;
|
||||
//刷新按钮
|
||||
@FXML
|
||||
@EventTrigger("test-message1")
|
||||
@@ -127,12 +129,14 @@ public class MainController {
|
||||
|
||||
@PostConstruct
|
||||
public void init() throws FlowException {
|
||||
|
||||
rootPane.getChildren().removeAll(navigationList);
|
||||
rootPane.getChildren().removeAll(leftDrawer);
|
||||
rootPane.getChildren().removeAll(tabPane);
|
||||
navigationList.setEffect(null);
|
||||
userLabel.textProperty().bind(ApplicatonStore.nameProperty());
|
||||
roleLabel.textProperty().bind(ApplicatonStore.getRoles().asString());
|
||||
userButton.textProperty().bind(ApplicatonStore.nameProperty());
|
||||
try {
|
||||
skinButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".skin"));
|
||||
homeButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".home-outline"));
|
||||
refreshButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".shuaxin"));
|
||||
rolesBut.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".admin"));
|
||||
@@ -166,12 +170,13 @@ public class MainController {
|
||||
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
|
||||
drawersStack.setContent(tabPane);
|
||||
drawersStack.toggle(leftDrawer);
|
||||
drawersStack.setEffect(null);
|
||||
try {
|
||||
addTab("主页", SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".home-outline"), HomeController.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
styleBut.selectedProperty().bindBidirectional(ApplicatonStore.styleProperty());
|
||||
featureResourceConsumer.consumeResource(this);
|
||||
|
||||
navigationList.setCellFactory(listView -> new JFXListCell<Object>() {
|
||||
@@ -369,8 +374,17 @@ public class MainController {
|
||||
|
||||
@ActionMethod("showSkinPane")
|
||||
private void showSkinPane() throws VetoException, FlowException {
|
||||
|
||||
getPopOver().show(skinButton);
|
||||
String style1 = AppStartup.class.getResource("/css/app-light.css").toExternalForm();
|
||||
String style2 = AppStartup.class.getResource("/css/app-dark.css").toExternalForm();
|
||||
if (styleBut.isSelected()) {
|
||||
styleBut.setText("明亮");
|
||||
styleBut.getScene().getStylesheets().removeAll(style1);
|
||||
styleBut.getScene().getStylesheets().addAll(style2);
|
||||
} else {
|
||||
styleBut.setText("黑暗");
|
||||
styleBut.getScene().getStylesheets().removeAll(style2);
|
||||
styleBut.getScene().getStylesheets().addAll(style1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.Map;
|
||||
public class ApplicatonStore {
|
||||
|
||||
public static String ICON_FONT_KEY = "icon.svg";
|
||||
private static SimpleBooleanProperty style = new SimpleBooleanProperty();
|
||||
private static SimpleIntegerProperty status = new SimpleIntegerProperty();
|
||||
private static SimpleStringProperty code = new SimpleStringProperty();
|
||||
private static SimpleStringProperty token = new SimpleStringProperty();
|
||||
@@ -170,6 +171,18 @@ public class ApplicatonStore {
|
||||
return permissionMenus;
|
||||
}
|
||||
|
||||
public static boolean isStyle() {
|
||||
return style.get();
|
||||
}
|
||||
|
||||
public static SimpleBooleanProperty styleProperty() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public static void setStyle(boolean style) {
|
||||
ApplicatonStore.style.set(style);
|
||||
}
|
||||
|
||||
public static void clearPermissionInfo() {
|
||||
setName("");
|
||||
getAllMenu().clear();
|
||||
|
||||
@@ -111,6 +111,9 @@
|
||||
-fx-prompt-text-fill: -fx-text-color;
|
||||
-jfx-size: 16px;
|
||||
}
|
||||
.jfx-toggle-button{
|
||||
-fx-text-fill: -fx-text-color;
|
||||
}
|
||||
|
||||
|
||||
.left-pill {
|
||||
955
client/src/main/resources/css/app-light.css
Normal file
@@ -8,6 +8,7 @@
|
||||
<?import com.jfoenix.controls.JFXListView?>
|
||||
<?import com.jfoenix.controls.JFXRippler?>
|
||||
<?import com.jfoenix.controls.JFXTabPane?>
|
||||
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||
<?import com.jfoenix.controls.JFXToolbar?>
|
||||
<?import com.jfoenix.transitions.hamburger.HamburgerSlideCloseTransition?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
@@ -71,8 +72,7 @@
|
||||
|
||||
|
||||
<HBox alignment="CENTER">
|
||||
<JFXButton fx:id="skinButton" contentDisplay="GRAPHIC_ONLY" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="40.0" prefWidth="40.0" styleClass="tool-bar-button">
|
||||
</JFXButton>
|
||||
<JFXToggleButton fx:id="styleBut" text="暗色" />
|
||||
<JFXButton fx:id="rolesBut" contentDisplay="GRAPHIC_ONLY" maxHeight="40.0" maxWidth="40.0" minHeight="40.0" minWidth="40.0" prefHeight="40.0" prefWidth="40.0" styleClass="tool-bar-button" text="user" textFill="WHITE" />
|
||||
<VBox alignment="CENTER">
|
||||
<Label fx:id="userLabel" maxWidth="1.7976931348623157E308" style="-fx-font-size: 16;-fx-font-weight: bold" text="李稳" VBox.vgrow="ALWAYS" />
|
||||
|
||||
|
Before Width: | Height: | Size: 286 KiB After Width: | Height: | Size: 210 KiB |
|
Before Width: | Height: | Size: 320 KiB After Width: | Height: | Size: 227 KiB |
|
Before Width: | Height: | Size: 560 KiB After Width: | Height: | Size: 441 KiB |
|
Before Width: | Height: | Size: 437 KiB After Width: | Height: | Size: 312 KiB |
|
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 221 KiB |
@@ -17,7 +17,7 @@ sample-client.ribbon.ConnectTimeout = 60000
|
||||
sample-client.ribbon.ReadTimeout = 60000
|
||||
|
||||
#初始服务器列表,可以在运行时通过Archaius动态属性进行更改
|
||||
sample-client.ribbon.listOfServers =127.0.0.1:8080,127.0.0.1:9080
|
||||
sample-client.ribbon.listOfServers =10.211.55.3:8080,10.211.55.3:9080
|
||||
|
||||
|
||||
#启用主要连接
|
||||
|
||||
@@ -6,8 +6,7 @@ spring:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
druid:
|
||||
#url: jdbc:dm://10.105.73.121:12345/EMSHIS
|
||||
url: jdbc:dm://192.168.1.210/EMSHIS
|
||||
#url: jdbc:dm://192.168.:12345/EMSHIS
|
||||
url: jdbc:dm://192.168.1.210:12345/EMSHIS
|
||||
username: IPSM_DBA
|
||||
password: IPSM_DBA
|
||||
driver-class-name: dm.jdbc.driver.DmDriver
|
||||
|
||||