增加主页刷新通知打开的tab页强制刷新功能

This commit is contained in:
liwen
2020-12-02 17:12:54 +08:00
parent 1fbebd387a
commit 88ae95e1ab
6 changed files with 49 additions and 22 deletions

View File

@@ -53,11 +53,17 @@ public class GroupManagementController {
// groupDataModel.setSelectedGroupType(newValue.);
}
});
ProcessChain.create()
initData();
}
private void initData() {
ProcessChain.create().addRunnableInPlatformThread(() -> {
tabPane.getTabs().clear();
})
.addSupplierInExecutor(() -> Request.connector(GroupTypeFeign.class).getAllGroupTypes())
.addConsumerInPlatformThread(rel -> {
for (GroupTypeVO groupType : rel) {
Tab tab = new Tab(groupType.getName());
Flow flow = new Flow(GroupDetailController.class);
ViewFlowContext viewFlowContext = new ViewFlowContext();
@@ -74,8 +80,11 @@ public class GroupManagementController {
.run();
}
@OnEvent("test-message")
private void onNewChatMessage(Event<String> e) {
@OnEvent("refresh")
private void onRefresh(Event<String> e) {
System.err.println(this.getClass() + "\t" + e.getContent());
initData();
}
}

View File

@@ -15,6 +15,8 @@ import io.datafx.controller.flow.action.ActionTrigger;
import io.datafx.controller.flow.context.FXMLViewFlowContext;
import io.datafx.controller.flow.context.ViewFlowContext;
import io.datafx.core.concurrent.ProcessChain;
import io.datafx.eventsystem.Event;
import io.datafx.eventsystem.OnEvent;
import javafx.collections.transformation.FilteredList;
import javafx.fxml.FXML;
import javafx.geometry.Pos;
@@ -306,4 +308,11 @@ public class GroupTypeManagementController {
}
@OnEvent("refresh")
private void onRefresh(Event<String> e) {
System.err.println(this.getClass() + "\t" + e.getContent());
initData();
}
}

View File

@@ -176,9 +176,9 @@ public class MenuManagementController {
deleteButton.setToggleGroup(group);
try {
addButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY+".add-circle-outline"));
editButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY+".create-outline"));
deleteButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY+".trash-outline"));
addButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".add-circle-outline"));
editButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".create-outline"));
deleteButton.setGraphic(SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".trash-outline"));
} catch (Exception e) {
e.printStackTrace();
}
@@ -260,7 +260,7 @@ public class MenuManagementController {
parentIdTextField.setDisable(true);
cancelButton.setOnAction(event -> {
infoPane.setDisable(true);
infoPane.setDisable(true);
});
@@ -686,8 +686,11 @@ public class MenuManagementController {
dialog.close();
}
@OnEvent("test-message")
private void onNewChatMessage(Event<String> e) {
@OnEvent("refresh")
private void onRefresh(Event<String> e) {
System.err.println(this.getClass() + "\t" + e.getContent());
initTreeData();
}
}

View File

@@ -25,6 +25,8 @@ import io.datafx.controller.flow.context.ActionHandler;
import io.datafx.controller.flow.context.FlowActionHandler;
import io.datafx.controller.util.VetoException;
import io.datafx.core.concurrent.ProcessChain;
import io.datafx.eventsystem.Event;
import io.datafx.eventsystem.OnEvent;
import javafx.collections.transformation.FilteredList;
import javafx.fxml.FXML;
import javafx.geometry.Pos;
@@ -377,4 +379,12 @@ public class UserManagementController {
private void test() {
System.err.println();
}
@OnEvent("refresh")
private void onRefresh(Event<String> e) {
System.err.println(this.getClass() + "\t" + e.getContent());
search();
}
}

View File

@@ -89,7 +89,7 @@ public class MainController {
private JFXToggleButton styleBut;
//刷新按钮
@FXML
@EventTrigger("test-message1")
@EventTrigger("refresh")
private JFXButton refreshButton;
//内容面板tabPane
@@ -224,15 +224,12 @@ public class MainController {
return popOver;
}
@EventProducer("test-message")
private String getMessage() {
@EventProducer("refresh")
private String refresh() {
return "--------=================-----------";
}
@EventProducer("test-message1")
private String getMessage1() {
return "--------=================-----------";
}
private void initData() {

View File

@@ -8,14 +8,13 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import com.jfoenix.controls.JFXButton?>
<VBox fx:id="userInfoPane" prefHeight="281.0" prefWidth="262.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox alignment="TOP_CENTER" spacing="10.0" VBox.vgrow="ALWAYS">
<children>
<Label fx:id="imageLabel" alignment="CENTER" contentDisplay="CENTER" graphicTextGap="0.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="80.0" prefWidth="80.0" style="-fx-background-radius: 40; -fx-background-color: #ab47bc;" textAlignment="CENTER">
<graphic>
<FontAwesomeIconView fill="WHITE" glyphName="USER" size="65" />
<FontAwesomeIconView fill="WHITE" glyphName="USER" size="55" />
</graphic>
</Label>
<Label fx:id="userLabel" text="李稳" textFill="#202124">
@@ -34,12 +33,12 @@
</padding>
</VBox>
<JFXListView fx:id="listView" depth="1" styleClass="user-info-listview">
<HBox>
<JFXListView fx:id="listView" depth="1" maxHeight="-Infinity" minHeight="90.0" prefHeight="90.0" styleClass="user-info-listview">
<HBox alignment="CENTER_LEFT">
<Label fx:id="personalCenterLabel" maxWidth="1.7976931348623157E308" text="个人中心" HBox.hgrow="ALWAYS" />
<FontAwesomeIconView fill="#5f6368" glyphName="USER_SECRET" size="20" />
</HBox>
<HBox>
<HBox alignment="CENTER_LEFT">
<Label fx:id="dropOutLabel" maxWidth="1.7976931348623157E308" text="退出" HBox.hgrow="ALWAYS" />
<FontAwesomeIconView fill="#5f6368" glyphName="SIGN_OUT" size="20" />
</HBox>