diff --git a/designer/src/com/fr/design/actions/report/ReportParameterAction.java b/designer/src/com/fr/design/actions/report/ReportParameterAction.java index 61507ebfea..ef8454a769 100644 --- a/designer/src/com/fr/design/actions/report/ReportParameterAction.java +++ b/designer/src/com/fr/design/actions/report/ReportParameterAction.java @@ -21,7 +21,7 @@ import com.fr.main.parameter.ReportParameterAttr; /** * Report Parameter */ -public class ReportParameterAction extends JWorkBookAction { +public class ReportParameterAction extends JWorkBookAction{ public ReportParameterAction(JWorkBook jwb) { super(jwb); @@ -62,6 +62,7 @@ public class ReportParameterAction extends JWorkBookAction { jwb.fireTargetModified(); jwb.updateReportParameterAttr(); jwb.populateReportParameterAttr(); + } }); parameterArrayDialog.setVisible(true); diff --git a/designer_base/src/com/fr/design/actions/file/PreferencePane.java b/designer_base/src/com/fr/design/actions/file/PreferencePane.java index 965cf415a0..bae1414524 100644 --- a/designer_base/src/com/fr/design/actions/file/PreferencePane.java +++ b/designer_base/src/com/fr/design/actions/file/PreferencePane.java @@ -1,13 +1,11 @@ package com.fr.design.actions.file; import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.dialog.DialogActionListener; import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; @@ -31,7 +29,9 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.File; +import java.util.ArrayList; import java.util.Locale; +import java.util.Map; /** * 选项对话框 @@ -72,19 +72,19 @@ public class PreferencePane extends BasicPane { private static final String DISPLAY_EQUALS = "+"; private static final String MINUS = "MINUS"; private static final String DISPLAY_MINUS = "-"; - + private static final FRLevel[] LOG = {FRLevel.SEVERE, FRLevel.WARNING, FRLevel.INFO, FRLevel.DEBUG}; - private static final String[] LANGUAGE = {Inter.getLocText("FR-Designer_Language_Default"), - getLocaledLanguage("Simplified_Chinese_Language", Locale.SIMPLIFIED_CHINESE), - getLocaledLanguage("English_Language", Locale.ENGLISH), - getLocaledLanguage("Japanese_Language", Locale.JAPAN), - getLocaledLanguage("Traditional_Chinese_Language", Locale.TRADITIONAL_CHINESE), - getLocaledLanguage("Korea_Language",Locale.KOREA), + private static java.util.List LANGUAGE = new ArrayList<>(); + static { + Map map = Inter.getSupportLocaleMap(); + LANGUAGE.add(Inter.getLocText("FR-Designer_Language_Default")); + for(Locale locale : map.keySet()){ + LANGUAGE.add(getLocaledLanguage(map.get(locale), locale)); + } }; - private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言 + private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言 private boolean languageChanged; // 是否修改了设计器语言设置 - //设置是否支持undo private UICheckBox supportUndoCheckBox; //设置最大撤销次数 @@ -154,7 +154,7 @@ public class PreferencePane extends BasicPane { JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + Inter.getLocText("FR-Designer_Oracle_All_Tables")); oracleSpace = new UICheckBox(Inter.getLocText(message, sign)); oraclePane.add(oracleSpace); - + JPanel improvePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Product_improve")); joinProductImprove = new UICheckBox(Inter.getLocText("FR-Designer_Join_Product_improve")); improvePane.add(joinProductImprove); @@ -164,12 +164,12 @@ public class PreferencePane extends BasicPane { spaceUpPane.add(improvePane, BorderLayout.SOUTH); advancePane.add(spaceUpPane); } - + private static String getLocaledLanguage(String key, Locale locale){ - StringBuilder sb = new StringBuilder(); - sb.append(Inter.getLocText(key)).append("("); - sb.append(Inter.getLocText(key, locale)).append(")"); - return sb.toString(); + StringBuilder sb = new StringBuilder(); + sb.append(Inter.getLocText(key)).append("("); + sb.append(Inter.getLocText(key, locale)).append(")"); + return sb.toString(); } private void createFunctionPane(JPanel generalPane) { @@ -361,7 +361,7 @@ public class PreferencePane extends BasicPane { JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Choose_Language")); generalPane.add(languageAndDashBoard_pane); languageAndDashBoard_pane.add(LanguagePane); - languageComboBox = new UIComboBox(LANGUAGE); + languageComboBox = new UIComboBox(LANGUAGE.toArray()); languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文 ActionLabel languageLabel = new ActionLabel(Inter.getLocText("FR-Designer_Designer_Language")); languageLabel.addActionListener(new ActionListener() { @@ -530,11 +530,10 @@ public class PreferencePane extends BasicPane { this.logExportDirectoryField.setText(designerEnvManager.getLogLocation()); - this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(designerEnvManager.getLogLevel())); + this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(designerEnvManager.getLogLevel())); - this.languageComboBox.setSelectedItem(LANGUAGE[designerEnvManager.getLanguage()]); + this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage())); designerEnvLanguageIndex = designerEnvManager.getLanguage(); - this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); @@ -620,8 +619,8 @@ public class PreferencePane extends BasicPane { private int getLanguageInt() { int l = 0; String lang = (String) this.languageComboBox.getSelectedItem(); - for (int i = 0; i < LANGUAGE.length; i++) { - if (ComparatorUtils.equals(lang, LANGUAGE[i])) { + for (int i = 0; i < LANGUAGE.size(); i++) { + if (ComparatorUtils.equals(lang, LANGUAGE.get(i))) { l = i; break; } @@ -629,20 +628,21 @@ public class PreferencePane extends BasicPane { return l; } + // 如果语言设置改变了,则显示重启对话框 public void showRestartDialog() { if (!languageChanged) { return; } int rv = JOptionPane.showOptionDialog( - null, - Inter.getLocText("FR-Designer_Language_Change_Successful"), - Inter.getLocText("FR-Designer-Plugin_Warning"), - JOptionPane.YES_NO_OPTION, - JOptionPane.INFORMATION_MESSAGE, - null, - new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")}, - null + null, + Inter.getLocText("FR-Designer_Language_Change_Successful"), + Inter.getLocText("FR-Designer-Plugin_Warning"), + JOptionPane.YES_NO_OPTION, + JOptionPane.INFORMATION_MESSAGE, + null, + new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")}, + null ); if (rv == JOptionPane.OK_OPTION) { RestartHelper.restart(); diff --git a/designer_base/src/com/fr/design/beans/FurtherBasicBeanPane.java b/designer_base/src/com/fr/design/beans/FurtherBasicBeanPane.java index 9129c2b870..8c61c96db0 100644 --- a/designer_base/src/com/fr/design/beans/FurtherBasicBeanPane.java +++ b/designer_base/src/com/fr/design/beans/FurtherBasicBeanPane.java @@ -1,5 +1,7 @@ package com.fr.design.beans; +import com.fr.stable.StringUtils; + /** * * @author zhou @@ -17,8 +19,10 @@ public abstract class FurtherBasicBeanPane extends BasicBeanPane { * title应该是一个属性,不只是对话框的标题时用到,与其他组件结合时,也会用得到 * @return 绥化狂标题 */ - @Override - public abstract String title4PopupWindow(); + @Deprecated + public String title4PopupWindow(){ + return StringUtils.EMPTY; + } /** * 重置 diff --git a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java index 311eaf7d94..43f73b870a 100644 --- a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java +++ b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java @@ -115,17 +115,7 @@ public abstract class AbstractHyperlinkPane extends BasicBe @Override public void populateBean(T link) { String name = link.getTargetFrame(); - if ("_self".equals(name)) { - targetFrameComboBox.setSelectedIndex(SELF); - } else if ("_dialog".equals(name)) { - targetFrameComboBox.setSelectedIndex(DIALOG); - } else if ("_blank".equals(name)) { - targetFrameComboBox.setSelectedIndex(NEW_WINDOW); - } else { - DefaultComboBoxModel model = (DefaultComboBoxModel) targetFrameComboBox.getModel(); - model.addElement(name); - targetFrameComboBox.setSelectedItem(name); - } + targetFrameComboBox.setSelectedIndex(HyperlinkTargetFrame.convert(name)); heightTextFiled.setText(String.valueOf(link.getHeight() == 0 ? DEFAULT_H_VALUE : link.getHeight())); widthTextFiled.setText(String.valueOf(link.getWidth() == 0 ? DEFAULT_V_VALUE : link.getWidth())); populateSubHyperlinkBean(link); diff --git a/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java b/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java index 80e9f21a0a..f0b0543a46 100644 --- a/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java +++ b/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java @@ -1,5 +1,7 @@ package com.fr.design.hyperlink; +import com.fr.general.ComparatorUtils; + /** * Created by ibm on 2016/10/13. */ @@ -27,6 +29,18 @@ public enum HyperlinkTargetFrame { return BLANK_FRAME; } + public static int convert(String name) { + if (arrayOfValues == null) { + arrayOfValues = HyperlinkTargetFrame.values(); + } + for (HyperlinkTargetFrame hyperlinkTargetFrame : HyperlinkTargetFrame.values()) { + if (ComparatorUtils.equals(hyperlinkTargetFrame.getName(), name)) { + return hyperlinkTargetFrame.getIndex(); + } + } + return BLANK_FRAME.getIndex(); + } + public int getIndex() { return index; diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 2ddb5b05f2..3bf990880c 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -259,7 +259,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); IndependentChartUIProvider provider = (IndependentChartUIProvider) entry.getValue(); - names[i++] = provider.getPlotTypePane().title4PopupWindow(); + names[i++] = provider.getPlotTypeTitle4PopupWindow(); } return names; } @@ -274,7 +274,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh public String getTitle4PopupWindow(String priority, String plotID){ if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){ IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID); - return provider.getPlotTypePane().title4PopupWindow(); + return provider.getPlotTypeTitle4PopupWindow(); } //兼容老的插件 @@ -284,7 +284,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Map.Entry entry = (Map.Entry) iterator.next(); String defaultPriority = (String) entry.getKey(); if (chartTypeInterfaces.get(defaultPriority).containsKey(plotID)) { - return chartTypeInterfaces.get(defaultPriority).get(plotID).getPlotTypePane().title4PopupWindow(); + return chartTypeInterfaces.get(defaultPriority).get(plotID).getPlotTypeTitle4PopupWindow(); } } } @@ -332,7 +332,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (chartUI.hasNext()) { Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); + names[index++] = provider.getPlotTypeTitle4PopupWindow(); } return index; } diff --git a/designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java b/designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java index a919143967..1b90382d6a 100644 --- a/designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java +++ b/designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java @@ -84,5 +84,10 @@ public interface IndependentChartUIProvider extends Level { */ String getIconPath(); + /** + * plot面板的标题 + */ + String getPlotTypeTitle4PopupWindow(); + } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java index 2a1e6b4c4b..ff0eaa81db 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -57,4 +57,12 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ public ConditionAttributesPane getPlotConditionPane(Plot plot){ return new DataSeriesConditionPane(); } + + /** + * plot面板的标题 + * 插件兼容 + */ + public String getPlotTypeTitle4PopupWindow(){ + return getPlotTypePane().title4PopupWindow(); + } } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 6b6c9a4276..91b6bba3c1 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -138,7 +138,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private void checkoutChange(){ editingCollection.calculateMultiChartMode(); if (parent != null){ - parent.reactorChartTypePane(editingCollection); + parent.relayoutChartTypePane(editingCollection); } //检查是否可以配置切换 configButton.setEnabled(editingCollection.changeEnable()); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 6c747c9cc1..a3a028ef89 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -68,8 +68,13 @@ public class ChartTypePane extends AbstractChartAttrPane{ buttonPane = new ChartTypeButtonPane(this); content.add(buttonPane, BorderLayout.NORTH); - - chartTypePane = new ComboBoxPane(); + + if (editingCollection != null) { + relayoutChartTypePane(editingCollection); + }else { + chartTypePane = new ComboBoxPane(); + } + BasicScrollPane scrollPane = new BasicScrollPane() { @Override protected JPanel createContentPane() { @@ -192,7 +197,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ }); } - public void reactor(ChartCollection collection){ + public void relayout(ChartCollection collection){ //重构需要重构下拉框选项和cardNames Chart chart = collection.getSelectedChart(); String chartID = chart.getPriority(); @@ -278,9 +283,9 @@ public class ChartTypePane extends AbstractChartAttrPane{ } - public void reactorChartTypePane(ChartCollection collection){ - if (needReactor(collection)) { - chartTypePane.reactor(collection); + public void relayoutChartTypePane(ChartCollection collection){ + if (needRelayout(collection)) { + chartTypePane.relayout(collection); //设置面板切换状态 updatePaneState(collection); } @@ -292,7 +297,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ } // TODO: 2016/11/17 因为现在populate面板时会重新构造面板,所以每次都需要重构 - private boolean needReactor(ChartCollection collection) { + private boolean needRelayout(ChartCollection collection) { /*return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState();*/ return true; } @@ -301,14 +306,14 @@ public class ChartTypePane extends AbstractChartAttrPane{ * 更新界面属性 用于展示 */ public void populate(ChartCollection collection) { + editingCollection = collection; + Chart chart = collection.getSelectedChart(); this.remove(leftContentPane); initContentPane(); buttonPane.populateBean(collection); chartTypePane.populateBean(chart); - //remove面板之后,就需要重构下拉框 - reactorChartTypePane(collection); this.initAllListeners(); }