|
|
@ -12,6 +12,7 @@ import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIColorButton; |
|
|
|
import com.fr.design.gui.ibutton.UIColorButton; |
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
|
|
|
import com.fr.design.gui.icombobox.UIDictionaryComboBox; |
|
|
|
import com.fr.design.gui.ilable.ActionLabel; |
|
|
|
import com.fr.design.gui.ilable.ActionLabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
@ -23,7 +24,6 @@ import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.FRFont; |
|
|
|
import com.fr.general.FRFont; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.general.log.Log4jConfig; |
|
|
|
import com.fr.general.log.Log4jConfig; |
|
|
|
import com.fr.locale.InterProviderFactory; |
|
|
|
import com.fr.locale.InterProviderFactory; |
|
|
|
import com.fr.third.apache.log4j.Level; |
|
|
|
import com.fr.third.apache.log4j.Level; |
|
|
@ -32,14 +32,11 @@ import javax.swing.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
|
|
|
|
import java.awt.event.ItemListener; |
|
|
|
|
|
|
|
import java.awt.event.KeyAdapter; |
|
|
|
import java.awt.event.KeyAdapter; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
@ -87,9 +84,7 @@ public class PreferencePane extends BasicPane { |
|
|
|
private static final String DISPLAY_MINUS = "-"; |
|
|
|
private static final String DISPLAY_MINUS = "-"; |
|
|
|
|
|
|
|
|
|
|
|
private static final Level[] LOG = {Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG}; |
|
|
|
private static final Level[] LOG = {Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG}; |
|
|
|
private static java.util.List<String> LANGUAGE = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言
|
|
|
|
|
|
|
|
private boolean languageChanged; // 是否修改了设计器语言设置
|
|
|
|
private boolean languageChanged; // 是否修改了设计器语言设置
|
|
|
|
//设置是否支持undo
|
|
|
|
//设置是否支持undo
|
|
|
|
private UICheckBox supportUndoCheckBox; |
|
|
|
private UICheckBox supportUndoCheckBox; |
|
|
@ -114,7 +109,8 @@ public class PreferencePane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
private UITextField logExportDirectoryField; |
|
|
|
private UITextField logExportDirectoryField; |
|
|
|
|
|
|
|
|
|
|
|
private UIComboBox logLevelComboBox, languageComboBox, pageLengthComboBox, reportLengthComboBox; |
|
|
|
private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox; |
|
|
|
|
|
|
|
private UIDictionaryComboBox<Locale> languageComboBox; |
|
|
|
private IntegerEditor portEditor; |
|
|
|
private IntegerEditor portEditor; |
|
|
|
private UITextField jdkHomeTextField; |
|
|
|
private UITextField jdkHomeTextField; |
|
|
|
private UICheckBox oracleSpace; |
|
|
|
private UICheckBox oracleSpace; |
|
|
@ -123,18 +119,8 @@ public class PreferencePane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
public PreferencePane() { |
|
|
|
public PreferencePane() { |
|
|
|
this.initComponents(); |
|
|
|
this.initComponents(); |
|
|
|
this.initLanguageItems(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 语言选项
|
|
|
|
|
|
|
|
private void initLanguageItems() { |
|
|
|
|
|
|
|
LANGUAGE.clear(); |
|
|
|
|
|
|
|
Map<Locale, String> map = InterProviderFactory.getProvider().getSupportLocaleMap(); |
|
|
|
|
|
|
|
LANGUAGE.add(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Language_Default")); |
|
|
|
|
|
|
|
for (Locale locale : map.keySet()) { |
|
|
|
|
|
|
|
LANGUAGE.add(getLocaledLanguage(map.get(locale), locale)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void initComponents() { |
|
|
|
protected void initComponents() { |
|
|
|
JPanel contentPane = this; |
|
|
|
JPanel contentPane = this; |
|
|
@ -182,13 +168,6 @@ public class PreferencePane extends BasicPane { |
|
|
|
advancePane.add(spaceUpPane); |
|
|
|
advancePane.add(spaceUpPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static String getLocaledLanguage(String key, Locale locale) { |
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
|
|
sb.append(com.fr.design.i18n.Toolkit.i18nText(key)).append("("); |
|
|
|
|
|
|
|
sb.append(com.fr.design.i18n.Toolkit.i18nText(key)).append(")"); |
|
|
|
|
|
|
|
return sb.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void createFunctionPane(JPanel generalPane) { |
|
|
|
private void createFunctionPane(JPanel generalPane) { |
|
|
|
JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference-Function")); |
|
|
|
JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference-Function")); |
|
|
|
generalPane.add(functionPane); |
|
|
|
generalPane.add(functionPane); |
|
|
@ -379,8 +358,9 @@ public class PreferencePane extends BasicPane { |
|
|
|
JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Choose_Language")); |
|
|
|
JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Choose_Language")); |
|
|
|
generalPane.add(languageAndDashBoard_pane); |
|
|
|
generalPane.add(languageAndDashBoard_pane); |
|
|
|
languageAndDashBoard_pane.add(LanguagePane); |
|
|
|
languageAndDashBoard_pane.add(LanguagePane); |
|
|
|
languageComboBox = new UIComboBox(LANGUAGE.toArray()); |
|
|
|
|
|
|
|
languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文
|
|
|
|
languageComboBox = createLanguageComboBox(); |
|
|
|
|
|
|
|
|
|
|
|
ActionLabel languageLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Designer_Language")); |
|
|
|
ActionLabel languageLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Designer_Language")); |
|
|
|
languageLabel.addActionListener(new ActionListener() { |
|
|
|
languageLabel.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -402,16 +382,26 @@ public class PreferencePane extends BasicPane { |
|
|
|
Component[][] components = { |
|
|
|
Component[][] components = { |
|
|
|
{languageLabel, languageComboBox, noticeLabel}, |
|
|
|
{languageLabel, languageComboBox, noticeLabel}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
languageComboBox.addItemListener(new ItemListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
|
|
|
//Inter.fr = ResourceBundle.getBundle("com/fr/general/locale/fr", Locale.US);
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
JPanel choosePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
JPanel choosePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
LanguagePane.add(choosePane); |
|
|
|
LanguagePane.add(choosePane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIDictionaryComboBox<Locale> createLanguageComboBox() { |
|
|
|
|
|
|
|
Map<Locale, String> map = InterProviderFactory.getProvider().getSupportLocaleMap(); |
|
|
|
|
|
|
|
int size = map.size(); |
|
|
|
|
|
|
|
Locale[] keys = new Locale[size]; |
|
|
|
|
|
|
|
String[] values = new String[size]; |
|
|
|
|
|
|
|
int i = 0; |
|
|
|
|
|
|
|
for (Map.Entry<Locale, String> entry : map.entrySet()) { |
|
|
|
|
|
|
|
keys[i] = entry.getKey(); |
|
|
|
|
|
|
|
values[i] = com.fr.design.i18n.Toolkit.i18nText(entry.getValue()); |
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
UIDictionaryComboBox<Locale> languageComboBox = new UIDictionaryComboBox<>(keys, values); |
|
|
|
|
|
|
|
languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文
|
|
|
|
|
|
|
|
return languageComboBox; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String getDisplayShortCut(String shotrCut) { |
|
|
|
private String getDisplayShortCut(String shotrCut) { |
|
|
|
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) |
|
|
|
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) |
|
|
|
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) |
|
|
|
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) |
|
|
@ -506,7 +496,7 @@ public class PreferencePane extends BasicPane { |
|
|
|
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_CachingTemplate")); |
|
|
|
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_CachingTemplate")); |
|
|
|
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_MaxCachingTemplate")); |
|
|
|
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_MaxCachingTemplate")); |
|
|
|
UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_CachingTemplateTip")); |
|
|
|
UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_CachingTemplateTip")); |
|
|
|
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder( 0, CACHING_GAP, 0, 0)); |
|
|
|
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0)); |
|
|
|
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT); |
|
|
|
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT); |
|
|
|
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
memorySpace.add(memoryLabel); |
|
|
|
memorySpace.add(memoryLabel); |
|
|
@ -564,8 +554,8 @@ public class PreferencePane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel()); |
|
|
|
this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel()); |
|
|
|
|
|
|
|
|
|
|
|
this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage())); |
|
|
|
this.languageComboBox.setSelectedItem(designerEnvManager.getLanguage()); |
|
|
|
designerEnvLanguageIndex = designerEnvManager.getLanguage(); |
|
|
|
|
|
|
|
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); |
|
|
|
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); |
|
|
|
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); |
|
|
|
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); |
|
|
|
|
|
|
|
|
|
|
@ -625,7 +615,7 @@ public class PreferencePane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor()); |
|
|
|
designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor()); |
|
|
|
|
|
|
|
|
|
|
|
designerEnvManager.setLanguage(getLanguageInt()); |
|
|
|
designerEnvManager.setLanguage(languageComboBox.getSelectedItem()); |
|
|
|
|
|
|
|
|
|
|
|
designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); |
|
|
|
designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); |
|
|
|
designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); |
|
|
|
designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); |
|
|
@ -637,7 +627,6 @@ public class PreferencePane extends BasicPane { |
|
|
|
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); |
|
|
|
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); |
|
|
|
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); |
|
|
|
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); |
|
|
|
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); |
|
|
|
designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); |
|
|
|
// designerEnvManager.setAutoBackUp(this.autoBackUp.isSelected());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5); |
|
|
|
designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5); |
|
|
|
if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) { |
|
|
|
if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) { |
|
|
@ -648,21 +637,6 @@ public class PreferencePane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* 得到所选语言的int值 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private int getLanguageInt() { |
|
|
|
|
|
|
|
int l = 0; |
|
|
|
|
|
|
|
String lang = (String) this.languageComboBox.getSelectedItem(); |
|
|
|
|
|
|
|
for (int i = 0; i < LANGUAGE.size(); i++) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(lang, LANGUAGE.get(i))) { |
|
|
|
|
|
|
|
l = i; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return l; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果语言设置改变了,则显示重启对话框
|
|
|
|
// 如果语言设置改变了,则显示重启对话框
|
|
|
|
public void showRestartDialog() { |
|
|
|
public void showRestartDialog() { |
|
|
@ -689,11 +663,7 @@ public class PreferencePane extends BasicPane { |
|
|
|
return showWindow(window, new DialogActionAdapter() { |
|
|
|
return showWindow(window, new DialogActionAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void doOk() { |
|
|
|
public void doOk() { |
|
|
|
if (languageComboBox.getSelectedIndex() != designerEnvLanguageIndex) { |
|
|
|
languageChanged = !ComparatorUtils.equals(languageComboBox.getSelectedItem(), DesignerEnvManager.getEnvManager(false).getLanguage()); |
|
|
|
languageChanged = true; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
languageChanged = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|