diff --git a/designer/src/com/fr/design/report/ReportBackgroundPane.java b/designer/src/com/fr/design/report/ReportBackgroundPane.java index a3e913fe41..dcf1247920 100644 --- a/designer/src/com/fr/design/report/ReportBackgroundPane.java +++ b/designer/src/com/fr/design/report/ReportBackgroundPane.java @@ -1,47 +1,57 @@ -package com.fr.design.report; - -import java.awt.BorderLayout; - -import com.fr.page.ReportSettingsProvider; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.dialog.BasicPane; -import com.fr.general.Inter; -import com.fr.design.style.background.BackgroundPane; - -public class ReportBackgroundPane extends BasicPane { - private UICheckBox isPrintBackgroundCheckBox; - private BackgroundPane backgroundPane; - - public ReportBackgroundPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - backgroundPane = new BackgroundPane(); - this.add(backgroundPane, BorderLayout.CENTER); - - isPrintBackgroundCheckBox = new UICheckBox( - Inter.getLocText("ReportGUI-Print_Background")); - this.add(isPrintBackgroundCheckBox, BorderLayout.SOUTH); - } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText(new String[]{"paper", "Background"}); - } - - /** - * Populate - */ - public void populate(ReportSettingsProvider reportSettings) { - this.backgroundPane.populate(reportSettings.getBackground()); - this.isPrintBackgroundCheckBox.setSelected(reportSettings.isPrintBackground()); - } - - /** - * update - */ - public void update(ReportSettingsProvider reportSettings) { - reportSettings.setBackground(this.backgroundPane.update()); - reportSettings.setPrintBackground(this.isPrintBackgroundCheckBox.isSelected()); - } +package com.fr.design.report; + +import java.awt.BorderLayout; + +import javax.swing.JPanel; + +import com.fr.page.ReportSettingsProvider; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.dialog.BasicPane; +import com.fr.general.Inter; +import com.fr.design.style.background.BackgroundPane; + +public class ReportBackgroundPane extends BasicPane { + private UICheckBox isPrintBackgroundCheckBox; + private UICheckBox isExportBackgroundCheckBox; + private BackgroundPane backgroundPane; + + public ReportBackgroundPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + backgroundPane = new BackgroundPane(); + this.add(backgroundPane, BorderLayout.CENTER); + + isPrintBackgroundCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Print_Background")); + isExportBackgroundCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Export_Background")); + JPanel sourth = new JPanel(); + sourth.add(isExportBackgroundCheckBox); + sourth.add(isPrintBackgroundCheckBox); + this.add(sourth, BorderLayout.SOUTH); + + this.add(isPrintBackgroundCheckBox, BorderLayout.SOUTH); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText(new String[]{"paper", "Background"}); + } + + /** + * Populate + */ + public void populate(ReportSettingsProvider reportSettings) { + this.backgroundPane.populate(reportSettings.getBackground()); + this.isPrintBackgroundCheckBox.setSelected(reportSettings.isPrintBackground()); + this.isExportBackgroundCheckBox.setSelected(reportSettings.isExportBackground()); + } + + /** + * update + */ + public void update(ReportSettingsProvider reportSettings) { + reportSettings.setBackground(this.backgroundPane.update()); + reportSettings.setPrintBackground(this.isPrintBackgroundCheckBox.isSelected()); + reportSettings.setExportBackground(this.isExportBackgroundCheckBox.isSelected()); + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/webattr/WriteWebSettingPane.java b/designer/src/com/fr/design/webattr/WriteWebSettingPane.java index 92b26b0d59..0f52d6f05a 100644 --- a/designer/src/com/fr/design/webattr/WriteWebSettingPane.java +++ b/designer/src/com/fr/design/webattr/WriteWebSettingPane.java @@ -56,7 +56,7 @@ public class WriteWebSettingPane extends WebSettingPane { //sheet标签页显示位置 topRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Top")); bottomRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer_Bottom")); - sheetShowLocationLabel = new UILabel("sheet" + Inter.getLocText(new String[]{"Label", "Page_Number", "Display position"}) + ":", UILabel.LEFT); + sheetShowLocationLabel = new UILabel(Inter.getLocText("FR-Designer_Sheet_Label_Page_Display_Position"), UILabel.LEFT); ButtonGroup buttonGroup = new ButtonGroup(); bottomRadioButton.setSelected(true); buttonGroup.add(topRadioButton); diff --git a/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java b/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java index e625c2490a..02addd1936 100644 --- a/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java @@ -49,7 +49,7 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); this.decimalLength.setColumns(4); - limitNumberPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"}) + ":"), this.decimalLength}, + limitNumberPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText("FR-Designer_Decimal_Places")), this.decimalLength}, FlowLayout.LEFT, 4); getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); this.allowDecimalsCheckBox.addActionListener(actionListener1); diff --git a/designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java b/designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java index 8545d85d06..0777d5991d 100644 --- a/designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java @@ -3,11 +3,13 @@ package com.fr.design.actions.file; import com.fr.base.BaseUtils; import com.fr.base.Env; import com.fr.base.FRContext; -import com.fr.design.data.DesignTableDataManager; -import com.fr.design.data.tabledata.ResponseDataSourceChange; +import com.fr.base.FRCoreContext; import com.fr.dav.LocalEnv; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.tabledata.ResponseDataSourceChange; +import com.fr.design.dialog.InformationWarnPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -15,16 +17,14 @@ import com.fr.design.mainframe.TemplatePane; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; -import com.fr.design.dialog.InformationWarnPane; import com.fr.env.RemoteEnv; import com.fr.env.SignIn; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.GeneralContext; import com.fr.general.Inter; -import com.fr.stable.LicUtils; -import com.fr.stable.ProductConstants; import com.fr.stable.EnvChangedListener; +import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import javax.swing.*; @@ -118,7 +118,7 @@ public class SwitchExistEnv extends MenuDef { return; } SignIn.signIn(selectedEnv); - LicUtils.resetBytes(); + resetLicenseBytes(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); fireDSChanged(); } catch (Exception em) { @@ -127,5 +127,10 @@ public class SwitchExistEnv extends MenuDef { TemplatePane.getInstance().editItems(); } } + + private void resetLicenseBytes() { + FRCoreContext.retryLicLock(); + } } + } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java b/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java index 0f1c50a5fd..d8ae98bbca 100644 --- a/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java +++ b/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java @@ -1,7 +1,7 @@ package com.fr.design.editor.editor; -import com.fr.design.data.DesignTableDataManager; import com.fr.data.SimpleDSColumn; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.icombobox.UIComboBox; @@ -36,9 +36,13 @@ public class ColumnSelectedEditor extends Editor { @Override public void itemStateChanged(ItemEvent e) { - //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 - List nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList(); - columnNames = new String[nameList.size()]; + TableDataWrapper tableDataWrapper = tableDataComboBox.getSelectedItem(); + if (tableDataWrapper == null) { + return; + } + //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 + List nameList = tableDataWrapper.calculateColumnNameList(); + columnNames = new String[nameList.size()]; columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames); columnNameComboBox.removeAllItems(); for (int i = 0; i < columnNames.length; i++) { @@ -64,7 +68,7 @@ public class ColumnSelectedEditor extends Editor { dsColumn.setDsName(tableDataWrappe.getTableDataName()); TableDataColumn column; String columnExp = (String) this.columnNameComboBox.getSelectedItem(); - if (StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#")) { + if (StringUtils.isNotBlank(columnExp) && checkColumnExp(columnExp)) { String number = columnExp.substring(1); Pattern pattern = Pattern.compile("[^\\d]"); if (pattern.matcher(number).find()) { @@ -80,6 +84,10 @@ public class ColumnSelectedEditor extends Editor { return dsColumn; } + private boolean checkColumnExp (String columnExp) { + return (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#"); + } + public String getIconName() { return "ds_column"; } diff --git a/designer_base/src/com/fr/design/gui/controlpane/AbstractNameableCreator.java b/designer_base/src/com/fr/design/gui/controlpane/AbstractNameableCreator.java index 36a760b5b1..f3fec1fba2 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/AbstractNameableCreator.java +++ b/designer_base/src/com/fr/design/gui/controlpane/AbstractNameableCreator.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; +import com.fr.js.JavaScript; import javax.swing.*; @@ -14,7 +15,7 @@ public abstract class AbstractNameableCreator implements NameableCreator { protected Class clazzOfObject; protected Class clazzOfInitCase; protected Class clazzOfEditor; - + public AbstractNameableCreator(String menuName, Class clazz, Class clazzOfEditor) { this.menuName = menuName; this.clazzOfObject = clazz; @@ -28,7 +29,7 @@ public abstract class AbstractNameableCreator implements NameableCreator { this.clazzOfObject = clazz; this.clazzOfInitCase = clazz; } - + public AbstractNameableCreator(String menuName, String iconPath, Class clazz, Class clazzOfEditor) { this.menuName = menuName; this.menuIcon = BaseUtils.readIcon(iconPath); @@ -36,7 +37,7 @@ public abstract class AbstractNameableCreator implements NameableCreator { this.clazzOfEditor = clazzOfEditor; this.clazzOfInitCase = clazz; } - + public AbstractNameableCreator(String menuName, String iconPath, Class clazz, Class clazz4Init, Class clazzOfEditor) { this.menuName = menuName; this.menuIcon = BaseUtils.readIcon(iconPath); @@ -50,7 +51,7 @@ public abstract class AbstractNameableCreator implements NameableCreator { * get menuName * @return */ - public String menuName() { + public String menuName() { return this.menuName; } @@ -70,6 +71,14 @@ public abstract class AbstractNameableCreator implements NameableCreator { return this.clazzOfEditor; } + /** + * get clazzOfObject + * @return clazzOfObject + */ + public Class getHyperlink() { + return this.clazzOfObject; + } + /** * * @param ob @@ -83,12 +92,12 @@ public abstract class AbstractNameableCreator implements NameableCreator { doSthChanged4Icon(ob); return ob; } - + return null; } protected void doSthChanged4Icon(Object ob){ - + } /** @@ -99,9 +108,9 @@ public abstract class AbstractNameableCreator implements NameableCreator { return null; } - public boolean isNeedParameterWhenPopulateJControlPane(){ - return false; - } + public boolean isNeedParameterWhenPopulateJControlPane(){ + return false; + } public boolean equals(Object obj) { return obj instanceof AbstractNameableCreator diff --git a/designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java b/designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java index f497be1e6c..09d1833b17 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java +++ b/designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java @@ -2,24 +2,27 @@ package com.fr.design.gui.controlpane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilist.ListModelElement; +import com.fr.js.JavaScript; import com.fr.stable.Nameable; import javax.swing.*; public interface NameableCreator { public String menuName(); - + public Icon menuIcon(); - + public String createTooltip(); - + public Nameable createNameable(UnrepeatedNameHelper helper); - + public Class getUpdatePane(); - + + public Class getHyperlink(); + public Object acceptObject2Populate(Object ob); - + public void saveUpdatedBean(ListModelElement wrapper, Object bean); - public boolean isNeedParameterWhenPopulateJControlPane(); + public boolean isNeedParameterWhenPopulateJControlPane(); } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java b/designer_base/src/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java index b2e30f41f5..d604ac3b8d 100644 --- a/designer_base/src/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java @@ -237,7 +237,8 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver { public Dimension getPreferredSize() { Dimension dimension = new Dimension(); dimension.height = super.getPreferredSize().height; - dimension.width = addButton.getWidth() - 2; + // 不能写死,否则出现国际化显示不全的问题 + dimension.width = Math.max(addButton.getWidth() - 2, super.getPreferredSize().width); return dimension; } }; diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index bebb719d75..7fb65a8282 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -1345,6 +1345,8 @@ Remove_All_Button=Remove_All_Button FR-Designer_Component_Interval=Components Interval ReportColumns-Columns_vertically=Columns vertically ReportGUI-Print_Background=Print Background +FR-Designer_Print_Background=Print Background +FR-Designer_Export_Background=Export Background Export-CSV=CSV M_Edit-Paste=Paste FR-Designer-Basic_Restart_Designer=Restart designer @@ -2003,4 +2005,7 @@ FR-Product_Demo=Demo FR-Designer_Tree_Data_Field=Tree Data Field FR-Designer_Data_Filter=Data Filter Default=Default +FR-Designer_Sheet_Label_Page_Display_Position=Sheet tab display location: +FR-Designer_Provide_Choose_All=Provide Select All +FR-Designer_Decimal_Places=Decimal Places: FR-Base-Load_Resource_File=Load resource file diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index fc7eb13c98..e4925190d6 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -1345,6 +1345,8 @@ Remove_All_Button=Remove all buttons FR-Designer_Component_Interval=Component Interval ReportColumns-Columns_vertically=Fixed columns per line ReportGUI-Print_Background=Print/export background +FR-Designer_Print_Background=Print Background +FR-Designer_Export_Background=Export Background Export-CSV=CSV M_Edit-Paste=Paste FR-Designer-Basic_Restart_Designer=Restart designer @@ -2004,4 +2006,7 @@ FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=Build Tree according to the pa FR-Product_Demo=Demo FR-Designer_Data_Filter=Data Filter Default=Default +FR-Designer_Sheet_Label_Page_Display_Position=Sheet tab display location: +FR-Designer_Provide_Choose_All=Provide Select All +FR-Designer_Decimal_Places=Decimal Places: FR-Base-Load_Resource_File=Load Configuration File diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index a7121617c0..11f0fb0d96 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -1345,6 +1345,8 @@ Remove_All_Button=\u3059\u3079\u3066\u306E\u30DC\u30BF\u30F3\u3092\u30AF\u30EA\u FR-Designer_Component_Interval=\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u9593\u9694 ReportColumns-Columns_vertically=\u5217\u306E\u6BB5\u7D44\u307F ReportGUI-Print_Background=\u5E33\u7968\u80CC\u666F\u306E\u5370\u5237/\u51FA\u529B +FR-Designer_Print_Background=\u5E33\u7968\u80CC\u666F\u306E\u5370\u5237 +FR-Designer_Export_Background=\u5E33\u7968\u80CC\u666F\u306E\u51FA\u529B Export-CSV=CSV(\u30AB\u30F3\u30DE\u533A\u5207\u308A) M_Edit-Paste=\u8CBC\u308A\u4ED8\u3051(P) FR-Designer-Basic_Restart_Designer=\u30C7\u30B6\u30A4\u30CA\u30FC\u518D\u8D77\u52D5 @@ -2003,5 +2005,7 @@ FR-Product_Demo=\u88FD\u54C1\u30C7\u30E2 FR-Designer_Data_Filter=\u30C7\u30FC\u30BF\u30D5\u30A3\u30EB\u30BF FR-Designer_Can_not_use_FormatBursh=\u9023\u7D9A\u3057\u306A\u3044\u8907\u6570\u9818\u57DF\u3067\u306F\u66F8\u5F0F\u30B3\u30D4\u30FC\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093 Default=\u65E2\u5B9A -FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9 - +FR-Designer_Sheet_Label_Page_Display_Position= +FR-Designer_Provide_Choose_All=\u63D0\u4F9B\u3059\u3079\u3066\u9078\u629E +FR-Designer_Decimal_Places=\u5C0F\u6570\u6570\u91CF: +FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9 \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 50adf67cee..84b0e8f076 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -1345,6 +1345,8 @@ Remove_All_Button=\uBAA8\uB4E0\uD0A4\uD074\uB9AC\uC5B4 FR-Designer_Component_Interval=\uC5B4\uC148\uBE14\uB9AC\uAC04\uACA9 ReportColumns-Columns_vertically=\uC5F4\uC140\uB098\uB204\uAE30 ReportGUI-Print_Background=\uC778\uC1C4/\uB0B4\uBCF4\uB0B4\uAE30\uBB38\uC11C\uBC30\uACBD +FR-Designer_Print_Background=\uC778\uC1C4\uBB38\uC11C\uBC30\uACBD +FR-Designer_Export_Background=\uB0B4\uBCF4\uB0B4\uAE30\uBB38\uC11C\uBC30\uACBD Export-CSV=CSV\uC11C\uC2DD(\uC27C\uD45C\uAD6C\uBD84) M_Edit-Paste=\uBD99\uC5EC\uB123\uAE30(P) FR-Designer-Basic_Restart_Designer=\uC7AC\uBD80\uD305\uC124\uACC4\uAE30 @@ -2003,4 +2005,7 @@ FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\uC120\uD0DD\uD55C\uB370\uC774 FR-Product_Demo=\uC81C\uD488\uC2DC\uC5F0 FR-Designer_Data_Filter=\uB370\uC774\uD130\uC120\uBCC4 Default=\uAE30\uBCF8 -FR-Base-Load_Resource_File=\uB85C\uB529\uAD6C\uC131\uD30C\uC77C +FR-Designer_Sheet_Label_Page_Display_Position= +FR-Designer_Provide_Choose_All=\uC81C\uACF5\uBAA8\uB450\uC120\uD0DD +FR-Designer_Decimal_Places=\uC18C\uC218\uC218\uB7C9: +FR-Base-Load_Resource_File=\uB85C\uB529\uAD6C\uC131\uD30C\uC77C \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 8e669cfe0c..e0bd4bf8d3 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -1345,6 +1345,8 @@ Remove_All_Button=\u6E05\u9664\u6240\u6709\u6309\u94AE FR-Designer_Component_Interval=\u7EC4\u4EF6\u95F4\u9694 ReportColumns-Columns_vertically=\u5217\u5206\u680F ReportGUI-Print_Background=\u6253\u5370/\u5BFC\u51FA\u62A5\u8868\u80CC\u666F +FR-Designer_Print_Background=\u6253\u5370\u62A5\u8868\u80CC\u666F +FR-Designer_Export_Background=\u5BFC\u51FA\u62A5\u8868\u80CC\u666F Export-CSV=CSV\u683C\u5F0F(\u9017\u53F7\u5206\u9694) M_Edit-Paste=\u7C98\u8D34(P) FR-Designer-Basic_Restart_Designer=\u91CD\u542F\u8BBE\u8BA1\u5668 @@ -2003,5 +2005,7 @@ FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\u4F9D\u8D56\u6240\u9009\u6570 FR-Product_Demo=\u4EA7\u54C1\u6F14\u793A FR-Designer_Data_Filter=\u6570\u636E\u7B5B\u9009 Default=\u9ED8\u8BA4 +FR-Designer_Sheet_Label_Page_Display_Position=sheet\u6807\u7B7E\u9875\u663E\u793A\u4F4D\u7F6E\uFF1A +FR-Designer_Provide_Choose_All=\u63D0\u4F9B\u5168\u9009 +FR-Designer_Decimal_Places=\u5C0F\u6570\u6570\u76EE\uFF1A FR-Base-Load_Resource_File=\u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6 - diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 563f4bfd92..74857e53bd 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -1345,6 +1345,8 @@ Remove_All_Button=\u6E05\u9664\u6240\u6709\u6309\u9215 FR-Designer_Component_Interval=\u5143\u4EF6\u9593\u9694 ReportColumns-Columns_vertically=\u6B04\u5206\u6B04 ReportGUI-Print_Background=\u5217\u5370/\u532F\u51FA\u5831\u8868\u80CC\u666F +FR-Designer_Print_Background=\u5217\u5370\u5831\u8868\u80CC\u666F +FR-Designer_Export_Background=\u532F\u51FA\u5831\u8868\u80CC\u666F Export-CSV=CSV\u683C\u5F0F(\u9017\u865F\u5206\u9694) M_Edit-Paste=\u8CBC\u4E0A(P) FR-Designer-Basic_Restart_Designer=\u91CD\u555F\u8A2D\u8A08\u5668 @@ -2004,5 +2006,7 @@ FR-Designer_Build_Tree_Accord_Parent_Marked_Filed=\u4F9D\u8CF4\u6240\u9078\u8CC7 FR-Product_Demo=\u529F\u80FD\u5C55\u793A FR-Designer_Data_Filter=\u8CC7\u6599\u7BE9\u9078 Default=\u9810\u8A2D +FR-Designer_Sheet_Label_Page_Display_Position=sheet\u6A19\u7C64\u9801\u986F\u793A\u4F4D\u7F6E\uFF1A +FR-Designer_Provide_Choose_All=\u63D0\u4F9B\u5168\u9078 +FR-Designer_Decimal_Places=\u5C0F\u6578\u6578\u76EE\uFF1A FR-Base-Load_Resource_File=\u52A0\u8F09\u914D\u7F6E\u6A94\u6848 - diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogImpl.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogImpl.java index bb121d0c2b..6960d0f0f8 100644 --- a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogImpl.java +++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogImpl.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.loghandler; import com.fr.stable.fun.impl.AbstractLogProvider; +import com.fr.stable.web.SessionProvider; import com.fr.stable.xml.LogRecordTimeProvider; import java.util.ArrayList; @@ -43,4 +44,9 @@ public class DesignerLogImpl extends AbstractLogProvider{ public void record(LogRecordTimeProvider logRecordTime) { records.add(logRecordTime); } + + @Override + public void record(LogRecordTimeProvider logRecordTime, SessionProvider sessionProvider) { + + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/LogDetailPane.java b/designer_base/src/com/fr/design/mainframe/loghandler/LogDetailPane.java index 6045e57b27..384f2c6599 100644 --- a/designer_base/src/com/fr/design/mainframe/loghandler/LogDetailPane.java +++ b/designer_base/src/com/fr/design/mainframe/loghandler/LogDetailPane.java @@ -7,6 +7,7 @@ import javax.swing.JPanel; import com.fr.base.BaseUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; public class LogDetailPane extends JPanel{ public LogDetailPane() { @@ -20,7 +21,7 @@ public class LogDetailPane extends JPanel{ fr.setSize(600, 400); GUICoreUtils.centerWindow(fr); fr.setResizable(false); - fr.setTitle("日志"); + fr.setTitle(Inter.getLocText("FR-Designer_Log")); fr.setIconImage(BaseUtils.readImageWithCache("com/fr/design/images/buttonicon/history.png")); fr.getContentPane().setLayout(new BorderLayout()); fr.getContentPane().add(this, BorderLayout.CENTER); diff --git a/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java index 9b1069056f..4555c336bb 100644 --- a/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -1 +1 @@ -package com.fr.design.roleAuthority; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DockingView; import com.fr.design.menu.ToolBarDef; import com.fr.general.Inter; import com.fr.general.VT4FR; import com.fr.stable.StableUtils; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.*; import java.util.Enumeration; /** * 设计器左下角面板,用于在权限编辑时存放角色 * Author : daisy * Date: 13-8-30 * Time: 下午2:22 */ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSourceChange { private static final int REPORT_PLATEFORM_MANAGE = 0; private static final int FS_MANAGE = 1; private static final int LEFT_GAP = -125; private static boolean isSupportFS = false; private TreePath treePath = null; private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); private static RoleTree roleTree; // carl:我先屏了,现在半拉子,等客户要了再好好做 // private AddAction addAction = new AddAction(); // private RemoveAction removeAction = new RemoveAction(); private RefreshAction refreshAction = new RefreshAction(); private UIHeadGroup buttonGroup; private RoleSourceOP op; protected String[] roleNames = new String[2]; public synchronized static ReportAndFSManagePane getInstance() { singleton.op = new RoleSourceOP(); singleton.op.setDataMode(isSupportFS ? FS_MANAGE : REPORT_PLATEFORM_MANAGE); singleton.setDefaultSelectedRole(); return singleton; } public ReportAndFSManagePane() { initRoleTree(); this.setLayout(new BorderLayout(4, 0)); this.setBorder(null); this.add(iniToolBarPane(), BorderLayout.NORTH); refreshAction.setEnabled(true); UIScrollPane scrollPane = new UIScrollPane(roleTree); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 0)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); initbuttonGroup(); JPanel jPanel = new JPanel(new BorderLayout(4, 4)); JPanel buttonPane = new JPanel(new GridLayout()); buttonPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); buttonPane.add(buttonGroup, BorderLayout.CENTER); jPanel.add(buttonPane, BorderLayout.NORTH); jPanel.add(scrollPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER); registerDSChangeListener(); } private void initRoleTree() { roleTree = new RoleTree() { public void refreshRoleTree(String selectedRole) { super.refreshRoleTree(selectedRole); changeAlreadyEditedPaneRole(selectedRole); } protected void doWithValueChanged(TreeSelectionEvent e) { super.doWithValueChanged(e); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); setSelectedRole(roleTree.getSelectedRoleName(), parent); } protected void setTabRoleName(String roleName) { roleNames[getMode()] = roleTree.getSelectedRoleName(); } }; roleTree.setEnabled(true); roleTree.setEditable(false); // RoleTreeCellEditor treeCellEditor = new RoleTreeCellEditor(new UITextField()); // treeCellEditor.addCellEditorListener(treeCellEditor); // roleTree.setCellEditor(treeCellEditor); roleTree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { super.mouseClicked(e); roleTree.setEditable(false); // int row = roleTree.getRowForLocation(e.getX(), e.getY()); // TreePath path = roleTree.getPathForLocation(e.getX(), e.getY()); // if (e.getClickCount() == 2 && buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // if (!(ap instanceof DaoAuthenticationProvider)) { // roleTree.setEditable(true); // roleTree.startEditingAtPath(path); // treePath = path; // } // } } }); } private void changeAlreadyEditedPaneRole(String selectedRole) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); RoleTree roleTree = RolesAlreadyEditedPane.getInstance().getRoleTree(); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); roleTree.setSelectedRole(selectedRole, parent); } public void setDefaultSelectedRole() { //设置选中的节点 TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); String selectedRole = null; if (singleton != null) { selectedRole = roleNames[getMode()]; } if (selectedRole == null) { if (node.getChildCount() <= 0 || node.getFirstChild().getChildCount() <= 0) { return; } selectedRole = node.getFirstChild().getChildAt(0).toString(); } roleTree.setSelectedRole(selectedRole, parent); } public RoleTree getRoleTree() { return roleTree; } /** * 检查f) 每增删改一个角色信息(及时保存),先对比下privilege下之前的角色信息有没有发生变化(即在此期间有没有在其他途径中修改过) */ private void checkChanges() { //如若有变化,则弹出下面的对话框 int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Role_changed_isRefresh") + "?", Inter.getLocText("FR-Designer_Refresh"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } private JPanel iniToolBarPane() { ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(refreshAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolbarDef.updateToolBar(toolBar); JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); toolbarPane.add(toolBar, BorderLayout.CENTER); return toolbarPane; } private void initbuttonGroup() { isSupportFS = VT4FR.isLicAvailable(StableUtils.getBytes()) && VT4FR.FS_BI.support(); Icon[] iconArray = null; String[] textArray = null; if (isSupportFS) { iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; textArray = new String[]{Inter.getLocText("FR-Designer_FS_Name")}; } else { iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/platform_16_16.png")}; textArray = new String[]{Inter.getLocText("M_Server-Platform_Manager")}; } buttonGroup = new UIHeadGroup(iconArray, textArray) { public void tabChanged(int index) { roleTree.setEditable(false); if (op != null) { op.setDataMode(getMode()); //判断是否可编辑 refreshDockingView(); } setDefaultSelectedRole(); if (singleton != null) { changeAlreadyEditedPaneRole(roleNames[getMode()]); } } }; buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); buttonGroup.setNeedLeftRightOutLine(false); } private int getMode(){ return isSupportFS?FS_MANAGE: REPORT_PLATEFORM_MANAGE; } // /** // * 检查看看是否可以增删刷新按钮是都可以编辑,并且检查角色树是不是可以编辑 // */ // public void checkToolButtonsEnabled() { // if (buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // PrivilegeFilter pf = pm.getPrivilegeFilter(); // boolean isClickable = !(ap instanceof DaoAuthenticationProvider) // && pf instanceof AuthorityControlFilter; // addAction.setEnabled(isClickable); // removeAction.setEnabled(isClickable); // } else { // addAction.setEnabled(false); // removeAction.setEnabled(false); // } // // } /** * 刷新界面 */ public void refreshDockingView() { populate(new RoleSourceOP()); // this.checkToolButtonsEnabled(); } private void populate(RoleSourceOP op) { this.op = op; roleTree.populate(op); expandTree(roleTree, true); } public String getViewTitle() { return null; } public Icon getViewIcon() { return null; } /** * 最佳定位 * @return 定位 */ public Location preferredLocation() { return null; } /** * 注册数据库改变的响应的Listener */ public void registerDSChangeListener() { DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } }); } // private class AddAction extends UpdateAction { // public AddAction() { // this.setName(Inter.getLocText("Add")); // this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); // } // // @Override // public void actionPerformed(ActionEvent e) { // refreshDockingView(); // // DefaultTreeModel treeModel = (DefaultTreeModel) roleTree.getModel(); // ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); // ExpandMutableTreeNode parentNode = (ExpandMutableTreeNode) root.getChildAt(0); // String newName = Inter.getLocText("newNode") + (++newIndex); // parentNode.add(new ExpandMutableTreeNode(newName)); // op.addAction(newName); // roleTree.updateUI(); // // try { // synchronized (AuthorityRoleDAOManager.class) { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // if (AuthorityRoleDAOManager.getAuthorityAllocation(pf, newName) != null) { // newName = Inter.getLocText("newNode") + (++newIndex); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // AuthorityRoleDAOManager.addAuthorityRole(pf, new Authority(newName), new Allocation(), false, true); // // AuthorityRoleDAOManager.doEnd(pf); // } // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // } // } // private class RemoveAction extends UpdateAction { // // public RemoveAction() { // this.setName(Inter.getLocText("Remove")); // this.setSmallIcon(UIConstants.CLEAR_ICON); // } // // @Override // public void actionPerformed(ActionEvent e) { // // // NameObject selectedNO = roleTree.getSelectedNameObject(); // // if (selectedNO == null) { // return; // } // // int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Are_you_sure_to_remove_the_selected_item") + ":" + selectedNO.getName() + "?", // Inter.getLocText("Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); // if (returnVal == JOptionPane.OK_OPTION) { // op.removeAction(selectedNO.getName()); // // try { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // AuthorityRoleDAOManager.removeAuthorityRole(pf, new Authority(selectedNO.getName()), true); // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // roleTree.requestFocus(); // roleTree.setSelectionRow(roleTree.getRowCount() - 1); // } // } // } /* * 刷新ReportletsTree */ private class RefreshAction extends UpdateAction { public RefreshAction() { this.setName(Inter.getLocText("FR-Designer_Refresh")); this.setSmallIcon(UIConstants.REFRESH_ICON); } @Override public void actionPerformed(ActionEvent evt) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } // private class RoleTreeCellEditor extends DefaultCellEditor implements TreeCellEditor, CellEditorListener { // // private NameObject editingNO; // private String oldName; // private String newName; // private UITextField jTextField; // // public RoleTreeCellEditor(final UITextField textField) { // super(textField); // this.jTextField = textField; // this.jTextField.setPreferredSize(new Dimension(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth() - 5, this.jTextField.getHeight())); // } // // @Override // public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { // editingNO = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // oldName = editingNO.getName(); // // delegate.setValue(oldName); // // editorComponent.setPreferredSize(new java.awt.Dimension(ReportAndFSManagePane.this.getPreferredSize().width, editorComponent.getPreferredSize().height)); // // return editorComponent; // } // // @Override // // public boolean isCellEditable(EventObject anEvent) { // NameObject no = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // return !(no.getName() == Inter.getLocText("Role")); // } // // @Override // public Object getCellEditorValue() { // newName = super.getCellEditorValue().toString(); // editingNO.setName(newName); // return editingNO; // } // // // private boolean checkRoleNameNotEmpty() { // refreshDockingView(); // // String currentText = delegate.getCellEditorValue().toString(); // boolean isContained = false; // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null && // !ComparatorUtils.equals(oldName, currentText)) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if(ComparatorUtils.equals(_authority.getName(), currentText)){ // isContained = true; // break; // } // } // } catch (Exception e) { // } // } // // if (currentText.isEmpty() || isContained) { // JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("RoleName_Can_Not_Be_Null") + "!"); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // delegate.setValue(oldName); // return false; // } // return true; // } // // /* // * 下面两个方法是CellEditorListener的 // */ // @Override // public void editingCanceled(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // roleTree.stopEditing(); // if (treePath == null) { // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // @Override // public void editingStopped(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // } // // private void changeValue() { // newName = delegate.getCellEditorValue().toString(); // if (!newName.isEmpty() && newName != oldName) { // roleTree.setSelectedRoleName(newName); // op.rename(oldName, newName); // // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if (ComparatorUtils.equals(_authority.getName(), oldName)) { // _authority.setName(newName); // } // } // } catch (Exception e) { // } // } // // try { // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e) { // FRContext.getLogger().error(e.getMessage(), e); // } // } // } // } /** * 展开树 * @param tree 树 * @param isExpand 是否展开 */ public void expandTree(JTree tree, boolean isExpand) { TreeNode root = (TreeNode) tree.getModel().getRoot(); expandAll(tree, new TreePath(root), isExpand); } private void expandAll(JTree tree, TreePath parent, boolean expand) { TreeNode node = (TreeNode) parent.getLastPathComponent(); if (node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { TreeNode n = (TreeNode) e.nextElement(); TreePath path = parent.pathByAddingChild(n); expandAll(tree, path, expand); } } if (expand) { tree.expandPath(parent); } else { tree.collapsePath(parent); } } } \ No newline at end of file +package com.fr.design.roleAuthority; import com.fr.base.BaseUtils; import com.fr.base.FRCoreContext; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DockingView; import com.fr.design.menu.ToolBarDef; import com.fr.general.Inter; import com.fr.general.VT4FR; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Enumeration; /** * 设计器左下角面板,用于在权限编辑时存放角色 * Author : daisy * Date: 13-8-30 * Time: 下午2:22 */ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSourceChange { private static final int REPORT_PLATEFORM_MANAGE = 0; private static final int FS_MANAGE = 1; private static final int LEFT_GAP = -125; private static boolean isSupportFS = false; private TreePath treePath = null; private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); private static RoleTree roleTree; // carl:我先屏了,现在半拉子,等客户要了再好好做 // private AddAction addAction = new AddAction(); // private RemoveAction removeAction = new RemoveAction(); private RefreshAction refreshAction = new RefreshAction(); private UIHeadGroup buttonGroup; private RoleSourceOP op; protected String[] roleNames = new String[2]; public synchronized static ReportAndFSManagePane getInstance() { singleton.op = new RoleSourceOP(); singleton.op.setDataMode(isSupportFS ? FS_MANAGE : REPORT_PLATEFORM_MANAGE); singleton.setDefaultSelectedRole(); return singleton; } public ReportAndFSManagePane() { initRoleTree(); this.setLayout(new BorderLayout(4, 0)); this.setBorder(null); this.add(iniToolBarPane(), BorderLayout.NORTH); refreshAction.setEnabled(true); UIScrollPane scrollPane = new UIScrollPane(roleTree); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 0)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); initbuttonGroup(); JPanel jPanel = new JPanel(new BorderLayout(4, 4)); JPanel buttonPane = new JPanel(new GridLayout()); buttonPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); buttonPane.add(buttonGroup, BorderLayout.CENTER); jPanel.add(buttonPane, BorderLayout.NORTH); jPanel.add(scrollPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER); registerDSChangeListener(); } private void initRoleTree() { roleTree = new RoleTree() { public void refreshRoleTree(String selectedRole) { super.refreshRoleTree(selectedRole); changeAlreadyEditedPaneRole(selectedRole); } protected void doWithValueChanged(TreeSelectionEvent e) { super.doWithValueChanged(e); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); setSelectedRole(roleTree.getSelectedRoleName(), parent); } protected void setTabRoleName(String roleName) { roleNames[getMode()] = roleTree.getSelectedRoleName(); } }; roleTree.setEnabled(true); roleTree.setEditable(false); // RoleTreeCellEditor treeCellEditor = new RoleTreeCellEditor(new UITextField()); // treeCellEditor.addCellEditorListener(treeCellEditor); // roleTree.setCellEditor(treeCellEditor); roleTree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { super.mouseClicked(e); roleTree.setEditable(false); // int row = roleTree.getRowForLocation(e.getX(), e.getY()); // TreePath path = roleTree.getPathForLocation(e.getX(), e.getY()); // if (e.getClickCount() == 2 && buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // if (!(ap instanceof DaoAuthenticationProvider)) { // roleTree.setEditable(true); // roleTree.startEditingAtPath(path); // treePath = path; // } // } } }); } private void changeAlreadyEditedPaneRole(String selectedRole) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); RoleTree roleTree = RolesAlreadyEditedPane.getInstance().getRoleTree(); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); roleTree.setSelectedRole(selectedRole, parent); } public void setDefaultSelectedRole() { //设置选中的节点 TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); String selectedRole = null; if (singleton != null) { selectedRole = roleNames[getMode()]; } if (selectedRole == null) { if (node.getChildCount() <= 0 || node.getFirstChild().getChildCount() <= 0) { return; } selectedRole = node.getFirstChild().getChildAt(0).toString(); } roleTree.setSelectedRole(selectedRole, parent); } public RoleTree getRoleTree() { return roleTree; } /** * 检查f) 每增删改一个角色信息(及时保存),先对比下privilege下之前的角色信息有没有发生变化(即在此期间有没有在其他途径中修改过) */ private void checkChanges() { //如若有变化,则弹出下面的对话框 int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Role_changed_isRefresh") + "?", Inter.getLocText("FR-Designer_Refresh"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } private JPanel iniToolBarPane() { ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(refreshAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolbarDef.updateToolBar(toolBar); JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); toolbarPane.add(toolBar, BorderLayout.CENTER); return toolbarPane; } private void initbuttonGroup() { isSupportFS = supportFineDecision(); Icon[] iconArray = null; String[] textArray = null; if (isSupportFS) { iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; textArray = new String[]{Inter.getLocText("FR-Designer_FS_Name")}; } else { iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/platform_16_16.png")}; textArray = new String[]{Inter.getLocText("M_Server-Platform_Manager")}; } buttonGroup = new UIHeadGroup(iconArray, textArray) { public void tabChanged(int index) { roleTree.setEditable(false); if (op != null) { op.setDataMode(getMode()); //判断是否可编辑 refreshDockingView(); } setDefaultSelectedRole(); if (singleton != null) { changeAlreadyEditedPaneRole(roleNames[getMode()]); } } }; buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); buttonGroup.setNeedLeftRightOutLine(false); } private boolean supportFineDecision() { byte[] bytes = FRCoreContext.getBytes(); return VT4FR.isLicAvailable(bytes) && VT4FR.FS_BI.support(); } private int getMode(){ return isSupportFS?FS_MANAGE: REPORT_PLATEFORM_MANAGE; } // /** // * 检查看看是否可以增删刷新按钮是都可以编辑,并且检查角色树是不是可以编辑 // */ // public void checkToolButtonsEnabled() { // if (buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // PrivilegeFilter pf = pm.getPrivilegeFilter(); // boolean isClickable = !(ap instanceof DaoAuthenticationProvider) // && pf instanceof AuthorityControlFilter; // addAction.setEnabled(isClickable); // removeAction.setEnabled(isClickable); // } else { // addAction.setEnabled(false); // removeAction.setEnabled(false); // } // // } /** * 刷新界面 */ public void refreshDockingView() { populate(new RoleSourceOP()); // this.checkToolButtonsEnabled(); } private void populate(RoleSourceOP op) { this.op = op; roleTree.populate(op); expandTree(roleTree, true); } public String getViewTitle() { return null; } public Icon getViewIcon() { return null; } /** * 最佳定位 * @return 定位 */ public Location preferredLocation() { return null; } /** * 注册数据库改变的响应的Listener */ public void registerDSChangeListener() { DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } }); } // private class AddAction extends UpdateAction { // public AddAction() { // this.setName(Inter.getLocText("Add")); // this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); // } // // @Override // public void actionPerformed(ActionEvent e) { // refreshDockingView(); // // DefaultTreeModel treeModel = (DefaultTreeModel) roleTree.getModel(); // ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); // ExpandMutableTreeNode parentNode = (ExpandMutableTreeNode) root.getChildAt(0); // String newName = Inter.getLocText("newNode") + (++newIndex); // parentNode.add(new ExpandMutableTreeNode(newName)); // op.addAction(newName); // roleTree.updateUI(); // // try { // synchronized (AuthorityRoleDAOManager.class) { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // if (AuthorityRoleDAOManager.getAuthorityAllocation(pf, newName) != null) { // newName = Inter.getLocText("newNode") + (++newIndex); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // AuthorityRoleDAOManager.addAuthorityRole(pf, new Authority(newName), new Allocation(), false, true); // // AuthorityRoleDAOManager.doEnd(pf); // } // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // } // } // private class RemoveAction extends UpdateAction { // // public RemoveAction() { // this.setName(Inter.getLocText("Remove")); // this.setSmallIcon(UIConstants.CLEAR_ICON); // } // // @Override // public void actionPerformed(ActionEvent e) { // // // NameObject selectedNO = roleTree.getSelectedNameObject(); // // if (selectedNO == null) { // return; // } // // int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Are_you_sure_to_remove_the_selected_item") + ":" + selectedNO.getName() + "?", // Inter.getLocText("Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); // if (returnVal == JOptionPane.OK_OPTION) { // op.removeAction(selectedNO.getName()); // // try { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // AuthorityRoleDAOManager.removeAuthorityRole(pf, new Authority(selectedNO.getName()), true); // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // roleTree.requestFocus(); // roleTree.setSelectionRow(roleTree.getRowCount() - 1); // } // } // } /* * 刷新ReportletsTree */ private class RefreshAction extends UpdateAction { public RefreshAction() { this.setName(Inter.getLocText("FR-Designer_Refresh")); this.setSmallIcon(UIConstants.REFRESH_ICON); } @Override public void actionPerformed(ActionEvent evt) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } // private class RoleTreeCellEditor extends DefaultCellEditor implements TreeCellEditor, CellEditorListener { // // private NameObject editingNO; // private String oldName; // private String newName; // private UITextField jTextField; // // public RoleTreeCellEditor(final UITextField textField) { // super(textField); // this.jTextField = textField; // this.jTextField.setPreferredSize(new Dimension(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth() - 5, this.jTextField.getHeight())); // } // // @Override // public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { // editingNO = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // oldName = editingNO.getName(); // // delegate.setValue(oldName); // // editorComponent.setPreferredSize(new java.awt.Dimension(ReportAndFSManagePane.this.getPreferredSize().width, editorComponent.getPreferredSize().height)); // // return editorComponent; // } // // @Override // // public boolean isCellEditable(EventObject anEvent) { // NameObject no = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // return !(no.getName() == Inter.getLocText("Role")); // } // // @Override // public Object getCellEditorValue() { // newName = super.getCellEditorValue().toString(); // editingNO.setName(newName); // return editingNO; // } // // // private boolean checkRoleNameNotEmpty() { // refreshDockingView(); // // String currentText = delegate.getCellEditorValue().toString(); // boolean isContained = false; // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null && // !ComparatorUtils.equals(oldName, currentText)) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if(ComparatorUtils.equals(_authority.getName(), currentText)){ // isContained = true; // break; // } // } // } catch (Exception e) { // } // } // // if (currentText.isEmpty() || isContained) { // JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("RoleName_Can_Not_Be_Null") + "!"); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // delegate.setValue(oldName); // return false; // } // return true; // } // // /* // * 下面两个方法是CellEditorListener的 // */ // @Override // public void editingCanceled(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // roleTree.stopEditing(); // if (treePath == null) { // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // @Override // public void editingStopped(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // } // // private void changeValue() { // newName = delegate.getCellEditorValue().toString(); // if (!newName.isEmpty() && newName != oldName) { // roleTree.setSelectedRoleName(newName); // op.rename(oldName, newName); // // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if (ComparatorUtils.equals(_authority.getName(), oldName)) { // _authority.setName(newName); // } // } // } catch (Exception e) { // } // } // // try { // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e) { // FRContext.getLogger().error(e.getMessage(), e); // } // } // } // } /** * 展开树 * @param tree 树 * @param isExpand 是否展开 */ public void expandTree(JTree tree, boolean isExpand) { TreeNode root = (TreeNode) tree.getModel().getRoot(); expandAll(tree, new TreePath(root), isExpand); } private void expandAll(JTree tree, TreePath parent, boolean expand) { TreeNode node = (TreeNode) parent.getLastPathComponent(); if (node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { TreeNode n = (TreeNode) e.nextElement(); TreePath path = parent.pathByAddingChild(n); expandAll(tree, path, expand); } } if (expand) { tree.expandPath(parent); } else { tree.collapsePath(parent); } } } \ No newline at end of file diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index ac5732e73d..05e023135c 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -1,6 +1,14 @@ package com.fr.env; -import com.fr.base.*; +import com.fr.base.AbstractEnv; +import com.fr.base.EnvException; +import com.fr.base.FRContext; +import com.fr.base.FRCoreContext; +import com.fr.base.ModifiedTable; +import com.fr.base.Parameter; +import com.fr.base.StoreProcedureParameter; +import com.fr.base.TableData; +import com.fr.base.Utils; import com.fr.base.remote.RemoteDeziConstants; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; @@ -22,7 +30,12 @@ import com.fr.file.CacheManager; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.file.filetree.FileNode; -import com.fr.general.*; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.IOUtils; +import com.fr.general.Inter; +import com.fr.general.LogRecordTime; +import com.fr.general.VT4FR; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONException; @@ -32,7 +45,14 @@ import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginLoader; import com.fr.share.ShareConstants; -import com.fr.stable.*; +import com.fr.stable.ArrayUtils; +import com.fr.stable.EncodeConstants; +import com.fr.stable.JavaCompileInfo; +import com.fr.stable.LicUtils; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.SvgProvider; import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; @@ -41,17 +61,37 @@ import com.fr.stable.xml.XMLableReader; import com.fr.web.ResourceConstants; import javax.swing.*; -import javax.xml.transform.*; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.awt.*; -import java.io.*; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.NoRouteToHostException; import java.net.Socket; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Timer; +import java.util.TimerTask; import java.util.logging.Level; import java.util.regex.Pattern; @@ -1387,13 +1427,17 @@ public class RemoteEnv extends AbstractEnv { return; } SignIn.signIn(remoteEnv); - LicUtils.resetBytes(); + resetLicenseBytes(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); } catch (Exception em) { FRContext.getLogger().error(em.getMessage(), em); } } + private void resetLicenseBytes() { + FRCoreContext.retryLicLock(); + } + /** * 停止连接 */ diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 412b657271..4c98ea1999 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -16,15 +16,13 @@ import com.fr.design.fun.GlobalListenerProvider; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.TemplatePane; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; +import com.fr.design.module.DesignModule; import com.fr.design.utils.DesignUtils; import com.fr.env.SignIn; import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; -import com.fr.general.ComparatorUtils; -import com.fr.general.FRLogger; -import com.fr.general.Inter; -import com.fr.general.ModuleContext; +import com.fr.general.*; import com.fr.plugin.PluginCollector; import com.fr.stable.*; @@ -66,6 +64,10 @@ public abstract class BaseDesigner extends ToolBarMenuDock { //下面这两句的位置不能随便调换,因为会影响语言切换的问题 initLanguage(); + // 先加载设计器的国际化文件 + Inter.loadLocaleFile(GeneralContext.getLocale(), DesignModule.LOCALE_FILE_PATH); + + SplashWindow splashWindow = new SplashWindow(createSplashPane()); if (args != null) { for (String arg : args) { diff --git a/designer_chart/src/com/fr/design/chart/ChartTypePane.java b/designer_chart/src/com/fr/design/chart/ChartTypePane.java index 5cc09a3b4e..d48ab810ab 100644 --- a/designer_chart/src/com/fr/design/chart/ChartTypePane.java +++ b/designer_chart/src/com/fr/design/chart/ChartTypePane.java @@ -5,8 +5,13 @@ package com.fr.design.chart; */ import com.fr.base.FRContext; +import com.fr.base.FRCoreContext; import com.fr.chart.base.ChartInternationalNameContentBean; -import com.fr.chart.chartattr.*; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.ChartIcon; +import com.fr.chart.chartattr.MapPlot; +import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -14,7 +19,6 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import com.fr.general.RegistEditionException; import com.fr.general.VT4FR; -import com.fr.stable.StableUtils; import javax.swing.*; import javax.swing.event.ListSelectionEvent; @@ -150,7 +154,7 @@ public class ChartTypePane extends ChartCommonWizardPane { String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); Chart chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; if(chart.getPlot() != null){ - if(chart.getPlot() instanceof MapPlot && !(VT4FR.isLicAvailable(StableUtils.getBytes()) && VT4FR.CHART_MAP.support())){ + if(chart.getPlot() instanceof MapPlot && !supportMap()){ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Chart-Map_Not_Supported")); throw new RegistEditionException(VT4FR.CHART_MAP); } @@ -165,6 +169,11 @@ public class ChartTypePane extends ChartCommonWizardPane { } } + private boolean supportMap() { + byte[] bytes = FRCoreContext.getBytes(); + return VT4FR.isLicAvailable(bytes) && VT4FR.CHART_MAP.support(); + } + public void update(ChartCollection cc) { if (cc == null) { return; diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java index f1f1b3deb3..a1207717bf 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java @@ -1 +1,484 @@ -package com.fr.design.chart.series.PlotSeries; import com.fr.base.*; import com.fr.chart.base.MapSvgAttr; import com.fr.chart.base.MapSvgXMLHelper; import com.fr.chart.chartattr.MapPlot; import com.fr.chart.chartglyph.MapShapeValue; import com.fr.design.constants.UIConstants; import com.fr.design.DesignerEnvManager; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.SvgProvider; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.geom.RoundRectangle2D; import java.util.ArrayList; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 12-12-29 * Time: 下午2:41 */ public class MapGroupExtensionPane extends BasicPane implements UIObserver { private static final String[] TYPE_NAMES = new String[]{ Inter.getLocText("FR-Chart-World_Map"), Inter.getLocText("FR-Chart-State_Map"), Inter.getLocText("FR-Chart-Province_Map"), Inter.getLocText("FR-Chart-Custom_Map")}; private static final int WORD = 0; private static final int NATION = 1; private static final int STATE = 2; private static final int USER = 3; private static final int OFFSET_X = 800; private static final int OFFSET_Y = 200; private UIGroupExtensionPane groupExtensionPane; private UIButton addButton; private JPopupMenu popupMenu; private ArrayList changeListeners = new ArrayList(); private boolean hasPopulated = false; @Override protected String title4PopupWindow() { return "Map"; } public MapGroupExtensionPane() { setLayout(new BorderLayout()); groupExtensionPane = new UIGroupExtensionPane(TYPE_NAMES){ /** * 新添加的数据的序号 * @param data 数据 */ protected void dealNewAddedDataIndex(Object data){ String newName = (String)data; MapSvgXMLHelper helper = MapSvgXMLHelper.getInstance(); if(helper.getNewMapAttr(newName) != null){ return; } MapSvgAttr attr = new MapSvgAttr(); attr.setFilePath(MapSvgXMLHelper.customMapPath() + CoreConstants.SEPARATOR + newName + ".svg"); helper.addNewSvgMaps(attr.getName(), attr); } /** * 一次鼠标的点击会有两次事件响应(按下和释放)。前者的事件属性中getValueIsAdjusting()=true,后者是false。 * 是否响应list值改变 * @return 鼠标按下时不响应,先响应mousePress事件,在鼠标释放是再响应list值改编的事件,并且点击删除不触发更新,并且populate后触发更新 */ protected boolean isRespondToValueChange(ListSelectionEvent e){ return !e.getValueIsAdjusting() && !this.isPressOnDelete() && hasPopulated; } }; groupExtensionPane.addSelectionChangeListener(new ChangeListener() { @Override public void fireChanged(ChangeEvent event) { fireStateChange(); } }); groupExtensionPane.addItemEditListener(new ChangeListener() { @Override public void fireChanged(ChangeEvent event) { doEdit(event); } }); groupExtensionPane.addDeleteListener(new ChangeListener() { @Override public void fireChanged(ChangeEvent event) { //这么写有点问题 String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); saveMapInfo(oldName); } }); setPreferredSize(new Dimension(400, 210)); add(groupExtensionPane, BorderLayout.CENTER); addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")) { @Override protected void paintBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setStroke(UIConstants.BS); Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); g2d.setColor(UIConstants.LINE_COLOR); g2d.draw(shape); } }; addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { popupMenu.show(MapGroupExtensionPane.this, addButton.getX() + 1, addButton.getY() + addButton.getHeight()); } }); add(addButton, BorderLayout.SOUTH); initPopupMenu(); } private void initPopupMenu() { popupMenu = new JPopupMenu() { @Override public Dimension getPreferredSize() { Dimension dimension = new Dimension(); dimension.height = super.getPreferredSize().height; dimension.width = addButton.getWidth() - 2; return dimension; } }; JMenuItem worldMap = new JMenuItem(TYPE_NAMES[WORD]); popupMenu.add(worldMap); worldMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { groupExtensionPane.addData(TYPE_NAMES[WORD], TYPE_NAMES[WORD], true); } }); JMenuItem countMap = new JMenuItem(TYPE_NAMES[NATION]); popupMenu.add(countMap); countMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { groupExtensionPane.addData(TYPE_NAMES[NATION], TYPE_NAMES[NATION], true); } }); JMenuItem proMap = new JMenuItem(TYPE_NAMES[STATE]); popupMenu.add(proMap); proMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { groupExtensionPane.addData(TYPE_NAMES[STATE], TYPE_NAMES[STATE], true); } }); JMenuItem menu = new JMenuItem(TYPE_NAMES[USER]); popupMenu.add(menu); menu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { groupExtensionPane.addData(TYPE_NAMES[USER], TYPE_NAMES[USER], true); } }); } private void doEdit(ChangeEvent e) { MouseEvent event = (MouseEvent) e.getSource(); JPopupMenu editPopMenu = new JPopupMenu(); final String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); editPopMenu.add(createAreaItem(oldName)); editPopMenu.add(createMarkerItem(oldName)); editPopMenu.add(createLayerItem(oldName)); editPopMenu.add(createRenameItem()); editPopMenu.show(MapGroupExtensionPane.this, event.getXOnScreen() - OFFSET_X, event.getYOnScreen() - OFFSET_Y); } private void mapCheckBeforeEdit(String name){ if(MapSvgXMLHelper.getInstance().containsMapName(name) || MapSvgXMLHelper.getInstance().getNewMapAttr(name)!=null){ return; } MapSvgAttr attr = new MapSvgAttr(); attr.setFilePath(MapSvgXMLHelper.customMapPath() + CoreConstants.SEPARATOR + name + ".svg"); MapSvgXMLHelper.getInstance().addNewSvgMaps(name,attr); } private JMenuItem createAreaItem(final String oldName) { JMenuItem editFileItem = new JMenuItem(Inter.getLocText(new String[]{"Edit", "Image", "Filed"})); editFileItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final MapCustomPane image = new MapCustomPane(); image.setImageSelectType(MapShapeValue.AREA); image.populateBean(oldName); image.setTypeNameAndMapName(groupExtensionPane.getSelectedType(), Utils.objectToString(groupExtensionPane.getSelectedObject())); mapCheckBeforeEdit(oldName); final Image oldImage = getMapImage(oldName); BasicDialog dialog = image.showMediumWindow(SwingUtilities.getWindowAncestor(MapGroupExtensionPane.this), new DialogActionAdapter() { public void doOk() { image.updateBean(); // 比较两个前后的名字是否相同, 是图片 如果图片不同, 则直接比较 Image newImage = getMapImage(oldName); if(!ComparatorUtils.equals(oldImage, newImage)) { fireStateChange(); } //versionID递增 MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); if(old != null) { old.addVersionID(); } saveMapInfo(oldName); refresh(); } }); dialog.setVisible(true); } }); return editFileItem; } //根据地图的名字返回地图的图片 private Image getMapImage(String mapName) { if (MapSvgXMLHelper.getInstance().containsMapName(mapName)) { MapSvgAttr mapAttr = MapSvgXMLHelper.getInstance().getMapAttr(mapName); if(mapAttr == null) { return null; } return mapAttr.getMapImage(); } return null; } private JMenuItem createMarkerItem(final String oldName) { JMenuItem editMarkerItem = new JMenuItem(Inter.getLocText(new String[]{"Edit", "Image", "Marker"})); editMarkerItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final MapCustomPane image = new MapCustomPane(); image.setImageSelectType(MapShapeValue.POINT); image.populateBean(oldName); mapCheckBeforeEdit(oldName); final Image oldImage = getMapImage(oldName); BasicDialog dialog = image.showMediumWindow(SwingUtilities.getWindowAncestor(image), new DialogActionAdapter() { public void doOk() { image.updateBean(); Image newImage = getMapImage(oldName); if(!ComparatorUtils.equals(oldImage, newImage)) { fireStateChange(); } //versionID递增 MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); if(old != null) { old.addVersionID(); } saveMapInfo(oldName); refresh(); } }); dialog.setVisible(true); } }); return editMarkerItem; } private JMenuItem createLayerItem(final String oldName) { JMenuItem corrItem = new JMenuItem(Inter.getLocText(new String[]{"Filed", "Corresponding_Fields"})); corrItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final MapDefiAreaNamePane namedPane = new MapDefiAreaNamePane(); namedPane.populateBean(oldName); mapCheckBeforeEdit(oldName); BasicDialog dialog = namedPane.showMediumWindow(SwingUtilities.getWindowAncestor(namedPane), new DialogActionAdapter() { public void doOk() { namedPane.updateBean();// 地图的名称 value对应情况 MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); if(old != null) { old.addVersionID(); } saveMapInfo(oldName); } }); dialog.setVisible(true); refresh(); } }); return corrItem; } private void showRenameWaring(String newName){ JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), "\"" + newName + "\"" + Inter.getLocText("Utils-has_been_existed") + "!", Inter.getLocText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); } private JMenuItem createRenameItem() { JMenuItem renameItem = new JMenuItem(Inter.getLocText("FR-Chart-Map_Rename")); renameItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newName = JOptionPane.showInputDialog(DesignerContext.getDesignerFrame().getContentPane(), Inter.getLocText("FR-Chart-Map_Rename"), groupExtensionPane.getSelectedObject()); if (StringUtils.isNotBlank(newName)) { String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); if(ComparatorUtils.equals(oldName, newName)){ return; } //本地在看看临时的helper里面有没有 if(MapSvgXMLHelper.getInstance().getNewMapAttr(newName) != null){ showRenameWaring(newName); return; } try{//提醒名字已存在 if(FRContext.getCurrentEnv().fileExists(StableUtils.pathJoin( new String[]{MapSvgXMLHelper.relativeDefaultMapPath(),newName+SvgProvider.EXTENSION}))){ showRenameWaring(newName); return; } if(FRContext.getCurrentEnv().fileExists(StableUtils.pathJoin( new String[]{MapSvgXMLHelper.relativeCustomMapPath(), newName + SvgProvider.EXTENSION}))){ showRenameWaring(newName); return; } MapSvgAttr editingAttr = MapSvgXMLHelper.getInstance().getMapAttr(oldName); if(editingAttr == null){ editingAttr = MapSvgXMLHelper.getInstance().getNewMapAttr(oldName); } if( editingAttr == null) { return; } editingAttr.renameMap(newName); groupExtensionPane.setValueAtCurrentSelectIndex(newName); fireStateChange(); saveMapInfo(newName); FRContext.getCurrentEnv().deleteFile( StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeDefaultMapPath(),oldName+SvgProvider.EXTENSION})); FRContext.getCurrentEnv().deleteFile( StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeCustomMapPath(),oldName+SvgProvider.EXTENSION})); refresh(); }catch (Exception exp){ FRLogger.getLogger().error(exp.getMessage()); } } } }); return renameItem; } private void refresh() { this.validate(); this.repaint(); DesignerFrame frame = DesignerContext.getDesignerFrame(); if(frame != null) { frame.repaint();//kunsnat: 图表属性没变, 只是读取时 内容变化. } } //保存修改过的地图信息 private void saveMapInfo(final String mapName) { SwingWorker worker = new SwingWorker() { @Override protected Integer doInBackground() throws Exception { MapSvgAttr attr = MapSvgXMLHelper.getInstance().getMapAttr(mapName);// 只有在编辑地图时才需要储存相关数据 @kuns if(attr != null){ attr.writeBack(mapName); } return 0; } @Override protected void done() { FRLogger.getLogger().info(Inter.getLocText("FR-Chart-Map_Saved")); // 地图已经保存. } }; worker.execute(); DesignerEnvManager.addWorkers(worker); } private void fireStateChange() { for (int i = changeListeners.size(); i > 0; i--) { changeListeners.get(i - 1).stateChanged(new javax.swing.event.ChangeEvent(this)); } } /** * 更新地图属性 * @return 返回地图名称. */ public String updateBean(MapPlot plot) { if(!hasPopulated){ this.populateBean(plot); hasPopulated = true; } MapHelper helper = plot.isSvgMap() ? MapSvgXMLHelper.getInstance() : MapXMLHelper.getInstance(); helper.clearCateNames(); for (String type : TYPE_NAMES) { Object[] datas = groupExtensionPane.getData(type); for (Object name : datas) { helper.addCateNames(type, name); } } return Utils.objectToString(groupExtensionPane.getSelectedObject()); } /** * 更新地图名称 * @param mapPlot 地图 */ public void populateBean(MapPlot mapPlot) { hasPopulated = false; groupExtensionPane.clearData(); for (String type : TYPE_NAMES) { MapHelper helper = mapPlot.isSvgMap() ? MapSvgXMLHelper.getInstance() : MapXMLHelper.getInstance(); java.util.List list = helper.getNamesListWithCateName(type); for (Object name : list) { groupExtensionPane.addData(name, type); } } groupExtensionPane.setSelectedObject(mapPlot.getMapName()); hasPopulated = true; } /** * 给组件登记一个观察者监听事件 * * @param listener 观察者监听事件 */ public void registerChangeListener(final UIObserverListener listener) { changeListeners.add(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent e) { listener.doChange(); } }); } /** * 组件是否需要响应添加的观察者事件 * * @return 如果需要响应观察者事件则返回true,否则返回false */ public boolean shouldResponseChangeListener() { return true; } public void setEnabled(boolean isEnabled){ super.setEnabled(isEnabled); addButton.setEnabled(isEnabled); popupMenu.setEnabled(isEnabled); groupExtensionPane.setEnabled(isEnabled); } } \ No newline at end of file +package com.fr.design.chart.series.PlotSeries; + +import com.fr.base.*; +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.chart.chartattr.MapPlot; +import com.fr.chart.chartglyph.MapShapeValue; +import com.fr.design.DesignerEnvManager; +import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.event.ChangeEvent; +import com.fr.design.event.ChangeListener; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.stable.CoreConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.SvgProvider; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.geom.RoundRectangle2D; +import java.util.ArrayList; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 7.0.3 + * Date: 12-12-29 + * Time: 下午2:41 + */ +public class MapGroupExtensionPane extends BasicPane implements UIObserver { + private static final String[] TYPE_NAMES = new String[]{ + Inter.getLocText("FR-Chart-World_Map"), + Inter.getLocText("FR-Chart-State_Map"), + Inter.getLocText("FR-Chart-Province_Map"), + Inter.getLocText("FR-Chart-Custom_Map")}; + private static final int WORD = 0; + private static final int NATION = 1; + private static final int STATE = 2; + private static final int USER = 3; + private static final int OFFSET_X = 800; + private static final int OFFSET_Y = 200; + + private UIGroupExtensionPane groupExtensionPane; + private UIButton addButton; + private JPopupMenu popupMenu; + private ArrayList changeListeners = new ArrayList(); + private boolean hasPopulated = false; + + @Override + protected String title4PopupWindow() { + return "Map"; + } + + public MapGroupExtensionPane() { + setLayout(new BorderLayout()); + groupExtensionPane = new UIGroupExtensionPane(TYPE_NAMES){ + + /** + * 新添加的数据的序号 + * @param data 数据 + */ + protected void dealNewAddedDataIndex(Object data){ + String newName = (String)data; + MapSvgXMLHelper helper = MapSvgXMLHelper.getInstance(); + if(helper.getNewMapAttr(newName) != null){ + return; + } + MapSvgAttr attr = new MapSvgAttr(); + attr.setFilePath(MapSvgXMLHelper.customMapPath() + CoreConstants.SEPARATOR + newName + ".svg"); + helper.addNewSvgMaps(attr.getName(), attr); + } + + + /** + * 一次鼠标的点击会有两次事件响应(按下和释放)。前者的事件属性中getValueIsAdjusting()=true,后者是false。 + * 是否响应list值改变 + * @return 鼠标按下时不响应,先响应mousePress事件,在鼠标释放是再响应list值改编的事件,并且点击删除不触发更新,并且populate后触发更新 + */ + protected boolean isRespondToValueChange(ListSelectionEvent e){ + return !e.getValueIsAdjusting() && !this.isPressOnDelete() && hasPopulated; + } + }; + groupExtensionPane.addSelectionChangeListener(new ChangeListener() { + @Override + public void fireChanged(ChangeEvent event) { + fireStateChange(); + } + }); + groupExtensionPane.addItemEditListener(new ChangeListener() { + @Override + public void fireChanged(ChangeEvent event) { + doEdit(event); + } + }); + groupExtensionPane.addDeleteListener(new ChangeListener() { + @Override + public void fireChanged(ChangeEvent event) { + //这么写有点问题 + String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); + saveMapInfo(oldName); + } + }); + setPreferredSize(new Dimension(400, 210)); + add(groupExtensionPane, BorderLayout.CENTER); + + addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")) { + @Override + protected void paintBorder(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + g2d.setStroke(UIConstants.BS); + Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + g2d.setColor(UIConstants.LINE_COLOR); + g2d.draw(shape); + } + }; + addButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + popupMenu.show(MapGroupExtensionPane.this, addButton.getX() + 1, addButton.getY() + addButton.getHeight()); + } + }); + add(addButton, BorderLayout.SOUTH); + initPopupMenu(); + } + + private void initPopupMenu() { + popupMenu = new JPopupMenu() { + @Override + public Dimension getPreferredSize() { + Dimension dimension = new Dimension(); + dimension.height = super.getPreferredSize().height; + dimension.width = addButton.getWidth() - 2; + return dimension; + } + }; + JMenuItem worldMap = new JMenuItem(TYPE_NAMES[WORD]); + popupMenu.add(worldMap); + worldMap.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + groupExtensionPane.addData(TYPE_NAMES[WORD], TYPE_NAMES[WORD], true); + } + }); + + JMenuItem countMap = new JMenuItem(TYPE_NAMES[NATION]); + popupMenu.add(countMap); + countMap.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + groupExtensionPane.addData(TYPE_NAMES[NATION], + TYPE_NAMES[NATION], true); + } + }); + + JMenuItem proMap = new JMenuItem(TYPE_NAMES[STATE]); + popupMenu.add(proMap); + proMap.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + groupExtensionPane.addData(TYPE_NAMES[STATE], + TYPE_NAMES[STATE], true); + } + }); + + JMenuItem menu = new JMenuItem(TYPE_NAMES[USER]); + popupMenu.add(menu); + menu.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + groupExtensionPane.addData(TYPE_NAMES[USER], + TYPE_NAMES[USER], true); + } + }); + } + + private void doEdit(ChangeEvent e) { + MouseEvent event = (MouseEvent) e.getSource(); + JPopupMenu editPopMenu = new JPopupMenu(); + + final String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); + editPopMenu.add(createAreaItem(oldName)); + editPopMenu.add(createMarkerItem(oldName)); + editPopMenu.add(createLayerItem(oldName)); + editPopMenu.add(createRenameItem()); + + editPopMenu.show(MapGroupExtensionPane.this, event.getXOnScreen() - OFFSET_X, event.getYOnScreen() - OFFSET_Y); + } + + private void mapCheckBeforeEdit(String name){ + if(MapSvgXMLHelper.getInstance().containsMapName(name) || MapSvgXMLHelper.getInstance().getNewMapAttr(name)!=null){ + return; + } + MapSvgAttr attr = new MapSvgAttr(); + attr.setFilePath(MapSvgXMLHelper.customMapPath() + CoreConstants.SEPARATOR + name + ".svg"); + MapSvgXMLHelper.getInstance().addNewSvgMaps(name,attr); + } + + private JMenuItem createAreaItem(final String oldName) { + JMenuItem editFileItem = new JMenuItem(Inter.getLocText(new String[]{"Edit", "Image", "Filed"})); + editFileItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + final MapCustomPane image = new MapCustomPane(); + image.setImageSelectType(MapShapeValue.AREA); + image.populateBean(oldName); + image.setTypeNameAndMapName(groupExtensionPane.getSelectedType(), Utils.objectToString(groupExtensionPane.getSelectedObject())); + mapCheckBeforeEdit(oldName); + final Image oldImage = getMapImage(oldName); + BasicDialog dialog = image.showMediumWindow(SwingUtilities.getWindowAncestor(MapGroupExtensionPane.this), new DialogActionAdapter() { + public void doOk() { + image.updateBean(); // 比较两个前后的名字是否相同, 是图片 如果图片不同, 则直接比较 + + Image newImage = getMapImage(oldName); + if(!ComparatorUtils.equals(oldImage, newImage)) { + fireStateChange(); + } + + //versionID递增 + MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); + if(old != null) { + old.addVersionID(); + } + + saveMapInfo(oldName); + refresh(); + } + }); + dialog.setVisible(true); + } + }); + return editFileItem; + } + + //根据地图的名字返回地图的图片 + private Image getMapImage(String mapName) { + if (MapSvgXMLHelper.getInstance().containsMapName(mapName)) { + MapSvgAttr mapAttr = MapSvgXMLHelper.getInstance().getMapAttr(mapName); + if(mapAttr == null) { + return null; + } + return mapAttr.getMapImage(); + } + + return null; + } + + private JMenuItem createMarkerItem(final String oldName) { + JMenuItem editMarkerItem = new JMenuItem(Inter.getLocText(new String[]{"Edit", "Image", "Marker"})); + editMarkerItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + final MapCustomPane image = new MapCustomPane(); + image.setImageSelectType(MapShapeValue.POINT); + image.populateBean(oldName); + mapCheckBeforeEdit(oldName); + final Image oldImage = getMapImage(oldName); + BasicDialog dialog = image.showMediumWindow(SwingUtilities.getWindowAncestor(image), new DialogActionAdapter() { + public void doOk() { + image.updateBean(); + + Image newImage = getMapImage(oldName); + if(!ComparatorUtils.equals(oldImage, newImage)) { + fireStateChange(); + } + + //versionID递增 + MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); + if(old != null) { + old.addVersionID(); + } + + saveMapInfo(oldName); + refresh(); + } + }); + dialog.setVisible(true); + } + }); + return editMarkerItem; + } + + private JMenuItem createLayerItem(final String oldName) { + JMenuItem corrItem = new JMenuItem(Inter.getLocText(new String[]{"Filed", "Corresponding_Fields"})); + corrItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + final MapDefiAreaNamePane namedPane = new MapDefiAreaNamePane(); + namedPane.populateBean(oldName); + mapCheckBeforeEdit(oldName); + BasicDialog dialog = namedPane.showMediumWindow(SwingUtilities.getWindowAncestor(namedPane), new DialogActionAdapter() { + public void doOk() { + namedPane.updateBean();// 地图的名称 value对应情况 + + MapSvgAttr old = MapSvgXMLHelper.getInstance().getMapAttr(oldName); + if(old != null) { + old.addVersionID(); + } + + saveMapInfo(oldName); + } + }); + dialog.setVisible(true); + refresh(); + } + }); + + return corrItem; + } + + private void showRenameWaring(String newName){ + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), "\"" + newName + "\"" + Inter.getLocText("Utils-has_been_existed") + + "!", Inter.getLocText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); + } + + private JMenuItem createRenameItem() { + JMenuItem renameItem = new JMenuItem(Inter.getLocText("FR-Chart-Map_Rename")); + renameItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + String newName = JOptionPane.showInputDialog(DesignerContext.getDesignerFrame().getContentPane(), + Inter.getLocText("FR-Chart-Map_Rename"), groupExtensionPane.getSelectedObject()); + if (StringUtils.isNotBlank(newName)) { + String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); + if(ComparatorUtils.equals(oldName, newName)){ + return; + } + //本地在看看临时的helper里面有没有 + if(MapSvgXMLHelper.getInstance().getNewMapAttr(newName) != null){ + showRenameWaring(newName); + return; + } + try{//提醒名字已存在 + if(FRContext.getCurrentEnv().fileExists(StableUtils.pathJoin( + new String[]{MapSvgXMLHelper.relativeDefaultMapPath(),newName+SvgProvider.EXTENSION}))){ + showRenameWaring(newName); + return; + } + if(FRContext.getCurrentEnv().fileExists(StableUtils.pathJoin( + new String[]{MapSvgXMLHelper.relativeCustomMapPath(), newName + SvgProvider.EXTENSION}))){ + showRenameWaring(newName); + return; + } + MapSvgAttr editingAttr = MapSvgXMLHelper.getInstance().getMapAttr(oldName); + if(editingAttr == null){ + editingAttr = MapSvgXMLHelper.getInstance().getNewMapAttr(oldName); + } + if( editingAttr == null) { + return; + } + editingAttr.renameMap(newName); + groupExtensionPane.setValueAtCurrentSelectIndex(newName); + fireStateChange(); + saveMapInfo(newName); + FRContext.getCurrentEnv().deleteFile( + StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeDefaultMapPath(),oldName+SvgProvider.EXTENSION})); + FRContext.getCurrentEnv().deleteFile( + StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeCustomMapPath(),oldName+SvgProvider.EXTENSION})); + refresh(); + }catch (Exception exp){ + FRLogger.getLogger().error(exp.getMessage()); + } + } + } + }); + return renameItem; + } + + private void refresh() { + this.validate(); + this.repaint(); + + DesignerFrame frame = DesignerContext.getDesignerFrame(); + if(frame != null) { + frame.repaint();//kunsnat: 图表属性没变, 只是读取时 内容变化. + } + } + + //保存修改过的地图信息 + private void saveMapInfo(final String mapName) { + SwingWorker worker = new SwingWorker() { + @Override + protected Integer doInBackground() throws Exception { + MapSvgAttr attr = MapSvgXMLHelper.getInstance().getMapAttr(mapName);// 只有在编辑地图时才需要储存相关数据 @kuns + if(attr != null){ + attr.writeBack(mapName); + } + return 0; + } + + @Override + protected void done() { + FRLogger.getLogger().info(Inter.getLocText("FR-Chart-Map_Saved")); // 地图已经保存. + } + + }; + worker.execute(); + DesignerEnvManager.addWorkers(worker); + } + + private void fireStateChange() { + for (int i = changeListeners.size(); i > 0; i--) { + changeListeners.get(i - 1).stateChanged(new javax.swing.event.ChangeEvent(this)); + } + } + + /** + * 更新地图属性 + * @return 返回地图名称. + */ + public String updateBean(MapPlot plot) { + if(!hasPopulated){ + this.populateBean(plot); + hasPopulated = true; + } + + MapHelper helper = plot.isSvgMap() ? MapSvgXMLHelper.getInstance() : MapXMLHelper.getInstance(); + + helper.clearCateNames(); + for (String type : TYPE_NAMES) { + Object[] datas = groupExtensionPane.getData(type); + for (Object name : datas) { + helper.addCateNames(type, name); + } + } + + return Utils.objectToString(groupExtensionPane.getSelectedObject()); + } + + /** + * 更新地图名称 + * @param mapPlot 地图 + */ + public void populateBean(MapPlot mapPlot) { + hasPopulated = false; + groupExtensionPane.clearData(); + + for (String type : TYPE_NAMES) { + MapHelper helper = mapPlot.isSvgMap() ? MapSvgXMLHelper.getInstance() : MapXMLHelper.getInstance(); + java.util.List list = helper.getNamesListWithCateName(type); + for (Object name : list) { + groupExtensionPane.addData(name, type); + } + } + + groupExtensionPane.setSelectedObject(mapPlot.getMapName()); + + hasPopulated = true; + } + + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(final UIObserverListener listener) { + changeListeners.add(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent e) { + listener.doChange(); + } + }); + } + + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + public boolean shouldResponseChangeListener() { + return true; + } + + public void setEnabled(boolean isEnabled){ + super.setEnabled(isEnabled); + addButton.setEnabled(isEnabled); + popupMenu.setEnabled(isEnabled); + groupExtensionPane.setEnabled(isEnabled); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java index 7d8b6c8ce1..3a200ee3ce 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java @@ -96,7 +96,7 @@ public class DataLabelPane extends TooltipContentsPane { } delimiterBox.setPreferredSize(new Dimension(70, 20)); JPanel boxPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); - boxPane.add(new UILabel(Inter.getLocText("Form-Delimiter") + ":")); + boxPane.add(new UILabel(Inter.getLocText("FR-Designer_Dismenber") + ":")); boxPane.add(delimiterBox); return boxPane; } @@ -111,34 +111,9 @@ public class DataLabelPane extends TooltipContentsPane { } protected JPanel createJPanel4Position() { - // 标签位置:上下左右中. - bottomButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Bottom")); - leftButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Left")); - rigtButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Right")); - topButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Top")); - centerButton = new UIRadioButton(Inter.getLocText("Center")); - - ButtonGroup bg = new ButtonGroup(); - bg.add(bottomButton); - bg.add(leftButton); - bg.add(rigtButton); - bg.add(topButton); - bg.add(centerButton); - topButton.setSelected(true); - - JPanel buttonPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - buttonPane.add(new UILabel(Inter.getLocText(new String[]{"Label", "Layout"}) + ":")); - buttonPane.add(bottomButton); - buttonPane.add(leftButton); - buttonPane.add(rigtButton); - buttonPane.add(topButton); - buttonPane.add(centerButton); - - return buttonPane; + return null; } - - public void populate(AttrContents seriesAttrContents) { super.populate(seriesAttrContents); String dataLabel = seriesAttrContents.getSeriesLabel(); 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 0b5cfe6c92..d5f170ef8d 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 @@ -17,6 +17,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox; import com.fr.design.mainframe.chart.gui.item.ItemEventType; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; @@ -238,6 +239,9 @@ public class ChartTypePane extends AbstractChartAttrPane{ for (int i = 0; i < this.cards.size(); i++) { FurtherBasicBeanPane pane = cards.get(i); if (pane.accept(ob)) { + + GUICoreUtils.setEnabled(this, ob.isValidPlot()); + pane.populateBean(ob); Object item = pane.title4PopupWindow(); for (int j = 0; j < cardNames.length; j++) { diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java index 07d699dae3..96d4af867a 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -5,6 +5,7 @@ import com.fr.base.Utils; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalReportDataDefinition; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -21,6 +22,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; +import java.util.List; /** @@ -30,125 +32,133 @@ import java.util.ArrayList; */ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotReportDataContentPane implements UIObserver{ private static final long serialVersionUID = -1122313353777460534L; - + private JPanel boxPane; private UIButton addButton; - + private ArrayList formualList = new ArrayList(); private UIObserverListener uiobListener = null; + public List getFormualList() { + return formualList; + } + public CategoryPlotMoreCateReportDataContentPane() { - + } - + public CategoryPlotMoreCateReportDataContentPane(ChartDataPane parent) { - initEveryPane(); - categoryName = initCategoryBox(Inter.getLocText("FR-Chart-Category_Name") + ":"); - - JPanel catePane = new JPanel(); - catePane.setLayout(new BorderLayout(2, 2)); - - catePane.add(categoryName); - - addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); - addButton.setPreferredSize(new Dimension(20, 20)); - catePane.add(addButton, BorderLayout.EAST); - - boxPane = new JPanel(); - boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); - - boxPane.setBackground(Color.red); - - catePane.add(boxPane, BorderLayout.SOUTH); - - this.add(catePane, "0,0,2,0"); - this.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Filter")), "0,4,2,4"); - this.add(filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent), "0,6,2,4"); - - addButton.addActionListener(new ActionListener() { + initEveryPane(); + categoryName = initCategoryBox(Inter.getLocText("FR-Chart-Category_Name") + ":"); + + JPanel catePane = new JPanel(); + catePane.setLayout(new BorderLayout(2, 2)); + + catePane.add(categoryName); + + addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + addButton.setPreferredSize(new Dimension(20, 20)); + catePane.add(addButton, BorderLayout.EAST); + + boxPane = new JPanel(); + boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); + + boxPane.setBackground(Color.red); + + catePane.add(boxPane, BorderLayout.SOUTH); + + this.add(catePane, "0,0,2,0"); + this.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Filter")), "0,4,2,4"); + this.add(filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent), "0,6,2,4"); + + addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewCatePane(); } }); - + + } + + /** + * 检查box 是否应该可用状态. + */ + public void checkBoxUse() { + super.checkBoxUse(); + String text = categoryName.getUITextField().getText(); + addButton.setEnabled(StringUtils.isNotEmpty(text)); } - - /** - * 检查box 是否应该可用状态. - */ - public void checkBoxUse() { - super.checkBoxUse(); - String text = categoryName.getUITextField().getText(); - addButton.setEnabled(StringUtils.isNotEmpty(text)); - } - + private TinyFormulaPane addNewCatePane() { final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY); pane.setPreferredSize(new Dimension(122, 16)); - + pane.registerChangeListener(uiobListener); - + formualList.add(pane); - + final JPanel newButtonPane = new JPanel(); newButtonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); newButtonPane.add(pane); - + UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); newButtonPane.add(delButton); - + boxPane.add(newButtonPane); - + delButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boxPane.remove(newButtonPane); formualList.remove(pane); - checkAddButton(); + checkComponent(); relayoutPane(); } }); delButton.registerChangeListener(uiobListener); - - checkAddButton(); + + checkComponent(); relayoutPane(); - + return pane; } - + private void checkAddButton() { int size = formualList.size(); addButton.setEnabled(size < 2); } - + + protected void checkComponent() { + checkAddButton(); + } + private void relayoutPane() { this.revalidate(); } - /** - * 给组件登记一个观察者监听事件 - * - * @param listener 观察者监听事件 - */ + /** + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ public void registerChangeListener(UIObserverListener listener) { uiobListener = listener; } - /** - * 组件是否需要响应添加的观察者事件 - * - * @return 如果需要响应观察者事件则返回true,否则返回false - */ + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ public boolean shouldResponseChangeListener() { return true; } - + public void populateBean(ChartCollection collection) { super.populateBean(collection); - + formualList.clear(); - + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; @@ -160,23 +170,28 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor } } } - + checkAddButton(); } - + public void updateBean(ChartCollection collection) { super.updateBean(collection); - + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + Plot plot = collection.getSelectedChart().getPlot(); if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; - + reportDefinition.clearMoreCate(); - - for(int i = 0, size = formualList.size(); i < size; i++) { - TinyFormulaPane pane = formualList.get(i); - reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); - } + updateMoreCate(reportDefinition, plot); + + } + } + + protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Plot plot) { + for (int i = 0, size = formualList.size(); i < size; i++) { + TinyFormulaPane pane = formualList.get(i); + reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); } } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 9ae7696d96..0b1909f985 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalTableDataDefinition; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -36,40 +37,44 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD private static final int COMBOX_HEIGHT = 20; private JPanel boxPane; - + private ArrayList boxList = new ArrayList(); private UIButton addButton; - + private UIObserverListener uiobListener = null; - + + public List getBoxList() { + return boxList; + } + public CategoryPlotMoreCateTableDataContentPane() { // do nothing } - + public CategoryPlotMoreCateTableDataContentPane(ChartDataPane parent) { categoryCombox = new UIComboBox(); categoryCombox.setPreferredSize(new Dimension(100,20)); - + JPanel categoryPane = new JPanel(new BorderLayout(4,0)); categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); - UILabel categoryLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ; - categoryLabel.setPreferredSize(new Dimension(75,20)); - - addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); - addButton.setPreferredSize(new Dimension(20, 20)); - - categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton,null,categoryLabel,null})); - - boxPane = new JPanel(); - boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); - - categoryPane.add(boxPane, BorderLayout.SOUTH); - + UILabel categoryLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ; + categoryLabel.setPreferredSize(new Dimension(75,20)); + + addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + addButton.setPreferredSize(new Dimension(20, 20)); + + categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton,null,categoryLabel,null})); + + boxPane = new JPanel(); + boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); + + categoryPane.add(boxPane, BorderLayout.SOUTH); + this.setLayout(new BorderLayout()); this.add(categoryPane, BorderLayout.NORTH); seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot()); this.add(seriesTypeComboxPane, BorderLayout.SOUTH); - + addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -77,81 +82,85 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD addNewCombox(); relayoutPane(); } - + checkSeriseUse(categoryCombox.getSelectedItem() != null); } }); - + categoryCombox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { checkSeriseUse(categoryCombox.getSelectedItem() != null); makeToolTipUse(categoryCombox); - - checkAddButton(); + + checkComponent(); } }); } - + protected void checkSeriseUse(boolean hasUse) { super.checkSeriseUse(hasUse); - + addButton.setEnabled(hasUse); } - + private UIComboBox addNewCombox() { - final JPanel buttonPane = new JPanel(); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); - - final UIComboBox combox = new UIComboBox(); - combox.setPreferredSize(new Dimension(COMBOX_WIDTH, COMBOX_HEIGHT)); - - int count = categoryCombox.getItemCount(); - for(int i = 0; i < count; i++) { - combox.addItem(categoryCombox.getItemAt(i)); - } - - combox.registerChangeListener(uiobListener); - combox.addItemListener(new ItemListener() { + final JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); + + final UIComboBox combox = new UIComboBox(); + combox.setPreferredSize(new Dimension(COMBOX_WIDTH, COMBOX_HEIGHT)); + + int count = categoryCombox.getItemCount(); + for(int i = 0; i < count; i++) { + combox.addItem(categoryCombox.getItemAt(i)); + } + + combox.registerChangeListener(uiobListener); + combox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { makeToolTipUse(combox); } }); - - combox.setSelectedItem(categoryCombox.getItemAt(0)); - makeToolTipUse(combox); - - buttonPane.add(combox); - UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); - buttonPane.add(delButton); - boxPane.add(buttonPane); - boxList.add(combox); - - checkAddButton(); - - delButton.addActionListener(new ActionListener() { + + combox.setSelectedItem(categoryCombox.getItemAt(0)); + makeToolTipUse(combox); + + buttonPane.add(combox); + UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); + buttonPane.add(delButton); + boxPane.add(buttonPane); + boxList.add(combox); + + checkComponent(); + + delButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boxPane.remove(buttonPane); boxList.remove(combox); - checkAddButton(); + checkComponent(); relayoutPane(); } }); - delButton.registerChangeListener(uiobListener); - - return combox; + delButton.registerChangeListener(uiobListener); + + return combox; } - + private void checkAddButton() { int size = boxList.size(); addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null); } - + + protected void checkComponent() { + checkAddButton(); + } + private void relayoutPane() { this.revalidate(); } - + /** *检查 某些Box是否可用 @@ -159,17 +168,17 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD */ public void checkBoxUse(boolean hasUse) { super.checkBoxUse(hasUse); - - checkAddButton(); + + checkComponent(); + } + + protected void refreshBoxListWithSelectTableData(List list) { + super.refreshBoxListWithSelectTableData(list); + + for(int i = 0, size = boxList.size(); i < size; i++) { + refreshBoxItems(boxList.get(i), list); + } } - - protected void refreshBoxListWithSelectTableData(List list) { - super.refreshBoxListWithSelectTableData(list); - - for(int i = 0, size = boxList.size(); i < size; i++) { - refreshBoxItems(boxList.get(i), list); - } - } /** * 给组件登记一个观察者监听事件 @@ -195,9 +204,9 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD */ public void populateBean(ChartCollection collection) { super.populateBean(collection); - + boxList.clear(); - + TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); if(top instanceof NormalTableDataDefinition) { NormalTableDataDefinition normal = (NormalTableDataDefinition)top; @@ -207,28 +216,34 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD box.setSelectedItem(normal.getMoreCateWithIndex(i)); } } - + checkAddButton(); checkSeriseUse(categoryCombox.getSelectedItem() != null); } - + /** * 保存多分类界面到collection * @param collection */ public void updateBean(ChartCollection collection) { super.updateBean(collection); - + TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); - if(top instanceof NormalTableDataDefinition) { - NormalTableDataDefinition normal = (NormalTableDataDefinition)top; + Plot plot = collection.getSelectedChart().getPlot(); + if (top instanceof NormalTableDataDefinition) { + NormalTableDataDefinition normal = (NormalTableDataDefinition) top; normal.clearMoreCate(); - for(int i = 0, size = boxList.size(); i < size; i++) { - UIComboBox box = boxList.get(i); - if(box.getSelectedItem() != null) { - normal.addMoreCate(box.getSelectedItem().toString()); - } + updateMoreCate(normal, plot); + } + } + + protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { + for (int i = 0, size = boxList.size(); i < size; i++) { + UIComboBox box = boxList.get(i); + if (box.getSelectedItem() != null) { + normal.addMoreCate(box.getSelectedItem().toString()); } } } + } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java index f8b002bcf4..0f0df0e7c7 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java @@ -12,6 +12,7 @@ import com.fr.chart.chartdata.GisMapTableDefinition; import com.fr.chart.web.ChartHyperPoplink; import com.fr.chart.web.ChartHyperRelateCellLink; import com.fr.chart.web.ChartHyperRelateFloatLink; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.javascript.ChartEmailPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; @@ -21,6 +22,8 @@ import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; +import com.fr.design.fun.HyperlinkProvider; +import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.frpane.UICorrelationComboBoxPane; import com.fr.design.gui.ibutton.UIButton; @@ -53,9 +56,10 @@ import java.text.DecimalFormat; import java.text.Format; import java.util.ArrayList; import java.util.List; +import java.util.Set; public class ChartInteractivePane extends BasicScrollPane implements UIObserver{ - private static final long serialVersionUID = 3477409806918835992L; + private static final long serialVersionUID = 3477409806918835992L; private static HashMap normalMap = new HashMap(); private static HashMap gisMap = new HashMap(); private static HashMap mapMap = new HashMap(); @@ -69,16 +73,16 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb private static final int TIME_SWITCH_GAP = 40; - private UICheckBox isChartAnimation;// 动态 + private UICheckBox isChartAnimation;// 动态 private UICheckBox isSeriesDragEnable; //系列拖拽 private UICheckBox isAxisZoom;// 缩放 - private UICheckBox isDatapointValue;// 数据点提示 - private UIButton dataPointValueFormat; + private UICheckBox isDatapointValue;// 数据点提示 + private UIButton dataPointValueFormat; - private UICheckBox isDatapointPercent; - private UIButton dataPointPercentFormat; + private UICheckBox isDatapointPercent; + private UIButton dataPointPercentFormat; private UILabel tooltipStyleLabel; private UIComboBox tooltipStyle; @@ -90,55 +94,55 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb private UICheckBox isAddress; private UICheckBox isAddressName; - private UICheckBox isAxisShowToolTip;// 坐标轴提示 + private UICheckBox isAxisShowToolTip;// 坐标轴提示 - protected UICheckBox isAutoRefresh;// 自动刷新 - protected UISpinner autoRefreshTime; + protected UICheckBox isAutoRefresh;// 自动刷新 + protected UISpinner autoRefreshTime; - private UICorrelationComboBoxPane superLink;// 超链 + private UICorrelationComboBoxPane superLink;// 超链 - private FormatPane valueFormatPane; - private FormatPane percentFormatPane; - private Format valueFormat; - private Format percentFormat; + private FormatPane valueFormatPane; + private FormatPane percentFormatPane; + private Format valueFormat; + private Format percentFormat; - private JPanel tooltipPane; - private JPanel axisShowPane; - private JPanel autoRefreshPane; - private JPanel superlinkPane; + private JPanel tooltipPane; + private JPanel axisShowPane; + private JPanel autoRefreshPane; + private JPanel superlinkPane; - private ChartOtherPane parent; + private ChartOtherPane parent; private UICheckBox timeSwitch; private JPanel timeSwitchContainer; private TimeSwitchPane timeSwitchPane; - private static final int SIZEX = 258; - private static final int SIZEY = 209; - private static final int DET = 20; - public ChartInteractivePane(ChartOtherPane parent) { - super(); - this.parent = parent; - } + private static final int SIZEX = 258; + private static final int SIZEY = 209; + private static final int DET = 20; + public ChartInteractivePane(ChartOtherPane parent) { + super(); + this.parent = parent; + } - /** - * 界面标题. + /** + * 界面标题. * @return 返回标题. - */ - public String title4PopupWindow() { - return Inter.getLocText("Chart-Interactive_Tab"); - } - - @Override - protected JPanel createContentPane() { - isChartAnimation = new UICheckBox(Inter.getLocText("Chart-Animation_JSShow")); + */ + public String title4PopupWindow() { + return Inter.getLocText("Chart-Interactive_Tab"); + } + + @Override + protected JPanel createContentPane() { + isChartAnimation = new UICheckBox(Inter.getLocText("Chart-Animation_JSShow")); isSeriesDragEnable = new UICheckBox(Inter.getLocText("Chart-Series_Drag")); - isDatapointValue = new UICheckBox(Inter.getLocText("Chart-Use_Value")); - dataPointValueFormat = new UIButton(Inter.getLocText("Chart-Use_Format")); - isDatapointPercent = new UICheckBox(Inter.getLocText("Chart-Value_Percent")); - dataPointPercentFormat = new UIButton(Inter.getLocText("Chart-Use_Format")); + isDatapointValue = new UICheckBox(Inter.getLocText("Chart-Use_Value")); + dataPointValueFormat = new UIButton(Inter.getLocText("Chart-Use_Format")); + isDatapointPercent = new UICheckBox(Inter.getLocText("Chart-Value_Percent")); + dataPointPercentFormat = new UIButton(Inter.getLocText("Chart-Use_Format")); tooltipStyle = new UIComboBox(new String []{Inter.getLocText("Chart-White_Black"), Inter.getLocText("Chart-Black_White")}); tooltipStyleLabel = new UILabel(Inter.getLocText("Chart-Style_Name")); tooltipShowType = new UIComboBox(new String []{Inter.getLocText("Chart-Series_SingleData"), Inter.getLocText("Chart-Series_AllData")}); @@ -148,13 +152,13 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb isAddress = new UICheckBox(Inter.getLocText("Chart-Gis_Address")); isAddressName = new UICheckBox(Inter.getLocText("Chart-Address_Name")); - isAxisShowToolTip = new UICheckBox(Inter.getLocText("Chart-Interactive_AxisTooltip")); - isAxisZoom = new UICheckBox(Inter.getLocText("Chart-Use_Zoom")); - isAutoRefresh = new UICheckBox(Inter.getLocText(new String[]{"Chart-Use_Auto", "Chart-Use_Refresh"})); - autoRefreshTime = new UISpinner(1, Integer.MAX_VALUE, 1); - superLink = new UICorrelationComboBoxPane(); + isAxisShowToolTip = new UICheckBox(Inter.getLocText("Chart-Interactive_AxisTooltip")); + isAxisZoom = new UICheckBox(Inter.getLocText("Chart-Use_Zoom")); + isAutoRefresh = new UICheckBox(Inter.getLocText(new String[]{"Chart-Use_Auto", "Chart-Use_Refresh"})); + autoRefreshTime = new UISpinner(1, Integer.MAX_VALUE, 1); + superLink = new UICorrelationComboBoxPane(); - isAutoRefresh.addActionListener(new ActionListener() { + isAutoRefresh.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { checkAutoRefresh(); @@ -162,9 +166,9 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb }); timeSwitch = new UICheckBox(Inter.getLocText("FR-Chart-Interactive_timeSwitch")); timeSwitchPane = new TimeSwitchPane(); - initFormatListener(); - return initPaneWithListener(); - } + initFormatListener(); + return initPaneWithListener(); + } private void initFormatListener() { @@ -240,19 +244,19 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb }); } - private void checkAutoRefresh() { - GUICoreUtils.setEnabled(autoRefreshTime, isAutoRefresh.isSelected()); - } - - /** - * 反正后面还有relayout,这边init一下就好了 保证所有的init 加入界面 并且加载入事件. - * @return - */ - private JPanel initPaneWithListener() { - initDataPointToolTipPane(); - initAxisShowPane(); - initAutoRefreshPane(); - initSuperlinkPane(); + private void checkAutoRefresh() { + GUICoreUtils.setEnabled(autoRefreshTime, isAutoRefresh.isSelected()); + } + + /** + * 反正后面还有relayout,这边init一下就好了 保证所有的init 加入界面 并且加载入事件. + * @return + */ + private JPanel initPaneWithListener() { + initDataPointToolTipPane(); + initAxisShowPane(); + initAutoRefreshPane(); + initSuperlinkPane(); initTimeSwitchPane(); @@ -271,7 +275,7 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb }; //初始化界面时 加载事件 return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - } + } private void initTimeSwitchPane(){ timeSwitchContainer = new JPanel(new BorderLayout()); @@ -283,11 +287,11 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb /** * 全部初始化, 对所有的界面 都加入, 然后会加载事件响应. 后续再relayout. */ - private void initDataPointToolTipPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = new double[]{p, f}; - double[] rowSize = new double[]{p, p, p, p, p, p, p}; + private void initDataPointToolTipPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = new double[]{p, f}; + double[] rowSize = new double[]{p, p, p, p, p, p, p}; Component[][] components = new Component[][]{ new Component[]{isDatapointValue, dataPointValueFormat}, new Component[]{isDatapointPercent, dataPointPercentFormat}, @@ -298,7 +302,7 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb new Component[]{tooltipStyleLabel, tooltipStyle} }; tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"},components, rowSize, columnSize); - } + } private void relayoutDataPointToolTipPane(Plot plot) { double p = TableLayout.PREFERRED; @@ -333,8 +337,8 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb } else { rowSize = new double[]{p, p, p}; components = new Component[][]{ - new Component[]{isDatapointValue, dataPointValueFormat}, - new Component[]{isDatapointPercent, dataPointPercentFormat}, + new Component[]{isDatapointValue, dataPointValueFormat}, + new Component[]{isDatapointPercent, dataPointPercentFormat}, getTooltipStyleComponent() }; } @@ -370,49 +374,49 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb return new Component[] {TableLayoutHelper.createTableLayoutPane(newComponents, newRowSize, newColumnSize), null}; } - private void initAxisShowPane() { - double p = TableLayout.PREFERRED; - double[] columnSize = new double[]{p}; - double[] rowSize = new double[]{p}; - Component[][] components = new Component[][]{ - new Component[]{isAxisShowToolTip}, - }; - axisShowPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartF-Axis", "Chart-Interactive"},components, rowSize, columnSize); - } - - private void initAutoRefreshPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = new double[]{p, f}; - double[] rowSize = new double[]{p, p, p,p}; - - Component[][] components = new Component[][]{ - new Component[]{isAutoRefresh,null}, - new Component[]{GUICoreUtils.createFlowPane(new Component[]{ - new UILabel(Inter.getLocText("Chart-Time_Interval")), - autoRefreshTime, - new UILabel(Inter.getLocText("Chart-Time_Seconds")) - }, 1)}, + private void initAxisShowPane() { + double p = TableLayout.PREFERRED; + double[] columnSize = new double[]{p}; + double[] rowSize = new double[]{p}; + Component[][] components = new Component[][]{ + new Component[]{isAxisShowToolTip}, + }; + axisShowPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartF-Axis", "Chart-Interactive"},components, rowSize, columnSize); + } + + private void initAutoRefreshPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = new double[]{p, f}; + double[] rowSize = new double[]{p, p, p,p}; + + Component[][] components = new Component[][]{ + new Component[]{isAutoRefresh,null}, + new Component[]{GUICoreUtils.createFlowPane(new Component[]{ + new UILabel(Inter.getLocText("Chart-Time_Interval")), + autoRefreshTime, + new UILabel(Inter.getLocText("Chart-Time_Seconds")) + }, 1)}, new Component[]{new UILabel("" + Inter.getLocText("FR-Chart-AutoRefresh_NotSupportIMGAndReportData") + ""), null}, - }; - autoRefreshPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Data-Check"},components, rowSize, columnSize); - } - - private void initSuperlinkPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = new double[]{p, f}; - double[] rowSize = new double[]{p}; - Component[][] components = new Component[][]{ - new Component[]{superLink, null}, - - }; - superlinkPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Hyperlink"},components, rowSize, columnSize); - } - - private void relayoutWithPlot(Plot plot) { - this.removeAll(); - double p = TableLayout.PREFERRED; + }; + autoRefreshPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Data-Check"},components, rowSize, columnSize); + } + + private void initSuperlinkPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = new double[]{p, f}; + double[] rowSize = new double[]{p}; + Component[][] components = new Component[][]{ + new Component[]{superLink, null}, + + }; + superlinkPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Hyperlink"},components, rowSize, columnSize); + } + + private void relayoutWithPlot(Plot plot) { + this.removeAll(); + double p = TableLayout.PREFERRED; double[] columnSize = new double[]{TableLayout.FILL}; double[] rowSize = new double[]{p, p, p}; @@ -427,7 +431,7 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb double[] row = new double[]{p, p, p, p, p, p}; reloaPane(TableLayoutHelper.createTableLayoutPane(components, row, columnSize)); - } + } private Component[] getChartAnimatePane(Plot plot, double[] row, double[] col) { @@ -455,9 +459,9 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb timeSwitchContainer.add(timeSwitch, BorderLayout.CENTER); if(timeSwitch.isSelected()){ double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = new double[]{TIME_SWITCH_GAP,f}; - double[] rowSize = new double[]{p}; + double f = TableLayout.FILL; + double[] columnSize = new double[]{TIME_SWITCH_GAP,f}; + double[] rowSize = new double[]{p}; Component[][] components = new Component[][]{ new Component[]{null, timeSwitchPane}, }; @@ -523,15 +527,15 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb return new Component[]{superlinkPane}; } - @Override - public void populateBean(Chart chart) { - if (chart == null || chart.getPlot() == null) { - return; - } + @Override + public void populateBean(Chart chart) { + if (chart == null || chart.getPlot() == null) { + return; + } - Plot plot = chart.getPlot(); + Plot plot = chart.getPlot(); relayoutWithGis(chart, plot); - relayoutWithPlot(plot); + relayoutWithPlot(plot); populateChartAnimate(chart, plot); populateChartScale(plot); @@ -540,8 +544,8 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb populateAutoRefresh(chart); populateHyperlink(plot); - checkAutoRefresh(); - } + checkAutoRefresh(); + } private void relayoutWithGis(Chart chart, Plot plot) { if(plot.isSupportAddress4Gis()) { @@ -579,7 +583,7 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb timeSwitch.setEnabled(false); //只有坐标轴为时间坐标轴,并且勾选了图表缩放的时候,才支持时间切换 if(!plot.isSupportZoomCategoryAxis() || !isAxisZoom.isSelected()){ - return; + return; } if(plot.getxAxis() ==null && !plot.getxAxis().isDate()){ @@ -655,6 +659,13 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb private void populateHyperlink(Plot plot) { HashMap paneMap = renewMapWithPlot(plot); + //安装平台内打开插件时,添加相应按钮 + Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); + for (HyperlinkProvider provider : providers) { + NameableCreator nc = provider.createHyperlinkCreator(); + paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); + } + List list = refreshList(paneMap); superLink.refreshMenuAndAddMenuAction(list); @@ -672,13 +683,13 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb superLink.doLayout(); } - @Override - public void updateBean(Chart chart) { - if (chart == null || chart.getPlot() == null) { - return; - } + @Override + public void updateBean(Chart chart) { + if (chart == null || chart.getPlot() == null) { + return; + } - Plot plot = chart.getPlot(); + Plot plot = chart.getPlot(); updateChartAnimate(chart, plot); updateChartScale(plot); @@ -686,7 +697,7 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb updateAxisTip(plot); updateAutoRefresh(plot); updateHyperlink(plot); - } + } private void updateChartAnimate(Chart chart, Plot plot) { if(plot.isSupportAnimate()) { @@ -818,7 +829,7 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb } - protected Class getUseMap(HashMap map, Object key) { + protected Class getUseMap(HashMap map, Object key) { if(map.get(key) != null){ return (Class)map.get(key); } @@ -832,33 +843,33 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb } } return null; - } - - protected List refreshList(HashMap map) { - List list = new ArrayList(); + } - list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Reportlet"), + protected List refreshList(HashMap map) { + List list = new ArrayList(); + + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Reportlet"), new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); - list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), ChartEmailPane.class)); - list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Web"), + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), ChartEmailPane.class)); + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Web"), new WebHyperlink(), getUseMap(map, WebHyperlink.class))); - list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Dynamic_Parameters"), + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Dynamic_Parameters"), new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class))); - list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); + list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); - list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Float_Chart"), + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Float_Chart"), new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class))); - list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Cell"), + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Cell"), new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class))); - list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Float"), + list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Float"), new ChartHyperRelateFloatLink(), getUseMap(map, ChartHyperRelateFloatLink.class))); - - FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + + FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Form"), - hyperlink, getUseMap(map, FormHyperlinkProvider.class))); - - return list; - } + hyperlink, getUseMap(map, FormHyperlinkProvider.class))); + + return list; + } private HashMap renewMapWithPlot(Plot plot) { if(plot instanceof PiePlot) { @@ -1021,8 +1032,8 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb private HashMap getNormalPlotHyperMap() { if(normalMap.isEmpty()) { - FormHyperlinkProvider fp = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); - + FormHyperlinkProvider fp = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + normalMap.put(ReportletHyperlink.class, ReportletHyperlinkPane.CHART.class); normalMap.put(EmailJavaScript.class, ChartEmailPane.class); normalMap.put(WebHyperlink.class, WebHyperlinkPane.CHART.class); @@ -1041,27 +1052,27 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb } return normalMap; } - - @Override - public Chart updateBean() { - return null; - } + + @Override + public Chart updateBean() { + return null; + } /** - * 给组件登记一个观察者监听事件 - * - * @param listener 观察者监听事件 - */ + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ public void registerChangeListener(UIObserverListener listener) { timeSwitch.registerChangeListener(listener); timeSwitchPane.registerChangeListener(listener); } /** - * 组件是否需要响应添加的观察者事件 - * - * @return 如果需要响应观察者事件则返回true,否则返回false - */ + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ public boolean shouldResponseChangeListener() { return true; } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java index 0afd0cd60c..1b3a684072 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java @@ -43,6 +43,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ protected List styleList; protected JPanel stylePane; //样式布局的面板 + private JPanel typePane; protected abstract String[] getTypeIconPath(); protected abstract String[] getTypeTipName(); protected abstract String[] getTypeLayoutPath(); @@ -70,10 +71,10 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ checkDemosBackground(); - JPanel typePane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(4); + this.typePane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(4); for(int i = 0; i < typeDemo.size(); i++) { ChartImagePane tmp = typeDemo.get(i); - typePane.add(tmp); + this.typePane.add(tmp); tmp.setDemoGroup(typeDemo.toArray(new ChartSelectDemoPane[typeDemo.size()])); } @@ -99,7 +100,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ stylePane.setVisible(false); } - JPanel panel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(typePane),rowSize,columnSize); + JPanel panel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(this.typePane),rowSize,columnSize); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER); } @@ -133,7 +134,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ } //子类覆盖 - protected Plot getSelectedClonedPlot(){ + protected T getSelectedClonedPlot(){ return null; } @@ -586,6 +587,10 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ && chart.getPlot().getPlotStyle() != ChartConstants.STYLE_NONE; } + protected JPanel getTypePane(){ + return this.typePane; + } + public Chart getDefaultChart() { return BarIndependentChart.barChartTypes[0]; } diff --git a/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java b/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java index a14c9330a8..1e0426e4e6 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java +++ b/designer_form/src/com/fr/design/designer/creator/XCheckBoxGroup.java @@ -50,7 +50,7 @@ public class XCheckBoxGroup extends XFieldEditor { new CRPropertyDescriptor("adaptive", this.data.getClass()).setI18NName(Inter.getLocText("Adaptive")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").setEditorClass(InChangeBooleanEditor.class), new CRPropertyDescriptor("chooseAll", this.data.getClass()).setI18NName( - Inter.getLocText(new String[]{"Provide", "Choose_All"})).putKeyValue( + Inter.getLocText("FR-Designer_Provide_Choose_All")).putKeyValue( XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("returnString", this.data.getClass()).setI18NName( Inter.getLocText("Return-String")).setEditorClass(InChangeBooleanEditor.class)