chore: 修改类名 WindowsUtil -> ViewUtil

This commit is contained in:
octopus_yan 2024-09-21 19:36:21 +08:00
parent fbdf6b3ba7
commit 6294fdbf42
6 changed files with 16 additions and 16 deletions

View File

@ -4,7 +4,7 @@ import cn.octopusyan.alistgui.Application;
import cn.octopusyan.alistgui.config.Context;
import cn.octopusyan.alistgui.config.I18n;
import cn.octopusyan.alistgui.util.FxmlUtil;
import cn.octopusyan.alistgui.util.WindowsUtil;
import cn.octopusyan.alistgui.util.ViewUtil;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Labeled;
@ -83,7 +83,7 @@ public abstract class BaseController<VM extends BaseViewModel> implements Initia
// 全局窗口拖拽
if (dragWindow() && getRootPanel() != null) {
// 窗口拖拽
WindowsUtil.bindDragged(getRootPanel());
ViewUtil.bindDragged(getRootPanel());
}
// 国际化绑定

View File

@ -6,7 +6,7 @@ import cn.octopusyan.alistgui.config.Context;
import cn.octopusyan.alistgui.config.I18n;
import cn.octopusyan.alistgui.manager.ConfigManager;
import cn.octopusyan.alistgui.manager.SystemTrayManager;
import cn.octopusyan.alistgui.util.WindowsUtil;
import cn.octopusyan.alistgui.util.ViewUtil;
import cn.octopusyan.alistgui.viewModel.RootViewModel;
import com.gluonhq.emoji.EmojiData;
import com.gluonhq.emoji.util.EmojiImageUtils;
@ -129,7 +129,7 @@ public class RootController extends BaseController<RootViewModel> {
getWindow().setAlwaysOnTop(newVal);
});
WindowsUtil.bindDragged(windowHeader);
ViewUtil.bindDragged(windowHeader);
viewModel.currentViewIndexProperty().bind(tabPane.getSelectionModel().selectedIndexProperty());
}

View File

@ -3,7 +3,7 @@ package cn.octopusyan.alistgui.manager;
import cn.octopusyan.alistgui.Application;
import cn.octopusyan.alistgui.config.Constants;
import cn.octopusyan.alistgui.config.Context;
import cn.octopusyan.alistgui.util.WindowsUtil;
import cn.octopusyan.alistgui.util.ViewUtil;
import cn.octopusyan.alistgui.view.PopupMenu;
import javafx.application.Platform;
import javafx.beans.binding.StringBinding;
@ -48,7 +48,7 @@ public class SystemTrayManager {
public static void icon(String path) {
if (trayIcon == null) return;
icon(WindowsUtil.class.getResource(path));
icon(ViewUtil.class.getResource(path));
}
public static void icon(URL url) {
@ -100,7 +100,7 @@ public class SystemTrayManager {
if (trayIcon != null) return;
// 系统托盘图标
URL resource = WindowsUtil.class.getResource(STR."/assets/logo\{running ? "" : "-disabled"}.png");
URL resource = ViewUtil.class.getResource(STR."/assets/logo\{running ? "" : "-disabled"}.png");
Image image = Toolkit.getDefaultToolkit().getImage(resource);
trayIcon = new TrayIcon(image);
@ -187,6 +187,6 @@ public class SystemTrayManager {
}
private static Stage stage() {
return WindowsUtil.getStage();
return ViewUtil.getStage();
}
}

View File

@ -13,7 +13,7 @@ import java.util.Map;
*
* @author octopus_yan
*/
public class WindowsUtil {
public class ViewUtil {
// 获取系统缩放比
public static final double scaleX = Screen.getPrimary().getOutputScaleX();
public static final double scaleY = Screen.getPrimary().getOutputScaleY();

View File

@ -2,7 +2,7 @@ package cn.octopusyan.alistgui.view;
import atlantafx.base.controls.CaptionMenuItem;
import cn.octopusyan.alistgui.config.Constants;
import cn.octopusyan.alistgui.util.WindowsUtil;
import cn.octopusyan.alistgui.util.ViewUtil;
import javafx.application.Platform;
import javafx.beans.binding.StringBinding;
import javafx.event.ActionEvent;
@ -115,8 +115,8 @@ public class PopupMenu {
root.hide();
root.show(utilityStage,
event.getX() / WindowsUtil.scaleX,
event.getY() / WindowsUtil.scaleY
event.getX() / ViewUtil.scaleX,
event.getY() / ViewUtil.scaleY
);
// 获取焦点 (失去焦点隐藏自身)
root.requestFocus();

View File

@ -2,7 +2,7 @@ package cn.octopusyan.alistgui.view.alert.builder;
import cn.octopusyan.alistgui.base.BaseBuilder;
import cn.octopusyan.alistgui.config.Context;
import cn.octopusyan.alistgui.util.WindowsUtil;
import cn.octopusyan.alistgui.util.ViewUtil;
import javafx.scene.Node;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
@ -26,9 +26,9 @@ public class DefaultBuilder extends BaseBuilder<DefaultBuilder, Dialog<?>> {
DialogPane dialogPane = dialog.getDialogPane();
dialogPane.getScene().setFill(Color.TRANSPARENT);
WindowsUtil.bindDragged(dialogPane);
WindowsUtil.bindShadow(dialogPane);
WindowsUtil.getStage(dialogPane).initStyle(StageStyle.TRANSPARENT);
ViewUtil.bindDragged(dialogPane);
ViewUtil.bindShadow(dialogPane);
ViewUtil.getStage(dialogPane).initStyle(StageStyle.TRANSPARENT);
dialogPane.getButtonTypes().add(new ButtonType(
Context.getLanguageBinding("label.cancel").get(),