2025年7月7日15:32:03

master
zhangmeng 2025-07-07 15:32:10 +08:00
parent eb7ba65b09
commit 6d95eeed3c
13 changed files with 300 additions and 282 deletions

View File

@ -1,3 +0,0 @@
endpoint = http://192.168.1.254:9000
accessKey = minioadmin
secretKey = minioadmin

78
pom.xml
View File

@ -18,25 +18,7 @@
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.5.7</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.8.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
<version>8.5.17</version>
</dependency>
<dependency>
@ -83,59 +65,41 @@
</dependency>
<dependency>
<groupId>com.github.leewyatt</groupId>
<artifactId>rxcontrols</artifactId>
<!-- 11.x.y -->
<version>11.0.2</version>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.49</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>1.27</version> <!-- 请检查并使用最新版本 -->
</dependency>
</dependencies>
<build>
<plugins>
<!-- 使用maven-jar-plugin和maven-dependency-plugin插件打包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.zhangmeng.minio.MiniToolsApplication</mainClass>
</manifest>
</archive>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<mainClass>com.zhangmeng.minio.MiniToolsApplication
</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>

View File

@ -5,6 +5,7 @@ import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
@ -18,9 +19,15 @@ public class MiniToolsApplication extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
MinioUtils.objectMap.put(MinioUtils.primaryStage,primaryStage);
Parent root = FXMLLoader.load(this.getClass().getResource("/fxml/main.fxml"));
AnchorPane root = FXMLLoader.load(this.getClass().getResource("/fxml/main.fxml"));
primaryStage.setScene(new Scene(root));
primaryStage.setTitle("javafx minio 工具");
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View File

@ -1,15 +0,0 @@
package com.zhangmeng.minio;
import javafx.application.Application;
/**
* @author zhangmeng
* @version 1.0
* @date 2024-03-11 16:44
*/
public class Start {
public static void main(String[] args) {
Application.launch(MiniToolsApplication.class,args);
}
}

View File

@ -0,0 +1,22 @@
package com.zhangmeng.minio.controller;
import javafx.event.ActionEvent;
import javafx.scene.control.TextField;
public class ConfigController {
public TextField url;
public TextField username;
public TextField password;
public void initialize() {
}
public void handleSave(ActionEvent actionEvent) {
}
public void handleCancel(ActionEvent actionEvent) {
}
}

View File

@ -1,6 +1,9 @@
package com.zhangmeng.minio.controller;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONPObject;
import com.zhangmeng.minio.model.BucketFile;
import com.zhangmeng.minio.model.Config;
import com.zhangmeng.minio.utils.AlertUtils;
import com.zhangmeng.minio.utils.MinioUtils;
import com.zhangmeng.minio.utils.ResourceUtils;
@ -14,10 +17,12 @@ import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
@ -29,9 +34,11 @@ import java.awt.datatransfer.Transferable;
import java.io.*;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;
import java.util.Properties;
/**
* @author zhangmeng
* @version 1.0
@ -68,18 +75,12 @@ public class MinioController {
@FXML
public Button bucket_btn;
@FXML
public TextField endpoint;
@FXML
public TextField accessKey;
@FXML
public TextField secretKey;
@FXML
public Button save_config;
@FXML
public ComboBox<String> backet_list;
@ -98,11 +99,18 @@ public class MinioController {
@FXML
public TableColumn<BucketFile, String> file_bucket;
public ImageView preview;
private File upload_file;
@FXML
public void initialize() {
endpoint = new TextField();
accessKey = new TextField();
secretKey = new TextField();
tableview.setItems(list);
file_name.setCellValueFactory(new PropertyValueFactory<BucketFile, String>("fileName"));
file_size.setCellValueFactory(new PropertyValueFactory<BucketFile, Number>("size"));
@ -122,13 +130,10 @@ public class MinioController {
BucketFile selectedItem = tableview.getSelectionModel().getSelectedItem();
// 获取系统剪贴板
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
// 创建一个 StringSelection 对象,该对象封装了要复制的文本
Transferable transferableText = new StringSelection(selectedItem.getUrl());
// 将文本内容设置到剪贴板
clipboard.setContents(transferableText, null);
@ -154,7 +159,7 @@ public class MinioController {
@Override
public void changed(ObservableValue<? extends BucketFile> observable, BucketFile oldValue, BucketFile newValue) {
if (newValue != null) {
System.out.println(newValue.getFileName());
loadPreview(backet_list.getSelectionModel().getSelectedItem(), newValue.getFileName());
}
}
});
@ -166,19 +171,35 @@ public class MinioController {
FileInputStream fileInputStream = null;
try {
FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("/fxml/config.fxml"));
AnchorPane root = fxmlLoader.load();
VBox root = fxmlLoader.load();
ObservableMap<String, Object> namespace = fxmlLoader.getNamespace();
TextArea text_area = (TextArea) namespace.get("text_area");
Button save_p = (Button) namespace.get("save_p");
TextField url = (TextField) namespace.get("url");
TextField username = (TextField) namespace.get("username");
TextField password = (TextField) namespace.get("password");
Button save = (Button) namespace.get("save");
Button cancel = (Button) namespace.get("cancel");
fileInputStream = new FileInputStream(ResourceUtils.getPropertiesFile());
byte[] bytes = fileInputStream.readAllBytes();
text_area.setText(new String(bytes, StandardCharsets.UTF_8));
Stage stage = AlertUtils.alert("minio 配置文件", root, 600, 410, (Stage) MinioUtils.objectMap.get(MinioUtils.primaryStage));
save_p.setOnAction(event1 -> {
String json = new String(bytes, StandardCharsets.UTF_8);
if (json != null && !json.equals("")) {
Config parseObject = JSON.parseObject(json, Config.class);
endpoint.setText(parseObject.getEndpoint());
url.setText(parseObject.getEndpoint());
accessKey.setText(parseObject.getAccessKey());
username.setText(parseObject.getAccessKey());
secretKey.setText(parseObject.getSecretKey());
password.setText(parseObject.getSecretKey());
}
Stage stage = AlertUtils.alert("minio 配置文件", root, 600, 180, (Stage) MinioUtils.objectMap.get(MinioUtils.primaryStage));
save.setOnAction(event1 -> {
stage.close();
try {
FileWriter fileWriter = new FileWriter(ResourceUtils.getPropertiesFile());
fileWriter.write(text_area.getText());
Config config = new Config(endpoint.getText(), accessKey.getText(), secretKey.getText());
String json_config = JSON.toJSONString(config);
fileWriter.write(json_config);
fileWriter.flush();
fileWriter.close();
load_property();
@ -232,9 +253,9 @@ public class MinioController {
AlertUtils.alert_warning("请选择上传的文件后再试!");
return;
}
MinioUtils.upload_file(upload_file);
reload();
String objectUrl = MinioUtils.getPresignedObjectUrl(bucket_name.getText(), upload_file.getName());
preview.setImage(new javafx.scene.image.Image(objectUrl));
});
bucket_btn.setOnAction(event -> {
@ -261,14 +282,10 @@ public class MinioController {
load_bucket_list();
});
load_property();
save_config.setOnAction(event -> save_properties());
backet_list.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue != null) {
if (newValue != null && !newValue.equals("")) {
MinioUtils.objectMap.put(MinioUtils.current_bucket, newValue);
reload();
}
@ -331,6 +348,11 @@ public class MinioController {
}
}
private void loadPreview(String bucketName, String objectName){
String objectUrl = MinioUtils.getPresignedObjectUrl(bucketName, objectName);
preview.setImage(new javafx.scene.image.Image(objectUrl));
}
public void load_bucket_list() {
//刷新bucket列表
//获取所有储存桶
@ -345,38 +367,21 @@ public class MinioController {
}
public void load_property() {
Properties prop = new Properties();
File file = ResourceUtils.getPropertiesFile();
if (file != null) {
InputStream input = null;
try {
input = new FileInputStream(file);
// load a properties file
prop.load(input);
// get the property value and print it out
String endpoint = prop.getProperty("endpoint");
this.endpoint.setText(endpoint);
String accessKey = prop.getProperty("accessKey");
this.accessKey.setText(accessKey);
String secretKey = prop.getProperty("secretKey");
this.secretKey.setText(secretKey);
MinioUtils.objectMap.put("endpoint", endpoint);
MinioUtils.objectMap.put("accessKey", accessKey);
MinioUtils.objectMap.put("secretKey", secretKey);
String json = Files.readString(file.toPath());
Config config = JSON.parseObject(json, Config.class);
this.endpoint.setText(config.getEndpoint());
this.accessKey.setText(config.getAccessKey());
this.secretKey.setText(config.getSecretKey());
MinioUtils.objectMap.put("endpoint", config.getEndpoint());
MinioUtils.objectMap.put("accessKey", config.getAccessKey());
MinioUtils.objectMap.put("secretKey", config.getSecretKey());
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
load_bucket_list();
}

View File

@ -0,0 +1,47 @@
package com.zhangmeng.minio.model;
public class Config {
private String endpoint;
private String accessKey;
private String secretKey;
public Config(String endpoint, String accessKey, String secretKey) {
this.endpoint = endpoint;
this.accessKey = accessKey;
this.secretKey = secretKey;
}
@Override
public String toString() {
return "Config{" +
"endpoint='" + endpoint + '\'' +
", accessKey='" + accessKey + '\'' +
", secretKey='" + secretKey + '\'' +
'}';
}
public String getEndpoint() {
return endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
public String getAccessKey() {
return accessKey;
}
public void setAccessKey(String accessKey) {
this.accessKey = accessKey;
}
public String getSecretKey() {
return secretKey;
}
public void setSecretKey(String secretKey) {
this.secretKey = secretKey;
}
}

View File

@ -7,10 +7,7 @@ import io.minio.http.Method;
import io.minio.messages.Bucket;
import io.minio.messages.Item;
import javafx.application.Platform;
import javafx.scene.control.TextField;
import org.apache.commons.lang3.StringUtils;
import org.apache.tika.Tika;
import org.apache.tika.exception.TikaException;
import java.io.*;
import java.security.InvalidKeyException;
@ -32,8 +29,6 @@ public class MinioUtils {
private static MinioClient minioClient = null;
public static Map<String,Object> objectMap = new HashMap<>();
public static String current_bucket = "current_bucket";
public static String primaryStage = "primaryStage";
@ -65,6 +60,7 @@ public class MinioUtils {
return null;
}
minioClient = MinioClient.builder().endpoint(endpoint.toString()).credentials(accessKey.toString(), secretKey.toString()).build();
}
return minioClient;
}
@ -77,23 +73,7 @@ public class MinioUtils {
public static List<Bucket> getAllBuckets() {
try {
return getDefault().listBuckets();
} catch (ErrorResponseException e) {
e.printStackTrace();
} catch (InsufficientDataException e) {
e.printStackTrace();
} catch (InternalException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidResponseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (ServerException e) {
e.printStackTrace();
} catch (XmlParserException e) {
} catch (ErrorResponseException | InsufficientDataException | InvalidKeyException | InternalException | InvalidResponseException | IOException | NoSuchAlgorithmException | ServerException | XmlParserException e) {
e.printStackTrace();
}
return null;
@ -109,23 +89,7 @@ public class MinioUtils {
if (!bucketExists(bucketName)) {
try {
getDefault().makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
} catch (ErrorResponseException e) {
e.printStackTrace();
} catch (InsufficientDataException e) {
e.printStackTrace();
} catch (InternalException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidResponseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (ServerException e) {
e.printStackTrace();
} catch (XmlParserException e) {
} catch (ErrorResponseException | InternalException | InvalidKeyException | InvalidResponseException | IOException | NoSuchAlgorithmException | XmlParserException | ServerException | InsufficientDataException e) {
e.printStackTrace();
}
}else {
@ -144,23 +108,7 @@ public class MinioUtils {
public static Boolean bucketExists(String bucketName) {
try {
return getDefault().bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
} catch (ErrorResponseException e) {
e.printStackTrace();
} catch (InsufficientDataException e) {
e.printStackTrace();
} catch (InternalException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidResponseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (ServerException e) {
e.printStackTrace();
} catch (XmlParserException e) {
} catch (ErrorResponseException | InsufficientDataException | InternalException | InvalidResponseException | NoSuchAlgorithmException | XmlParserException | ServerException | IOException | InvalidKeyException e) {
e.printStackTrace();
}
return null;
@ -192,23 +140,9 @@ public class MinioUtils {
Item item = null;
try {
item = o.get();
} catch (ErrorResponseException e) {
e.printStackTrace();
} catch (InsufficientDataException e) {
e.printStackTrace();
} catch (InternalException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidResponseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (ServerException e) {
e.printStackTrace();
} catch (XmlParserException e) {
} catch (ErrorResponseException | InsufficientDataException | InvalidKeyException |
InvalidResponseException | InternalException | IOException | NoSuchAlgorithmException |
ServerException | XmlParserException e) {
e.printStackTrace();
}
list.add(item);
@ -231,23 +165,7 @@ public class MinioUtils {
.method(Method.GET).build();
try {
return getDefault() .getPresignedObjectUrl(args);
} catch (ErrorResponseException e) {
e.printStackTrace();
} catch (InsufficientDataException e) {
e.printStackTrace();
} catch (InternalException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidResponseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (XmlParserException e) {
e.printStackTrace();
} catch (ServerException e) {
} catch (ErrorResponseException | InsufficientDataException | InvalidKeyException | InvalidResponseException | NoSuchAlgorithmException | ServerException | XmlParserException | IOException | InternalException e) {
e.printStackTrace();
}
return null;
@ -275,7 +193,7 @@ public class MinioUtils {
public static void upload_file(File file){
//文件名
String fileName = file.getName();
String newFileName = System.currentTimeMillis() + "." + StringUtils.substringAfterLast(fileName, ".");
String newFileName = System.currentTimeMillis() + "." + getFileExtension(fileName);
String contentType = getContentType(file);
String bucketName = objectMap.get(current_bucket).toString();
if (bucketName == null){
@ -285,6 +203,77 @@ public class MinioUtils {
uploadFile(bucketName, file, newFileName, contentType);
}
public static String getContentType(File file) {
String fileName = file.getName();
String extension = getFileExtension(fileName).toLowerCase();
return switch (extension) {
case "jpg", "jpeg" -> "image/jpeg";
case "png" -> "image/png";
case "mp4" -> "video/mp4";
case "gif" -> "image/gif";
case "txt" -> "text/plain";
case "pdf" -> "application/pdf";
case "doc" -> "application/msword";
case "docx" -> "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
case "xls" -> "application/vnd.ms-excel";
case "xlsx" -> "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
case "ppt" -> "application/vnd.ms-powerpoint";
case "pptx" -> "application/vnd.openxmlformats-officedocument.presentationml.presentation";
case "zip" -> "application/zip";
case "tar" -> "application/x-tar";
case "json" -> "application/json";
case "html" -> "text/html";
case "css" -> "text/css";
case "js" -> "application/javascript";
case "mp3" -> "audio/mp3";
case "wav" -> "audio/wav";
case "flac" -> "audio/flac";
case "aac" -> "audio/aac";
case "ogg" -> "audio/ogg";
case "avi" -> "video/avi";
case "mov" -> "video/quicktime";
case "wmv" -> "video/x-ms-wmv";
case "mkv" -> "video/x-matroska";
case "flv" -> "video/x-flv";
case "swf" -> "application/x-shockwave-flash";
case "psd" -> "image/vnd.adobe.photoshop";
case "ai" -> "application/postscript";
case "eps" -> "application/postscript";
case "ps" -> "application/postscript";
case "svg" -> "image/svg+xml";
case "tif" -> "image/tiff";
case "tiff" -> "image/tiff";
case "ico" -> "image/x-icon";
case "md" -> "text/markdown";
case "yaml" -> "text/yaml";
case "yml" -> "text/yaml";
case "xml" -> "text/xml";
case "csv" -> "text/csv";
case "tsv" -> "text/tab-separated-values";
case "jsonl" -> "application/json-seq";
case "bin" -> "application/octet-stream";
case "exe" -> "application/octet-stream";
case "dll" -> "application/octet-stream";
case "so" -> "application/octet-stream";
case "class" -> "application/octet-stream";
case "war" -> "application/octet-stream";
case "ear" -> "application/octet-stream";
case "rar" -> "application/octet-stream";
case "gz" -> "application/gzip";
default -> "application/octet-stream";
};
}
// 原生 Java 的等价方法
public static String getFileExtension(String fileName) {
if (fileName == null) return "";
int lastDotIndex = fileName.lastIndexOf('.');
// 判断没有点,或者点是第一个字符(例如 ".gitignore"
if (lastDotIndex == -1 || lastDotIndex == 0) {
return fileName;
}
return fileName.substring(lastDotIndex + 1);
}
/**
* 使MultipartFile
*
@ -305,23 +294,7 @@ public class MinioUtils {
.contentType(contentType)
.stream(inputStream,inputStream.available(), -1)
.build());
} catch (IOException e) {
e.printStackTrace();
} catch (ServerException e) {
e.printStackTrace();
} catch (InsufficientDataException e) {
e.printStackTrace();
} catch (ErrorResponseException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidResponseException e) {
e.printStackTrace();
} catch (XmlParserException e) {
e.printStackTrace();
} catch (InternalException e) {
} catch (IOException | XmlParserException | InternalException | InvalidKeyException | ErrorResponseException | ServerException | InsufficientDataException | InvalidResponseException | NoSuchAlgorithmException e) {
e.printStackTrace();
} finally {
if (inputStream != null){
@ -334,15 +307,4 @@ public class MinioUtils {
}
return null;
}
public static String getContentType(File file){
Tika tika = new Tika();
try {
return tika.detect(file);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -11,14 +11,13 @@ import java.io.IOException;
*/
public class ResourceUtils {
/**
* Properties prop = new Properties();
* URL resource = this.getClass().getResource("/minio.properties");
*/
public static File getPropertiesFile(){
String file_path = System.getProperty("user.dir") + "/minio.properties";
String file_path = System.getProperty("user.dir") + "/minio.json";
File file = new File(file_path);
if (!file.exists()){
try {

View File

@ -0,0 +1,17 @@
module javafx.tools.minio {
requires javafx.controls;
requires javafx.fxml;
requires java.sql;
requires java.datatransfer;
requires java.desktop;
requires minio;
requires com.fasterxml.jackson.core;
requires com.alibaba.fastjson2;
opens com.zhangmeng.minio to javafx.graphics;
opens com.zhangmeng.minio.controller to javafx.fxml;
exports com.zhangmeng.minio.controller;
exports com.zhangmeng.minio.model;
}

View File

@ -1,17 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<AnchorPane prefHeight="323.0" prefWidth="600.0" style="-fx-border-width: 0;-fx-font-size: 14" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TextArea fx:id="text_area" layoutX="100.0" layoutY="80.0" prefHeight="255.0" prefWidth="600.0" style="-fx-border-width: 0;-fx-focus-color: null" AnchorPane.bottomAnchor="68.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<Button fx:id="save_p" layoutX="269.0" layoutY="271.0" mnemonicParsing="false" prefHeight="20.0" prefWidth="62.0" text="确定" AnchorPane.bottomAnchor="22.0">
<font>
<Font size="15.0" />
</font>
</Button>
</children>
</AnchorPane>
<VBox spacing="10" xmlns:fx="http://javafx.com/fxml"
fx:controller="com.zhangmeng.minio.controller.ConfigController">
<padding>
<Insets top="10" right="10" bottom="10" left="10"/>
</padding>
<GridPane hgap="10" vgap="10">
<columnConstraints>
<ColumnConstraints minWidth="80" prefWidth="100"/>
<ColumnConstraints hgrow="ALWAYS"/>
</columnConstraints>
<Label text="minio服务器地址:" GridPane.rowIndex="0" GridPane.columnIndex="0"/>
<TextField fx:id="url" GridPane.rowIndex="0" GridPane.columnIndex="1"/>
<Label text="用户名:" GridPane.rowIndex="1" GridPane.columnIndex="0"/>
<TextField fx:id="username" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
<!-- 描述 -->
<Label text="密码:" GridPane.rowIndex="2" GridPane.columnIndex="0"/>
<TextField fx:id="password" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
</GridPane>
<HBox spacing="10" alignment="CENTER_RIGHT">
<Button fx:id="save" text="保存" onAction="#handleSave" defaultButton="true"/>
<Button fx:id="cancel" text="取消" onAction="#handleCancel" cancelButton="true"/>
</HBox>
</VBox>

View File

@ -9,22 +9,15 @@
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<AnchorPane prefHeight="649" prefWidth="1200" stylesheets="@../css/main.css" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.minio.controller.MinioController">
<AnchorPane prefHeight="649" prefWidth="1200" stylesheets="@../css/main.css" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.minio.controller.MinioController">
<children>
<AnchorPane fx:id="center" layoutY="25.0" prefHeight="623.0" prefWidth="1200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="25.0">
<children>
<Label layoutX="57.0" layoutY="53.0" text="endpoint :" />
<Label layoutX="55.0" layoutY="119.0" text="accessKey :" />
<Label layoutX="56.0" layoutY="181.0" text="secretKey :" />
<TextField fx:id="endpoint" layoutX="143.0" layoutY="49.0" prefHeight="23.0" prefWidth="207.0" />
<TextField fx:id="accessKey" layoutX="143.0" layoutY="115.0" prefHeight="23.0" prefWidth="207.0" />
<TextField fx:id="secretKey" layoutX="143.0" layoutY="177.0" prefHeight="23.0" prefWidth="207.0" />
<ComboBox fx:id="backet_list" layoutX="500.0" layoutY="114.0" prefHeight="25.0" prefWidth="207.0" />
<Label layoutX="391.0" layoutY="119.0" text="backetList :" />
<Button fx:id="save_config" layoutX="215.0" layoutY="233.0" mnemonicParsing="false" text="保存配置" />
<TableView fx:id="tableview" layoutX="378.0" layoutY="277.0" prefHeight="347.0" prefWidth="1200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="277.0">
<TableView fx:id="tableview" layoutX="378.0" layoutY="277.0" prefHeight="347.0" prefWidth="1200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="151.0">
<columns>
<TableColumn fx:id="file_bucket" prefWidth="300.0" text="bucket名称" />
<TableColumn fx:id="file_name" prefWidth="270.0" text="文件名称" />
@ -33,13 +26,17 @@
</columns>
</TableView>
<Label layoutX="391.0" layoutY="53.0" text="createBucket :" />
<TextField fx:id="bucket_name" layoutX="500.0" layoutY="49.0" />
<Button fx:id="bucket_btn" layoutX="677.0" layoutY="49.0" mnemonicParsing="false" text="创建bucket" />
<Label layoutX="394.0" layoutY="181.0" text="上传文件 :" />
<TextField fx:id="upload_path" layoutX="500.0" layoutY="177.0" prefHeight="23.0" prefWidth="207.0" />
<Button fx:id="upload" layoutX="792.0" layoutY="177.0" mnemonicParsing="false" text="上传" />
<Button fx:id="choose_upload_file" layoutX="717.0" layoutY="177.0" mnemonicParsing="false" text="选择文件" />
<Label layoutX="14.0" layoutY="16.0" text="createBucket :" />
<TextField fx:id="bucket_name" layoutX="111.0" layoutY="10.0" prefHeight="27.0" prefWidth="348.0" />
<Label layoutX="23.0" layoutY="58.0" text="backetList :" />
<ComboBox fx:id="backet_list" layoutX="112.0" layoutY="52.0" prefHeight="27.0" prefWidth="346.0" />
<Label layoutX="28.0" layoutY="102.0" text="上传文件 :" />
<TextField fx:id="upload_path" layoutX="112.0" layoutY="96.0" prefHeight="27.0" prefWidth="347.0" />
<HBox layoutX="792.0" layoutY="6.0" />
<Button fx:id="choose_upload_file" layoutX="484.0" layoutY="99.0" mnemonicParsing="false" prefHeight="23.0" prefWidth="69.0" text="选择文件" />
<Button fx:id="upload" layoutX="571.0" layoutY="99.0" mnemonicParsing="false" prefHeight="23.0" prefWidth="58.0" text="上传" />
<ImageView fx:id="preview" fitHeight="133.0" fitWidth="211.0" layoutX="696.0" layoutY="7.0" pickOnBounds="true" preserveRatio="true" />
<Button fx:id="bucket_btn" layoutX="484.0" layoutY="11.0" mnemonicParsing="false" text="创建bucket" />
</children>
</AnchorPane>
<MenuBar prefHeight="25.0" prefWidth="240.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">

View File

@ -1,3 +0,0 @@
endpoint = http://192.168.1.254:9000
accessKey = minioadmin
secretKey = minioadmin