diff --git a/.image/javafx/文件列表1.png b/.image/javafx/文件列表1.png
new file mode 100644
index 0000000..7867984
Binary files /dev/null and b/.image/javafx/文件列表1.png differ
diff --git a/.image/javafx/文件列表2.png b/.image/javafx/文件列表2.png
new file mode 100644
index 0000000..fb1829c
Binary files /dev/null and b/.image/javafx/文件列表2.png differ
diff --git a/.image/javafx/文件列表3.png b/.image/javafx/文件列表3.png
new file mode 100644
index 0000000..2fde0ce
Binary files /dev/null and b/.image/javafx/文件列表3.png differ
diff --git a/.image/javafx/文件配置1.png b/.image/javafx/文件配置1.png
new file mode 100644
index 0000000..65140d4
Binary files /dev/null and b/.image/javafx/文件配置1.png differ
diff --git a/.image/javafx/文件配置2.png b/.image/javafx/文件配置2.png
new file mode 100644
index 0000000..67f1f70
Binary files /dev/null and b/.image/javafx/文件配置2.png differ
diff --git a/.image/javafx/文件配置3.png b/.image/javafx/文件配置3.png
new file mode 100644
index 0000000..8eb7f50
Binary files /dev/null and b/.image/javafx/文件配置3.png differ
diff --git a/.image/swing/文件列表1.png b/.image/swing/文件列表1.png
new file mode 100644
index 0000000..10e42ef
Binary files /dev/null and b/.image/swing/文件列表1.png differ
diff --git a/.image/swing/文件列表2.png b/.image/swing/文件列表2.png
new file mode 100644
index 0000000..4ff2403
Binary files /dev/null and b/.image/swing/文件列表2.png differ
diff --git a/.image/swing/文件列表3.png b/.image/swing/文件列表3.png
new file mode 100644
index 0000000..323806d
Binary files /dev/null and b/.image/swing/文件列表3.png differ
diff --git a/.image/swing/文件配置1.png b/.image/swing/文件配置1.png
new file mode 100644
index 0000000..7e57132
Binary files /dev/null and b/.image/swing/文件配置1.png differ
diff --git a/.image/swing/文件配置2.png b/.image/swing/文件配置2.png
new file mode 100644
index 0000000..f4aa55d
Binary files /dev/null and b/.image/swing/文件配置2.png differ
diff --git a/.image/swing/文件配置3.png b/.image/swing/文件配置3.png
new file mode 100644
index 0000000..7973979
Binary files /dev/null and b/.image/swing/文件配置3.png differ
diff --git a/README.md b/README.md
index b827a20..d59fba1 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,8 @@ HTTP库:使用 OpenFeign HTTP库,该库提供了方便的 HTTP 请求和响
| 操作日志 |  |  |  |
| 登录日志 |  |  |  |
| 令牌管理 |  |  |  |
+| 文件配置 |  |  |  |
+| 文件列表 |  |  |  |
### Java Swing
@@ -159,8 +161,9 @@ HTTP库:使用 OpenFeign HTTP库,该库提供了方便的 HTTP 请求和响
| 字典数据 |  |  |  |
| 通知公告 |  |  |  |
| 消息模板 |  |  |  |
-| 消息记录 |  |  |  |
-| 我的消息 |  |  |  |
+| 消息记录 |  |  |  |
+| 我的消息 |  |  |  |
| 操作日志 |  |  |  |
| 登录日志 |  |  |  |
-
+| 文件配置 |  |  |  |
+| 文件列表 |  |  |  |
diff --git a/dillon-dependencies/pom.xml b/dillon-dependencies/pom.xml
index 5826029..40b5076 100644
--- a/dillon-dependencies/pom.xml
+++ b/dillon-dependencies/pom.xml
@@ -82,7 +82,7 @@
1.5.3
2.5.1
- 13.2.1
+ 13.3
@@ -686,6 +686,11 @@
${openfeign.version}
+
+ io.github.openfeign
+ feign-form
+ ${openfeign.version}
+
diff --git a/dillon-module-infra/dillon-module-infra-biz/src/main/java/com/lw/dillon/admin/module/infra/controller/admin/file/FileController.java b/dillon-module-infra/dillon-module-infra-biz/src/main/java/com/lw/dillon/admin/module/infra/controller/admin/file/FileController.java
index 2c8ec7a..f8e1d7e 100644
--- a/dillon-module-infra/dillon-module-infra-biz/src/main/java/com/lw/dillon/admin/module/infra/controller/admin/file/FileController.java
+++ b/dillon-module-infra/dillon-module-infra-biz/src/main/java/com/lw/dillon/admin/module/infra/controller/admin/file/FileController.java
@@ -43,9 +43,11 @@ public class FileController {
public CommonResult uploadFile(FileUploadReqVO uploadReqVO) throws Exception {
MultipartFile file = uploadReqVO.getFile();
String path = uploadReqVO.getPath();
+
return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
}
+
@GetMapping("/presigned-url")
@Operation(summary = "获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器")
public CommonResult getFilePresignedUrl(@RequestParam("path") String path) throws Exception {
diff --git a/dillon-ui/dillon-ui-common/pom.xml b/dillon-ui/dillon-ui-common/pom.xml
index 71fce48..a0dff6c 100644
--- a/dillon-ui/dillon-ui-common/pom.xml
+++ b/dillon-ui/dillon-ui-common/pom.xml
@@ -47,6 +47,16 @@
feign-slf4j
+
+ io.github.openfeign.form
+ feign-form
+ 3.8.0
+
+
+ io.github.openfeign.form
+ feign-form-spring
+ 3.8.0
+
org.slf4j
slf4j-api
@@ -66,6 +76,12 @@
Java-WebSocket
1.5.1
+
+ com.lw.dillon
+ dillon-module-infra-biz
+ 2.1.0-jdk8-snapshot
+ compile
+
\ No newline at end of file
diff --git a/dillon-ui/dillon-ui-common/src/main/java/com/lw/ui/request/api/file/FileConfigFeign.java b/dillon-ui/dillon-ui-common/src/main/java/com/lw/ui/request/api/file/FileConfigFeign.java
new file mode 100644
index 0000000..99c8a0f
--- /dev/null
+++ b/dillon-ui/dillon-ui-common/src/main/java/com/lw/ui/request/api/file/FileConfigFeign.java
@@ -0,0 +1,44 @@
+package com.lw.ui.request.api.file;
+
+import com.google.gson.JsonObject;
+import com.lw.dillon.admin.framework.common.pojo.CommonResult;
+import com.lw.dillon.admin.framework.common.pojo.PageResult;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.config.FileConfigRespVO;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
+import com.lw.ui.request.api.BaseFeignApi;
+import feign.Param;
+import feign.QueryMap;
+import feign.RequestLine;
+
+import java.util.Map;
+
+public interface FileConfigFeign extends BaseFeignApi {
+
+ //"创建文件配置")
+ @RequestLine("POST /admin-api/infra/file-config/create")
+ CommonResult createFileConfig( FileConfigSaveReqVO createReqVO);
+
+ //"更新文件配置")
+ @RequestLine("PUT /admin-api/infra/file-config/update")
+ CommonResult updateFileConfig( FileConfigSaveReqVO updateReqVO);
+
+ //"更新文件配置为 Master")
+ @RequestLine("PUT /admin-api/infra/file-config/update-master?id={id}")
+ CommonResult updateFileConfigMaster(@Param("id") Long id);
+
+ //"删除文件配置")
+ @RequestLine("DELETE /admin-api/infra/file-config/delete?id={id}")
+ CommonResult deleteFileConfig(@Param("id") Long id);
+
+ //"获得文件配置")
+ @RequestLine("GET /admin-api/infra/file-config/get?id={id}")
+ CommonResult getFileConfig(@Param("id") Long id);
+
+ //"获得文件配置分页")
+ @RequestLine("GET /admin-api/infra/file-config/page")
+ CommonResult> getFileConfigPage(@QueryMap Map map);
+
+ //"测试文件配置是否正确")
+ @RequestLine("GET /admin-api/infra/file-config/test?id={id}")
+ CommonResult testFileConfig(@Param("id") Long id) throws Exception;
+}
diff --git a/dillon-ui/dillon-ui-common/src/main/java/com/lw/ui/request/api/file/FileFeign.java b/dillon-ui/dillon-ui-common/src/main/java/com/lw/ui/request/api/file/FileFeign.java
new file mode 100644
index 0000000..513cd78
--- /dev/null
+++ b/dillon-ui/dillon-ui-common/src/main/java/com/lw/ui/request/api/file/FileFeign.java
@@ -0,0 +1,47 @@
+package com.lw.ui.request.api.file;
+
+import com.lw.dillon.admin.framework.common.pojo.CommonResult;
+import com.lw.dillon.admin.framework.common.pojo.PageResult;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.file.FileCreateReqVO;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.file.FileRespVO;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.file.FileUploadReqVO;
+import com.lw.ui.request.api.BaseFeignApi;
+import feign.Headers;
+import feign.Param;
+import feign.QueryMap;
+import feign.RequestLine;
+
+import java.io.File;
+import java.util.Map;
+
+public interface FileFeign extends BaseFeignApi {
+
+
+ // "上传文件", description = "模式一:后端上传文件")
+ @RequestLine("POST /admin-api/infra/file/upload")
+ @Headers("Content-Type: multipart/form-data; boundary=----WebKitFormBoundarypATHfppjzqwXomVO")
+ CommonResult uploadFile(@Param("path") String path, @Param("file") File file);
+
+
+ // "获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器")
+ @RequestLine("GET /admin-api/infra/file/presigned-url?path={path}")
+ CommonResult getFilePresignedUrl(@Param("path") String path);
+
+ // "创建文件", description = "模式二:前端上传文件:配合 presigned-url 接口,记录上传了上传的文件")
+ @RequestLine("POST /admin-api/infra/file/create")
+ CommonResult createFile(FileCreateReqVO createReqVO);
+
+ // "删除文件")
+ @RequestLine("DELETE /admin-api/infra/file/delete?id={id}")
+ CommonResult deleteFile(@Param("id") Long id);
+
+ // "下载文件")
+ @RequestLine("GET /admin-api/infra/file/{configId}/get/**")
+ void getFileContent(@Param("configId") Long configId) throws Exception;
+
+ // "获得文件分页")
+ @RequestLine("GET /admin-api/infra/file/page")
+ CommonResult> getFilePage(@QueryMap Map pageVO);
+
+}
diff --git a/dillon-ui/dillon-ui-fx/pom.xml b/dillon-ui/dillon-ui-fx/pom.xml
index 5a458a7..f567e15 100644
--- a/dillon-ui/dillon-ui-fx/pom.xml
+++ b/dillon-ui/dillon-ui-fx/pom.xml
@@ -221,6 +221,7 @@
+
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/Request.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/Request.java
index 0104c68..ce18148 100644
--- a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/Request.java
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/Request.java
@@ -2,9 +2,12 @@ package com.lw.fx.request;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import com.lw.dillon.admin.module.infra.framework.file.core.client.FileClientConfig;
+import com.lw.fx.request.feign.FileClientConfigAdapter;
import com.lw.fx.request.feign.interceptor.ForwardedForInterceptor;
import com.lw.fx.request.feign.interceptor.OkHttpInterceptor;
import com.lw.ui.request.api.BaseFeignApi;
+import com.lw.ui.request.api.file.FileFeign;
import com.lw.ui.request.gson.LocalDateTimeTypeAdapter;
import com.lw.ui.request.gson.LocalDateTypeAdapter;
import com.lw.ui.request.gson.ZonedDateTimeTypeAdapter;
@@ -14,8 +17,10 @@ import feign.Logger;
import feign.Retryer;
import feign.codec.Decoder;
import feign.codec.Encoder;
+import feign.form.spring.SpringFormEncoder;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
+import feign.jackson.JacksonDecoder;
import feign.okhttp.OkHttpClient;
import feign.querymap.BeanQueryMapEncoder;
import feign.slf4j.Slf4jLogger;
@@ -47,6 +52,7 @@ public class Request {
private static final okhttp3.OkHttpClient OK_HTTP_CLIENT = createOkHttpClient();
private static final Feign.Builder BUILDER = createFeignBuilder();
+ private static final Feign.Builder FILE_BUILDER = createFileFeignBuilder();
private static final AsyncFeign.AsyncBuilder ASYNC_BUILDER = createAsyncFeignBuilder();
private Request() {
@@ -62,6 +68,10 @@ public class Request {
return connector(connectorClass, READ_TIME_OUT_MILLIS);
}
+ public static T fileConnector(Class connectorClass) {
+ return FILE_BUILDER.target(connectorClass, API_URL);
+ }
+
public static T asyncConnector(Class connectorClass, int readTimeOut) {
final String key = connectorClass.getSimpleName() + readTimeOut;
@@ -102,4 +112,14 @@ public class Request {
.requestInterceptor(new ForwardedForInterceptor())
.retryer(new Retryer.Default()); // 默认重试策略
}
+
+ private static Feign.Builder createFileFeignBuilder() {
+
+
+ return Feign.builder()
+ .encoder(new SpringFormEncoder())
+ .decoder(new JacksonDecoder())
+ .requestInterceptor(new ForwardedForInterceptor());
+
+ }
}
\ No newline at end of file
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/feign/FileClientConfigAdapter.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/feign/FileClientConfigAdapter.java
new file mode 100644
index 0000000..7655f9d
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/feign/FileClientConfigAdapter.java
@@ -0,0 +1,47 @@
+package com.lw.fx.request.feign;
+
+import cn.hutool.core.util.StrUtil;
+import com.google.gson.*;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import com.lw.dillon.admin.module.infra.framework.file.core.client.FileClientConfig;
+import com.lw.dillon.admin.module.infra.framework.file.core.client.db.DBFileClientConfig;
+import com.lw.dillon.admin.module.infra.framework.file.core.client.ftp.FtpFileClientConfig;
+import com.lw.dillon.admin.module.infra.framework.file.core.client.local.LocalFileClientConfig;
+import com.lw.dillon.admin.module.infra.framework.file.core.client.s3.S3FileClientConfig;
+import com.lw.dillon.admin.module.infra.framework.file.core.client.sftp.SftpFileClientConfig;
+
+import java.io.IOException;
+
+// TypeAdapter 实现
+public class FileClientConfigAdapter extends TypeAdapter {
+
+ @Override
+ public void write(JsonWriter out, FileClientConfig value) throws IOException {
+ out.beginObject();
+
+ out.endObject();
+ }
+
+ @Override
+ public FileClientConfig read(JsonReader in) throws IOException {
+ JsonObject jsonObject = JsonParser.parseReader(in).getAsJsonObject();
+ String className = jsonObject.get("@class").getAsString();
+ className = StrUtil.subAfter(className, ".", true);
+
+ switch (className) {
+ case "DBFileClientConfig":
+ return new Gson().fromJson(jsonObject, DBFileClientConfig.class);
+ case "FtpFileClientConfig":
+ return new Gson().fromJson(jsonObject, FtpFileClientConfig.class);
+ case "LocalFileClientConfig":
+ return new Gson().fromJson(jsonObject, LocalFileClientConfig.class);
+ case "SftpFileClientConfig":
+ return new Gson().fromJson(jsonObject, SftpFileClientConfig.class);
+ case "S3FileClientConfig":
+ return new Gson().fromJson(jsonObject, S3FileClientConfig.class);
+ default:
+ throw new JsonParseException("未知的 FileClientConfig 类型:" + className);
+ }
+ }
+}
\ No newline at end of file
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/feign/interceptor/ForwardedForInterceptor.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/feign/interceptor/ForwardedForInterceptor.java
index 508e63c..dde171c 100644
--- a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/feign/interceptor/ForwardedForInterceptor.java
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/request/feign/interceptor/ForwardedForInterceptor.java
@@ -10,5 +10,7 @@ public class ForwardedForInterceptor implements RequestInterceptor {
public void apply(RequestTemplate template) {
template.header("Authorization", AppStore.getToken());
+
+
}
}
\ No newline at end of file
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigFormView.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigFormView.java
new file mode 100644
index 0000000..c4d7450
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigFormView.java
@@ -0,0 +1,202 @@
+package com.lw.fx.view.infra.file;
+
+import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
+import com.lw.fx.store.AppStore;
+import de.saxsys.mvvmfx.FxmlView;
+import de.saxsys.mvvmfx.InjectViewModel;
+import javafx.collections.FXCollections;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.ComboBox;
+import javafx.scene.control.RadioButton;
+import javafx.scene.control.TextField;
+import javafx.scene.control.ToggleGroup;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.VBox;
+
+import java.net.URL;
+import java.util.Optional;
+import java.util.ResourceBundle;
+
+import static com.lw.ui.utils.DictTypeEnum.INFRA_FILE_STORAGE;
+
+public class FileConfigFormView implements FxmlView, Initializable {
+
+ @InjectViewModel
+ private FileConfigFormViewModel viewModel;
+ @FXML
+ private HBox accessKeyBox;
+
+ @FXML
+ private TextField accessKeyField;
+
+ @FXML
+ private HBox accessSecretBox;
+
+ @FXML
+ private TextField accessSecretField;
+
+ @FXML
+ private HBox basePathBox;
+
+ @FXML
+ private TextField basePathField;
+
+ @FXML
+ private HBox bucketBox;
+
+ @FXML
+ private TextField bucketField;
+
+ @FXML
+ private TextField domainField;
+
+ @FXML
+ private HBox endpointBox;
+
+ @FXML
+ private TextField endpointField;
+
+ @FXML
+ private ToggleGroup group;
+
+ @FXML
+ private HBox hostBox;
+
+ @FXML
+ private TextField hostField;
+
+ @FXML
+ private HBox modeBox;
+
+ @FXML
+ private RadioButton modeRadioBut1;
+
+ @FXML
+ private RadioButton modeRadioBut2;
+
+ @FXML
+ private TextField nameField;
+
+ @FXML
+ private TextField remarkField;
+
+ @FXML
+ private HBox passwordBox;
+
+ @FXML
+ private TextField passwordField;
+
+ @FXML
+ private HBox portBox;
+
+ @FXML
+ private TextField portField;
+
+ @FXML
+ private VBox rootBox;
+ @FXML
+ private HBox domainBox;
+
+ @FXML
+ private ComboBox storageComboBox;
+
+ @FXML
+ private HBox usernameBox;
+
+ @FXML
+ private TextField usernameField;
+
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle) {
+
+ storageComboBox.setItems(FXCollections.observableArrayList(AppStore.getDictDataList(INFRA_FILE_STORAGE)));
+ nameField.textProperty().bindBidirectional(viewModel.nameProperty());
+ remarkField.textProperty().bindBidirectional(viewModel.remarkProperty());
+ storageComboBox.valueProperty().bindBidirectional(viewModel.selStorageProperty());
+ storageComboBox.disableProperty().bind(viewModel.editProperty());
+ domainField.textProperty().bindBidirectional(viewModel.domainProperty());
+ basePathField.textProperty().bindBidirectional(viewModel.basePathProperty());
+ hostField.textProperty().bindBidirectional(viewModel.hostProperty());
+ portField.textProperty().bindBidirectional(viewModel.portProperty());
+ usernameField.textProperty().bindBidirectional(viewModel.usernameProperty());
+ passwordField.textProperty().bindBidirectional(viewModel.passwordProperty());
+ endpointField.textProperty().bindBidirectional(viewModel.endpointProperty());
+ bucketField.textProperty().bindBidirectional(viewModel.bucketProperty());
+ accessKeyField.textProperty().bindBidirectional(viewModel.accessKeyProperty());
+ accessSecretField.textProperty().bindBidirectional(viewModel.accessSecretProperty());
+ storageComboBox.valueProperty().addListener((observableValue, dictDataSimpleRespVO, t1) -> showStorage(Optional.of(t1).map(DictDataSimpleRespVO::getLabel).orElse("")));
+
+ domainBox.managedProperty().bind(domainBox.visibleProperty());
+ basePathBox.managedProperty().bind(basePathBox.visibleProperty());
+ hostBox.managedProperty().bind(hostBox.visibleProperty());
+ portBox.managedProperty().bind(portBox.visibleProperty());
+ usernameBox.managedProperty().bind(usernameBox.visibleProperty());
+ passwordBox.managedProperty().bind(passwordBox.visibleProperty());
+ endpointBox.managedProperty().bind(endpointBox.visibleProperty());
+ bucketBox.managedProperty().bind(bucketBox.visibleProperty());
+ accessKeyBox.managedProperty().bind(accessKeyBox.visibleProperty());
+ accessSecretBox.managedProperty().bind(accessSecretBox.visibleProperty());
+ modeBox.managedProperty().bind(modeBox.visibleProperty());
+
+ showStorage("");
+ }
+
+
+ private void showStorage(String type) {
+
+ domainBox.setVisible(false);
+ basePathBox.setVisible(false);
+ hostBox.setVisible(false);
+ portBox.setVisible(false);
+ usernameBox.setVisible(false);
+ passwordBox.setVisible(false);
+ endpointBox.setVisible(false);
+ bucketBox.setVisible(false);
+ accessKeyBox.setVisible(false);
+ accessSecretBox.setVisible(false);
+ modeBox.setVisible(false);
+
+ switch (type) {
+ case "数据库": {
+ domainBox.setVisible(true);
+ break;
+ }
+ case "本地磁盘": {
+ domainBox.setVisible(true);
+ basePathBox.setVisible(true);
+ break;
+ }
+ case "FTP 服务器": {
+ domainBox.setVisible(true);
+ basePathBox.setVisible(true);
+ hostBox.setVisible(true);
+ portBox.setVisible(true);
+ usernameBox.setVisible(true);
+ passwordBox.setVisible(true);
+ break;
+ }
+ case "SFTP 服务器": {
+ domainBox.setVisible(true);
+ basePathBox.setVisible(true);
+ hostBox.setVisible(true);
+ portBox.setVisible(true);
+ usernameBox.setVisible(true);
+ passwordBox.setVisible(true);
+ modeBox.setVisible(true);
+ break;
+ }
+ case "S3 对象存储": {
+
+ endpointBox.setVisible(true);
+ bucketBox.setVisible(true);
+ accessKeyBox.setVisible(true);
+ accessSecretBox.setVisible(true);
+ break;
+ }
+ default: {
+
+ }
+ }
+ }
+}
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigFormViewModel.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigFormViewModel.java
new file mode 100644
index 0000000..4cbff24
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigFormViewModel.java
@@ -0,0 +1,267 @@
+package com.lw.fx.view.infra.file;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
+import com.google.gson.JsonObject;
+import com.lw.dillon.admin.framework.common.pojo.CommonResult;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
+import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
+import com.lw.fx.request.Request;
+import com.lw.fx.store.AppStore;
+import com.lw.ui.request.api.file.FileConfigFeign;
+import de.saxsys.mvvmfx.ViewModel;
+import io.datafx.core.concurrent.ProcessChain;
+import javafx.beans.property.*;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Optional;
+
+import static com.lw.ui.utils.DictTypeEnum.INFRA_FILE_STORAGE;
+
+public class FileConfigFormViewModel implements ViewModel {
+
+ private ObjectProperty id = new SimpleObjectProperty<>();
+ private StringProperty name = new SimpleStringProperty();
+ private StringProperty remark = new SimpleStringProperty();
+ private StringProperty domain = new SimpleStringProperty();
+ private StringProperty basePath = new SimpleStringProperty();
+ private StringProperty host = new SimpleStringProperty();
+ private StringProperty port = new SimpleStringProperty();
+ private StringProperty username = new SimpleStringProperty();
+ private StringProperty password = new SimpleStringProperty();
+ private StringProperty mode = new SimpleStringProperty();
+ private StringProperty endpoint = new SimpleStringProperty();
+ private StringProperty bucket = new SimpleStringProperty();
+ private StringProperty accessKey = new SimpleStringProperty();
+ private StringProperty accessSecret = new SimpleStringProperty();
+ private BooleanProperty edit = new SimpleBooleanProperty(false);
+
+
+ private ObjectProperty selStorage = new SimpleObjectProperty<>();
+
+ public void updateData(Long id, boolean isAdd) {
+
+ this.id.set(id);
+ edit.set(!isAdd);
+ ProcessChain.create()
+ .addSupplierInExecutor(() -> {
+ if (id == null) {
+ return new FileConfigSaveReqVO();
+ }
+ JsonObject jsonObject = Request.connector(FileConfigFeign.class).getFileConfig(id).getData();
+ FileConfigSaveReqVO saveReqVO = new FileConfigSaveReqVO();
+ saveReqVO.setName(jsonObject.get("name").getAsString());
+ saveReqVO.setStorage(jsonObject.get("storage").getAsInt());
+ saveReqVO.setRemark(jsonObject.get("remark").getAsString());
+ saveReqVO.setId(jsonObject.get("id").getAsLong());
+ JsonObject config = jsonObject.getAsJsonObject("config");
+ Map map = new HashMap<>();
+ Iterator keys = config.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ Object value = config.get(key).getAsString();
+ map.put(key, value);
+ }
+ saveReqVO.setConfig(map);
+ return saveReqVO;
+
+ })
+ .addConsumerInPlatformThread(rel -> {
+
+ name.set(rel.getName());
+ remark.set(rel.getRemark());
+ if (rel.getConfig() != null) {
+
+ domain.set(Convert.toStr(rel.getConfig().get("domain")));
+ basePath.set(Convert.toStr(rel.getConfig().get("basePath")));
+ host.set(Convert.toStr(rel.getConfig().get("host")));
+ port.set(Convert.toStr(rel.getConfig().get("port")));
+ username.set(Convert.toStr(rel.getConfig().get("username")));
+ password.set(Convert.toStr(rel.getConfig().get("password")));
+ mode.set(Convert.toStr(rel.getConfig().get("mode")));
+ endpoint.set(Convert.toStr(rel.getConfig().get("endpoint")));
+ bucket.set(Convert.toStr(rel.getConfig().get("bucket")));
+ accessKey.set(Convert.toStr(rel.getConfig().get("accessKey")));
+ accessSecret.set(Convert.toStr(rel.getConfig().get("accessSecret")));
+
+ }
+
+ if (isEdit()) {
+ DictDataSimpleRespVO sel = AppStore.getDictDataValueMap(INFRA_FILE_STORAGE).get(rel.getStorage() + "");
+ selStorage.set(sel);
+ }
+
+ })
+
+ .run();
+
+ }
+
+ public CommonResult save(boolean isAdd) {
+
+ if (isAdd) {
+ return Request.connector(FileConfigFeign.class).createFileConfig(getSaveReqVO());
+ } else {
+ return Request.connector(FileConfigFeign.class).updateFileConfig(getSaveReqVO());
+ }
+ }
+
+ public FileConfigSaveReqVO getSaveReqVO() {
+ FileConfigSaveReqVO saveReqVO = new FileConfigSaveReqVO();
+
+ saveReqVO.setName(name.get());
+ saveReqVO.setId(id.get());
+ saveReqVO.setRemark(remark.get());
+ saveReqVO.setStorage(Convert.toInt(selStorage.get().getValue(),null));
+ Map config = new HashMap<>();
+ createConfig("domain", domain.get(), config);
+ createConfig("basePath", basePath.get(), config);
+ createConfig("host", host.get(), config);
+ createConfig("username", username.get(), config);
+ createConfig("mode", mode.get(), config);
+ createConfig("endpoint", endpoint.get(), config);
+ createConfig("bucket", bucket.get(), config);
+ createConfig("accessKey", accessKey.get(), config);
+ createConfig("accessSecret", accessSecret.get(), config);
+ saveReqVO.setConfig(config);
+ return saveReqVO;
+ }
+
+ private void createConfig(String key,String value, Map config) {
+
+ if ( StrUtil.isNotBlank(value)) {
+ config.put(key, value);
+ }
+
+ }
+
+ public DictDataSimpleRespVO getSelStorage() {
+ return selStorage.get();
+ }
+
+ public ObjectProperty selStorageProperty() {
+ return selStorage;
+ }
+
+ public String getName() {
+ return name.get();
+ }
+
+ public StringProperty nameProperty() {
+ return name;
+ }
+
+ public String getRemark() {
+ return remark.get();
+ }
+
+ public StringProperty remarkProperty() {
+ return remark;
+ }
+
+ public String getDomain() {
+ return domain.get();
+ }
+
+ public StringProperty domainProperty() {
+ return domain;
+ }
+
+ public String getBasePath() {
+ return basePath.get();
+ }
+
+ public StringProperty basePathProperty() {
+ return basePath;
+ }
+
+ public String getHost() {
+ return host.get();
+ }
+
+ public StringProperty hostProperty() {
+ return host;
+ }
+
+ public String getPort() {
+ return port.get();
+ }
+
+ public StringProperty portProperty() {
+ return port;
+ }
+
+ public String getUsername() {
+ return username.get();
+ }
+
+ public StringProperty usernameProperty() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password.get();
+ }
+
+ public StringProperty passwordProperty() {
+ return password;
+ }
+
+ public String getMode() {
+ return mode.get();
+ }
+
+ public StringProperty modeProperty() {
+ return mode;
+ }
+
+ public String getEndpoint() {
+ return endpoint.get();
+ }
+
+ public StringProperty endpointProperty() {
+ return endpoint;
+ }
+
+ public String getBucket() {
+ return bucket.get();
+ }
+
+ public StringProperty bucketProperty() {
+ return bucket;
+ }
+
+ public String getAccessKey() {
+ return accessKey.get();
+ }
+
+ public StringProperty accessKeyProperty() {
+ return accessKey;
+ }
+
+ public String getAccessSecret() {
+ return accessSecret.get();
+ }
+
+ public StringProperty accessSecretProperty() {
+ return accessSecret;
+ }
+
+ public long getId() {
+ return id.get();
+ }
+
+ public ObjectProperty idProperty() {
+ return id;
+ }
+
+ public boolean isEdit() {
+ return edit.get();
+ }
+
+ public BooleanProperty editProperty() {
+ return edit;
+ }
+}
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigView.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigView.java
new file mode 100644
index 0000000..12fb197
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigView.java
@@ -0,0 +1,391 @@
+package com.lw.fx.view.infra.file;
+
+import cn.hutool.core.date.DateUtil;
+import com.dlsc.gemsfx.DialogPane;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.config.FileConfigRespVO;
+import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
+import com.lw.fx.request.Request;
+import com.lw.fx.store.AppStore;
+import com.lw.fx.util.MessageType;
+import com.lw.fx.view.control.PagingControl;
+import com.lw.fx.view.control.WFXGenericDialog;
+import com.lw.ui.request.api.file.FileConfigFeign;
+import de.saxsys.mvvmfx.*;
+import io.datafx.core.concurrent.ProcessChain;
+import javafx.collections.FXCollections;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.geometry.Insets;
+import javafx.geometry.Pos;
+import javafx.scene.control.*;
+import javafx.scene.control.cell.PropertyValueFactory;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.StackPane;
+import javafx.scene.layout.VBox;
+import javafx.util.Callback;
+import org.kordamp.ikonli.feather.Feather;
+import org.kordamp.ikonli.javafx.FontIcon;
+
+import java.net.URL;
+import java.time.LocalDateTime;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import static atlantafx.base.theme.Styles.*;
+import static com.lw.ui.utils.DictTypeEnum.INFRA_BOOLEAN_STRING;
+import static com.lw.ui.utils.DictTypeEnum.INFRA_FILE_STORAGE;
+
+public class FileConfigView implements FxmlView, Initializable {
+ @InjectViewModel
+ private FileConfigViewModel viewModel;
+ @FXML
+ private VBox contentPane;
+
+ @FXML
+ private TableColumn createTimeCol;
+
+ @FXML
+ private Button addBut;
+
+ @FXML
+ private DatePicker endDatePicker;
+
+ @FXML
+ private TableColumn idCol;
+
+ @FXML
+ private TableColumn nameCol;
+
+ @FXML
+ private TableColumn optCol;
+
+ @FXML
+ private TableColumn primaryCol;
+
+ @FXML
+ private TableColumn remarkCol;
+
+ @FXML
+ private Button resetBut;
+
+ @FXML
+ private StackPane rootPane;
+
+ @FXML
+ private Button searchBut;
+
+ @FXML
+ private DatePicker startDatePicker;
+
+ @FXML
+ private TableColumn storageCol;
+
+ @FXML
+ private TableView tableView;
+
+ @FXML
+ private TextField nameField;
+
+ @FXML
+ private ComboBox storageComboBox;
+
+ private PagingControl pagingControl;
+
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle) {
+
+ pagingControl = new PagingControl();
+ contentPane.getChildren().add(pagingControl);
+
+ pagingControl.totalProperty().bind(viewModel.totalProperty());
+ viewModel.pageNumProperty().bind(pagingControl.pageNumProperty());
+ viewModel.pageSizeProperty().bind(pagingControl.pageSizeProperty());
+ pagingControl.pageNumProperty().addListener((observable, oldValue, newValue) -> {
+ viewModel.loadTableData();
+ });
+
+ pagingControl.pageSizeProperty().addListener((observable, oldValue, newValue) -> {
+ viewModel.loadTableData();
+ });
+
+ storageComboBox.setItems(FXCollections.observableArrayList(AppStore.getDictDataList(INFRA_FILE_STORAGE)));
+ storageComboBox.valueProperty().bindBidirectional(viewModel.storageProperty());
+ nameField.textProperty().bindBidirectional(viewModel.nameProperty());
+
+
+ idCol.setCellValueFactory(new PropertyValueFactory<>("id"));
+ idCol.setStyle("-fx-alignment: CENTER");
+
+ nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
+ nameCol.setStyle("-fx-alignment: CENTER");
+
+ storageCol.setCellValueFactory(new PropertyValueFactory<>("storage"));
+ storageCol.setStyle("-fx-alignment: CENTER");
+ storageCol.setCellFactory(new Callback, TableCell>() {
+ @Override
+ public TableCell call(TableColumn param) {
+ return new TableCell<>() {
+ @Override
+ protected void updateItem(Integer item, boolean empty) {
+ super.updateItem(item, empty);
+ if (empty) {
+ setText(null);
+ setGraphic(null);
+ } else {
+
+
+ DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(INFRA_FILE_STORAGE).get(item + "");
+ Button state = new Button(dict.getLabel());
+ switch (dict.getColorType()) {
+ case "primary":
+ state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
+ break;
+ case "success":
+ state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
+ break;
+ case "info":
+ state.getStyleClass().addAll(BUTTON_OUTLINED);
+ break;
+ case "warning":
+ state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
+ break;
+ case "danger":
+ state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
+ break;
+ default:
+ state.getStyleClass().addAll(BUTTON_OUTLINED);
+ }
+
+ HBox box = new HBox(state);
+ box.setPadding(new Insets(7, 7, 7, 7));
+ box.setAlignment(Pos.CENTER);
+ setGraphic(box);
+
+
+ }
+
+ }
+ };
+ }
+ });
+
+ remarkCol.setCellValueFactory(new PropertyValueFactory<>("remark"));
+ remarkCol.setStyle("-fx-alignment: CENTER");
+
+
+ primaryCol.setCellValueFactory(new PropertyValueFactory<>("master"));
+ primaryCol.setStyle("-fx-alignment: CENTER");
+ primaryCol.setCellFactory(new Callback, TableCell>() {
+ @Override
+ public TableCell call(TableColumn param) {
+ return new TableCell<>() {
+ @Override
+ protected void updateItem(Boolean item, boolean empty) {
+ super.updateItem(item, empty);
+ if (empty) {
+ setText(null);
+ setGraphic(null);
+ } else {
+
+ DictDataSimpleRespVO dict = AppStore.getDictDataValueMap(INFRA_BOOLEAN_STRING).get(item + "");
+ Button state = new Button(dict.getLabel());
+ switch (dict.getColorType()) {
+ case "primary":
+ state.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
+ break;
+ case "success":
+ state.getStyleClass().addAll(BUTTON_OUTLINED, SUCCESS);
+ break;
+ case "info":
+ state.getStyleClass().addAll(BUTTON_OUTLINED);
+ break;
+ case "warning":
+ state.getStyleClass().addAll(BUTTON_OUTLINED, WARNING);
+ break;
+ case "danger":
+ state.getStyleClass().addAll(BUTTON_OUTLINED, DANGER);
+ break;
+ default:
+ state.getStyleClass().addAll(BUTTON_OUTLINED);
+ }
+
+ HBox box = new HBox(state);
+ box.setPadding(new Insets(7, 7, 7, 7));
+ box.setAlignment(Pos.CENTER);
+ setGraphic(box);
+
+ }
+
+ }
+ };
+ }
+ });
+
+ createTimeCol.setCellValueFactory(new PropertyValueFactory<>("createTime"));
+ createTimeCol.setStyle("-fx-alignment: CENTER");
+ createTimeCol.setCellFactory(new Callback, TableCell>() {
+ @Override
+ public TableCell call(TableColumn param) {
+ return new TableCell<>() {
+ @Override
+ protected void updateItem(LocalDateTime item, boolean empty) {
+ super.updateItem(item, empty);
+ if (empty) {
+ setText(null);
+ } else {
+
+
+ if (item != null) {
+ this.setText(DateUtil.format(item, "yyyy-MM-dd HH:mm:ss"));
+ }
+ }
+
+ }
+ };
+ }
+ });
+
+ optCol.setCellValueFactory(new PropertyValueFactory<>("id"));
+ optCol.setCellFactory(new Callback, TableCell>() {
+ @Override
+ public TableCell call(TableColumn param) {
+
+ TableCell cell = new TableCell() {
+ @Override
+ protected void updateItem(Long item, boolean empty) {
+ super.updateItem(item, empty);
+ if (empty) {
+ setText(null);
+ setGraphic(null);
+ } else {
+
+
+ Button editBut = new Button("编辑");
+ editBut.setOnAction(event -> showFormView(getTableRow().getItem().getId()));
+ editBut.setGraphic(FontIcon.of(Feather.EDIT));
+ editBut.getStyleClass().addAll(FLAT, ACCENT);
+
+ Button masterBut = new Button("主配置");
+ masterBut.setOnAction(event -> showMasterDialog(getTableRow().getItem()));
+ masterBut.setGraphic(FontIcon.of(Feather.EDIT));
+ masterBut.getStyleClass().addAll(FLAT, ACCENT);
+
+ Button delBut = new Button("删除");
+ delBut.setOnAction(actionEvent -> showDelDialog(getTableRow().getItem()));
+ delBut.setGraphic(FontIcon.of(Feather.TRASH));
+ delBut.getStyleClass().addAll(FLAT, DANGER);
+ HBox box = new HBox(editBut,masterBut, delBut);
+ box.setAlignment(Pos.CENTER);
+// box.setSpacing(7);
+ setGraphic(box);
+ }
+ }
+ };
+ return cell;
+ }
+ });
+
+ tableView.setItems(viewModel.getTableItems());
+
+ addBut.setOnAction(actionEvent -> showFormView(null));
+ searchBut.setOnAction(actionEvent -> viewModel.loadTableData());
+ resetBut.setOnAction(actionEvent -> {
+ nameField.setText(null);
+ storageComboBox.getSelectionModel().select(null);
+ startDatePicker.setValue(null);
+ endDatePicker.setValue(null);
+ viewModel.loadTableData();
+ });
+ }
+
+
+ /**
+ * 显示编辑对话框
+ */
+ private void showFormView(Long id) {
+ WFXGenericDialog dialog = new WFXGenericDialog();
+
+ boolean isAdd = (id == null);
+ ViewTuple load = FluentViewLoader.fxmlView(FileConfigFormView.class).load();
+ load.getViewModel().updateData(id,isAdd);
+ dialog.addActions(
+ Map.entry(new Button("取消"), event -> dialog.close()),
+ Map.entry(new Button("确定"), event -> {
+ ProcessChain.create()
+ .addSupplierInExecutor(() -> {
+ return load.getViewModel().save(isAdd);
+ })
+ .addConsumerInPlatformThread(r -> {
+ if (r.isSuccess()) {
+ dialog.close();
+ MvvmFX.getNotificationCenter().publish("message", "保存成功", MessageType.SUCCESS);
+
+ viewModel.loadTableData();
+
+ }
+ }).onException(e -> e.printStackTrace())
+ .run();
+ })
+ );
+
+ dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
+ dialog.setHeaderText(id != null ? "编辑角色" : "添加角色");
+ dialog.setContent(load.getView());
+ dialog.show(rootPane.getScene());
+
+ }
+
+ private void showDelDialog(FileConfigRespVO respVO) {
+ WFXGenericDialog dialog = new WFXGenericDialog();
+ dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
+ dialog.setHeaderText("删除");
+ dialog.addActions(
+ Map.entry(new Button("取消"), event -> dialog.close()),
+ Map.entry(new Button("确定"), event -> {
+ ProcessChain.create()
+ .addSupplierInExecutor(() -> {
+ return Request.connector(FileConfigFeign.class).deleteFileConfig(respVO.getId());
+ })
+ .addConsumerInPlatformThread(r -> {
+ if (r.isSuccess()) {
+ dialog.close();
+ MvvmFX.getNotificationCenter().publish("message", "删除成功", MessageType.SUCCESS);
+
+ viewModel.loadTableData();
+ }
+ }).onException(e -> e.printStackTrace())
+ .run();
+ })
+ );
+
+ dialog.setContent(new Label("是否确认删除名称为" + respVO.getName() + "的数据项?"));
+ dialog.show(rootPane.getScene());
+ }
+
+ private void showMasterDialog(FileConfigRespVO respVO) {
+ WFXGenericDialog dialog = new WFXGenericDialog();
+ dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
+ dialog.setHeaderText("系统提示");
+ dialog.addActions(
+ Map.entry(new Button("取消"), event -> dialog.close()),
+ Map.entry(new Button("确定"), event -> {
+ ProcessChain.create()
+ .addSupplierInExecutor(() -> {
+ return Request.connector(FileConfigFeign.class).updateFileConfigMaster(respVO.getId());
+ })
+ .addConsumerInPlatformThread(r -> {
+ if (r.isSuccess()) {
+ dialog.close();
+ MvvmFX.getNotificationCenter().publish("message", "修改成功", MessageType.SUCCESS);
+
+ viewModel.loadTableData();
+ }
+ }).onException(e -> e.printStackTrace())
+ .run();
+ })
+ );
+
+ dialog.setContent(new Label("是否确认修改配置名称为" + respVO.getName() + "的数据项为主配置?"));
+ dialog.show(rootPane.getScene());
+ }
+}
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigViewModel.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigViewModel.java
new file mode 100644
index 0000000..1ff2179
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileConfigViewModel.java
@@ -0,0 +1,140 @@
+package com.lw.fx.view.infra.file;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.ObjectUtil;
+import com.google.gson.JsonObject;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.config.FileConfigRespVO;
+import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO;
+import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
+import com.lw.fx.request.Request;
+import com.lw.ui.request.api.file.FileConfigFeign;
+import de.saxsys.mvvmfx.ViewModel;
+import io.datafx.core.concurrent.ProcessChain;
+import javafx.beans.property.*;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class FileConfigViewModel implements ViewModel {
+ private SimpleIntegerProperty total = new SimpleIntegerProperty(0);
+ private IntegerProperty pageNum = new SimpleIntegerProperty(0);
+ private IntegerProperty pageSize = new SimpleIntegerProperty(10);
+ private ObjectProperty beginDate = new SimpleObjectProperty<>();
+ private ObjectProperty endDate = new SimpleObjectProperty<>();
+
+ private StringProperty name = new SimpleStringProperty();
+ private ObjectProperty storage = new SimpleObjectProperty<>();
+
+ private ObservableList tableItems = FXCollections.observableArrayList();
+
+ public FileConfigViewModel() {
+ loadTableData();
+ }
+
+
+ public void loadTableData() {
+
+ Map queryMap = new HashMap<>();
+ queryMap.put("pageNo", pageNum.get() + 1);
+ queryMap.put("pageSize", pageSize.get());
+
+ queryMap.put("name", name.get());
+ if (storage.get() != null) {
+ queryMap.put("storage", Convert.toInt(storage.get().getValue(), null));
+ }
+
+ if (ObjectUtil.isAllNotEmpty(getBeginDate(), getEndDate())) {
+ String sd = getBeginDate().atTime(0, 0, 0).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+ String ed = getEndDate().atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+ queryMap.put("createTime", new String[]{sd, ed});
+ }
+
+ ProcessChain.create()
+ .addRunnableInPlatformThread(() -> tableItems.clear())
+ .addSupplierInExecutor(() -> Request.connector(FileConfigFeign.class).getFileConfigPage(queryMap))
+ .addConsumerInPlatformThread(listCommonResult -> {
+ if (listCommonResult.isSuccess()) {
+ List list = listCommonResult.getData().getList();
+ for (JsonObject jsonObject:list) {
+ FileConfigRespVO fileConfigRespVO = new FileConfigRespVO();
+ fileConfigRespVO.setId(jsonObject.get("id").getAsLong());
+ fileConfigRespVO.setName(jsonObject.get("name").getAsString());
+ fileConfigRespVO.setStorage(jsonObject.get("storage").getAsInt());
+ fileConfigRespVO.setRemark(jsonObject.get("remark").getAsString());
+ fileConfigRespVO.setMaster(jsonObject.get("master").getAsBoolean());
+ fileConfigRespVO.setCreateTime(Convert.toLocalDateTime(jsonObject.get("createTime")));
+ tableItems.add(fileConfigRespVO);
+ }
+ totalProperty().set(listCommonResult.getData().getTotal().intValue());
+ }
+ }).onException(e -> e.printStackTrace())
+ .run();
+
+
+ }
+
+ public int getTotal() {
+ return total.get();
+ }
+
+ public SimpleIntegerProperty totalProperty() {
+ return total;
+ }
+
+ public int getPageNum() {
+ return pageNum.get();
+ }
+
+ public IntegerProperty pageNumProperty() {
+ return pageNum;
+ }
+
+ public int getPageSize() {
+ return pageSize.get();
+ }
+
+ public IntegerProperty pageSizeProperty() {
+ return pageSize;
+ }
+
+ public LocalDate getBeginDate() {
+ return beginDate.get();
+ }
+
+ public ObjectProperty beginDateProperty() {
+ return beginDate;
+ }
+
+ public LocalDate getEndDate() {
+ return endDate.get();
+ }
+
+ public ObjectProperty endDateProperty() {
+ return endDate;
+ }
+
+ public ObservableList getTableItems() {
+ return tableItems;
+ }
+
+ public String getName() {
+ return name.get();
+ }
+
+ public StringProperty nameProperty() {
+ return name;
+ }
+
+ public DictDataSimpleRespVO getStorage() {
+ return storage.get();
+ }
+
+ public ObjectProperty storageProperty() {
+ return storage;
+ }
+}
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileListView.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileListView.java
new file mode 100644
index 0000000..ee2504a
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileListView.java
@@ -0,0 +1,324 @@
+package com.lw.fx.view.infra.file;
+
+import atlantafx.base.controls.ModalPane;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.file.FileRespVO;
+import com.lw.fx.request.Request;
+import com.lw.fx.util.MessageType;
+import com.lw.fx.view.control.PagingControl;
+import com.lw.fx.view.control.WFXGenericDialog;
+import com.lw.ui.request.api.file.FileFeign;
+import de.saxsys.mvvmfx.FxmlView;
+import de.saxsys.mvvmfx.InjectViewModel;
+import de.saxsys.mvvmfx.MvvmFX;
+import io.datafx.core.concurrent.ProcessChain;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.geometry.Insets;
+import javafx.geometry.Pos;
+import javafx.scene.Cursor;
+import javafx.scene.control.*;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.control.cell.PropertyValueFactory;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.StackPane;
+import javafx.scene.layout.VBox;
+import javafx.stage.FileChooser;
+import javafx.util.Callback;
+import org.kordamp.ikonli.feather.Feather;
+import org.kordamp.ikonli.javafx.FontIcon;
+
+import java.awt.*;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.time.LocalDateTime;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import static atlantafx.base.theme.Styles.DANGER;
+import static atlantafx.base.theme.Styles.FLAT;
+
+public class FileListView implements FxmlView, Initializable {
+ @InjectViewModel
+ private FileListViewModel viewModel;
+ @FXML
+ private VBox contentPane;
+
+ @FXML
+ private TableColumn createTimeCol;
+
+ @FXML
+ private Button uploadBut;
+
+ @FXML
+ private DatePicker endDatePicker;
+
+
+ @FXML
+ private TableColumn nameCol;
+
+ @FXML
+ private TableColumn optCol;
+
+ @FXML
+ private TableColumn pathCol;
+
+ @FXML
+ private TableColumn urlCol;
+
+ @FXML
+ private Button resetBut;
+
+ @FXML
+ private StackPane rootPane;
+
+ @FXML
+ private Button searchBut;
+
+ @FXML
+ private DatePicker startDatePicker;
+
+ @FXML
+ private TableColumn sizeCol;
+ @FXML
+ private TableColumn typeCol;
+ @FXML
+ private TableColumn centerCol;
+
+ @FXML
+ private TableView tableView;
+
+ @FXML
+ private TextField typeField;
+ @FXML
+ private TextField pathField;
+
+ private PagingControl pagingControl;
+
+ private ImageView modalImage = new ImageView();
+
+ private final ModalPane modalPane = new ModalPane();
+
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle) {
+ pagingControl = new PagingControl();
+ rootPane.getChildren().add(0, modalPane);
+ contentPane.getChildren().add(pagingControl);
+
+ pagingControl.totalProperty().bind(viewModel.totalProperty());
+ viewModel.pageNumProperty().bind(pagingControl.pageNumProperty());
+ viewModel.pageSizeProperty().bind(pagingControl.pageSizeProperty());
+ pagingControl.pageNumProperty().addListener((observable, oldValue, newValue) -> {
+ viewModel.loadTableData();
+ });
+
+ pagingControl.pageSizeProperty().addListener((observable, oldValue, newValue) -> {
+ viewModel.loadTableData();
+ });
+
+
+ pathField.textProperty().bindBidirectional(viewModel.pathProperty());
+ typeField.textProperty().bindBidirectional(viewModel.typeProperty());
+
+
+ nameCol.setCellValueFactory(new PropertyValueFactory<>("name"));
+ nameCol.setStyle("-fx-alignment: CENTER");
+
+ pathCol.setCellValueFactory(new PropertyValueFactory<>("path"));
+ pathCol.setStyle("-fx-alignment: CENTER");
+
+ urlCol.setCellValueFactory(new PropertyValueFactory<>("url"));
+ urlCol.setStyle("-fx-alignment: CENTER");
+ sizeCol.setCellValueFactory(new PropertyValueFactory<>("size"));
+ sizeCol.setStyle("-fx-alignment: CENTER");
+ typeCol.setCellValueFactory(new PropertyValueFactory<>("type"));
+ typeCol.setStyle("-fx-alignment: CENTER");
+ centerCol.setCellValueFactory(new PropertyValueFactory<>("url"));
+ centerCol.setStyle("-fx-alignment: CENTER");
+ createTimeCol.setCellValueFactory(new PropertyValueFactory<>("createTime"));
+ createTimeCol.setStyle("-fx-alignment: CENTER");
+ createTimeCol.setCellFactory(new Callback, TableCell>() {
+ @Override
+ public TableCell call(TableColumn param) {
+ return new TableCell<>() {
+ @Override
+ protected void updateItem(LocalDateTime item, boolean empty) {
+ super.updateItem(item, empty);
+ if (empty) {
+ setText(null);
+ } else {
+
+
+ if (item != null) {
+ this.setText(DateUtil.format(item, "yyyy-MM-dd HH:mm:ss"));
+ }
+ }
+
+ }
+ };
+ }
+ });
+
+ centerCol.setCellFactory(new Callback, TableCell>() {
+ @Override
+ public TableCell call(TableColumn param) {
+ return new TableCell<>() {
+ @Override
+ protected void updateItem(String item, boolean empty) {
+ super.updateItem(item, empty);
+ if (empty) {
+ setText(null);
+ setGraphic(null);
+ } else {
+
+ FileRespVO fileRespVO = getTableRow().getItem();
+ if (StrUtil.contains(fileRespVO.getType(), "image")) {
+ Image image = new Image(item, true);
+ ImageView view = new ImageView();
+ view.setImage(image);
+ view.setFitWidth(180);
+ view.setFitHeight(120);
+ view.setCursor(Cursor.HAND);
+
+ view.setOnMouseClicked(evt -> {
+ modalImage.setImage(view.getImage());
+ modalPane.show(modalImage);
+ modalImage.requestFocus();
+ });
+ VBox vBox = new VBox(view);
+ vBox.setPadding(new Insets(10,10,10,10));
+ vBox.setAlignment(Pos.CENTER);
+ setGraphic(vBox);
+
+ }else {
+ Hyperlink hyperlink = new Hyperlink("下载");
+ hyperlink.setOnAction(event -> {
+ try {
+ // Check if Desktop API is supported on the current platform
+ if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+ Desktop.getDesktop().browse(new URI(item));
+ } else {
+// showAlert("Error", "Desktop API is not supported on this platform.");
+ }
+ } catch (IOException | URISyntaxException e) {
+// showAlert("Error", "Failed to open URL: " + e.getMessage());
+ }
+ });
+ VBox vBox = new VBox(hyperlink);
+ vBox.setAlignment(Pos.CENTER);
+ setGraphic(vBox);
+ }
+
+ }
+
+ }
+ };
+ }
+ });
+
+ optCol.setCellValueFactory(new PropertyValueFactory<>("id"));
+ optCol.setCellFactory(new Callback, TableCell>() {
+ @Override
+ public TableCell call(TableColumn param) {
+
+ TableCell cell = new TableCell() {
+ @Override
+ protected void updateItem(Long item, boolean empty) {
+ super.updateItem(item, empty);
+ if (empty) {
+ setText(null);
+ setGraphic(null);
+ } else {
+
+ Button delBut = new Button("删除");
+ delBut.setOnAction(actionEvent -> showDelDialog(getTableRow().getItem()));
+ delBut.setGraphic(FontIcon.of(Feather.TRASH));
+ delBut.getStyleClass().addAll(FLAT, DANGER);
+ HBox box = new HBox(delBut);
+ box.setAlignment(Pos.CENTER);
+ setGraphic(box);
+ }
+ }
+ };
+ return cell;
+ }
+ });
+
+ tableView.setItems(viewModel.getTableItems());
+
+ uploadBut.setOnAction(actionEvent -> addFile());
+ searchBut.setOnAction(actionEvent -> viewModel.loadTableData());
+ resetBut.setOnAction(actionEvent -> {
+ pathField.setText(null);
+ typeField.setText(null);
+ startDatePicker.setValue(null);
+ endDatePicker.setValue(null);
+ viewModel.loadTableData();
+ });
+ }
+
+ private void addFile() {
+ var fileChooser = new FileChooser();
+ fileChooser.setTitle("选择要上传的文件");
+ File file = fileChooser.showOpenDialog(rootPane.getScene().getWindow());
+ if (file == null) {
+ return;
+ }
+
+ ProcessChain.create()
+ .addSupplierInExecutor(() -> {
+
+ return Request.fileConnector(FileFeign.class).uploadFile("", file);
+ })
+ .addConsumerInPlatformThread(r -> {
+ if (r.isSuccess()) {
+
+ viewModel.loadTableData();
+ } else {
+ MvvmFX.getNotificationCenter().publish("message", r.getMsg(), MessageType.WARNING);
+
+ }
+
+ }).onException(e -> e.printStackTrace())
+ .run();
+
+ }
+
+
+ private void showDelDialog(FileRespVO respVO) {
+ WFXGenericDialog dialog = new WFXGenericDialog();
+ dialog.setHeaderIcon(FontIcon.of(Feather.INFO));
+ dialog.setHeaderText("删除");
+ dialog.addActions(
+ Map.entry(new Button("取消"), event -> dialog.close()),
+ Map.entry(new Button("确定"), event -> {
+ ProcessChain.create()
+ .addSupplierInExecutor(() -> {
+ return Request.connector(FileFeign.class).deleteFile(respVO.getId());
+ })
+ .addConsumerInPlatformThread(r -> {
+ if (r.isSuccess()) {
+ dialog.close();
+ MvvmFX.getNotificationCenter().publish("message", "删除成功", MessageType.SUCCESS);
+
+ viewModel.loadTableData();
+ }
+ }).onException(e -> e.printStackTrace())
+ .run();
+ })
+ );
+
+ dialog.setContent(new Label("是否确认删除名称为" + respVO.getName() + "的数据项?"));
+ dialog.show(rootPane.getScene());
+ }
+
+
+}
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileListViewModel.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileListViewModel.java
new file mode 100644
index 0000000..96729a1
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/view/infra/file/FileListViewModel.java
@@ -0,0 +1,123 @@
+package com.lw.fx.view.infra.file;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.file.FileRespVO;
+import com.lw.fx.request.Request;
+import com.lw.ui.request.api.file.FileFeign;
+import de.saxsys.mvvmfx.ViewModel;
+import io.datafx.core.concurrent.ProcessChain;
+import javafx.beans.property.*;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
+
+public class FileListViewModel implements ViewModel {
+ private SimpleIntegerProperty total = new SimpleIntegerProperty(0);
+ private IntegerProperty pageNum = new SimpleIntegerProperty(0);
+ private IntegerProperty pageSize = new SimpleIntegerProperty(10);
+ private ObjectProperty beginDate = new SimpleObjectProperty<>();
+ private ObjectProperty endDate = new SimpleObjectProperty<>();
+
+ private StringProperty path = new SimpleStringProperty();
+ private StringProperty type = new SimpleStringProperty();
+
+ private ObservableList tableItems = FXCollections.observableArrayList();
+
+ public FileListViewModel() {
+ loadTableData();
+ }
+
+
+ public void loadTableData() {
+
+ Map queryMap = new HashMap<>();
+ queryMap.put("pageNo", pageNum.get() + 1);
+ queryMap.put("pageSize", pageSize.get());
+
+ queryMap.put("path", path.get());
+ queryMap.put("type", type.get());
+
+ if (ObjectUtil.isAllNotEmpty(getBeginDate(), getEndDate())) {
+ String sd = getBeginDate().atTime(0, 0, 0).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+ String ed = getEndDate().atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+ queryMap.put("createTime", new String[]{sd, ed});
+ }
+
+ ProcessChain.create()
+ .addRunnableInPlatformThread(() -> tableItems.clear())
+ .addSupplierInExecutor(() -> Request.connector(FileFeign.class).getFilePage(queryMap))
+ .addConsumerInPlatformThread(listCommonResult -> {
+ if (listCommonResult.isSuccess()) {
+ tableItems.setAll(listCommonResult.getData().getList());
+ totalProperty().set(listCommonResult.getData().getTotal().intValue());
+ }
+ }).onException(e -> e.printStackTrace())
+ .run();
+
+
+ }
+
+ public int getTotal() {
+ return total.get();
+ }
+
+ public SimpleIntegerProperty totalProperty() {
+ return total;
+ }
+
+ public int getPageNum() {
+ return pageNum.get();
+ }
+
+ public IntegerProperty pageNumProperty() {
+ return pageNum;
+ }
+
+ public int getPageSize() {
+ return pageSize.get();
+ }
+
+ public IntegerProperty pageSizeProperty() {
+ return pageSize;
+ }
+
+ public LocalDate getBeginDate() {
+ return beginDate.get();
+ }
+
+ public ObjectProperty beginDateProperty() {
+ return beginDate;
+ }
+
+ public LocalDate getEndDate() {
+ return endDate.get();
+ }
+
+ public ObjectProperty endDateProperty() {
+ return endDate;
+ }
+
+ public ObservableList getTableItems() {
+ return tableItems;
+ }
+
+ public String getPath() {
+ return path.get();
+ }
+
+ public StringProperty pathProperty() {
+ return path;
+ }
+
+ public String getType() {
+ return type.get();
+ }
+
+ public StringProperty typeProperty() {
+ return type;
+ }
+}
diff --git a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/vo/NotifyMessageVo.java b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/vo/NotifyMessageVo.java
index e008c87..ae2bc09 100644
--- a/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/vo/NotifyMessageVo.java
+++ b/dillon-ui/dillon-ui-fx/src/main/java/com/lw/fx/vo/NotifyMessageVo.java
@@ -1,7 +1,5 @@
package com.lw.fx.vo;
-import com.lw.dillon.admin.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
-import io.swagger.v3.oas.annotations.media.Schema;
import javafx.beans.property.SimpleBooleanProperty;
import lombok.Data;
diff --git a/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileConfigFormView.fxml b/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileConfigFormView.fxml
new file mode 100644
index 0000000..b3648fc
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileConfigFormView.fxml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileConfigView.fxml b/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileConfigView.fxml
new file mode 100644
index 0000000..bb08bdb
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileConfigView.fxml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileListView.fxml b/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileListView.fxml
new file mode 100644
index 0000000..f6523e5
--- /dev/null
+++ b/dillon-ui/dillon-ui-fx/src/main/resources/com/lw/fx/view/infra/file/FileListView.fxml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/components/table/renderer/WNumberEditor.java b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/components/table/renderer/WNumberEditor.java
deleted file mode 100644
index d57e8b7..0000000
--- a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/components/table/renderer/WNumberEditor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.lw.swing.components.table.renderer;
-
-//import sun.reflect.misc.ReflectUtil;
-import sun.swing.SwingUtilities2;
-
-import javax.swing.*;
-import javax.swing.border.LineBorder;
-import javax.swing.text.JTextComponent;
-import java.awt.*;
-import java.util.EventObject;
-
-public class WNumberEditor extends DefaultCellEditor {
-
- Class[] argTypes = new Class[]{String.class};
- java.lang.reflect.Constructor constructor;
- Object value;
-
- public WNumberEditor( JTextField textField) {
- super(textField);
-
- editorComponent = textField;
- delegate = new EditorDelegate() {
- @Override
- public void setValue(Object value) {
- textField.setText((value != null) ? value.toString() : "");
- }
-
- @Override
- public Object getCellEditorValue() {
- return textField.getText();
- }
-
- @Override
- public boolean shouldSelectCell(EventObject anEvent) {
- textField.selectAll();
- return super.shouldSelectCell(anEvent);
- }
- };
- getComponent().setName("Table.editor");
-
- textField.addActionListener(delegate);
- }
-
-
- @Override
- public boolean stopCellEditing() {
- String s = (String) super.getCellEditorValue();
- // Here we are dealing with the case where a user
- // has deleted the string value in a cell, possibly
- // after a failed validation. Return null, so that
- // they have the option to replace the value with
- // null or use escape to restore the original.
- // For Strings, return "" for backward compatibility.
- try {
- if ("".equals(s)) {
- if (constructor.getDeclaringClass() == String.class) {
- value = s;
- }
- return super.stopCellEditing();
- }
-
- SwingUtilities2.checkAccess(constructor.getModifiers());
- value = constructor.newInstance(new Object[]{s});
- } catch (Exception e) {
- ((JComponent) getComponent()).setBorder(new LineBorder(Color.red));
- return false;
- }
- return super.stopCellEditing();
- }
-
-
- @Override
- public Component getTableCellEditorComponent(JTable table, Object value,
- boolean isSelected,
- int row, int column) {
- this.value = null;
- ((JComponent) getComponent()).setBorder(new LineBorder(Color.black));
- try {
- Class> type = table.getColumnClass(column);
- // Since our obligation is to produce a value which is
- // assignable for the required type it is OK to use the
- // String constructor for columns which are declared
- // to contain Objects. A String is an Object.
- if (type == Object.class) {
- type = String.class;
- }
-// ReflectUtil.checkPackageAccess(type);
- SwingUtilities2.checkAccess(type.getModifiers());
- constructor = type.getConstructor(argTypes);
- } catch (Exception e) {
- return null;
- }
- Component component= super.getTableCellEditorComponent(table, value, isSelected, row, column);
- if (editorComponent instanceof JTextComponent) {
- ((JTextComponent) editorComponent).selectAll();
- }
- return component;
- }
-
- @Override
- public Object getCellEditorValue() {
- return value;
- }
-}
\ No newline at end of file
diff --git a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/request/Request.java b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/request/Request.java
index 6f28db2..aabb78f 100644
--- a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/request/Request.java
+++ b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/request/Request.java
@@ -14,8 +14,10 @@ import feign.Logger;
import feign.Retryer;
import feign.codec.Decoder;
import feign.codec.Encoder;
+import feign.form.spring.SpringFormEncoder;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
+import feign.jackson.JacksonDecoder;
import feign.okhttp.OkHttpClient;
import feign.querymap.BeanQueryMapEncoder;
import feign.slf4j.Slf4jLogger;
@@ -46,6 +48,8 @@ public class Request {
private static final okhttp3.OkHttpClient OK_HTTP_CLIENT = createOkHttpClient();
private static final Feign.Builder BUILDER = createFeignBuilder();
+ private static final Feign.Builder FILE_BUILDER = createFileFeignBuilder();
+
private static final AsyncFeign.AsyncBuilder ASYNC_BUILDER = createAsyncFeignBuilder();
private Request() {
@@ -101,4 +105,19 @@ public class Request {
.requestInterceptor(new ForwardedForInterceptor())
.retryer(new Retryer.Default()); // 默认重试策略
}
+
+
+ public static T fileConnector(Class connectorClass) {
+ return FILE_BUILDER.target(connectorClass, System.getProperty("app.server.url"));
+ }
+
+ private static Feign.Builder createFileFeignBuilder() {
+
+
+ return Feign.builder()
+ .encoder(new SpringFormEncoder())
+ .decoder(new JacksonDecoder())
+ .requestInterceptor(new ForwardedForInterceptor());
+
+ }
}
diff --git a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/SidePane.java b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/SidePane.java
index cd2be44..96b70d8 100644
--- a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/SidePane.java
+++ b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/SidePane.java
@@ -68,11 +68,11 @@ public class SidePane extends WPanel {
((JLabel) component).setText(menuVO.getName());
String icon = menuVO.getIcon();
if (StrUtil.isBlank(menuVO.getIcon())) {
- icon="icons/menu/item.svg";
+ icon="icons/item.svg";
}else if (StrUtil.contains(icon,":")){
icon="icons/menu/"+icon.split(":")[1]+".svg";
}
- FlatSVGIcon svgIcon = IconLoader.getSvgIcon(icon, 25, 25);
+ FlatSVGIcon svgIcon = new FlatSVGIcon(icon, 25, 25);
svgIcon.setColorFilter(new FlatSVGIcon.ColorFilter(color -> {
return component.getForeground();
diff --git a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigFromPane.java b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigFromPane.java
new file mode 100644
index 0000000..04784d1
--- /dev/null
+++ b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigFromPane.java
@@ -0,0 +1,607 @@
+/*
+ * Created by JFormDesigner on Sun Jul 28 10:24:06 CST 2024
+ */
+
+package com.lw.swing.view.intra.file;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
+import com.google.gson.JsonObject;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
+import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
+import com.lw.swing.request.Request;
+import com.lw.swing.store.AppStore;
+import com.lw.ui.request.api.file.FileConfigFeign;
+import net.miginfocom.swing.MigLayout;
+import org.jdesktop.swingx.HorizontalLayout;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ItemEvent;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+
+import static com.lw.ui.utils.DictTypeEnum.INFRA_FILE_STORAGE;
+
+/**
+ * @author wenli
+ */
+public class FileConfigFromPane extends JPanel {
+ private Long id = null;
+
+ public FileConfigFromPane() {
+ initComponents();
+ }
+
+ private void initComponents() {
+ // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
+ // Generated using JFormDesigner non-commercial license
+ namePane = new JPanel();
+ label1 = new JLabel();
+ nameField = new JTextField();
+ remarkPane = new JPanel();
+ label2 = new JLabel();
+ remarkField = new JTextField();
+ storagePane = new JPanel();
+ label3 = new JLabel();
+ storageComboBox = new JComboBox();
+ basePathPane = new JPanel();
+ label4 = new JLabel();
+ basePathField = new JTextField();
+ hostPane = new JPanel();
+ label5 = new JLabel();
+ hostField = new JTextField();
+ portPane = new JPanel();
+ label6 = new JLabel();
+ portField = new JTextField();
+ usernamePane = new JPanel();
+ label7 = new JLabel();
+ usernameField = new JTextField();
+ passwordPane = new JPanel();
+ label8 = new JLabel();
+ passwordField = new JTextField();
+ modePane = new JPanel();
+ label9 = new JLabel();
+ panel3 = new JPanel();
+ activeRb = new JRadioButton();
+ passiveRb = new JRadioButton();
+ endpointPane = new JPanel();
+ label10 = new JLabel();
+ endpointField = new JTextField();
+ bucketPane = new JPanel();
+ label11 = new JLabel();
+ bucketField = new JTextField();
+ accessKeyPane = new JPanel();
+ label13 = new JLabel();
+ accessKeyField = new JTextField();
+ accessSecretPane = new JPanel();
+ label14 = new JLabel();
+ accessSecretField = new JTextField();
+ domainPane = new JPanel();
+ label15 = new JLabel();
+ domainField = new JTextField();
+
+ //======== this ========
+ setMinimumSize(new Dimension(340, 500));
+ setLayout(new MigLayout(
+ "fill,insets 0,gap 10 5",
+ // columns
+ "[500,grow,fill]",
+ // rows
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]" +
+ "[]"));
+
+ //======== namePane ========
+ {
+ namePane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[320,fill]",
+ // rows
+ "[]"));
+
+ //---- label1 ----
+ label1.setText("\u914d\u7f6e\u540d");
+ label1.setMinimumSize(new Dimension(80, 16));
+ label1.setHorizontalAlignment(SwingConstants.RIGHT);
+ namePane.add(label1, "cell 0 0");
+
+ //---- nameField ----
+ nameField.setMinimumSize(new Dimension(180, 34));
+ nameField.setPreferredSize(new Dimension(240, 34));
+ namePane.add(nameField, "cell 0 0,growx");
+ }
+ add(namePane, "cell 0 0,grow");
+
+ //======== remarkPane ========
+ {
+ remarkPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label2 ----
+ label2.setText("\u5907\u6ce8");
+ label2.setMinimumSize(new Dimension(80, 16));
+ label2.setHorizontalAlignment(SwingConstants.RIGHT);
+ remarkPane.add(label2, "cell 0 0");
+ remarkPane.add(remarkField, "cell 0 0,growx");
+ }
+ add(remarkPane, "cell 0 1,grow");
+
+ //======== storagePane ========
+ {
+ storagePane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label3 ----
+ label3.setText("\u5b58\u50a8\u5668");
+ label3.setMinimumSize(new Dimension(80, 16));
+ label3.setHorizontalAlignment(SwingConstants.RIGHT);
+ storagePane.add(label3, "cell 0 0");
+ storagePane.add(storageComboBox, "cell 0 0,growx");
+ }
+ add(storagePane, "cell 0 2,grow");
+
+ //======== basePathPane ========
+ {
+ basePathPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label4 ----
+ label4.setText("\u57fa\u7840\u8def\u5f84");
+ label4.setMinimumSize(new Dimension(80, 16));
+ label4.setHorizontalAlignment(SwingConstants.RIGHT);
+ basePathPane.add(label4, "cell 0 0");
+ basePathPane.add(basePathField, "cell 0 0,growx");
+ }
+ add(basePathPane, "cell 0 3,grow");
+
+ //======== hostPane ========
+ {
+ hostPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label5 ----
+ label5.setText("\u4e3b\u673a\u5730\u5740");
+ label5.setMinimumSize(new Dimension(80, 16));
+ label5.setHorizontalAlignment(SwingConstants.RIGHT);
+ hostPane.add(label5, "cell 0 0");
+ hostPane.add(hostField, "cell 0 0,growx");
+ }
+ add(hostPane, "cell 0 4,grow");
+
+ //======== portPane ========
+ {
+ portPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label6 ----
+ label6.setText("\u4e3b\u673a\u7aef\u53e3");
+ label6.setMinimumSize(new Dimension(80, 16));
+ label6.setHorizontalAlignment(SwingConstants.RIGHT);
+ portPane.add(label6, "cell 0 0");
+ portPane.add(portField, "cell 0 0,growx");
+ }
+ add(portPane, "cell 0 5,grow");
+
+ //======== usernamePane ========
+ {
+ usernamePane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label7 ----
+ label7.setText("\u7528\u6237\u540d");
+ label7.setMinimumSize(new Dimension(80, 16));
+ label7.setHorizontalAlignment(SwingConstants.RIGHT);
+ usernamePane.add(label7, "cell 0 0");
+ usernamePane.add(usernameField, "cell 0 0,growx");
+ }
+ add(usernamePane, "cell 0 6,grow");
+
+ //======== passwordPane ========
+ {
+ passwordPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label8 ----
+ label8.setText("\u5bc6\u7801");
+ label8.setMinimumSize(new Dimension(80, 16));
+ label8.setHorizontalAlignment(SwingConstants.RIGHT);
+ passwordPane.add(label8, "cell 0 0");
+ passwordPane.add(passwordField, "cell 0 0,growx");
+ }
+ add(passwordPane, "cell 0 7,grow");
+
+ //======== modePane ========
+ {
+ modePane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label9 ----
+ label9.setText("\u8fde\u63a5\u6a21\u5f0f");
+ label9.setMinimumSize(new Dimension(80, 16));
+ label9.setHorizontalAlignment(SwingConstants.RIGHT);
+ modePane.add(label9, "cell 0 0");
+
+ //======== panel3 ========
+ {
+ panel3.setLayout(new HorizontalLayout());
+
+ //---- activeRb ----
+ activeRb.setText("\u4e3b\u52a8\u6a21\u5f0f");
+ panel3.add(activeRb);
+
+ //---- passiveRb ----
+ passiveRb.setText("\u88ab\u52a8\u6a21\u5f0f");
+ panel3.add(passiveRb);
+ }
+ modePane.add(panel3, "cell 0 0,growx");
+ }
+ add(modePane, "cell 0 8,grow");
+
+ //======== endpointPane ========
+ {
+ endpointPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label10 ----
+ label10.setText("\u8282\u70b9\u5730\u5740");
+ label10.setHorizontalAlignment(SwingConstants.RIGHT);
+ label10.setMinimumSize(new Dimension(80, 16));
+ endpointPane.add(label10, "cell 0 0,alignx left,growx 0");
+ endpointPane.add(endpointField, "cell 0 0,growx");
+ }
+ add(endpointPane, "cell 0 9,grow");
+
+ //======== bucketPane ========
+ {
+ bucketPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label11 ----
+ label11.setText("\u5b58\u50a8 bucket");
+ label11.setMinimumSize(new Dimension(80, 16));
+ label11.setHorizontalAlignment(SwingConstants.RIGHT);
+ bucketPane.add(label11, "cell 0 0");
+ bucketPane.add(bucketField, "cell 0 0,growx");
+ }
+ add(bucketPane, "cell 0 10,grow");
+
+ //======== accessKeyPane ========
+ {
+ accessKeyPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label13 ----
+ label13.setText("accessKey");
+ label13.setMinimumSize(new Dimension(80, 16));
+ label13.setHorizontalAlignment(SwingConstants.RIGHT);
+ accessKeyPane.add(label13, "cell 0 0");
+ accessKeyPane.add(accessKeyField, "cell 0 0,growx");
+ }
+ add(accessKeyPane, "cell 0 11,grow");
+
+ //======== accessSecretPane ========
+ {
+ accessSecretPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label14 ----
+ label14.setText("accessSecret");
+ label14.setMinimumSize(new Dimension(80, 16));
+ label14.setHorizontalAlignment(SwingConstants.RIGHT);
+ accessSecretPane.add(label14, "cell 0 0");
+ accessSecretPane.add(accessSecretField, "cell 0 0,growx");
+ }
+ add(accessSecretPane, "cell 0 12,grow");
+
+ //======== domainPane ========
+ {
+ domainPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[fill]",
+ // rows
+ "[]"));
+
+ //---- label15 ----
+ label15.setText("\u81ea\u5b9a\u4e49\u57df\u540d");
+ label15.setMinimumSize(new Dimension(80, 16));
+ label15.setHorizontalAlignment(SwingConstants.RIGHT);
+ domainPane.add(label15, "cell 0 0");
+ domainPane.add(domainField, "cell 0 0,growx");
+ }
+ add(domainPane, "cell 0 13,grow");
+
+ //---- buttonGroup1 ----
+ ButtonGroup buttonGroup1 = new ButtonGroup();
+ buttonGroup1.add(activeRb);
+ buttonGroup1.add(passiveRb);
+ // JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
+
+
+ AppStore.getDictDataList(INFRA_FILE_STORAGE).forEach(dictDataSimpleRespVO -> {
+ storageComboBox.addItem(dictDataSimpleRespVO);
+ });
+
+ storageComboBox.addItemListener(e -> {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ showStorage(((DictDataSimpleRespVO) e.getItem()).getLabel()); //修改后
+ }
+ });
+
+ showStorage("");
+ }
+
+ private void showStorage(String type) {
+
+ domainPane.setVisible(false);
+ basePathPane.setVisible(false);
+ hostPane.setVisible(false);
+ portPane.setVisible(false);
+ usernamePane.setVisible(false);
+ passwordPane.setVisible(false);
+ endpointPane.setVisible(false);
+ bucketPane.setVisible(false);
+ accessKeyPane.setVisible(false);
+ accessSecretPane.setVisible(false);
+ modePane.setVisible(false);
+
+ switch (type) {
+ case "数据库": {
+ domainPane.setVisible(true);
+ break;
+ }
+ case "本地磁盘": {
+ domainPane.setVisible(true);
+ basePathPane.setVisible(true);
+ break;
+ }
+ case "FTP 服务器": {
+ domainPane.setVisible(true);
+ basePathPane.setVisible(true);
+ hostPane.setVisible(true);
+ portPane.setVisible(true);
+ usernamePane.setVisible(true);
+ passwordPane.setVisible(true);
+ break;
+ }
+ case "SFTP 服务器": {
+ domainPane.setVisible(true);
+ basePathPane.setVisible(true);
+ hostPane.setVisible(true);
+ portPane.setVisible(true);
+ usernamePane.setVisible(true);
+ passwordPane.setVisible(true);
+ modePane.setVisible(true);
+ break;
+ }
+ case "S3 对象存储": {
+
+ endpointPane.setVisible(true);
+ bucketPane.setVisible(true);
+ accessKeyPane.setVisible(true);
+ accessSecretPane.setVisible(true);
+ break;
+ }
+ default: {
+
+ }
+ }
+ revalidate();
+ repaint();
+ }
+
+ public void updateData(Long id) {
+
+ this.id = id;
+
+ SwingWorker swingWorker = new SwingWorker() {
+ @Override
+ protected FileConfigSaveReqVO doInBackground() throws Exception {
+ FileConfigSaveReqVO saveReqVO = new FileConfigSaveReqVO();
+ if (id != null) {
+ JsonObject jsonObject = Request.connector(FileConfigFeign.class).getFileConfig(id).getData();
+
+ saveReqVO.setName(jsonObject.get("name").getAsString());
+ saveReqVO.setStorage(jsonObject.get("storage").getAsInt());
+ saveReqVO.setRemark(jsonObject.get("remark").getAsString());
+ saveReqVO.setId(jsonObject.get("id").getAsLong());
+ JsonObject config = jsonObject.getAsJsonObject("config");
+ Map map = new HashMap<>();
+ Iterator keys = config.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ Object value = config.get(key).getAsString();
+ map.put(key, value);
+ }
+ saveReqVO.setConfig(map);
+ }
+
+ return saveReqVO;
+ }
+
+
+ @Override
+ protected void done() {
+
+ try {
+ setValue(get());
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ swingWorker.execute();
+ }
+
+ private void setValue(FileConfigSaveReqVO rel) {
+ nameField.setText(rel.getName());
+ remarkField.setText(rel.getRemark());
+ DictDataSimpleRespVO sel = AppStore.getDictDataValueMap(INFRA_FILE_STORAGE).get(rel.getStorage() + "");
+ storageComboBox.setSelectedItem(sel);
+ if (rel.getConfig() != null) {
+
+ domainField.setText(Convert.toStr(rel.getConfig().get("domain")));
+ basePathField.setText(Convert.toStr(rel.getConfig().get("basePath")));
+ hostField.setText(Convert.toStr(rel.getConfig().get("host")));
+ portField.setText(Convert.toStr(rel.getConfig().get("port")));
+ usernameField.setText(Convert.toStr(rel.getConfig().get("username")));
+ passwordField.setText(Convert.toStr(rel.getConfig().get("password")));
+ activeRb.setSelected(StrUtil.equals(Convert.toStr(rel.getConfig().get("mode")), "Active"));
+ endpointField.setText(Convert.toStr(rel.getConfig().get("endpoint")));
+ bucketField.setText(Convert.toStr(rel.getConfig().get("bucket")));
+ accessKeyField.setText(Convert.toStr(rel.getConfig().get("accessKey")));
+ accessSecretField.setText(Convert.toStr(rel.getConfig().get("accessSecret")));
+
+ }
+
+ showStorage(Optional.ofNullable(sel).map(DictDataSimpleRespVO::getLabel).orElse(""));
+
+ }
+
+ public FileConfigSaveReqVO getValue() {
+ FileConfigSaveReqVO saveReqVO = new FileConfigSaveReqVO();
+
+ saveReqVO.setName(nameField.getText());
+ saveReqVO.setId(id);
+ saveReqVO.setRemark(remarkField.getText());
+ if (storageComboBox.getSelectedItem() != null) {
+ DictDataSimpleRespVO dictDataSimpleRespVO = (DictDataSimpleRespVO) storageComboBox.getSelectedItem();
+ saveReqVO.setStorage(Convert.toInt(dictDataSimpleRespVO.getValue()));
+ }
+ Map config = new HashMap<>();
+ createConfig("domain", domainField.getText(), config);
+ createConfig("basePath", basePathField.getText(), config);
+ createConfig("host", hostField.getText(), config);
+ createConfig("username", usernameField.getText(), config);
+ createConfig("mode", activeRb.isSelected() ? "Active" : "Passive", config);
+ createConfig("endpoint", endpointField.getText(), config);
+ createConfig("bucket", bucketField.getText(), config);
+ createConfig("accessKey", accessKeyField.getText(), config);
+ createConfig("accessSecret", accessSecretField.getText(), config);
+ saveReqVO.setConfig(config);
+ return saveReqVO;
+ }
+
+ private void createConfig(String key, String value, Map config) {
+
+ if (StrUtil.isNotBlank(value)) {
+ config.put(key, value);
+ }
+
+ }
+
+
+ // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
+ // Generated using JFormDesigner non-commercial license
+ private JPanel namePane;
+ private JLabel label1;
+ private JTextField nameField;
+ private JPanel remarkPane;
+ private JLabel label2;
+ private JTextField remarkField;
+ private JPanel storagePane;
+ private JLabel label3;
+ private JComboBox storageComboBox;
+ private JPanel basePathPane;
+ private JLabel label4;
+ private JTextField basePathField;
+ private JPanel hostPane;
+ private JLabel label5;
+ private JTextField hostField;
+ private JPanel portPane;
+ private JLabel label6;
+ private JTextField portField;
+ private JPanel usernamePane;
+ private JLabel label7;
+ private JTextField usernameField;
+ private JPanel passwordPane;
+ private JLabel label8;
+ private JTextField passwordField;
+ private JPanel modePane;
+ private JLabel label9;
+ private JPanel panel3;
+ private JRadioButton activeRb;
+ private JRadioButton passiveRb;
+ private JPanel endpointPane;
+ private JLabel label10;
+ private JTextField endpointField;
+ private JPanel bucketPane;
+ private JLabel label11;
+ private JTextField bucketField;
+ private JPanel accessKeyPane;
+ private JLabel label13;
+ private JTextField accessKeyField;
+ private JPanel accessSecretPane;
+ private JLabel label14;
+ private JTextField accessSecretField;
+ private JPanel domainPane;
+ private JLabel label15;
+ private JTextField domainField;
+ // JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
+}
diff --git a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigFromPane.jfd b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigFromPane.jfd
new file mode 100644
index 0000000..4efafa3
--- /dev/null
+++ b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigFromPane.jfd
@@ -0,0 +1,343 @@
+JFDML JFormDesigner: "8.2.3.0.386" Java: "17.0.11" encoding: "UTF-8"
+
+new FormModel {
+ contentType: "form/swing"
+ root: new FormRoot {
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$layoutConstraints": "fill,insets 0,gap 10 5"
+ "$columnConstraints": "[500,grow,fill]"
+ "$rowConstraints": "[][][][][][][][][][][][][][]"
+ } ) {
+ name: "this"
+ "minimumSize": new java.awt.Dimension( 340, 500 )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[320,fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "namePane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label1"
+ "text": "配置名"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "nameField"
+ "minimumSize": new java.awt.Dimension( 180, 34 )
+ "preferredSize": new java.awt.Dimension( 240, 34 )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "remarkPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label2"
+ "text": "备注"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "remarkField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 1,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "storagePane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label3"
+ "text": "存储器"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JComboBox" ) {
+ name: "storageComboBox"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 2,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "basePathPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label4"
+ "text": "基础路径"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "basePathField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 3,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "hostPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label5"
+ "text": "主机地址"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "hostField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 4,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "portPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label6"
+ "text": "主机端口"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "portField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 5,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "usernamePane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label7"
+ "text": "用户名"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "usernameField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 6,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "passwordPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label8"
+ "text": "密码"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "passwordField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 7,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "modePane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label9"
+ "text": "连接模式"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class org.jdesktop.swingx.HorizontalLayout ) ) {
+ name: "panel3"
+ add( new FormComponent( "javax.swing.JRadioButton" ) {
+ name: "activeRb"
+ "text": "主动模式"
+ "$buttonGroup": new FormReference( "buttonGroup1" )
+ } )
+ add( new FormComponent( "javax.swing.JRadioButton" ) {
+ name: "passiveRb"
+ "text": "被动模式"
+ "$buttonGroup": new FormReference( "buttonGroup1" )
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 8,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "endpointPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label10"
+ "text": "节点地址"
+ "horizontalAlignment": 4
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,alignx left,growx 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "endpointField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 9,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "bucketPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label11"
+ "text": "存储 bucket"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "bucketField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 10,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "accessKeyPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label13"
+ "text": "accessKey"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "accessKeyField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 11,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "accessSecretPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label14"
+ "text": "accessSecret"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "accessSecretField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 12,grow"
+ } )
+ add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
+ "$columnConstraints": "[fill]"
+ "$rowConstraints": "[]"
+ "$layoutConstraints": "fill,insets 0,hidemode 3"
+ } ) {
+ name: "domainPane"
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label15"
+ "text": "自定义域名"
+ "minimumSize": new java.awt.Dimension( 80, 16 )
+ "horizontalAlignment": 4
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "domainField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 0,growx"
+ } )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 13,grow"
+ } )
+ }, new FormLayoutConstraints( null ) {
+ "location": new java.awt.Point( 0, 0 )
+ "size": new java.awt.Dimension( 550, 880 )
+ } )
+ add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
+ name: "buttonGroup1"
+ }, new FormLayoutConstraints( null ) {
+ "location": new java.awt.Point( 0, 896 )
+ } )
+ }
+}
diff --git a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigPane.java b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigPane.java
new file mode 100644
index 0000000..e0bf23f
--- /dev/null
+++ b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileConfigPane.java
@@ -0,0 +1,523 @@
+/*
+ * Created by JFormDesigner on Thu Jun 13 19:52:21 CST 2024
+ */
+
+package com.lw.swing.view.intra.file;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.formdev.flatlaf.extras.FlatSVGIcon;
+import com.google.gson.JsonObject;
+import com.lw.dillon.admin.framework.common.pojo.CommonResult;
+import com.lw.dillon.admin.framework.common.pojo.PageResult;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
+import com.lw.dillon.admin.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
+import com.lw.dillon.admin.module.system.controller.admin.permission.vo.permission.PermissionAssignRoleDataScopeReqVO;
+import com.lw.dillon.admin.module.system.controller.admin.permission.vo.permission.PermissionAssignRoleMenuReqVO;
+import com.lw.dillon.admin.module.system.controller.admin.permission.vo.role.RoleRespVO;
+import com.lw.swing.components.*;
+import com.lw.swing.components.notice.WMessage;
+import com.lw.swing.components.table.renderer.OptButtonTableCellEditor;
+import com.lw.swing.components.table.renderer.OptButtonTableCellRenderer;
+import com.lw.swing.request.Request;
+import com.lw.swing.store.AppStore;
+import com.lw.swing.utils.BadgeLabelUtil;
+import com.lw.swing.view.MainFrame;
+import com.lw.swing.view.system.role.RoleAssignMenuPane;
+import com.lw.ui.request.api.file.FileConfigFeign;
+import com.lw.ui.request.api.system.PermissionFeign;
+import com.lw.ui.request.api.system.RoleFeign;
+import net.miginfocom.swing.MigLayout;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableModel;
+import java.awt.*;
+import java.util.List;
+import java.util.*;
+import java.util.concurrent.ExecutionException;
+
+import static com.lw.ui.utils.DictTypeEnum.INFRA_BOOLEAN_STRING;
+import static com.lw.ui.utils.DictTypeEnum.INFRA_FILE_STORAGE;
+import static javax.swing.JOptionPane.*;
+
+/**
+ * @author wenli
+ */
+public class FileConfigPane extends JPanel {
+ private String[] COLUMN_ID = {"编号", "配置名", "存储器", "备注", "主配置", "创建时间", "操作"};
+
+ private DefaultTableModel tableModel;
+
+ private WPaginationPane paginationPane;
+
+ public FileConfigPane() {
+ initComponents();
+ initListeners();
+ loadTableData();
+ }
+
+ private void initComponents() {
+ textField = new JTextField();
+ scrollPane1 = new WScrollPane();
+ centerPane = new JPanel();
+ scrollPane2 = new WScrollPane();
+ table = new JXTable(tableModel = new DefaultTableModel());
+ toolPane = new WPanel();
+ label7 = new JLabel();
+ nameTextField = new JTextField();
+ label9 = new JLabel();
+ storageComboBox = new JComboBox();
+ label10 = new JLabel();
+ startDateTextField = new WLocalDateCombo();
+ label11 = new JLabel();
+ endDateTextField = new WLocalDateCombo();
+ searchBut = new JButton();
+ reseBut = new JButton();
+ newBut = new JButton();
+
+ //======== this ========
+ setOpaque(false);
+ setLayout(new BorderLayout(10, 10));
+
+
+ //======== centerPane ========
+ {
+ centerPane.setOpaque(false);
+ centerPane.setLayout(new BorderLayout(10, 10));
+
+ //======== scrollPane2 ========
+ {
+ tableModel.setColumnIdentifiers(COLUMN_ID);
+ scrollPane2.setViewportView(table);
+ }
+
+ JPanel panel = new WPanel();
+ panel.setLayout(new BorderLayout());
+ panel.add(scrollPane2);
+ paginationPane = new WPaginationPane() {
+ @Override
+ public void setPageIndex(long pageIndex) {
+ super.setPageIndex(pageIndex);
+ loadTableData();
+ }
+ };
+ paginationPane.setOpaque(false);
+ panel.add(paginationPane, BorderLayout.SOUTH);
+ centerPane.add(panel, BorderLayout.CENTER);
+
+ //======== toolPane ========
+ {
+ toolPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[left]",
+ // rows
+ "[]"));
+ toolPane.setBorder(new EmptyBorder(10, 10, 10, 10));
+ //---- label7 ----
+ label7.setText("配置名");
+ toolPane.add(label7, "cell 0 0");
+
+ //---- userNameTextField ----
+ nameTextField.setColumns(15);
+ toolPane.add(nameTextField, "cell 0 0");
+
+ //---- label9 ----
+ label9.setText("存储器");
+ toolPane.add(label9, "cell 0 0");
+ toolPane.add(storageComboBox, "cell 0 0");
+
+ //---- label10 ----
+ label10.setText("创建时间");
+ toolPane.add(label10, "cell 0 0");
+
+ //---- startDateTextField ----
+ toolPane.add(startDateTextField, "cell 0 0");
+
+ //---- label11 ----
+ label11.setText("-");
+ toolPane.add(label11, "cell 0 0");
+
+ //---- endDateTextField ----
+ toolPane.add(endDateTextField, "cell 0 0");
+
+ //---- button1 ----
+ searchBut.setText("\u641c\u7d22");
+ toolPane.add(searchBut, "cell 0 0");
+
+ //---- reseBut ----
+ reseBut.setText("\u91cd\u7f6e");
+ toolPane.add(reseBut, "cell 0 0");
+
+ //---- newBut ----
+ newBut.setText("\u65b0\u589e");
+ toolPane.add(newBut, "cell 0 0");
+ }
+ centerPane.add(toolPane, BorderLayout.NORTH);
+ }
+ add(centerPane, BorderLayout.CENTER);
+ // JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
+
+ table.setRowHeight(40);
+
+ AppStore.getDictDataList(INFRA_FILE_STORAGE).forEach(dictDataSimpleRespVO -> {
+ storageComboBox.addItem(dictDataSimpleRespVO);
+ });
+
+ storageComboBox.setSelectedItem(null);
+ startDateTextField.setValue(null);
+ endDateTextField.setValue(null);
+
+
+ table.setDefaultRenderer(Object.class, new CenterTableCellRenderer());
+
+
+ }
+
+ private JToolBar creatBar() {
+ JToolBar optBar = new JToolBar();
+ optBar.setOpaque(false);
+ JButton edit = new JButton("修改");
+ edit.setForeground(UIManager.getColor("App.accentColor"));
+ edit.setIcon(new FlatSVGIcon("icons/xiugai.svg", 15, 15));
+ edit.addActionListener(e -> showEditDialog());
+ edit.setForeground(UIManager.getColor("App.accentColor"));
+
+ JButton del = new JButton("删除");
+ del.setIcon(new FlatSVGIcon("icons/delte.svg", 15, 15));
+ del.addActionListener(e -> del());
+ del.setForeground(UIManager.getColor("app-error-color-5"));
+
+ JButton primaryBut = new JButton("主配置");
+ primaryBut.addActionListener(e -> updateFileConfigMaster());
+ primaryBut.setForeground(UIManager.getColor("App.accentColor"));
+ primaryBut.setIcon(new FlatSVGIcon("icons/xinzeng.svg", 15, 15));
+
+ optBar.add(Box.createGlue());
+ optBar.add(edit);
+ optBar.add(primaryBut);
+ optBar.add(del);
+ optBar.add(Box.createGlue());
+ return optBar;
+
+ }
+
+ private void initListeners() {
+
+ reseBut.addActionListener(e -> reset());
+ searchBut.addActionListener(e -> loadTableData());
+ newBut.addActionListener(e -> showAddDialog(null));
+ }
+
+ private void reset() {
+ nameTextField.setText("");
+ storageComboBox.setSelectedItem(null);
+ startDateTextField.setValue(null);
+ endDateTextField.setValue(null);
+ loadTableData();
+ }
+
+ private void showAddDialog(Long id) {
+ FileConfigFromPane roleEditPane = new FileConfigFromPane();
+ roleEditPane.updateData(id);
+ int opt = WOptionPane.showOptionDialog(null, roleEditPane, "添加", OK_CANCEL_OPTION, PLAIN_MESSAGE, null, new Object[]{"确定", "取消"}, "确定");
+ if (opt == 0) {
+ add(roleEditPane.getValue());
+ }
+ }
+
+ private void showEditDialog() {
+
+
+ int selRow = table.getSelectedRow();
+ Long id = null;
+ if (selRow != -1) {
+ id = Convert.toLong(table.getValueAt(selRow, 0));
+ }
+
+ FileConfigFromPane roleEditPane = new FileConfigFromPane();
+ roleEditPane.updateData(id);
+ roleEditPane.revalidate();
+ int opt = WOptionPane.showOptionDialog(null, roleEditPane, "修改", OK_CANCEL_OPTION, PLAIN_MESSAGE, null, new Object[]{"确定", "取消"}, "确定");
+ if (opt == 0) {
+ edit(roleEditPane.getValue());
+ }
+ }
+
+
+ @Override
+ public void updateUI() {
+ super.updateUI();
+ if (table != null) {
+ table.setDefaultRenderer(Object.class, new CenterTableCellRenderer());
+ }
+ }
+
+
+ /**
+ * 添加
+ */
+ private void add(FileConfigSaveReqVO roleSaveReqVO) {
+
+ SwingWorker, Object> swingWorker = new SwingWorker, Object>() {
+ @Override
+ protected CommonResult doInBackground() throws Exception {
+ return Request.connector(FileConfigFeign.class).createFileConfig(roleSaveReqVO);
+ }
+
+ @Override
+ protected void done() {
+ try {
+ if (get().isSuccess()) {
+ WMessage.showMessageSuccess(MainFrame.getInstance(), "添加成功!");
+ loadTableData();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ swingWorker.execute();
+
+ }
+
+ private void edit(FileConfigSaveReqVO roleSaveReqVO) {
+
+
+ SwingWorker, Object> swingWorker = new SwingWorker, Object>() {
+ @Override
+ protected CommonResult doInBackground() throws Exception {
+ return Request.connector(FileConfigFeign.class).updateFileConfig(roleSaveReqVO);
+ }
+
+ @Override
+ protected void done() {
+ try {
+ if (get().isSuccess()) {
+ WMessage.showMessageSuccess(MainFrame.getInstance(), "修改成功!");
+ loadTableData();
+ }
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ swingWorker.execute();
+
+ }
+
+ private void del() {
+ Long id = null;
+ String userName = null;
+
+ int selRow = table.getSelectedRow();
+ if (selRow != -1) {
+ id = Convert.toLong(table.getValueAt(selRow, 0));
+ userName = Convert.toStr(table.getValueAt(selRow, 1));
+ }
+
+ int opt = WOptionPane.showOptionDialog(this, "是否确定删除[" + userName + "]?", "提示", OK_CANCEL_OPTION, WARNING_MESSAGE, null, null, null);
+
+ if (opt != 0) {
+ return;
+ }
+ Long finalId = id;
+ SwingWorker, Object> swingWorker = new SwingWorker, Object>() {
+ @Override
+ protected CommonResult doInBackground() throws Exception {
+ return Request.connector(FileConfigFeign.class).deleteFileConfig(finalId);
+ }
+
+ @Override
+ protected void done() {
+ try {
+ if (get().isSuccess()) {
+ WMessage.showMessageSuccess(MainFrame.getInstance(), "删除成功!");
+ loadTableData();
+ }
+ } catch (Exception e) {
+
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ swingWorker.execute();
+
+ }
+
+
+ private void updateFileConfigMaster() {
+
+ Long id = null;
+
+ int selRow = table.getSelectedRow();
+ if (selRow != -1) {
+ id = Convert.toLong(table.getValueAt(selRow, 0));
+ }
+
+ int opt = WOptionPane.showOptionDialog(this, "是否确认修改配置编号为"+id+"的数据项为主配置?", "提示", OK_CANCEL_OPTION, WARNING_MESSAGE, null, null, null);
+
+ if (opt != 0) {
+ return;
+ }
+
+ Long finalId = id;
+ SwingWorker, Object> swingWorker = new SwingWorker, Object>() {
+ @Override
+ protected CommonResult doInBackground() throws Exception {
+ return Request.connector(FileConfigFeign.class).updateFileConfigMaster(finalId);
+ }
+
+ @Override
+ protected void done() {
+ try {
+ if (get().isSuccess()) {
+ WMessage.showMessageSuccess(MainFrame.getInstance(), "修改成功!");
+ loadTableData();
+ }
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ swingWorker.execute();
+
+ }
+
+
+ public void loadTableData() {
+
+ Map queryMap = new HashMap<>();
+ queryMap.put("pageNo", paginationPane.getPageIndex());
+ queryMap.put("pageSize", paginationPane.getPageSize());
+
+ String name = null;
+ if (StrUtil.isNotBlank(nameTextField.getText())) {
+ name = nameTextField.getText();
+ }
+
+ Integer storage = null;
+ if (storageComboBox.getSelectedItem() != null) {
+ DictDataSimpleRespVO dictDataSimpleRespVO = (DictDataSimpleRespVO) storageComboBox.getSelectedItem();
+ storage = Convert.toInt(dictDataSimpleRespVO.getValue(), null);
+ }
+
+ queryMap.put("name", name);
+ queryMap.put("storage", storage);
+
+ if (ObjectUtil.isAllNotEmpty(startDateTextField.getValue(), endDateTextField.getValue())) {
+ String[] dateTimes = new String[2];
+ dateTimes[0] = DateUtil.format(startDateTextField.getValue().atTime(0, 0, 0), "yyyy-MM-dd HH:mm:ss");
+ dateTimes[1] = DateUtil.format(endDateTextField.getValue().atTime(23, 59, 59), "yyyy-MM-dd HH:mm:ss");
+ queryMap.put("createTime", dateTimes);
+ }
+
+ SwingWorker, Long> swingWorker = new SwingWorker, Long>() {
+ @Override
+ protected Vector doInBackground() throws Exception {
+ CommonResult> result = Request.connector(FileConfigFeign.class).getFileConfigPage(queryMap);
+
+ Vector tableData = new Vector<>();
+
+
+ if (result.isSuccess()) {
+
+ result.getData().getList().forEach(roleRespVO -> {
+ Vector rowV = new Vector();
+ rowV.add(roleRespVO.get("id").getAsLong());
+ rowV.add(roleRespVO.get("name").getAsString());
+ rowV.add(roleRespVO.get("storage").getAsInt());
+ rowV.add(roleRespVO.get("remark").getAsString());
+ rowV.add(roleRespVO.get("master").getAsBoolean());
+ rowV.add(DateUtil.format(Convert.toLocalDateTime(roleRespVO.get("createTime")), "yyyy-MM-dd HH:mm:ss"));
+ rowV.add(roleRespVO);
+ tableData.add(rowV);
+ });
+
+ publish(result.getData().getTotal());
+ }
+ return tableData;
+ }
+
+
+ @Override
+ protected void process(List chunks) {
+ chunks.forEach(total -> paginationPane.setTotal(total));
+ }
+
+ @Override
+ protected void done() {
+ try {
+
+
+ tableModel.setDataVector(get(), new Vector<>(Arrays.asList(COLUMN_ID)));
+ table.getColumn("操作").setMinWidth(180);
+ table.getColumn("操作").setCellRenderer(new OptButtonTableCellRenderer(creatBar()));
+ table.getColumn("操作").setCellEditor(new OptButtonTableCellEditor(creatBar()));
+
+ table.getColumn("存储器").setCellRenderer(new DefaultTableCellRenderer() {
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+ Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 10));
+ JLabel label = BadgeLabelUtil.getBadgeLabel(INFRA_FILE_STORAGE, value);
+ panel.add(label);
+ panel.setBackground(component.getBackground());
+ panel.setOpaque(isSelected);
+ return panel;
+ }
+ });
+ table.getColumn("主配置").setCellRenderer(new DefaultTableCellRenderer() {
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+ Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 10));
+ JLabel label = BadgeLabelUtil.getBadgeLabel(INFRA_BOOLEAN_STRING, value);
+ panel.add(label);
+ panel.setBackground(component.getBackground());
+ panel.setOpaque(isSelected);
+ return panel;
+ }
+ });
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+ };
+ swingWorker.execute();
+
+ }
+
+ // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
+ // Generated using JFormDesigner non-commercial license
+ private JTextField textField;
+ private JScrollPane scrollPane1;
+ private JPanel centerPane;
+ private JScrollPane scrollPane2;
+ private JTable table;
+ private JPanel toolPane;
+ private JLabel label7;
+ private JTextField nameTextField;
+ private JLabel label9;
+ private JComboBox storageComboBox;
+ private JLabel label10;
+ private WLocalDateCombo startDateTextField;
+ private JLabel label11;
+ private WLocalDateCombo endDateTextField;
+ private JButton searchBut;
+ private JButton reseBut;
+ private JButton newBut;
+ // JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
+}
diff --git a/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileListPane.java b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileListPane.java
new file mode 100644
index 0000000..2090cb0
--- /dev/null
+++ b/dillon-ui/dillon-ui-swing/src/main/java/com/lw/swing/view/intra/file/FileListPane.java
@@ -0,0 +1,448 @@
+/*
+ * Created by JFormDesigner on Thu Jun 13 19:52:21 CST 2024
+ */
+
+package com.lw.swing.view.intra.file;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.formdev.flatlaf.extras.FlatSVGIcon;
+import com.lw.dillon.admin.framework.common.pojo.CommonResult;
+import com.lw.dillon.admin.framework.common.pojo.PageResult;
+import com.lw.dillon.admin.module.infra.controller.admin.file.vo.file.FileRespVO;
+import com.lw.swing.components.*;
+import com.lw.swing.components.notice.WMessage;
+import com.lw.swing.components.table.renderer.OptButtonTableCellEditor;
+import com.lw.swing.components.table.renderer.OptButtonTableCellRenderer;
+import com.lw.swing.request.Request;
+import com.lw.swing.view.MainFrame;
+import com.lw.ui.request.api.file.FileConfigFeign;
+import com.lw.ui.request.api.file.FileFeign;
+import net.miginfocom.swing.MigLayout;
+import org.jdesktop.swingx.JXTable;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableModel;
+import java.awt.*;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+import java.util.*;
+import java.util.concurrent.ExecutionException;
+
+import static javax.swing.JOptionPane.*;
+
+/**
+ * @author wenli
+ */
+public class FileListPane extends JPanel {
+ private String[] COLUMN_ID = {"文件名", "文件路径", "URL", "文件类型", "文件内容", "上传时间", "操作"};
+
+ private DefaultTableModel tableModel;
+
+ private WPaginationPane paginationPane;
+
+ public FileListPane() {
+ initComponents();
+ initListeners();
+ loadTableData();
+ }
+
+ private void initComponents() {
+ textField = new JTextField();
+ scrollPane1 = new WScrollPane();
+ centerPane = new JPanel();
+ scrollPane2 = new WScrollPane();
+ table = new JXTable(tableModel = new DefaultTableModel());
+ toolPane = new WPanel();
+ label7 = new JLabel();
+ pathField = new JTextField();
+ label9 = new JLabel();
+ typeField = new JTextField();
+ label10 = new JLabel();
+ startDateTextField = new WLocalDateCombo();
+ label11 = new JLabel();
+ endDateTextField = new WLocalDateCombo();
+ searchBut = new JButton();
+ reseBut = new JButton();
+ newBut = new JButton();
+
+ //======== this ========
+ setOpaque(false);
+ setLayout(new BorderLayout(10, 10));
+
+
+ //======== centerPane ========
+ {
+ centerPane.setOpaque(false);
+ centerPane.setLayout(new BorderLayout(10, 10));
+
+ //======== scrollPane2 ========
+ {
+ tableModel.setColumnIdentifiers(COLUMN_ID);
+ scrollPane2.setViewportView(table);
+ }
+
+ JPanel panel = new WPanel();
+ panel.setLayout(new BorderLayout());
+ panel.add(scrollPane2);
+ paginationPane = new WPaginationPane() {
+ @Override
+ public void setPageIndex(long pageIndex) {
+ super.setPageIndex(pageIndex);
+ loadTableData();
+ }
+ };
+ paginationPane.setOpaque(false);
+ panel.add(paginationPane, BorderLayout.SOUTH);
+ centerPane.add(panel, BorderLayout.CENTER);
+
+ //======== toolPane ========
+ {
+ toolPane.setLayout(new MigLayout(
+ "fill,insets 0,hidemode 3",
+ // columns
+ "[left]",
+ // rows
+ "[]"));
+ toolPane.setBorder(new EmptyBorder(10, 10, 10, 10));
+ //---- label7 ----
+ label7.setText("文件路径");
+ toolPane.add(label7, "cell 0 0");
+
+ //---- userNameTextField ----
+ pathField.setColumns(15);
+ toolPane.add(pathField, "cell 0 0");
+
+ //---- label9 ----
+ label9.setText("文件类型");
+ toolPane.add(label9, "cell 0 0");
+ toolPane.add(typeField, "cell 0 0");
+
+ //---- label10 ----
+ label10.setText("创建时间");
+ toolPane.add(label10, "cell 0 0");
+
+ //---- startDateTextField ----
+ toolPane.add(startDateTextField, "cell 0 0");
+
+ //---- label11 ----
+ label11.setText("-");
+ toolPane.add(label11, "cell 0 0");
+
+ //---- endDateTextField ----
+ toolPane.add(endDateTextField, "cell 0 0");
+
+ //---- button1 ----
+ searchBut.setText("搜索");
+ toolPane.add(searchBut, "cell 0 0");
+
+ //---- reseBut ----
+ reseBut.setText("重置");
+ toolPane.add(reseBut, "cell 0 0");
+
+ //---- newBut ----
+ newBut.setText("上传文件");
+ toolPane.add(newBut, "cell 0 0");
+ }
+ centerPane.add(toolPane, BorderLayout.NORTH);
+ }
+ add(centerPane, BorderLayout.CENTER);
+ // JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
+
+ table.setRowHeight(40);
+
+ startDateTextField.setValue(null);
+ endDateTextField.setValue(null);
+
+
+ table.setDefaultRenderer(Object.class, new CenterTableCellRenderer());
+
+
+ }
+
+ private JToolBar creatBar() {
+ JToolBar optBar = new JToolBar();
+ optBar.setOpaque(false);
+
+ JButton del = new JButton("删除");
+ del.setIcon(new FlatSVGIcon("icons/delte.svg", 15, 15));
+ del.addActionListener(e -> del());
+ del.setForeground(UIManager.getColor("app-error-color-5"));
+
+ JButton downLoadBut = new JButton("下载");
+ downLoadBut.setIcon(new FlatSVGIcon("icons/xiazai.svg", 15, 15));
+ downLoadBut.addActionListener(e -> download());
+ del.setForeground(UIManager.getColor("App.accentColor"));
+
+ optBar.add(Box.createGlue());
+ optBar.add(downLoadBut);
+ optBar.add(del);
+ optBar.add(Box.createGlue());
+ return optBar;
+ }
+
+
+ private void initListeners() {
+
+ reseBut.addActionListener(e -> reset());
+ searchBut.addActionListener(e -> loadTableData());
+ newBut.addActionListener(e -> uploadFile());
+ }
+
+ private void reset() {
+ pathField.setText("");
+ typeField.setText(null);
+ startDateTextField.setValue(null);
+ endDateTextField.setValue(null);
+ loadTableData();
+ }
+
+ private void uploadFile() {
+ JFileChooser fileChooser = new JFileChooser();
+ int result = fileChooser.showOpenDialog(this);
+ if (result == JFileChooser.APPROVE_OPTION) {
+ File selectedFile = fileChooser.getSelectedFile();
+ SwingWorker, Object> swingWorker = new SwingWorker, Object>() {
+ @Override
+ protected CommonResult doInBackground() throws Exception {
+ return Request.fileConnector(FileFeign.class).uploadFile("", selectedFile);
+ }
+
+ @Override
+ protected void done() {
+ try {
+ if (get().isSuccess()) {
+ WMessage.showMessageSuccess(MainFrame.getInstance(), "上传成功!");
+ loadTableData();
+ }
+ } catch (Exception e) {
+
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ swingWorker.execute();
+ }
+ }
+
+
+ @Override
+ public void updateUI() {
+ super.updateUI();
+ if (table != null) {
+ table.setDefaultRenderer(Object.class, new CenterTableCellRenderer());
+ }
+ }
+
+
+ private void del() {
+ Long id = null;
+ String userName = null;
+
+ int selRow = table.getSelectedRow();
+ if (selRow != -1) {
+ id = Convert.toLong(table.getValueAt(selRow, 0));
+ userName = Convert.toStr(table.getValueAt(selRow, 1));
+ }
+
+ int opt = WOptionPane.showOptionDialog(this, "是否确定删除[" + userName + "]?", "提示", OK_CANCEL_OPTION, WARNING_MESSAGE, null, null, null);
+
+ if (opt != 0) {
+ return;
+ }
+ Long finalId = id;
+ SwingWorker, Object> swingWorker = new SwingWorker, Object>() {
+ @Override
+ protected CommonResult doInBackground() throws Exception {
+ return Request.connector(FileConfigFeign.class).deleteFileConfig(finalId);
+ }
+
+ @Override
+ protected void done() {
+ try {
+ if (get().isSuccess()) {
+ WMessage.showMessageSuccess(MainFrame.getInstance(), "删除成功!");
+ loadTableData();
+ }
+ } catch (Exception e) {
+
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ swingWorker.execute();
+
+ }
+
+
+ private void download() {
+
+ FileRespVO respVO=null;
+ int selRow = table.getSelectedRow();
+ if (selRow != -1) {
+ respVO = (FileRespVO) table.getValueAt(selRow, COLUMN_ID.length - 1);
+ }
+
+
+ if (respVO == null) {
+ return;
+ }
+ // Check if Desktop API is supported on the current platform
+ if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+ try {
+ Desktop.getDesktop().browse(new URI(respVO.getUrl()));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+// showAlert("Error", "Desktop API is not supported on this platform.");
+ }
+
+ }
+
+
+ public void loadTableData() {
+
+ Map queryMap = new HashMap<>();
+ queryMap.put("pageNo", paginationPane.getPageIndex());
+ queryMap.put("pageSize", paginationPane.getPageSize());
+
+ String path = null;
+ String type = null;
+ if (StrUtil.isNotBlank(pathField.getText())) {
+ path = pathField.getText();
+ }
+ if (StrUtil.isNotBlank(typeField.getText())) {
+ type = typeField.getText();
+ }
+
+
+ queryMap.put("path", path);
+ queryMap.put("type", type);
+
+ if (ObjectUtil.isAllNotEmpty(startDateTextField.getValue(), endDateTextField.getValue())) {
+ String[] dateTimes = new String[2];
+ dateTimes[0] = DateUtil.format(startDateTextField.getValue().atTime(0, 0, 0), "yyyy-MM-dd HH:mm:ss");
+ dateTimes[1] = DateUtil.format(endDateTextField.getValue().atTime(23, 59, 59), "yyyy-MM-dd HH:mm:ss");
+ queryMap.put("createTime", dateTimes);
+ }
+
+ SwingWorker, Long> swingWorker = new SwingWorker, Long>() {
+ @Override
+ protected Vector doInBackground() throws Exception {
+ CommonResult> result = Request.connector(FileFeign.class).getFilePage(queryMap);
+
+ Vector tableData = new Vector<>();
+
+
+ if (result.isSuccess()) {
+
+ result.getData().getList().forEach(respVO -> {
+ Vector rowV = new Vector();
+ rowV.add(respVO.getName());
+ rowV.add(respVO.getPath());
+ rowV.add(respVO.getUrl());
+ rowV.add(respVO.getType());
+ rowV.add(respVO);
+ rowV.add(DateUtil.format(respVO.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
+ rowV.add(respVO);
+ tableData.add(rowV);
+ });
+
+ publish(result.getData().getTotal());
+ }
+ return tableData;
+ }
+
+
+ @Override
+ protected void process(List chunks) {
+ chunks.forEach(total -> paginationPane.setTotal(total));
+ }
+
+ @Override
+ protected void done() {
+ try {
+
+
+ tableModel.setDataVector(get(), new Vector<>(Arrays.asList(COLUMN_ID)));
+ table.getColumn("操作").setMinWidth(180);
+ table.getColumn("操作").setCellRenderer(new OptButtonTableCellRenderer(creatBar()));
+ table.getColumn("操作").setCellEditor(new OptButtonTableCellEditor(creatBar()));
+
+ table.getColumn("文件内容").setCellRenderer(new DefaultTableCellRenderer() {
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+ Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ JPanel panel = new JPanel(new BorderLayout());
+ table.setRowHeight(row, 35);
+ if (value instanceof FileRespVO) {
+
+ if (StrUtil.contains(((FileRespVO) value).getType(), "image")) {
+ URL url = null;
+ try {
+ url = new URL(((FileRespVO) value).getUrl());
+ ImageIcon imageIcon = new ImageIcon(url);
+ // Create a label and set the icon
+ JLabel imageLabel = new JLabel(imageIcon);
+ panel.add(imageLabel);
+ table.setRowHeight(row, 180);
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+
+ } else {
+
+ }
+ }
+ panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ panel.setBackground(component.getBackground());
+ panel.setOpaque(isSelected);
+ return panel;
+ }
+ });
+
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ } catch (ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+ };
+ swingWorker.execute();
+
+ }
+
+ // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
+ // Generated using JFormDesigner non-commercial license
+ private JTextField textField;
+ private JScrollPane scrollPane1;
+ private JPanel centerPane;
+ private JScrollPane scrollPane2;
+ private JTable table;
+ private JPanel toolPane;
+ private JLabel label7;
+ private JTextField pathField;
+ private JLabel label9;
+ private JTextField typeField;
+ private JLabel label10;
+ private WLocalDateCombo startDateTextField;
+ private JLabel label11;
+ private WLocalDateCombo endDateTextField;
+ private JButton searchBut;
+ private JButton reseBut;
+ private JButton newBut;
+ // JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
+}
diff --git a/dillon-ui/dillon-ui-swing/src/main/resources/icons/xiazai.svg b/dillon-ui/dillon-ui-swing/src/main/resources/icons/xiazai.svg
new file mode 100644
index 0000000..c38ec77
--- /dev/null
+++ b/dillon-ui/dillon-ui-swing/src/main/resources/icons/xiazai.svg
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file