commit
a606dbc188
@ -13,7 +13,7 @@ public class PopUpUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取错误弹窗
|
* 设置错误弹窗
|
||||||
*
|
*
|
||||||
* @param title 弹窗标题
|
* @param title 弹窗标题
|
||||||
* @param headerText 头文本
|
* @param headerText 头文本
|
||||||
@ -23,9 +23,10 @@ public class PopUpUtil {
|
|||||||
* @apiNote
|
* @apiNote
|
||||||
* @since 2023/9/3 11:54
|
* @since 2023/9/3 11:54
|
||||||
*/
|
*/
|
||||||
public static void errorAlert(String title, String headerText, String message, AppDialog.ButtonAction leftBtnAction, AppDialog.ButtonAction rightBtnAction) {
|
public static void errorAlert(
|
||||||
AppDialog.AppDialogBuilder builder = new AppDialog.AppDialogBuilder();
|
String title, String headerText, String message,
|
||||||
builder
|
AppDialog.ButtonAction leftBtnAction, AppDialog.ButtonAction rightBtnAction) {
|
||||||
|
getCustomDialog()
|
||||||
.setDialogType(AppDialog.DialogType.ERROR)
|
.setDialogType(AppDialog.DialogType.ERROR)
|
||||||
.setTitle(title)
|
.setTitle(title)
|
||||||
.setHeaderText(headerText)
|
.setHeaderText(headerText)
|
||||||
@ -34,4 +35,86 @@ public class PopUpUtil {
|
|||||||
.setRightBtnAction(rightBtnAction)
|
.setRightBtnAction(rightBtnAction)
|
||||||
.build().showAndWait();
|
.build().showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置信息弹窗
|
||||||
|
*
|
||||||
|
* @param title 弹窗标题
|
||||||
|
* @param headerText 头文本
|
||||||
|
* @param message 消息文本
|
||||||
|
* @param leftBtnAction 左侧按钮点击事件
|
||||||
|
* @param rightBtnAction 右侧按钮点击事件
|
||||||
|
* @apiNote
|
||||||
|
* @since 2023/9/3 11:54
|
||||||
|
*/
|
||||||
|
public static void infoAlert(
|
||||||
|
String title, String headerText, String message,
|
||||||
|
AppDialog.ButtonAction leftBtnAction, AppDialog.ButtonAction rightBtnAction) {
|
||||||
|
getCustomDialog()
|
||||||
|
.setDialogType(AppDialog.DialogType.INFO)
|
||||||
|
.setTitle(title)
|
||||||
|
.setHeaderText(headerText)
|
||||||
|
.setCustomText(message)
|
||||||
|
.setLeftBtnAction(leftBtnAction)
|
||||||
|
.setRightBtnAction(rightBtnAction)
|
||||||
|
.build().showAndWait();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置警告弹窗
|
||||||
|
*
|
||||||
|
* @param title 弹窗标题
|
||||||
|
* @param headerText 头文本
|
||||||
|
* @param message 消息文本
|
||||||
|
* @param leftBtnAction 左侧按钮点击事件
|
||||||
|
* @param rightBtnAction 右侧按钮点击事件
|
||||||
|
* @apiNote
|
||||||
|
* @since 2023/9/3 11:54
|
||||||
|
*/
|
||||||
|
public static void warningAlert(
|
||||||
|
String title, String headerText, String message,
|
||||||
|
AppDialog.ButtonAction leftBtnAction, AppDialog.ButtonAction rightBtnAction) {
|
||||||
|
getCustomDialog()
|
||||||
|
.setDialogType(AppDialog.DialogType.WARNING)
|
||||||
|
.setTitle(title)
|
||||||
|
.setHeaderText(headerText)
|
||||||
|
.setCustomText(message)
|
||||||
|
.setLeftBtnAction(leftBtnAction)
|
||||||
|
.setRightBtnAction(rightBtnAction)
|
||||||
|
.build().showAndWait();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置疑问弹窗
|
||||||
|
*
|
||||||
|
* @param title 弹窗标题
|
||||||
|
* @param headerText 头文本
|
||||||
|
* @param message 消息文本
|
||||||
|
* @param leftBtnAction 左侧按钮点击事件
|
||||||
|
* @param rightBtnAction 右侧按钮点击事件
|
||||||
|
* @apiNote
|
||||||
|
* @since 2023/9/3 11:54
|
||||||
|
*/
|
||||||
|
public static void questionAlert(
|
||||||
|
String title, String headerText, String message,
|
||||||
|
AppDialog.ButtonAction leftBtnAction, AppDialog.ButtonAction rightBtnAction) {
|
||||||
|
getCustomDialog()
|
||||||
|
.setDialogType(AppDialog.DialogType.QUESTION)
|
||||||
|
.setTitle(title)
|
||||||
|
.setHeaderText(headerText)
|
||||||
|
.setCustomText(message)
|
||||||
|
.setLeftBtnAction(leftBtnAction)
|
||||||
|
.setRightBtnAction(rightBtnAction)
|
||||||
|
.build().showAndWait();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自定义弹窗
|
||||||
|
*
|
||||||
|
* @apiNote 使用此方法会返回原始的应用对话框建造者类,以实现自定义弹窗
|
||||||
|
* @since 2023/9/3 11:54
|
||||||
|
*/
|
||||||
|
public static AppDialog.AppDialogBuilder getCustomDialog() {
|
||||||
|
return new AppDialog.AppDialogBuilder();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package org.jcnc.jnotepad.util;
|
package org.jcnc.jnotepad.util;
|
||||||
|
|
||||||
|
import atlantafx.base.theme.Styles;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.paint.Color;
|
|
||||||
import javafx.stage.Window;
|
import javafx.stage.Window;
|
||||||
import org.jcnc.jnotepad.LunchApp;
|
import org.jcnc.jnotepad.LunchApp;
|
||||||
import org.jcnc.jnotepad.common.constants.AppConstants;
|
import org.jcnc.jnotepad.common.constants.AppConstants;
|
||||||
@ -14,7 +14,7 @@ import static org.kordamp.ikonli.antdesignicons.AntDesignIconsFilled.*;
|
|||||||
/**
|
/**
|
||||||
* UI工具
|
* UI工具
|
||||||
*
|
*
|
||||||
* <p>封装了项目中所有的UI组件,以减少组件单例模式造成的代码复杂性。</p>
|
* <p>封装了项目中需要引入的UI组件</p>
|
||||||
*
|
*
|
||||||
* @author gewuyou
|
* @author gewuyou
|
||||||
*/
|
*/
|
||||||
@ -27,24 +27,34 @@ public class UiUtil {
|
|||||||
/**
|
/**
|
||||||
* 错误图标
|
* 错误图标
|
||||||
*/
|
*/
|
||||||
private static final FontIcon ERROR_ICON = FontIcon.of(EXCLAMATION_CIRCLE, 64, Color.RED);
|
private static final FontIcon ERROR_ICON = FontIcon.of(EXCLAMATION_CIRCLE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 信息图标
|
* 信息图标
|
||||||
*/
|
*/
|
||||||
private static final FontIcon INFO_ICON = FontIcon.of(INFO_CIRCLE, 64, Color.BLUE);
|
private static final FontIcon INFO_ICON = FontIcon.of(INFO_CIRCLE);
|
||||||
/**
|
/**
|
||||||
* 警告图标
|
* 警告图标
|
||||||
*/
|
*/
|
||||||
private static final FontIcon WARNING_ICON = FontIcon.of(WARNING, 64, Color.ORANGE);
|
private static final FontIcon WARNING_ICON = FontIcon.of(WARNING);
|
||||||
/**
|
/**
|
||||||
* 问题图标
|
* 问题图标
|
||||||
*/
|
*/
|
||||||
private static final FontIcon QUESTION_ICON = FontIcon.of(QUESTION_CIRCLE, 64, Color.YELLOW);
|
private static final FontIcon QUESTION_ICON = FontIcon.of(QUESTION_CIRCLE);
|
||||||
|
|
||||||
|
private static final FontIcon SUCCEED_ICON = FontIcon.of(CHECK_CIRCLE);
|
||||||
|
|
||||||
private UiUtil() {
|
private UiUtil() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
// 暂时设置颜色
|
||||||
|
ERROR_ICON.getStyleClass().addAll(Styles.DANGER);
|
||||||
|
INFO_ICON.getStyleClass().addAll(Styles.ACCENT);
|
||||||
|
QUESTION_ICON.getStyleClass().addAll(Styles.ACCENT);
|
||||||
|
WARNING_ICON.getStyleClass().addAll(Styles.WARNING);
|
||||||
|
SUCCEED_ICON.getStyleClass().addAll(Styles.SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用程序图标。
|
* 获取应用程序图标。
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user