@ -1,5 +1,9 @@
package com.fr.design.actions.file ;
import com.fine.theme.utils.FineUIScale ;
import com.fine.theme.utils.FineUIStyle ;
import com.fine.theme.utils.FineUIUtils ;
import com.formdev.flatlaf.util.ScaledEmptyBorder ;
import com.fr.config.Configuration ;
import com.fr.config.ServerPreferenceConfig ;
import com.fr.design.DesignerEnvManager ;
@ -31,8 +35,6 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.jdk.JdkVersion ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.layout.TableLayout ;
import com.fr.design.layout.TableLayoutHelper ;
import com.fr.design.layout.VerticalFlowLayout ;
import com.fr.design.mainframe.vcs.VcsConfigManager ;
import com.fr.design.mainframe.vcs.common.VcsHelper ;
@ -44,7 +46,6 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory ;
import com.fr.general.ComparatorUtils ;
import com.fr.general.FRFont ;
import com.fr.general.GeneralContext ;
import com.fr.general.IOUtils ;
import com.fr.general.Inter ;
import com.fr.general.log.Log4jConfig ;
@ -52,7 +53,6 @@ import com.fr.io.attr.ImageExportAttr;
import com.fr.locale.InterProviderFactory ;
import com.fr.log.FineLoggerFactory ;
import com.fr.report.ReportConfigManager ;
import com.fr.scheduler.tool.FineScheduler ;
import com.fr.stable.Constants ;
import com.fr.stable.os.OperatingSystem ;
import com.fr.third.apache.logging.log4j.Level ;
@ -70,13 +70,10 @@ import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService ;
import org.jetbrains.annotations.NotNull ;
import javax.swing.BorderFactory ;
import javax.swing.BoxLayout ;
import javax.swing.ButtonGroup ;
import javax.swing.JComponent ;
import javax.swing.JDialog ;
import javax.swing.JFileChooser ;
import javax.swing.JLabel ;
import javax.swing.JOptionPane ;
import javax.swing.JPanel ;
import javax.swing.JProgressBar ;
@ -86,7 +83,6 @@ import javax.swing.SwingUtilities;
import javax.swing.SwingWorker ;
import javax.swing.Timer ;
import javax.swing.UIManager ;
import javax.swing.border.EmptyBorder ;
import javax.swing.event.ChangeEvent ;
import javax.swing.event.ChangeListener ;
import java.awt.* ;
@ -105,6 +101,10 @@ import java.util.Locale;
import java.util.Map ;
import java.util.concurrent.ExecutionException ;
import static com.fine.swing.ui.layout.Layouts.cell ;
import static com.fine.swing.ui.layout.Layouts.column ;
import static com.fine.swing.ui.layout.Layouts.fix ;
import static com.fine.swing.ui.layout.Layouts.row ;
import static com.fr.design.i18n.Toolkit.i18nText ;
/ * *
@ -127,6 +127,7 @@ public class PreferencePane extends BasicPane {
private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230 ;
private static final int PREFERENCE_LABEL_MAX_WIDTH = 460 ;
private static final int OFFSET_HEIGHT = 60 ;
private static final int SETTING_V_GAP = 15 ;
private static final int VCS_FILL_TOTAL = 5 ;
private static final String TYPE = "pressed" ;
@ -275,108 +276,116 @@ public class PreferencePane extends BasicPane {
protected void initComponents ( ) {
JPanel contentPane = this ;
contentPane . setLayout ( FRGUIPaneFactory . createBorderLayout ( ) ) ;
UITabbedPane jtabPane = new UITabbedPane ( ) ;
JPanel generalPane = FRGUIPaneFactory . createY_AXISBoxInnerContainer_L_Pane ( ) ;
UITabbedPane tabPane = new UITabbedPane ( ) ;
contentPane . add ( tabPane , BorderLayout . NORTH ) ;
// 常用面板
JPanel generalPane = column ( SETTING_V_GAP ,
// 功能设置
cell ( createFunctionPane ( ) ) ,
// 编辑器设置
cell ( createEditPane ( ) ) ,
// 颜色设置
cell ( createColorSettingPane ( ) ) ,
// 语言选择
cell ( createLanPane ( ) ) ,
// 启动页配置
cell ( createStartupPagePane ( ) )
) . weight ( 1 ) . getComponent ( ) ;
UIScrollPane generalScrollPane = patchScroll ( generalPane ) ;
jtabPane . addTab ( i18nText ( "Fine-Design_Basic_General" ) , generalScrollPane ) ;
JPanel advancePane = FRGUIPaneFactory . createY_AXISBoxInnerContainer_L_Pane ( ) ;
tabPane . addTab ( i18nText ( "Fine-Design_Basic_General" ) , generalScrollPane ) ;
// 高级面板
JPanel advancePane = column ( SETTING_V_GAP ,
// log导出配置
cell ( createLogPane ( ) ) ,
// 标尺单位设置
cell ( createLengthPane ( ) ) ,
// 服务器设置
cell ( createServerPane ( ) ) ,
// 插件管理设置
cell ( createUpmSelectorPane ( ) ) . with ( it - > it . setVisible ( ! OperatingSystem . isLinux ( ) & & JdkVersion . LE_8 . support ( ) ) ) ,
// 登录选项
cell ( createLoginSelectorPane ( ) ) . with ( it - > it . setVisible ( SupportOSImpl . DESIGNER_LOGIN . support ( ) ) ) ,
// Oracle设置
cell ( createOraclePane ( ) ) ,
// 内存设置
cell ( createMemoryPane ( ) ) ,
// 产品改良
cell ( createImprovePane ( ) ) ,
// 内置服务器
cell ( createEmbeddedServerPane ( ) ) ,
// 模板预览性能
cell ( createTplPreviewPane ( ) ) ,
// 设计器启动选项
cell ( createDesignerStartupPane ( ) )
) . getComponent ( ) ;
useUniverseDBMCheckbox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Use_Universe_Database_Manager" ) ) ;
UIScrollPane adviceScrollPane = patchScroll ( advancePane ) ;
jtabPane . addTab ( i18nText ( "Fine-Design_Basic_Advanced" ) , adviceScrollPane ) ;
tabPane . addTab ( i18nText ( "Fine-Design_Basic_Advanced" ) , adviceScrollPane ) ;
// 版本管理面板
//初始化vcs总面板
JPanel vcsParentPane = new JPanel ( ) ;
CardLayout cardLayout = new CardLayout ( ) ;
vcsParentPane . setLayout ( cardLayout ) ;
//vcs配置面板
JPanel vcsPane = new JPanel ( new BorderLayout ( ) ) ;
JPanel vcsPane = new JPanel ( new BorderLayout ( 0 , SETTING_V_GAP ) ) ;
// vcsPane
createVcsSettingPane ( vcsPane , vcsParentPane , cardLayout ) ;
//添加滚动条
UIScrollPane vcsScrollPane = patchScroll ( vcsPane ) ;
//配置面板作为vcs总面板的一张卡片
vcsParentPane . add ( vcsScrollPane , VcsMovePanel . SETTING ) ;
jtabPane . addTab ( i18nText ( "Fine-Design_Vcs_Title" ) , vcsParentPane ) ;
contentPane . add ( jtabPane , BorderLayout . NORTH ) ;
createFunctionPane ( generalPane ) ;
createEditPane ( generalPane ) ;
createColorSettingPane ( generalPane ) ;
// vcsPane
createVcsSettingPane ( vcsPane , vcsParentPane , cardLayout ) ;
// ConfPane
JPanel confLocationPane = FRGUIPaneFactory . createX_AXISBoxInnerContainer_S_Pane ( ) ;
advancePane . add ( confLocationPane ) ;
createLogPane ( advancePane ) ;
createLanPane ( generalPane ) ;
createStartupPagePane ( generalPane ) ;
createLengthPane ( advancePane ) ;
createServerPane ( advancePane ) ;
JPanel oraclePane = FRGUIPaneFactory . createTitledBorderPane ( "Oracle" + i18nText ( "Fine-Design_Basic_Oracle_All_Tables" ) ) ;
oracleSpace = new UICheckBox ( i18nText ( "Fine-Design_Basic_Show_All_Oracle_Tables" ) ) ;
oraclePane . add ( oracleSpace ) ;
tabPane . addTab ( i18nText ( "Fine-Design_Vcs_Title" ) , vcsParentPane ) ;
}
if ( ! OperatingSystem . isLinux ( ) & & JdkVersion . LE_8 . support ( ) ) {
JPanel upmSelectorPane = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Basic_Update_Plugin_Manager" ) ) ;
useOptimizedUPMCheckbox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Use_New_Update_Plugin_Manager" ) ) ;
upmSelectorPane . add ( useOptimizedUPMCheckbox ) ;
advancePane . add ( upmSelectorPane ) ;
}
private Component createDesignerStartupPane ( ) {
cloudAnalyticsDelayCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Cloud_Analytics_Delay" ) ) ;
return FineUIUtils . wrapComponentWithTitle ( column ( 10 , cell ( cloudAnalyticsDelayCheckBox ) ) . getComponent ( ) ,
i18nText ( "Fine-Design_Startup_Option" ) ) ;
}
if ( SupportOSImpl . DESIGNER_LOGIN . support ( ) ) {
JPanel loginSelectorPane = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Basic_Login_Manager" ) ) ;
useNewVersionLoginCheckbox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Use_New_Login_Manager" ) ) ;
loginSelectorPane . add ( useNewVersionLoginCheckbox ) ;
advancePane . add ( loginSelectorPane ) ;
}
private Component createTplPreviewPane ( ) {
imageCompressPanelCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Image_Compress" ) ) ;
return FineUIUtils . wrapComponentWithTitle ( column ( 10 ,
cell ( imageCompressPanelCheckBox ) ,
cell ( createImageExportSettingPane ( ) )
) . getComponent ( ) ,
i18nText ( "Fine-Design_Template_Preview_Performance" ) ) ;
}
JPanel dbmSelectorPane = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Basic_Database_Manager" ) ) ;
useUniverseDBMCheckbox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Use_Universe_Database_Manager" ) ) ;
//dbmSelectorPane.add(useUniverseDBMCheckbox);
//advancePane.add(dbmSelectorPane);
private Component createEmbeddedServerPane ( ) {
embedServerLazyStartupCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Startup_When_Needed" ) ) ;
return FineUIUtils . wrapComponentWithTitle ( column ( 10 , cell ( embedServerLazyStartupCheckBox ) ) . getComponent ( ) ,
i18nText ( "Fine-Design_Embed_Server" ) ) ;
}
JPanel improvePane = FRGUIPaneFactory . createVerticalTitledBorderPane ( i18nText ( "Fine-Design_Basic_Product_Improve" ) ) ;
private Component createImprovePane ( ) {
joinProductImproveCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Join_Product_Improve" ) ) ;
improvePane . add ( joinProductImproveCheckBox ) ;
autoPushUpdateCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Automatic_Push_Update" ) ) ;
JPanel improvePane = column ( 10 ,
cell ( joinProductImproveCheckBox ) ,
cell ( autoPushUpdateCheckBox ) . with ( it - > it . setVisible ( SupportOSImpl . AUTOPUSHUPDATE . support ( ) ) )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( improvePane , i18nText ( "Fine-Design_Basic_Product_Improve" ) ) ;
}
if ( SupportOSImpl . AUTOPUSHUPDATE . support ( ) ) {
autoPushUpdateCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Automatic_Push_Update" ) ) ;
improvePane . add ( autoPushUpdateCheckBox ) ;
}
/ *
if ( DesignerPushUpdateManager . getInstance ( ) . isAutoPushUpdateSupported ( ) ) {
autoPushUpdateCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Automatic_Push_Update" ) ) ;
improvePane . add ( autoPushUpdateCheckBox ) ;
} * /
JPanel spaceUpPane = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
spaceUpPane . add ( oraclePane , BorderLayout . NORTH ) ;
spaceUpPane . add ( createMemoryPane ( ) , BorderLayout . CENTER ) ;
spaceUpPane . add ( improvePane , BorderLayout . SOUTH ) ;
advancePane . add ( spaceUpPane ) ;
JPanel embedServerPanel = FRGUIPaneFactory . createVerticalTitledBorderPane ( i18nText ( "Fine-Design_Embed_Server" ) ) ;
embedServerLazyStartupCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Startup_When_Needed" ) ) ;
embedServerPanel . add ( embedServerLazyStartupCheckBox ) ;
advancePane . add ( embedServerPanel ) ;
private Component createOraclePane ( ) {
oracleSpace = new UICheckBox ( i18nText ( "Fine-Design_Basic_Show_All_Oracle_Tables" ) ) ;
return FineUIUtils . wrapComponentWithTitle ( column ( 10 , cell ( oracleSpace ) ) . getComponent ( ) ,
i18nText ( "Fine-Design_Basic_Oracle_All_Tables" ) ) ;
}
JPanel imageCompressPanel = FRGUIPaneFactory . createVerticalTitledBorderPane ( i18nText ( "Fine-Design_Template_Preview_Performance" ) ) ;
imageCompressPanelCheckB ox = new UICheckBox ( i18nText ( "Fine-Design_Image_Compress " ) ) ;
imageCompressPanel . add ( imageCompressPanelCheckBox ) ;
imageCompressPanel . add ( createImageExportSettingPane ( ) ) ;
advancePane . add ( imageCompressPanel ) ;
private Component createLoginSelectorPane ( ) {
useNewVersionLoginCheckbox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Use_New_Login_Manager" ) ) ;
return FineUIUtils . wrapComponentWithTitle ( column ( 10 , cell ( useNewVersionLoginCheckbox ) ) . getComponent ( ) ,
i18nText ( "Fine-Design_Basic_Login_Manager" ) ) ;
}
JPanel designerStartupOption = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Startup_Option" ) ) ;
cloudAnalyticsDelayCheckB ox = new UICheckBox ( i18nText ( "Fine-Design_Cloud_Analytics_Delay " ) ) ;
designerStartupOption . add ( cloudAnalyticsDelayCheckBox ) ;
advancePane . add ( designerStartupOption ) ;
private Component createUpmSelectorPane ( ) {
useOptimizedUPMCheckbox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Use_New_Update_Plugin_Manager" ) ) ;
return FineUIUtils . wrapComponentWithTitle ( column ( 10 , cell ( useOptimizedUPMCheckbox ) ) . getComponent ( ) ,
i18nText ( "Fine-Design_Basic_Update_Plugin_Manager" ) ) ;
}
private JPanel createImageExportSettingPane ( ) {
@ -391,42 +400,32 @@ public class PreferencePane extends BasicPane {
ButtonGroup previewRenderGroup = new ButtonGroup ( ) ;
previewRenderGroup . add ( previewRenderQuality ) ;
previewRenderGroup . add ( previewRenderSpeed ) ;
JPanel imageExportSettingPane = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
JComponent [ ] [ ] templateComps = {
{ new UILabel ( Toolkit . i18nText ( "Fine-Design_Report_Engine_Enlarge_Or_Reduce" ) + ":" ) , this . previewResolutionBtnS , this . previewResolutionBtnM } ,
{ new UILabel ( Toolkit . i18nText ( "Fine-Design_Image_Export_Rendering_Quality" ) + ":" ) , this . previewRenderQuality , this . previewRenderSpeed } ,
} ;
imageExportSettingPane . add (
TableLayoutHelper . createGapTableLayoutPane (
templateComps ,
new double [ ] { TableLayout . FILL , TableLayout . FILL } ,
new double [ ] { TableLayout . FILL , TableLayout . FILL , TableLayout . FILL } ,
20 , 0 ) ,
BorderLayout . CENTER ) ;
imageExportSettingPane . setBorder ( BorderFactory . createEmptyBorder ( 0 , 3 , 0 , 0 ) ) ;
return imageExportSettingPane ;
return column ( 10 ,
row (
cell ( new UILabel ( Toolkit . i18nText ( "Fine-Design_Report_Engine_Enlarge_Or_Reduce" ) + ":" ) ) . weight ( 1 ) ,
cell ( this . previewResolutionBtnS ) . weight ( 1 ) ,
cell ( this . previewResolutionBtnM ) . weight ( 1 )
) ,
row (
cell ( new UILabel ( Toolkit . i18nText ( "Fine-Design_Image_Export_Rendering_Quality" ) + ":" ) ) . weight ( 1 ) ,
cell ( this . previewRenderQuality ) . weight ( 1 ) ,
cell ( this . previewRenderSpeed ) . weight ( 1 )
)
) . getComponent ( ) ;
}
@NotNull
private UIScrollPane patchScroll ( JPanel generalPane ) {
UIScrollPane generalPanelWithScroll = new UIScrollPane ( generalPane , ScrollPaneConstants . VERTICAL_SCROLLBAR_AS_NEEDED , ScrollPaneConstants . HORIZONTAL_SCROLLBAR_NEVER ) ;
generalPanelWithScroll . setBorder ( new EmptyBorder ( 0 , 0 , 0 , 0 ) ) ;
generalPanelWithScroll . setPreferredSize ( new Dimension ( generalPane . getWidth ( ) , 60 0) ) ;
return generalPanelWithScroll ;
JPanel wrapperPane = FRGUIPaneFactory . createBorderLayout_S_Pane ( ) ;
wrapperPane . add ( generalPane ) ;
wrapperPane . setBorder ( new ScaledEmptyBorder ( 10 , 10 , 10 , 1 0) ) ;
return new UIScrollPane ( wrapperPane , ScrollPaneConstants . VERTICAL_SCROLLBAR_AS_NEEDED , ScrollPaneConstants . HORIZONTAL_SCROLLBAR_NEVER ) ;
}
private void createVcsSettingPane ( JPanel generalPane , JPanel parentPane , CardLayout cardLayout ) {
private void createVcsSettingPane ( JPanel generalPane , JPanel parentPane , CardLayout cardLayout ) {
//迁移面板
movePanel = createMovePane ( cardLayout , parentPane ) ;
generalPane . add ( movePanel , BorderLayout . NORTH ) ;
JPanel savePane = FRGUIPaneFactory . createTopVerticalTitledBorderPane ( i18nText ( "Fine-Design_Vcs_Save_Setting" ) ) ;
JPanel vcsPane = FRGUIPaneFactory . createTopVerticalTitledBorderPane ( i18nText ( "Fine-Design_Vcs_Clean_Setting" ) ) ;
JPanel containPane = FRGUIPaneFactory . createY_AXISBoxInnerContainer_L_Pane ( ) ;
containPane . add ( savePane ) ;
containPane . add ( vcsPane ) ;
//填充一下面板
fillPane ( containPane , VCS_FILL_TOTAL ) ;
generalPane . add ( containPane , BorderLayout . CENTER ) ;
remindVcsLabel = new UILabel ( i18nText ( "Fine-Design_Vcs_Remind" ) ) ;
remindVcsLabel . setVisible ( ! VcsHelper . getInstance ( ) . needInit ( ) ) ;
vcsEnableCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Vcs_SaveAuto" ) ) ;
@ -435,55 +434,56 @@ public class PreferencePane extends BasicPane {
saveCommitCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Vcs_No_Delete" ) ) ;
saveIntervalEditor = new UIPositiveIntEditor ( 60 ) ;
useIntervalCheckBox = new UICheckBox ( ) ;
savePane . add ( vcsEnableCheckBox ) ;
savePane . add ( saveIntervalPane ) ;
//gc面板
gcControlPane = createGcControlPane ( ) ;
JPanel enableVcsPanel = new JPanel ( FRGUIPaneFactory . createLeftZeroLayout ( ) ) ;
enableVcsPanel . add ( remindVcsLabel ) ;
JPanel intervalPanel = new JPanel ( FRGUIPaneFactory . createLeftZeroLayout ( ) ) ;
final UILabel everyLabel = new UILabel ( i18nText ( "Fine-Design_Vcs_Every" ) ) ;
final UILabel delayLabel = new UILabel ( i18nText ( "Fine-Design_Vcs_Delay" ) ) ;
intervalPanel . add ( useIntervalCheckBox ) ;
intervalPanel . add ( everyLabel ) ;
intervalPanel . add ( saveIntervalEditor ) ;
intervalPanel . add ( delayLabel ) ;
JPanel intervalPanel = row ( 4 ,
cell ( useIntervalCheckBox ) ,
cell ( everyLabel ) ,
cell ( saveIntervalEditor ) ,
cell ( delayLabel )
) . getComponent ( ) ;
autoCleanPane = createAutoCleanPane ( ) ;
checkAutoScheduleStartAndUpdateStatus ( ) ;
vcsEnableCheckBox . addChangeListener ( new ChangeListener ( ) {
@Override
public void stateChanged ( ChangeEvent e ) {
boolean selected = vcsEnableCheckBox . isSelected ( ) ;
if ( selected & & vcsEnableCheckBox . isEnabled ( ) ) {
saveCommitCheckBox . setEnabled ( true ) ;
saveIntervalEditor . setEnabled ( true ) ;
useIntervalCheckBox . setEnabled ( true ) ;
everyLabel . setEnabled ( true ) ;
delayLabel . setEnabled ( true ) ;
} else {
saveCommitCheckBox . setEnabled ( false ) ;
saveIntervalEditor . setEnabled ( false ) ;
useIntervalCheckBox . setEnabled ( false ) ;
everyLabel . setEnabled ( false ) ;
delayLabel . setEnabled ( false ) ;
}
vcsEnableCheckBox . addChangeListener ( e - > {
boolean selected = vcsEnableCheckBox . isSelected ( ) ;
if ( selected & & vcsEnableCheckBox . isEnabled ( ) ) {
saveCommitCheckBox . setEnabled ( true ) ;
saveIntervalEditor . setEnabled ( true ) ;
useIntervalCheckBox . setEnabled ( true ) ;
everyLabel . setEnabled ( true ) ;
delayLabel . setEnabled ( true ) ;
} else {
saveCommitCheckBox . setEnabled ( false ) ;
saveIntervalEditor . setEnabled ( false ) ;
useIntervalCheckBox . setEnabled ( false ) ;
everyLabel . setEnabled ( false ) ;
delayLabel . setEnabled ( false ) ;
}
} ) ;
vcsPane . add ( enableVcsPanel ) ;
vcsPane . add ( intervalPanel ) ;
if ( VcsHelper . getInstance ( ) . isLegacyMode ( ) ) {
vcsPane . add ( saveCommitCheckBox ) ;
}
vcsPane . add ( autoCleanPane ) ;
boolean support = VcsHelper . getInstance ( ) . checkV2FunctionSupport ( ) ;
saveIntervalPane . setVisible ( support ) ;
autoCleanPane . setVisible ( support ) ;
if ( VcsHelper . getInstance ( ) . isLegacyMode ( ) ) {
// 老版本时才显示gc选项
vcsPane . add ( gcControlPane ) ;
}
//gc面板
gcControlPane = createGcControlPane ( ) ;
Component savePane = FineUIUtils . wrapComponentWithTitle ( column ( 10 ,
cell ( vcsEnableCheckBox ) ,
cell ( saveIntervalPane ) . with ( it - > it . setVisible ( VcsHelper . getInstance ( ) . checkV2FunctionSupport ( ) ) )
) . getComponent ( ) , i18nText ( "Fine-Design_Vcs_Save_Setting" ) ) ;
Component vcsPane = FineUIUtils . wrapComponentWithTitle ( column ( 10 ,
cell ( remindVcsLabel ) ,
cell ( intervalPanel ) ,
cell ( saveCommitCheckBox ) . with ( it - > it . setVisible ( VcsHelper . getInstance ( ) . isLegacyMode ( ) ) ) ,
cell ( autoCleanPane ) ,
cell ( gcControlPane ) . with ( it - > it . setVisible ( VcsHelper . getInstance ( ) . isLegacyMode ( ) ) )
) . getComponent ( ) , i18nText ( "Fine-Design_Vcs_Clean_Setting" ) ) ;
JPanel containPane = column ( SETTING_V_GAP ,
cell ( savePane ) ,
cell ( vcsPane )
) . getComponent ( ) ;
//填充一下面板
fillPane ( containPane , VCS_FILL_TOTAL ) ;
generalPane . add ( containPane , BorderLayout . CENTER ) ;
}
private void fillPane ( JPanel containPane , int total ) {
@ -557,20 +557,16 @@ public class PreferencePane extends BasicPane {
}
private JPanel createSaveIntervalPane ( ) {
JPanel saveIntervalPane = new JPanel ( FRGUIPaneFactory . createLeftZeroLayout ( ) ) ;
useVcsAutoSaveScheduleCheckBox = new UICheckBox ( ) ;
autoSaveIntervalEditor = new UIPositiveIntEditor ( 60 ) ;
saveIntervalPane . add ( useVcsAutoSaveScheduleCheckBox ) ;
saveIntervalPane . add ( new UILabel ( i18nText ( "Fine-Design_Vcs_Every" ) ) ) ;
saveIntervalPane . add ( autoSaveIntervalEditor ) ;
saveIntervalPane . add ( new UILabel ( i18nText ( "Fine-Design_Vcs_Save_Delay" ) ) ) ;
useVcsAutoSaveScheduleCheckBox . setEnabled ( ! VcsHelper . getInstance ( ) . isLegacyMode ( ) ) ;
saveIntervalPane . setVisible ( false ) ;
return saveIntervalPane ;
return row ( 4 ,
cell ( useVcsAutoSaveScheduleCheckBox ) . with ( it - > it . setEnabled ( ! VcsHelper . getInstance ( ) . isLegacyMode ( ) ) ) ,
cell ( new UILabel ( i18nText ( "Fine-Design_Vcs_Every" ) ) ) ,
cell ( autoSaveIntervalEditor ) ,
cell ( new UILabel ( i18nText ( "Fine-Design_Vcs_Save_Delay" ) ) )
) . with ( it - > it . setVisible ( false ) ) . getComponent ( ) ;
}
/ * *
* 模创建板版本gc 配置操作面板
*
@ -600,22 +596,13 @@ public class PreferencePane extends BasicPane {
return gcControlPane ;
}
private void createFunctionPane ( JPanel generalPane ) {
JPanel topVerticalTitledBorderPane = FRGUIPaneFactory . createTopVerticalTitledBorderPane ( i18nText ( "Fine-Design_Basic_Preference_Function" ) ) ;
JPanel supportUndoPanel = new JPanel ( FRGUIPaneFactory . createLeftZeroVgapNormalHgapLayout ( ) ) ;
topVerticalTitledBorderPane . add ( supportUndoPanel ) ;
generalPane . add ( topVerticalTitledBorderPane ) ;
private Component createFunctionPane ( ) {
//添加supportUndo选择项
supportUndoCheckBox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Preference_Support_Undo" ) ) ;
supportUndoPanel . add ( supportUndoCheckBox ) ;
//添加maxUndoLimit
//String[] undoTimes = {"最大撤销次数","5次","10次","15次","20次","50次"};
String [ ] undoTimes = { i18nText ( "Fine-Design_Basic_Max_Undo_Limit" ) , MAX_UNDO_LIMIT_5 + i18nText ( "Fine-Design_Basic_Time(s)" ) , MAX_UNDO_LIMIT_10 + i18nText ( "Fine-Design_Basic_Time(s)" )
, MAX_UNDO_LIMIT_15 + i18nText ( "Fine-Design_Basic_Time(s)" ) , MAX_UNDO_LIMIT_20 + i18nText ( "Fine-Design_Basic_Time(s)" ) , MAX_UNDO_LIMIT_50 + i18nText ( "Fine-Design_Basic_Time(s)" ) } ;
maxUndoLimit = new UIComboBox ( undoTimes ) ;
supportUndoPanel . add ( maxUndoLimit ) ;
//不支持撤销则不能选择撤销可缓存,也不能设置最大撤销次数
supportUndoCheckBox . addActionListener ( new ActionListener ( ) {
@ -625,32 +612,31 @@ public class PreferencePane extends BasicPane {
}
} ) ;
//添加supportDefaultParentCalculate选择项
supportDefaultParentCalculateCheckBox = new UICheckBox (
i18nText ( "Fine-Design_Basic_Preference_Support_Default_Parent_Calculate" ) ) ;
topVerticalTitledBorderPane . add ( supportDefaultParentCalculateCheckBox ) ;
//添加是否展示打开模板提示缺少插件选择项
showTemplateMissingPlugin = new UICheckBox (
i18nText ( "Fine-Design_Basic_Preference_Show-Template-Missing-Plugin" ) ) ;
topVerticalTitledBorderPane . add ( showTemplateMissingPlugin ) ;
startWithEmptyFile = new UICheckBox ( i18nText ( "Fine-Design_Basic_Preference_Start_Empty_File" ) ) ;
topVerticalTitledBorderPane . add ( startWithEmptyFile ) ;
JPanel functionPanel = column ( 10 ,
row ( 10 ,
cell ( supportUndoCheckBox ) , cell ( maxUndoLimit )
) ,
cell ( supportDefaultParentCalculateCheckBox ) ,
cell ( showTemplateMissingPlugin ) ,
cell ( startWithEmptyFile )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( functionPanel , i18nText ( "Fine-Design_Basic_Preference_Function" ) ) ;
}
private void createEditPane ( JPanel generalPane ) {
private Component createEditPane ( ) {
//samuel:编辑器设置
JPanel editPane = FRGUIPaneFactory . createTopVerticalTitledBorderPane ( i18nText ( "Fine-Design_Basic_Editor_Preference" ) ) ;
generalPane . add ( editPane ) ;
//设置是否支持将字符串编辑为公式
supportStringToFormulaBox = new UICheckBox ( i18nText ( "Fine-Design_Report_Support_String_To_Formula" ) ) ;
editPane . add ( supportStringToFormulaBox ) ;
//是否默认转化
defaultStringToFormulaBox = new UICheckBox ( i18nText ( "Fine-Design_Basic_Always" ) ) ;
//不支持转化则不能默认执行
supportStringToFormulaBox . addActionListener ( new ActionListener ( ) {
@Override
@ -658,16 +644,8 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox . setEnabled ( supportStringToFormulaBox . isSelected ( ) ) ;
}
} ) ;
JPanel keyStrokePane = new JPanel ( new BorderLayout ( ) ) ;
keyStrokePane . add ( new UILabel ( i18nText ( "Fine-Design_Basic_Support_Auto_Complete_Shortcut" ) + ":" ) , BorderLayout . WEST ) ;
UILabel shortCutInfoLabel = new UILabel ( i18nText ( "Fine-Design_Basic_Support_Auto_Complete_Shortcut" ) + ":" ) ;
shortCutLabel = new UILabel ( ) ;
keyStrokePane . add ( shortCutLabel , BorderLayout . CENTER ) ;
keyStrokePane . setBorder ( new EmptyBorder ( 0 , 10 , 0 , 0 ) ) ;
JPanel defaultExecutePane = new JPanel ( FRGUIPaneFactory . createLeftZeroVgapNormalHgapLayout ( ) ) ;
defaultExecutePane . add ( defaultStringToFormulaBox ) ;
defaultExecutePane . add ( keyStrokePane ) ;
editPane . add ( defaultExecutePane ) ;
shortCutLabel . addMouseListener ( new MouseAdapter ( ) {
@Override
public void mouseClicked ( MouseEvent e ) {
@ -683,6 +661,16 @@ public class PreferencePane extends BasicPane {
}
}
} ) ;
JPanel editPanel = column ( 10 ,
cell ( supportStringToFormulaBox ) ,
row (
cell ( defaultStringToFormulaBox ) ,
fix ( 10 ) ,
cell ( shortCutInfoLabel ) ,
cell ( shortCutLabel )
)
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( editPanel , i18nText ( "Fine-Design_Basic_Editor_Preference" ) ) ;
}
private class KeyStrokePane extends BasicPane {
@ -726,39 +714,28 @@ public class PreferencePane extends BasicPane {
}
private void createColorSettingPane ( JPanel generalPane ) {
private Component createColorSettingPane ( ) {
// Color Setting Pane
JPanel colorSettingPane = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Basic_Preference_Setting_Colors" ) ) ;
generalPane . add ( colorSettingPane ) ;
gridLineColorTBButton = new UINoThemeColorButton ( IOUtils . readIcon ( "/com/fr/design/images/gui/color/foreground.png" ) ) ;
gridLineColorTBButton . setEnabled ( this . isEnabled ( ) ) ;
paginationLineColorTBButton = new UINoThemeColorButton ( IOUtils . readIcon ( "/com/fr/design/images/gui/color/foreground.png" ) ) ;
paginationLineColorTBButton . setEnabled ( this . isEnabled ( ) ) ;
JPanel leftPane = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
leftPane . add ( new UILabel ( i18nText ( "Fine-Design_Basic_Preference_Grid_Line_Color" ) + ":" ) ) ;
leftPane . add ( gridLineColorTBButton ) ;
JPanel rightPane = FRGUIPaneFactory . createNormalFlowInnerContainer_S_Pane ( ) ;
rightPane . add ( new UILabel ( i18nText ( "Fine-Design_Basic_Preference_Pagination_Line_Color" ) + ":" ) ) ;
rightPane . add ( paginationLineColorTBButton ) ;
colorSettingPane . add ( leftPane ) ;
colorSettingPane . add ( rightPane ) ;
JPanel colorPanel = row ( 10 ,
cell ( new UILabel ( i18nText ( "Fine-Design_Basic_Preference_Grid_Line_Color" ) + ":" ) ) ,
cell ( gridLineColorTBButton ) ,
cell ( new UILabel ( i18nText ( "Fine-Design_Basic_Preference_Pagination_Line_Color" ) + ":" ) ) ,
cell ( paginationLineColorTBButton )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( colorPanel , i18nText ( "Fine-Design_Basic_Preference_Setting_Colors" ) ) ;
}
private void createLogPane ( JPanel advancePane ) {
private Component createLogPane ( ) {
//richer:选择导出log文件的目录.
JPanel logPane = FRGUIPaneFactory . createX_AXISBoxInnerContainer_S_Pane ( ) ;
advancePane . add ( logPane ) ;
JPanel logExportPane = FRGUIPaneFactory . createTitledBorderPane ( "log" + i18nText ( "Fine-Design_Basic_Export_Setting" ) ) ;
logPane . add ( logExportPane ) ;
UILabel logLabel = new UILabel ( i18nText ( "Fine-Design_Basic_Select_Export_Log_Directory" ) + ":" ) ;
logExportPane . add ( logLabel , BorderLayout . WEST ) ;
logExportDirectoryField = new UITextField ( 24 ) ;
logExportPane . add ( logExportDirectoryField , BorderLayout . CENTER ) ;
UIButton chooseDirBtn = new UIButton ( "..." ) ;
logExportPane . add ( chooseDirBtn , BorderLayout . EAST ) ;
chooseDirBtn . setPreferredSize ( new Dimension ( 25 , 25 ) ) ;
chooseDirBtn . addActionListener ( new ActionListener ( ) {
@Override
@ -773,46 +750,40 @@ public class PreferencePane extends BasicPane {
}
}
} ) ;
JPanel logLevelPane = FRGUIPaneFactory . createTitledBorderPane ( "log" + i18nText ( "Fine-Design_Basic_Level_Setting" ) ) ;
logPane . add ( logLevelPane ) ;
UILabel logLevelLabel = new UILabel ( "Log" + i18nText ( "Fine-Design_Basic_Level_Setting" ) ) ;
logLevelComboBox = new UIComboBox ( LOG ) ;
logLevelComboBox . setEnabled ( WorkContext . getCurrent ( ) . isLocal ( ) ) ;
logLevelPane . add ( logLevelComboBox ) ;
JPanel logPanel = row ( 10 ,
cell ( logLabel ) ,
cell ( logExportDirectoryField ) ,
cell ( chooseDirBtn ) ,
cell ( logLevelLabel ) ,
cell ( logLevelComboBox )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( logPanel , "Log" + i18nText ( "Fine-Design_Basic_Export_Setting" ) ) ;
}
private void createLanPane ( JPanel generalPane ) {
private Component createLanPane ( ) {
// ben:选择版本语言;
JPanel languageAndDashBoard_pane = FRGUIPaneFactory . createX_AXISBoxInnerContainer_S_Pane ( ) ;
JPanel LanguagePane = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Basic_Choose_Language" ) ) ;
generalPane . add ( languageAndDashBoard_pane ) ;
languageAndDashBoard_pane . add ( LanguagePane ) ;
languageComboBox = createLanguageComboBox ( ) ;
ActionLabel languageLabel = new ActionLabel ( i18nText ( "Fine-Design_Basic_Designer_Language" ) ) ;
languageLabel . addActionListener ( new ActionListener ( ) {
@Override
public void actionPerformed ( ActionEvent e ) {
final LocalePane localePane = new LocalePane ( ) ;
BasicDialog dlg = localePane . showLargeWindow ( SwingUtilities . getWindowAncestor ( PreferencePane . this ) , new DialogActionAdapter ( ) {
@Override
public void doOk ( ) {
localePane . save ( ) ;
}
} ) ;
dlg . setVisible ( true ) ;
}
languageLabel . addActionListener ( e - > {
final LocalePane localePane = new LocalePane ( ) ;
BasicDialog dlg = localePane . showLargeWindow ( SwingUtilities . getWindowAncestor ( PreferencePane . this ) , new DialogActionAdapter ( ) {
@Override
public void doOk ( ) {
localePane . save ( ) ;
}
} ) ;
dlg . setVisible ( true ) ;
} ) ;
UILabel noticeLabel = new UILabel ( i18nText ( "Fine-Design_Basic_Work_After_Restart_Designer" ) ) ; //sail:提示重启后生效
double p = TableLayout . PREFERRED ;
double [ ] rowSize = { p } ;
double [ ] columnSize = { p , p , p } ;
Component [ ] [ ] components = {
{ languageLabel , languageComboBox , noticeLabel } ,
} ;
JPanel choosePane = TableLayoutHelper . createTableLayoutPane ( components , rowSize , columnSize ) ;
LanguagePane . add ( choosePane ) ;
JPanel langPanel = row ( 10 ,
cell ( languageLabel ) ,
cell ( languageComboBox ) ,
cell ( noticeLabel )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( langPanel , i18nText ( "Fine-Design_Basic_Choose_Language" ) ) ;
}
private UIDictionaryComboBox < Locale > createLanguageComboBox ( ) {
@ -832,19 +803,15 @@ public class PreferencePane extends BasicPane {
return languageComboBox ;
}
private void createStartupPagePane ( JPanel generalPane ) {
// ben:选择版本语言;
JPanel startupPagePaneWrapper = FRGUIPaneFactory . createX_AXISBoxInnerContainer_S_Pane ( ) ;
JPanel startupPane = FRGUIPaneFactory . createTopVerticalTitledBorderPane ( Toolkit . i18nText ( "Fine-Design_Startup_Page_Config" ) ) ;
generalPane . add ( startupPagePaneWrapper ) ;
startupPagePaneWrapper . add ( startupPane ) ;
private Component createStartupPagePane ( ) {
startupPageEnabledCheckBox = new UICheckBox ( Toolkit . i18nText ( "Fine-Design_Startup_Page_Config_Check_Text" ) ) ;
startupPane . add ( startupPageEnabledCheckBox ) ;
UILabel descLabel = FRWidgetFactory . createLineWrapLabel ( Toolkit . i18nText ( "Fine-Design_Startup_Page_Config_Desc" ) , PREFERENCE_LABEL_MAX_WIDTH ) ;
descLabel . setForeground ( new Color ( 51 , 51 , 52 , ( int ) Math . round ( 0 . 5 * 255 ) ) ) ;
startupPane . add ( descLabel ) ;
FineUIStyle . setStyle ( descLabel , FineUIStyle . LABEL_TIP ) ;
JPanel startPanel = column ( 10 ,
cell ( startupPageEnabledCheckBox ) ,
cell ( descLabel )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( startPanel , i18nText ( "Fine-Design_Startup_Page_Config" ) ) ;
}
private String getDisplayShortCut ( String shotrCut ) {
@ -860,60 +827,44 @@ public class PreferencePane extends BasicPane {
}
private void createLengthPane ( JPanel advancePane ) {
double p = TableLayout . PREFERRED ;
double [ ] rowSize = { p } ;
private Component createLengthPane ( ) {
// 长度单位选择
JPanel lengthPane = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Basic_Setting_Ruler_Units" ) ) ;
advancePane . add ( lengthPane ) ;
pageLengthComboBox = new UIComboBox ( new String [ ] { i18nText ( "Fine-Design_Basic_Page_Setup_MM" ) , i18nText ( "Fine-Design_Report_Unit_CM" ) , i18nText ( "Fine-Design_Report_Unit_INCH" ) } ) ;
pageLengthComboBox . setPreferredSize ( new Dimension ( 80 , 20 ) ) ;
pageLengthComboBox . setMinimumSize ( new Dimension ( 80 , 20 ) ) ;
reportLengthComboBox = new UIComboBox ( UnitConvertUtil . getUnitItems ( ) ) ;
reportLengthComboBox . setPreferredSize ( new Dimension ( 80 , 20 ) ) ;
reportLengthComboBox . setMinimumSize ( new Dimension ( 80 , 20 ) ) ;
UILabel pagelengthLabel = new UILabel ( i18nText ( "Fine-Design_Basic_Page_Setup_Scale_Units" ) + ":" ) ;
UILabel pageLengthLabel = new UILabel ( i18nText ( "Fine-Design_Basic_Page_Setup_Scale_Units" ) + ":" ) ;
UILabel reportLengthLabel = new UILabel ( i18nText ( "Fine-Design_Basic_Report_Design_Ruler_Units" ) + ":" ) ;
Component [ ] [ ] lengthComponents = {
{ pagelengthLabel , pageLengthComboBox , reportLengthLabel , reportLengthComboBox } ,
} ;
JPanel chooseLengthPane = TableLayoutHelper . createTableLayoutPane ( lengthComponents , rowSize , new double [ ] { p , p , p , p } ) ;
lengthPane . add ( chooseLengthPane ) ;
JPanel lengthPane = row ( 10 ,
cell ( pageLengthLabel ) ,
cell ( pageLengthComboBox ) ,
cell ( reportLengthLabel ) ,
cell ( reportLengthComboBox )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( lengthPane , i18nText ( "Fine-Design_Basic_Setting_Ruler_Units" ) ) ;
}
private void createServerPane ( JPanel advancePane ) {
double p = TableLayout . PREFERRED ;
double [ ] rowSize = { p } ;
double [ ] columnSize = { p , p , p } ;
JPanel serverPortPane = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Basic_Web_Preview_Port_Setting" ) ) ;
advancePane . add ( serverPortPane ) ;
private Component createServerPane ( ) {
portEditor = new IntegerEditor ( ) ;
portEditor . setPreferredSize ( new Dimension ( 80 , 20 ) ) ;
portEditor . setMinimumSize ( new Dimension ( 80 , 20 ) ) ;
UILabel notiJlabel = new UILabel ( i18nText ( "Fine-Design_Basic_Work_After_Restart_Designer" ) ) ;
UILabel serverPortLabel = new UILabel ( i18nText ( "Fine-Design_Basic_Web_Preview_Port" ) + ":" ) ;
Component [ ] [ ] portComponents = {
{ serverPortLabel , portEditor , notiJlabel } ,
} ;
JPanel choosePortPane = TableLayoutHelper . createTableLayoutPane ( portComponents , rowSize , columnSize ) ;
serverPortPane . add ( choosePortPane , BorderLayout . CENTER ) ;
JPanel serverPane = row ( 10 ,
cell ( serverPortLabel ) ,
cell ( portEditor ) ,
cell ( notiJlabel )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( serverPane , i18nText ( "Fine-Design_Basic_Web_Preview_Port_Setting" ) ) ;
}
private JPanel createMemoryPane ( ) {
JPanel memoryPane = FRGUIPaneFactory . createTitledBorderPane ( i18nText ( "Fine-Design_Basic_Preference_Caching_Template" ) ) ;
private Component createMemoryPane ( ) {
UILabel memoryLabel = new UILabel ( i18nText ( "Fine-Design_Basic_Preference_Max_Caching_Template" ) ) ;
UILabel memoryTipLabel = FRWidgetFactory . createLineWrapLabel (
i18nText ( "Fine-Design_Basic_Preference_Caching_Template_Tip" ) , MEMORY_TIP_LABEL_MAX_WIDTH ) ;
memoryTipLabel . setBorder ( BorderFactory . createEmptyBorder ( 0 , CACHING_GAP , 0 , 0 ) ) ;
cachingTemplateSpinner = new UISpinner ( 0 , CACHING_MAX , 1 , CACHING_DEFAULT ) ;
JPanel memorySpace = new JPanel ( FRGUIPaneFactory . createLeftZeroLayout ( ) ) ;
memorySpa ce. add ( memoryLabel ) ;
memorySpa ce. add ( cachingTemplateSpinner ) ;
memorySpa ce. add ( memoryTipLabel ) ;
memoryPane . add ( memorySpace ) ;
return memoryPane ;
JPanel memoryPane = row ( 5 ,
cell ( memoryLabel ) ,
cell ( cachingTemplateSpinner ) ,
cell ( memoryTipLabel )
) . getComponent ( ) ;
return FineUIUtils . wrapComponentWithTitle ( memoryPane , i18nText ( "Fine-Design_Basic_Preference_Caching_Template" ) ) ;
}
@Override
@ -1286,7 +1237,7 @@ public class PreferencePane extends BasicPane {
@Override
public BasicDialog showWindow ( Window window , DialogActionListener l ) {
return showWindowWithCustomSize ( window , l , new Dimension ( BasicDialog . DEFAULT . width , this . getPreferredSize ( ) . height + OFFSET_HEIGHT ) ) ;
return showWindowWithCustomSize ( window , l , new Dimension ( BasicDialog . DEFAULT . width , BasicDialog . DEFAULT . height + OFFSET_HEIGHT ) ) ;
}
private void tryGc ( ) {
@ -1482,7 +1433,7 @@ public class PreferencePane extends BasicPane {
* /
private UIButton initGcButton ( ) {
UIButton gcButton = new UIButton ( i18nText ( "Fine-Design_Vcs_Clean" ) ) ;
gcButton . setPreferredSize ( new Dimension ( 100 , 15 ) ) ;
gcButton . setPreferredSize ( FineUIScale . scale ( new Dimension ( 100 , 15 ) ) ) ;
gcButton . setRoundBorder ( true , Constants . LEFT ) ;
return gcButton ;
}