commit
4f59dda32e
@ -23,11 +23,6 @@ module org.jcnc.jnotepad {
|
||||
exports org.jcnc.jnotepad.controller.event.handler.menubar;
|
||||
exports org.jcnc.jnotepad.tool;
|
||||
exports org.jcnc.jnotepad.interfaces;
|
||||
exports org.jcnc.jnotepad.ui.module;
|
||||
exports org.jcnc.jnotepad.ui.setstage;
|
||||
exports org.jcnc.jnotepad.root.center.main.center.tab;
|
||||
exports org.jcnc.jnotepad.root.top.menu;
|
||||
exports org.jcnc.jnotepad.view.manager;
|
||||
opens org.jcnc.jnotepad.app.config;
|
||||
exports org.jcnc.jnotepad.root.center.main.bottom.status;
|
||||
|
||||
|
||||
@ -27,10 +27,7 @@ import java.util.concurrent.ExecutorService;
|
||||
* @author 许轲
|
||||
*/
|
||||
public class LunchApp extends Application {
|
||||
/**
|
||||
* 线程池
|
||||
*/
|
||||
private final ExecutorService threadPool = ThreadPoolManager.getThreadPool();
|
||||
|
||||
private static final Pane ROOT = new Pane();
|
||||
private static final Scene SCENE;
|
||||
|
||||
@ -40,6 +37,11 @@ public class LunchApp extends Application {
|
||||
SCENE = new Scene(ROOT, width, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线程池
|
||||
*/
|
||||
private final ExecutorService threadPool = ThreadPoolManager.getThreadPool();
|
||||
|
||||
/**
|
||||
* 应用程序的入口点,启动 JavaFX 应用程序。
|
||||
*
|
||||
|
||||
@ -4,9 +4,9 @@ import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||
import org.jcnc.jnotepad.constants.TextConstants;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.StatusHorizontalBox;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.ui.module.LineNumberTextArea;
|
||||
import org.jcnc.jnotepad.view.manager.ViewManager;
|
||||
|
||||
@ -38,15 +38,15 @@ public class NewFile implements EventHandler<ActionEvent> {
|
||||
// TODO: refactor:统一TextArea新建、绑定监听器入口
|
||||
ViewManager viewManager = ViewManager.getInstance();
|
||||
// 创建标签页
|
||||
MainTab mainTab = new MainTab(
|
||||
JNotepadTab JNotepadTab = new JNotepadTab(
|
||||
UiResourceBundle.getContent(TextConstants.NEW_FILE)
|
||||
+ viewManager.selfIncreaseAndGetTabIndex(),
|
||||
textArea);
|
||||
// 设置当前标签页与本地文件无关联
|
||||
mainTab.setRelevance(false);
|
||||
JNotepadTab.setRelevance(false);
|
||||
// 将Tab页添加到TabPane中
|
||||
MainTabPane.getInstance().addNewTab(mainTab);
|
||||
JNotepadTabPane.getInstance().addNewTab(JNotepadTab);
|
||||
// 更新编码信息
|
||||
StatusHorizontalBox.getInstance().updateEncodingLabel();
|
||||
JNotepadStatusBox.getInstance().updateEncodingLabel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,8 +9,8 @@ import javafx.stage.FileChooser;
|
||||
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||
import org.jcnc.jnotepad.constants.TextConstants;
|
||||
import org.jcnc.jnotepad.manager.ThreadPoolManager;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.tool.EncodingDetector;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.tool.UiUtil;
|
||||
@ -83,9 +83,9 @@ public class OpenFile implements EventHandler<ActionEvent> {
|
||||
*/
|
||||
public void openFile(File file) {
|
||||
// 获取标签页集合
|
||||
MainTabPane jnotepadMainTabPane = MainTabPane.getInstance();
|
||||
JNotepadTabPane jnotepadTabPane = JNotepadTabPane.getInstance();
|
||||
// 遍历标签页,查找匹配的标签页
|
||||
for (Tab tab : jnotepadMainTabPane.getTabs()) {
|
||||
for (Tab tab : jnotepadTabPane.getTabs()) {
|
||||
// 获取绑定的文件
|
||||
File tabFile = (File) tab.getUserData();
|
||||
if (tabFile == null) {
|
||||
@ -93,7 +93,7 @@ public class OpenFile implements EventHandler<ActionEvent> {
|
||||
}
|
||||
if (file.getPath().equals((tabFile).getPath())) {
|
||||
// 找到匹配的标签页,设置为选中状态并跳转
|
||||
jnotepadMainTabPane.getSelectionModel().select(tab);
|
||||
jnotepadTabPane.getSelectionModel().select(tab);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -119,11 +119,11 @@ public class OpenFile implements EventHandler<ActionEvent> {
|
||||
LogUtil.getLogger(this.getClass()).info("已调用读取文件功能");
|
||||
Platform.runLater(() -> {
|
||||
textArea.getMainTextArea().setText(text);
|
||||
MainTab tab = createNewTab(file.getName(), textArea, encoding);
|
||||
JNotepadTab tab = createNewTab(file.getName(), textArea, encoding);
|
||||
// 设置当前标签页关联本地文件
|
||||
tab.setRelevance(true);
|
||||
tab.setUserData(file);
|
||||
MainTabPane.getInstance().addNewTab(tab);
|
||||
JNotepadTabPane.getInstance().addNewTab(tab);
|
||||
});
|
||||
} catch (IOException ignored) {
|
||||
LogUtil.getLogger(this.getClass()).info("已忽视IO异常!");
|
||||
@ -146,7 +146,7 @@ public class OpenFile implements EventHandler<ActionEvent> {
|
||||
* @param textArea 文本区域
|
||||
* @return 新的标签页
|
||||
*/
|
||||
private MainTab createNewTab(String tabName, LineNumberTextArea textArea, Charset charset) {
|
||||
return new MainTab(tabName, textArea, charset);
|
||||
private JNotepadTab createNewTab(String tabName, LineNumberTextArea textArea, Charset charset) {
|
||||
return new JNotepadTab(tabName, textArea, charset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@ import javafx.scene.input.KeyCode;
|
||||
import javafx.stage.FileChooser;
|
||||
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||
import org.jcnc.jnotepad.constants.TextConstants;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.tool.UiUtil;
|
||||
import org.jcnc.jnotepad.ui.dialog.factory.impl.TextFileChooserFactory;
|
||||
@ -30,7 +30,7 @@ public class RenameFile implements EventHandler<ActionEvent> {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
// 获取当前标签页
|
||||
MainTab jnotepadtab = MainTabPane.getInstance().getSelected();
|
||||
JNotepadTab jnotepadtab = JNotepadTabPane.getInstance().getSelected();
|
||||
if (jnotepadtab == null || jnotepadtab.getText().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -50,7 +50,7 @@ public class RenameFile implements EventHandler<ActionEvent> {
|
||||
*
|
||||
* @param jnotepadtab 标签页组件
|
||||
*/
|
||||
private void handleRenameTab(MainTab jnotepadtab) {
|
||||
private void handleRenameTab(JNotepadTab jnotepadtab) {
|
||||
TextField textField = new TextField(jnotepadtab.getText());
|
||||
textField.getStyleClass().add("tab-title-editable");
|
||||
// 清空标签页名称
|
||||
@ -88,7 +88,7 @@ public class RenameFile implements EventHandler<ActionEvent> {
|
||||
*
|
||||
* @param jnotepadtab 标签页组件
|
||||
*/
|
||||
private void handleRenameRelevanceFile(MainTab jnotepadtab) {
|
||||
private void handleRenameRelevanceFile(JNotepadTab jnotepadtab) {
|
||||
// 获取原始文件对象
|
||||
File file = (File) jnotepadtab.getUserData();
|
||||
// 获取应用窗口并绑定
|
||||
|
||||
@ -6,8 +6,8 @@ import javafx.stage.FileChooser;
|
||||
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||
import org.jcnc.jnotepad.constants.TextConstants;
|
||||
import org.jcnc.jnotepad.controller.i18n.LocalizationController;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.root.top.menu.TopMenuBar;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.tool.SingletonUtil;
|
||||
@ -40,7 +40,7 @@ public class SaveFile implements EventHandler<ActionEvent> {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
// 获取当前tab页
|
||||
MainTab selectedTab = MainTabPane.getInstance().getSelected();
|
||||
JNotepadTab selectedTab = JNotepadTabPane.getInstance().getSelected();
|
||||
if (selectedTab == null) {
|
||||
return;
|
||||
}
|
||||
@ -72,7 +72,7 @@ public class SaveFile implements EventHandler<ActionEvent> {
|
||||
* @see LogUtil
|
||||
*/
|
||||
protected void saveTab(Class<?> currentClass) {
|
||||
MainTab selectedTab = MainTabPane.getInstance().getSelected();
|
||||
JNotepadTab selectedTab = JNotepadTabPane.getInstance().getSelected();
|
||||
if (selectedTab == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import org.jcnc.jnotepad.ui.setstage.SetStage;
|
||||
|
||||
|
||||
/**
|
||||
* 设置按钮事件的事件处理程序。
|
||||
*
|
||||
|
||||
@ -24,6 +24,15 @@ public class RootBorderPane extends AbstractBorderPane {
|
||||
initRootBorderPane();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 RootBorderPane 的单例实例。
|
||||
*
|
||||
* @return RootBorderPane 的单例实例
|
||||
*/
|
||||
public static RootBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化 RootBorderPane。
|
||||
*
|
||||
@ -43,12 +52,5 @@ public class RootBorderPane extends AbstractBorderPane {
|
||||
setBottomComponent(RootBottomSideBarVerticalBox.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 RootBorderPane 的单例实例。
|
||||
*
|
||||
* @return RootBorderPane 的单例实例
|
||||
*/
|
||||
public static RootBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package org.jcnc.jnotepad.root.bottom;
|
||||
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.StatusHorizontalBox;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||
import org.jcnc.jnotepad.ui.module.AbstractVerticalBox;
|
||||
|
||||
/**
|
||||
@ -18,10 +18,6 @@ public class RootBottomSideBarVerticalBox extends AbstractVerticalBox {
|
||||
initSidebarVerticalBox();
|
||||
}
|
||||
|
||||
private void initSidebarVerticalBox() {
|
||||
getChildren().addAll(StatusHorizontalBox.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 RootBottomSideBarVerticalBox 的唯一实例。
|
||||
*
|
||||
@ -30,4 +26,8 @@ public class RootBottomSideBarVerticalBox extends AbstractVerticalBox {
|
||||
public static RootBottomSideBarVerticalBox getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void initSidebarVerticalBox() {
|
||||
getChildren().addAll(JNotepadStatusBox.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package org.jcnc.jnotepad.root.center.main;
|
||||
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.ui.module.AbstractBorderPane;
|
||||
|
||||
/**
|
||||
@ -18,11 +18,6 @@ public class MainBorderPane extends AbstractBorderPane {
|
||||
initRootBorderPane();
|
||||
}
|
||||
|
||||
private void initRootBorderPane() {
|
||||
// 文本框
|
||||
setCenterComponent(MainTabPane.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 MainBorderPane 的唯一实例。
|
||||
*
|
||||
@ -31,4 +26,10 @@ public class MainBorderPane extends AbstractBorderPane {
|
||||
public static MainBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void initRootBorderPane() {
|
||||
// 文本框
|
||||
setCenterComponent(JNotepadTabPane.getInstance());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextArea;
|
||||
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||
import org.jcnc.jnotepad.constants.TextConstants;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.ui.module.AbstractHorizontalBox;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@ -19,9 +19,9 @@ import java.nio.charset.Charset;
|
||||
*
|
||||
* @author songdragon
|
||||
*/
|
||||
public class StatusHorizontalBox extends AbstractHorizontalBox {
|
||||
public class JNotepadStatusBox extends AbstractHorizontalBox {
|
||||
|
||||
private static final StatusHorizontalBox STATUS_BOX = new StatusHorizontalBox();
|
||||
private static final JNotepadStatusBox STATUS_BOX = new JNotepadStatusBox();
|
||||
private static final String STATUS_LABEL_FORMAT = "%s : %d \t%s: %d \t%s: %d \t";
|
||||
/**
|
||||
* 字数统计及光标
|
||||
@ -33,11 +33,11 @@ public class StatusHorizontalBox extends AbstractHorizontalBox {
|
||||
private Label encodingLabel;
|
||||
|
||||
|
||||
private StatusHorizontalBox() {
|
||||
private JNotepadStatusBox() {
|
||||
initStatusBox();
|
||||
}
|
||||
|
||||
public static StatusHorizontalBox getInstance() {
|
||||
public static JNotepadStatusBox getInstance() {
|
||||
return STATUS_BOX;
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ public class StatusHorizontalBox extends AbstractHorizontalBox {
|
||||
* 更新字数统计
|
||||
*/
|
||||
public void updateWordCountStatusLabel() {
|
||||
MainTabPane instance = MainTabPane.getInstance();
|
||||
JNotepadTabPane instance = JNotepadTabPane.getInstance();
|
||||
if (instance.getSelected() == null) {
|
||||
return;
|
||||
}
|
||||
@ -107,12 +107,12 @@ public class StatusHorizontalBox extends AbstractHorizontalBox {
|
||||
* <br>2. 状态栏更新当前选中tab的字符编码
|
||||
*/
|
||||
public void updateWhenTabSelected() {
|
||||
MainTabPane instance = MainTabPane.getInstance();
|
||||
JNotepadTabPane instance = JNotepadTabPane.getInstance();
|
||||
if (instance.getSelected() != null) {
|
||||
updateWordCountStatusLabel();
|
||||
MainTab mainTab = instance.getSelected();
|
||||
if (mainTab != null) {
|
||||
updateEncodingLabel(mainTab.getCharset().name());
|
||||
JNotepadTab JNotepadTab = instance.getSelected();
|
||||
if (JNotepadTab != null) {
|
||||
updateEncodingLabel(JNotepadTab.getCharset().name());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,7 @@ import java.nio.charset.Charset;
|
||||
*
|
||||
* @author songdragon
|
||||
*/
|
||||
public class MainTab extends Tab {
|
||||
public class JNotepadTab extends Tab {
|
||||
|
||||
private final LineNumberTextArea lineNumberTextArea;
|
||||
/**
|
||||
@ -26,15 +26,15 @@ public class MainTab extends Tab {
|
||||
private boolean isRelevance = false;
|
||||
private Charset charset = Charset.defaultCharset();
|
||||
|
||||
public MainTab(String tabTitle) {
|
||||
public JNotepadTab(String tabTitle) {
|
||||
this(tabTitle, new LineNumberTextArea());
|
||||
}
|
||||
|
||||
public MainTab(String tabTitle, LineNumberTextArea textArea) {
|
||||
public JNotepadTab(String tabTitle, LineNumberTextArea textArea) {
|
||||
this(tabTitle, textArea, Charset.defaultCharset());
|
||||
}
|
||||
|
||||
public MainTab(String tabTitle, LineNumberTextArea textArea, Charset charset) {
|
||||
public JNotepadTab(String tabTitle, LineNumberTextArea textArea, Charset charset) {
|
||||
super(tabTitle);
|
||||
lineNumberTextArea = textArea;
|
||||
this.setContent(lineNumberTextArea);
|
||||
@ -1,7 +1,7 @@
|
||||
package org.jcnc.jnotepad.root.center.main.center.tab;
|
||||
|
||||
import javafx.scene.control.TabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.StatusHorizontalBox;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||
import org.jcnc.jnotepad.root.top.menu.TopMenuBar;
|
||||
import org.jcnc.jnotepad.tool.SingletonUtil;
|
||||
|
||||
@ -10,15 +10,15 @@ import org.jcnc.jnotepad.tool.SingletonUtil;
|
||||
*
|
||||
* @author songdragon
|
||||
*/
|
||||
public class MainTabPane extends TabPane {
|
||||
public class JNotepadTabPane extends TabPane {
|
||||
|
||||
private static final MainTabPane TAB_PANE = new MainTabPane();
|
||||
private static final JNotepadTabPane TAB_PANE = new JNotepadTabPane();
|
||||
|
||||
private MainTabPane() {
|
||||
private JNotepadTabPane() {
|
||||
initListeners();
|
||||
}
|
||||
|
||||
public static MainTabPane getInstance() {
|
||||
public static JNotepadTabPane getInstance() {
|
||||
return TAB_PANE;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public class MainTabPane extends TabPane {
|
||||
TopMenuBar.getInstance().updateMenuStatusBySelectedTab();
|
||||
}
|
||||
// 更新状态标签
|
||||
StatusHorizontalBox.getInstance().updateWhenTabSelected();
|
||||
JNotepadStatusBox.getInstance().updateWhenTabSelected();
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class MainTabPane extends TabPane {
|
||||
*
|
||||
* @param tab 新标签页
|
||||
*/
|
||||
public void addNewTab(MainTab tab) {
|
||||
public void addNewTab(JNotepadTab tab) {
|
||||
if (tab == null) {
|
||||
return;
|
||||
}
|
||||
@ -61,8 +61,8 @@ public class MainTabPane extends TabPane {
|
||||
*
|
||||
* @return 当前选中的标签页
|
||||
*/
|
||||
public MainTab getSelected() {
|
||||
return (MainTab) this.getSelectionModel().getSelectedItem();
|
||||
public JNotepadTab getSelected() {
|
||||
return (JNotepadTab) this.getSelectionModel().getSelectedItem();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,8 +70,8 @@ public class MainTabPane extends TabPane {
|
||||
* 应用当前菜单上选中的自动换行设置。
|
||||
*/
|
||||
public void fireTabSelected() {
|
||||
MainTab selectedTab = getSelected();
|
||||
JNotepadTab selectedTab = getSelected();
|
||||
selectedTab.setAutoLine(SingletonUtil.getAppConfigController().getAutoLineConfig());
|
||||
StatusHorizontalBox.getInstance().updateWhenTabSelected();
|
||||
JNotepadStatusBox.getInstance().updateWhenTabSelected();
|
||||
}
|
||||
}
|
||||
@ -3,21 +3,36 @@ package org.jcnc.jnotepad.root.right;
|
||||
import org.jcnc.jnotepad.ui.module.AbstractVerticalBox;
|
||||
|
||||
/**
|
||||
* @author 许轲
|
||||
* 右侧边栏的垂直布局容器类。
|
||||
*
|
||||
* <p>该类用于管理右侧边栏的布局和内容。</p>
|
||||
*
|
||||
* @Author 许轲
|
||||
*/
|
||||
public class RootRightSideBarVerticalBox extends AbstractVerticalBox {
|
||||
|
||||
/**
|
||||
* 唯一的 RootRightSideBarVerticalBox 实例,使用单例模式
|
||||
*/
|
||||
private static final RootRightSideBarVerticalBox INSTANCE = new RootRightSideBarVerticalBox();
|
||||
|
||||
private RootRightSideBarVerticalBox() {
|
||||
initSidebarVerticalBox();
|
||||
}
|
||||
|
||||
private void initSidebarVerticalBox() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 RootRightSideBarVerticalBox 的唯一实例。
|
||||
*
|
||||
* @return RootRightSideBarVerticalBox 的实例
|
||||
*/
|
||||
public static RootRightSideBarVerticalBox getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化右侧边栏的垂直布局。
|
||||
*/
|
||||
private void initSidebarVerticalBox() {
|
||||
// 在此添加右侧边栏布局和内容的初始化代码
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,15 @@ public class RootTopBorderPane extends AbstractBorderPane {
|
||||
initRootBorderPane();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 RootTopBorderPane 的单例实例。
|
||||
*
|
||||
* @return RootTopBorderPane 的单例实例
|
||||
*/
|
||||
public static RootTopBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化 RootTopBorderPane。
|
||||
*
|
||||
@ -29,13 +38,4 @@ public class RootTopBorderPane extends AbstractBorderPane {
|
||||
// 在顶部区域添加菜单栏
|
||||
setTopComponent(TopMenuBar.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 RootTopBorderPane 的单例实例。
|
||||
*
|
||||
* @return RootTopBorderPane 的单例实例
|
||||
*/
|
||||
public static RootTopBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ import org.jcnc.jnotepad.controller.config.AppConfigController;
|
||||
import org.jcnc.jnotepad.controller.event.handler.menubar.*;
|
||||
import org.jcnc.jnotepad.controller.event.handler.tool.SetBtn;
|
||||
import org.jcnc.jnotepad.controller.i18n.LocalizationController;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.root.left.sidebar.tools.ToolBar;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.slf4j.Logger;
|
||||
@ -35,7 +35,7 @@ public class TopMenuBar extends MenuBar {
|
||||
/**
|
||||
* 标签页布局组件封装。
|
||||
*/
|
||||
MainTabPane mainTabPane = MainTabPane.getInstance();
|
||||
JNotepadTabPane JNotepadTabPane = org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane.getInstance();
|
||||
AppConfigController appConfigController = AppConfigController.getInstance();
|
||||
Logger logger = LogUtil.getLogger(this.getClass());
|
||||
/**
|
||||
@ -289,7 +289,7 @@ public class TopMenuBar extends MenuBar {
|
||||
// 1. 更新全局配置
|
||||
AppConfigController.getInstance().setAutoLineConfig(after);
|
||||
// 2. 对当前tab生效配置
|
||||
mainTabPane.fireTabSelected();
|
||||
JNotepadTabPane.fireTabSelected();
|
||||
});
|
||||
topItem.selectedProperty().addListener((observableValue, before, after) -> {
|
||||
// 获取窗口容器
|
||||
@ -322,7 +322,7 @@ public class TopMenuBar extends MenuBar {
|
||||
* 根据当前选中tab,更新菜单选项
|
||||
*/
|
||||
public void updateMenuStatusBySelectedTab() {
|
||||
MainTab selectedTab = mainTabPane.getSelected();
|
||||
JNotepadTab selectedTab = JNotepadTabPane.getSelected();
|
||||
lineFeedItem.selectedProperty().setValue(selectedTab.isAutoLine());
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ public class UiUtil {
|
||||
private UiUtil() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取应用程序图标。
|
||||
*
|
||||
|
||||
@ -3,9 +3,9 @@ package org.jcnc.jnotepad.ui.module;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.StatusHorizontalBox;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.MainTabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.tool.SingletonUtil;
|
||||
import org.slf4j.Logger;
|
||||
@ -24,9 +24,9 @@ import java.io.IOException;
|
||||
*/
|
||||
public class LineNumberTextArea extends BorderPane {
|
||||
|
||||
private static final Logger logger = LogUtil.getLogger(LineNumberTextArea.class);
|
||||
static final int[] SIZE_TABLE = {9, 99, 999, 9999, 99999, 999999, 9999999,
|
||||
99999999, 999999999, Integer.MAX_VALUE};
|
||||
private static final Logger logger = LogUtil.getLogger(LineNumberTextArea.class);
|
||||
private static final int MIN_LINE_NUMBER_WIDTH = 30;
|
||||
private final TextArea mainTextArea;
|
||||
private final TextArea lineNumberArea;
|
||||
@ -62,12 +62,12 @@ public class LineNumberTextArea extends BorderPane {
|
||||
|
||||
lineNumberArea.textProperty().addListener((observable, oldValue, newValue) -> updateLineNumberWidth());
|
||||
|
||||
this.mainTextArea.caretPositionProperty().addListener((caretObservable, oldPosition, newPosition) -> StatusHorizontalBox.getInstance().updateWordCountStatusLabel());
|
||||
this.mainTextArea.caretPositionProperty().addListener((caretObservable, oldPosition, newPosition) -> JNotepadStatusBox.getInstance().updateWordCountStatusLabel());
|
||||
this.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||
// 更新行号
|
||||
updateLineNumberArea();
|
||||
// 更新状态栏
|
||||
StatusHorizontalBox.getInstance().updateWordCountStatusLabel();
|
||||
JNotepadStatusBox.getInstance().updateWordCountStatusLabel();
|
||||
// 自动保存
|
||||
save();
|
||||
});
|
||||
@ -77,7 +77,7 @@ public class LineNumberTextArea extends BorderPane {
|
||||
* 以原文件编码格式写回文件
|
||||
*/
|
||||
public void save() {
|
||||
MainTab tab = MainTabPane.getInstance().getSelected();
|
||||
JNotepadTab tab = JNotepadTabPane.getInstance().getSelected();
|
||||
if (tab == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user