From ce9c9eecd0dc2d3305f93e74a1c1652011bb01de Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 27 Dec 2016 17:25:35 +0800 Subject: [PATCH 01/92] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/fun/ConnectionProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/fun/ConnectionProvider.java b/designer_base/src/com/fr/design/fun/ConnectionProvider.java index c6bd2fca24..bb646c48d6 100644 --- a/designer_base/src/com/fr/design/fun/ConnectionProvider.java +++ b/designer_base/src/com/fr/design/fun/ConnectionProvider.java @@ -12,7 +12,7 @@ public interface ConnectionProvider extends Mutable { public static final String XML_TAG = "ConnectionProvider"; - int CURRENT_LEVEL = 1; + int CURRENT_LEVEL = 2; /** * 数据连接弹出菜单的名字 From 7a20e537115d8250cd81e2a8062dd715d2c5830a Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 27 Dec 2016 17:45:43 +0800 Subject: [PATCH 02/92] roll back --- designer_base/src/com/fr/design/fun/ConnectionProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/fun/ConnectionProvider.java b/designer_base/src/com/fr/design/fun/ConnectionProvider.java index bb646c48d6..c6bd2fca24 100644 --- a/designer_base/src/com/fr/design/fun/ConnectionProvider.java +++ b/designer_base/src/com/fr/design/fun/ConnectionProvider.java @@ -12,7 +12,7 @@ public interface ConnectionProvider extends Mutable { public static final String XML_TAG = "ConnectionProvider"; - int CURRENT_LEVEL = 2; + int CURRENT_LEVEL = 1; /** * 数据连接弹出菜单的名字 From 7c9c93d94ad6fc03d2e9f7a27ba5533940a91f44 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Mar 2017 15:13:35 +0800 Subject: [PATCH 03/92] diamond --- designer/src/com/fr/design/present/PresentPane.java | 8 ++++---- .../src/com/fr/design/report/ReportExportAttrPane.java | 2 +- designer/src/com/fr/design/report/VerifierListPane.java | 2 +- .../com/fr/design/write/submit/SubmitVisitorListPane.java | 8 ++++---- .../designer/creator/cardlayout/XCardSwitchButton.java | 4 ++-- .../properties/mobile/ElementCasePropertyTable.java | 2 +- .../src/com/fr/design/gui/xtable/PropertyGroupModel.java | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/designer/src/com/fr/design/present/PresentPane.java b/designer/src/com/fr/design/present/PresentPane.java index 043b069b0d..7d1d571fcf 100644 --- a/designer/src/com/fr/design/present/PresentPane.java +++ b/designer/src/com/fr/design/present/PresentPane.java @@ -57,12 +57,12 @@ public class PresentPane extends UIComboBoxPane { @Override protected List> initPaneList() { if (keys == null) { - keys = new ArrayList<>(); + keys = new ArrayList(); } if (displays == null) { - displays = new ArrayList<>(); + displays = new ArrayList(); } - List> paneList = new ArrayList<>(); + List> paneList = new ArrayList>(); FurtherBasicBeanPane none = new NonePresentPane(); paneList.add(none); keys.add("NOPRESENT"); @@ -99,7 +99,7 @@ public class PresentPane extends UIComboBoxPane { @Override protected UIComboBox createComboBox() { - return new DictionaryComboBox<>(keys.toArray(new String[keys.size()]), displays.toArray(new String[displays.size()])); + return new DictionaryComboBox(keys.toArray(new String[keys.size()]), displays.toArray(new String[displays.size()])); } @Override diff --git a/designer/src/com/fr/design/report/ReportExportAttrPane.java b/designer/src/com/fr/design/report/ReportExportAttrPane.java index 33eb07519f..1f549c62eb 100644 --- a/designer/src/com/fr/design/report/ReportExportAttrPane.java +++ b/designer/src/com/fr/design/report/ReportExportAttrPane.java @@ -31,7 +31,7 @@ public class ReportExportAttrPane extends BasicPane { wordExportPane = new WordExportPane(); uiTabbedPane.addTab("Word", wordExportPane); Set providers = ExtraDesignClassManager.getInstance().getArray(ExportAttrTabProvider.XML_TAG); - paneList = new ArrayList<>(); + paneList = new ArrayList(); for (ExportAttrTabProvider provider : providers) { uiTabbedPane.addTab(provider.title(), provider.toSwingComponent()); paneList.add(provider.toExportPane()); diff --git a/designer/src/com/fr/design/report/VerifierListPane.java b/designer/src/com/fr/design/report/VerifierListPane.java index 9bdedbd8a5..15b69398b5 100644 --- a/designer/src/com/fr/design/report/VerifierListPane.java +++ b/designer/src/com/fr/design/report/VerifierListPane.java @@ -1 +1 @@ -package com.fr.design.report; import com.fr.data.Verifier; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.VerifyDefineProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ObjectJControlPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.report.write.ReportWriteAttr; import com.fr.report.write.ValueVerifier; import com.fr.report.write.WClassVerifier; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import java.util.ArrayList; import java.util.Set; /** * 校验列表 */ public class VerifierListPane extends ObjectJControlPane { public VerifierListPane(ElementCasePane ePane) { super(ePane); } /** * 创建选项 * * @return 选项 */ public NameableCreator[] createNameableCreators() { NameableCreator[] creators = new NameableCreator[]{ new NameObjectCreator(Inter.getLocText(new String[]{"BuildIn", "Verify"}), "/com/fr/web/images/reportlet.png", ValueVerifier.class, BuildInVerifierPane.class) }; Set set = ExtraDesignClassManager.getInstance().getArray(VerifyDefineProvider.MARK_STRING); for (VerifyDefineProvider provider : set) { creators = ArrayUtils.add(creators, new NameObjectCreator( provider.nameForVerifier(), provider.iconPath(), provider.classForVerifier(), provider.appearanceForVerifier() ) { }); } creators = ArrayUtils.add(creators, new NameObjectCreator( Inter.getLocText(new String[]{"Custom", "Verify"}), "/com/fr/web/images/reportlet.png", WClassVerifier.class, CustomVerifierPane.class)); return creators; } @Override protected String title4PopupWindow() { return "Verify Collections"; } public void populate(ReportWriteAttr reportWriteAttr) { if (reportWriteAttr == null) { return; } java.util.List nameObjectList = new ArrayList<>(); int verifierCount = reportWriteAttr.getVerifierCount(); for (int i = 0; i < verifierCount; i++) { Verifier verifier = reportWriteAttr.getVerifier(i); nameObjectList.add(new NameObject(verifier.getName(), verifier)); } this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); } public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length]; java.util.Arrays.asList(res).toArray(res_array); reportWriteAttr.clearVerifiers(); for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; if (nameObject.getObject() instanceof Verifier) { Verifier verifier = (Verifier) nameObject.getObject(); verifier.setName(nameObject.getName()); reportWriteAttr.addVerifier(verifier); } } } } \ No newline at end of file +package com.fr.design.report; import com.fr.data.Verifier; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.VerifyDefineProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ObjectJControlPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.report.write.ReportWriteAttr; import com.fr.report.write.ValueVerifier; import com.fr.report.write.WClassVerifier; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import java.util.ArrayList; import java.util.Set; /** * 校验列表 */ public class VerifierListPane extends ObjectJControlPane { public VerifierListPane(ElementCasePane ePane) { super(ePane); } /** * 创建选项 * * @return 选项 */ public NameableCreator[] createNameableCreators() { NameableCreator[] creators = new NameableCreator[]{ new NameObjectCreator(Inter.getLocText(new String[]{"BuildIn", "Verify"}), "/com/fr/web/images/reportlet.png", ValueVerifier.class, BuildInVerifierPane.class) }; Set set = ExtraDesignClassManager.getInstance().getArray(VerifyDefineProvider.MARK_STRING); for (VerifyDefineProvider provider : set) { creators = ArrayUtils.add(creators, new NameObjectCreator( provider.nameForVerifier(), provider.iconPath(), provider.classForVerifier(), provider.appearanceForVerifier() ) { }); } creators = ArrayUtils.add(creators, new NameObjectCreator( Inter.getLocText(new String[]{"Custom", "Verify"}), "/com/fr/web/images/reportlet.png", WClassVerifier.class, CustomVerifierPane.class)); return creators; } @Override protected String title4PopupWindow() { return "Verify Collections"; } public void populate(ReportWriteAttr reportWriteAttr) { if (reportWriteAttr == null) { return; } java.util.List nameObjectList = new ArrayList(); int verifierCount = reportWriteAttr.getVerifierCount(); for (int i = 0; i < verifierCount; i++) { Verifier verifier = reportWriteAttr.getVerifier(i); nameObjectList.add(new NameObject(verifier.getName(), verifier)); } this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); } public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length]; java.util.Arrays.asList(res).toArray(res_array); reportWriteAttr.clearVerifiers(); for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; if (nameObject.getObject() instanceof Verifier) { Verifier verifier = (Verifier) nameObject.getObject(); verifier.setName(nameObject.getName()); reportWriteAttr.addVerifier(verifier); } } } } \ No newline at end of file diff --git a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java index 3dfea6c15b..8990170030 100644 --- a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java +++ b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java @@ -68,7 +68,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane { return; } - List nameObjectList = new ArrayList<>(); + List nameObjectList = new ArrayList(); int submiterCount = reportWriteAttr.getSubmitVisitorCount(); for (int i = 0; i < submiterCount; i++) { @@ -169,8 +169,8 @@ public class SubmitVisitorListPane extends ObjectJControlPane { public CustomPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); customCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - customSubmitPanes = new HashMap<>(); - comboItemsMap = new HashMap<>(); + customSubmitPanes = new HashMap(); + comboItemsMap = new HashMap(); Set providers = ExtraDesignClassManager.getInstance().getArray(SubmitProvider.MARK_STRING); addSubmitPane(new DefaultSubmit()); @@ -178,7 +178,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane { addSubmitPane(provider); } - configTypes = new ArrayList<>(); + configTypes = new ArrayList(); for (Map.Entry entry : customSubmitPanes.entrySet()) { String key = entry.getKey(); configTypes.add(comboItemsMap.get(key)); diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index 04e678029c..7189687d61 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -389,8 +389,8 @@ public class XCardSwitchButton extends XButton { return; } int tabLength = this.tagLayout.getComponentCount(); - Map cardWidth = new HashMap<>(); - Map cardHeight = new HashMap<>(); + Map cardWidth = new HashMap(); + Map cardHeight = new HashMap(); for (int i = 0; i < tabLength; i++) { XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i); CardSwitchButton tempCard = (CardSwitchButton) temp.toData(); diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java index 5a156f346d..3522c32b24 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java @@ -60,7 +60,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ .setRendererClass(BooleanRender.class) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit")) }; - List defaultList = new ArrayList<>(); + List defaultList = new ArrayList(); for (CRPropertyDescriptor propertyDescriptor: propertyTableEditor) { defaultList.add(propertyDescriptor); diff --git a/designer_form/src/com/fr/design/gui/xtable/PropertyGroupModel.java b/designer_form/src/com/fr/design/gui/xtable/PropertyGroupModel.java index bb0f0cd3a4..50f234324f 100644 --- a/designer_form/src/com/fr/design/gui/xtable/PropertyGroupModel.java +++ b/designer_form/src/com/fr/design/gui/xtable/PropertyGroupModel.java @@ -54,7 +54,7 @@ public class PropertyGroupModel extends AbstractPropertyGroupModel { creator.resetCreatorName(value.toString()); } if(ComparatorUtils.equals("visible", properties[row].getName())){ - creator.resetVisible((boolean) value); + creator.resetVisible((Boolean) value); } properties[row].firePropertyChanged(); return true; From c2c72ce0d70079b61a3963d55a07613f4670e7df Mon Sep 17 00:00:00 2001 From: eason-skx Date: Mon, 12 Jun 2017 14:12:40 +0800 Subject: [PATCH 04/92] =?UTF-8?q?=E5=88=A0import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/module/DesignModuleFactory.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_base/src/com/fr/design/module/DesignModuleFactory.java b/designer_base/src/com/fr/design/module/DesignModuleFactory.java index 1e5b4d1ed4..2a4342a7dc 100644 --- a/designer_base/src/com/fr/design/module/DesignModuleFactory.java +++ b/designer_base/src/com/fr/design/module/DesignModuleFactory.java @@ -2,7 +2,6 @@ package com.fr.design.module; import com.fr.base.FRContext; import com.fr.base.chart.BaseChartCollection; -import com.fr.chart.chartattr.ChartCollection; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartDialog; From 6213784e43bab3455bfd1e11e7c0a5379bca4267 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Thu, 15 Jun 2017 15:08:54 +0800 Subject: [PATCH 05/92] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeriesCondition/dlp/DataLabelPane.java | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) 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..3bad0eefd6 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 @@ -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(); From de3fbb5cabd0ca2ca9b076b9c06b91e1bc46ad9e Mon Sep 17 00:00:00 2001 From: eason-skx Date: Thu, 15 Jun 2017 15:27:32 +0800 Subject: [PATCH 06/92] pmd --- .../design/chart/series/SeriesCondition/dlp/DataLabelPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3bad0eefd6..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; } From 5a490cf8dd753d983b46edc2d1b8fc8c96e2bd13 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Mon, 19 Jun 2017 13:53:39 +0800 Subject: [PATCH 07/92] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=EF=BC=9A=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=98=BE=E7=A4=BA=E9=87=8C=E8=AE=BE=E7=BD=AE=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=86=85=E5=AE=B9=E4=B8=BA=E6=95=B0=E6=8D=AE=E5=88=97?= =?UTF-8?q?=EF=BC=8C=E6=8A=8A=E5=AF=B9=E5=BA=94=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=88=A0=E6=8E=89=E5=90=8E=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=EF=BC=8C=E9=A1=B5=E9=9D=A2=E6=89=93=E4=B8=8D=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor/editor/ColumnSelectedEditor.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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..29b1a3ea03 100644 --- a/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java +++ b/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java @@ -36,15 +36,18 @@ public class ColumnSelectedEditor extends Editor { @Override public void itemStateChanged(ItemEvent e) { - //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 - List nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList(); - columnNames = new String[nameList.size()]; - columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames); - columnNameComboBox.removeAllItems(); - for (int i = 0; i < columnNames.length; i++) { - columnNameComboBox.addItem(columnNames[i]); + TableDataWrapper tableDataWrapper = tableDataComboBox.getSelectedItem(); + if (tableDataWrapper != null) { + //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 + List nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList(); + columnNames = new String[nameList.size()]; + columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames); + columnNameComboBox.removeAllItems(); + for (int i = 0; i < columnNames.length; i++) { + columnNameComboBox.addItem(columnNames[i]); + } + columnNameComboBox.validate(); } - columnNameComboBox.validate(); } }); columnNameComboBox = new UIComboBox(); From c5536e6d61d93a766380a4e8221d601276e297ee Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 20 Jun 2017 17:20:39 +0800 Subject: [PATCH 08/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9pmd=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor/editor/ColumnSelectedEditor.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 29b1a3ea03..e21099d719 100644 --- a/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java +++ b/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java @@ -37,17 +37,18 @@ public class ColumnSelectedEditor extends Editor { @Override public void itemStateChanged(ItemEvent e) { TableDataWrapper tableDataWrapper = tableDataComboBox.getSelectedItem(); - if (tableDataWrapper != null) { - //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 - List nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList(); - columnNames = new String[nameList.size()]; - columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames); - columnNameComboBox.removeAllItems(); - for (int i = 0; i < columnNames.length; i++) { - columnNameComboBox.addItem(columnNames[i]); - } - columnNameComboBox.validate(); + if (tableDataWrapper == null) { + return; } + //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 + List nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList(); + columnNames = new String[nameList.size()]; + columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames); + columnNameComboBox.removeAllItems(); + for (int i = 0; i < columnNames.length; i++) { + columnNameComboBox.addItem(columnNames[i]); + } + columnNameComboBox.validate(); } }); columnNameComboBox = new UIComboBox(); From 382268234df6ed7c8ad3b1172bdf66c8a2ac6b31 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 20 Jun 2017 17:25:45 +0800 Subject: [PATCH 09/92] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpmd=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/editor/editor/ColumnSelectedEditor.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 e21099d719..22516882bd 100644 --- a/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java +++ b/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java @@ -36,13 +36,13 @@ public class ColumnSelectedEditor extends Editor { @Override public void itemStateChanged(ItemEvent e) { - TableDataWrapper tableDataWrapper = tableDataComboBox.getSelectedItem(); - if (tableDataWrapper == null) { - return; - } - //这边需要重新初始化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++) { From 58bc5e247e1f26c0288d5e65af6af5cb3e6b4ac0 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 20 Jun 2017 17:57:47 +0800 Subject: [PATCH 10/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9pmd=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/editor/editor/ColumnSelectedEditor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 22516882bd..71014d4c8a 100644 --- a/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java +++ b/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java @@ -68,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()) { @@ -84,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"; } From 58a009ed1092c119f0c288da3da4898d0ef05e6c Mon Sep 17 00:00:00 2001 From: sunmondong <646575997@qq.com> Date: Thu, 6 Jul 2017 15:49:36 +0800 Subject: [PATCH 11/92] fix --- build.performance.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.performance.gradle b/build.performance.gradle index 132db468fb..1022056799 100644 --- a/build.performance.gradle +++ b/build.performance.gradle @@ -14,7 +14,8 @@ task appletJar<<{ fileset(dir:"${basicDir}/core/build/classes/main") fileset(dir:"${basicDir}/chart/build/classes/main") fileset(dir:"${basicDir}/report/build/classes/main") - fileset(dir:"${basicDir}/platform/build/classes/main") + fileset(dir:"${basicDir}/platform/build/classes/main") + fileset(dir:"${basicDir}/performance/build/classes/main") } unjar(src:"${libDir}/3rd.jar",dest:"./tmp") unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") From b7ca742217b97eaef5e27a24072405792b5c3c53 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Mon, 10 Jul 2017 14:44:10 +0800 Subject: [PATCH 12/92] =?UTF-8?q?=E5=A4=9A=E5=88=86=E7=B1=BB=E8=BD=B4?= =?UTF-8?q?=E6=95=B4=E4=BD=93=E4=BB=A3=E7=A0=81=EF=BC=8C=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...goryPlotMoreCateReportDataContentPane.java | 38 ++++++++++----- ...egoryPlotMoreCateTableDataContentPane.java | 47 ++++++++++++------- 2 files changed, 57 insertions(+), 28 deletions(-) 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..1cd4b8c091 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 @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.data.report; import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartdata.NormalReportDataDefinition; @@ -37,6 +38,10 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor private ArrayList formualList = new ArrayList(); private UIObserverListener uiobListener = null; + public ArrayList getFormualList() { + return formualList; + } + public CategoryPlotMoreCateReportDataContentPane() { } @@ -105,13 +110,13 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor public void actionPerformed(ActionEvent e) { boxPane.remove(newButtonPane); formualList.remove(pane); - checkAddButton(); + checkComponent(); relayoutPane(); } }); delButton.registerChangeListener(uiobListener); - - checkAddButton(); + + checkComponent(); relayoutPane(); return pane; @@ -121,7 +126,11 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor int size = formualList.size(); addButton.setEnabled(size < 2); } - + + protected void checkComponent() { + checkAddButton(); + } + private void relayoutPane() { this.revalidate(); } @@ -163,20 +172,25 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor checkAddButton(); } - + public void updateBean(ChartCollection collection) { super.updateBean(collection); - + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + Axis axis = collection.getSelectedChart().getPlot().getxAxis(); 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, axis); + + } + } + + protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Axis axis) { + 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..f37fc93563 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; @@ -41,7 +42,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD private UIButton addButton; private UIObserverListener uiobListener = null; - + + public ArrayList getBoxList() { + return boxList; + } + public CategoryPlotMoreCateTableDataContentPane() { // do nothing } @@ -86,8 +91,8 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD public void itemStateChanged(ItemEvent e) { checkSeriseUse(categoryCombox.getSelectedItem() != null); makeToolTipUse(categoryCombox); - - checkAddButton(); + + checkComponent(); } }); } @@ -126,15 +131,15 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD buttonPane.add(delButton); boxPane.add(buttonPane); boxList.add(combox); - - checkAddButton(); + + checkComponent(); delButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boxPane.remove(buttonPane); boxList.remove(combox); - checkAddButton(); + checkComponent(); relayoutPane(); } }); @@ -147,6 +152,10 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD int size = boxList.size(); addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null); } + + protected void checkComponent() { + checkAddButton(); + } private void relayoutPane() { this.revalidate(); @@ -159,8 +168,8 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD */ public void checkBoxUse(boolean hasUse) { super.checkBoxUse(hasUse); - - checkAddButton(); + + checkComponent(); } protected void refreshBoxListWithSelectTableData(List list) { @@ -218,17 +227,23 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD */ 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 From 2aa4fee16e180840b8567400f6d323e8726900e7 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 11 Jul 2017 09:31:06 +0800 Subject: [PATCH 13/92] =?UTF-8?q?=E5=B0=86Table=E4=B8=AD=E7=9A=84=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=B1=BB=E5=9E=8BArrayList=E6=94=B9?= =?UTF-8?q?=E4=B8=BAList=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/table/CategoryPlotMoreCateTableDataContentPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f37fc93563..aae7e35400 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 @@ -43,7 +43,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD private UIObserverListener uiobListener = null; - public ArrayList getBoxList() { + public List getBoxList() { return boxList; } From 8810f3c6956e3e2fc9cab3731eee052bb2b732aa Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 11 Jul 2017 13:30:04 +0800 Subject: [PATCH 14/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/report/CategoryPlotMoreCateReportDataContentPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 1cd4b8c091..d63bafbae4 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 @@ -22,6 +22,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; +import java.util.List; /** @@ -38,7 +39,7 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor private ArrayList formualList = new ArrayList(); private UIObserverListener uiobListener = null; - public ArrayList getFormualList() { + public List getFormualList() { return formualList; } From eda63515b4550fc48549e6a54162418da3dc9526 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 13 Jul 2017 14:45:59 +0800 Subject: [PATCH 15/92] =?UTF-8?q?REPORT-3272=20=E8=A1=A8=E5=8D=95=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_form/src/com/fr/design/mainframe/JForm.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index ba491e3519..0a4aa98944 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -468,18 +468,21 @@ public class JForm extends JTemplate implements BaseJForm { @Override protected void applyUndoState(FormUndoState u) { try { - //JForm的target重置 - this.setTarget((Form) u.getForm().clone()); if (this.index == FORM_TAB) { + //JForm的target重置 + this.setTarget((Form) u.getForm().clone()); JForm.this.refreshRoot(); this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue()); //撤销的时候要重新选择的body布局 this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(), formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()})); } else { + // 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块. + // 修改了JForm的Target需要同步修改formDesign的Target. + Form undoForm = (Form) u.getForm().clone(); String widgetName = this.formDesign.getElementCaseContainerName(); //这儿太坑了,u.getForm() 与 getTarget内容不一样 - FormElementCaseProvider dataTable = getTarget().getElementCaseByName(widgetName); + FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName); this.reportComposite.setSelectedWidget(dataTable); //下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC formDesign.setElementCase(dataTable); From 53aa00aa1a98b45b292a34ffda9f4650a562ea3f Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 13 Jul 2017 14:46:58 +0800 Subject: [PATCH 16/92] =?UTF-8?q?REPORT-3272=20=E8=A1=A8=E5=8D=95=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_form/src/com/fr/design/mainframe/JForm.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index ba491e3519..0a4aa98944 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -468,18 +468,21 @@ public class JForm extends JTemplate implements BaseJForm { @Override protected void applyUndoState(FormUndoState u) { try { - //JForm的target重置 - this.setTarget((Form) u.getForm().clone()); if (this.index == FORM_TAB) { + //JForm的target重置 + this.setTarget((Form) u.getForm().clone()); JForm.this.refreshRoot(); this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue()); //撤销的时候要重新选择的body布局 this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(), formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()})); } else { + // 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块. + // 修改了JForm的Target需要同步修改formDesign的Target. + Form undoForm = (Form) u.getForm().clone(); String widgetName = this.formDesign.getElementCaseContainerName(); //这儿太坑了,u.getForm() 与 getTarget内容不一样 - FormElementCaseProvider dataTable = getTarget().getElementCaseByName(widgetName); + FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName); this.reportComposite.setSelectedWidget(dataTable); //下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC formDesign.setElementCase(dataTable); From 23fd3ad8effcfa5ebe2e6355b1984a53318da90b Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 13 Jul 2017 14:48:00 +0800 Subject: [PATCH 17/92] 1 --- designer_form/src/com/fr/design/mainframe/JForm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 0a4aa98944..892cb8d91e 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -478,7 +478,7 @@ public class JForm extends JTemplate implements BaseJForm { formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()})); } else { // 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块. - // 修改了JForm的Target需要同步修改formDesign的Target. + // 修改了JForm的Target需 要同步修改formDesign的Target. Form undoForm = (Form) u.getForm().clone(); String widgetName = this.formDesign.getElementCaseContainerName(); //这儿太坑了,u.getForm() 与 getTarget内容不一样 From 9dcd2698c86b4236851d773ea9e5c78ffb1b3abd Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 13 Jul 2017 14:48:13 +0800 Subject: [PATCH 18/92] 1 --- designer_form/src/com/fr/design/mainframe/JForm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 892cb8d91e..0a4aa98944 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -478,7 +478,7 @@ public class JForm extends JTemplate implements BaseJForm { formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()})); } else { // 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块. - // 修改了JForm的Target需 要同步修改formDesign的Target. + // 修改了JForm的Target需要同步修改formDesign的Target. Form undoForm = (Form) u.getForm().clone(); String widgetName = this.formDesign.getElementCaseContainerName(); //这儿太坑了,u.getForm() 与 getTarget内容不一样 From 2f8a2447a6a5e45db3a2f4376149dc51ea08ee24 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 13 Jul 2017 16:17:32 +0800 Subject: [PATCH 19/92] =?UTF-8?q?REPORT-2825=20=E6=8C=89=E9=92=AE=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E5=A4=9A=E4=B8=AA,=20design=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=BF=98=E4=BA=86patch=E4=BA=86.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java index bd1f70829b..03e76dcdfc 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractDsinFrameUpButtonProvider.java @@ -2,6 +2,7 @@ package com.fr.design.fun.impl; import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.gui.ibutton.UIButton; +import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; /** @@ -10,7 +11,7 @@ import com.fr.stable.fun.mark.API; * Time: 15:50 */ @API(level = DesignerFrameUpButtonProvider.CURRENT_LEVEL) -public abstract class AbstractDsinFrameUpButtonProvider implements DesignerFrameUpButtonProvider { +public abstract class AbstractDsinFrameUpButtonProvider extends AbstractProvider implements DesignerFrameUpButtonProvider { @Override public UIButton[] getUpButtons(int menuState) { return new UIButton[0]; From 896fa76e9598a56fe31673d96ca962937b00527f Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Thu, 13 Jul 2017 16:18:38 +0800 Subject: [PATCH 20/92] 1 --- designer_form/src/com/fr/design/mainframe/JForm.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 0a4aa98944..ba491e3519 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -468,21 +468,18 @@ public class JForm extends JTemplate implements BaseJForm { @Override protected void applyUndoState(FormUndoState u) { try { + //JForm的target重置 + this.setTarget((Form) u.getForm().clone()); if (this.index == FORM_TAB) { - //JForm的target重置 - this.setTarget((Form) u.getForm().clone()); JForm.this.refreshRoot(); this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue()); //撤销的时候要重新选择的body布局 this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(), formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()})); } else { - // 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块. - // 修改了JForm的Target需要同步修改formDesign的Target. - Form undoForm = (Form) u.getForm().clone(); String widgetName = this.formDesign.getElementCaseContainerName(); //这儿太坑了,u.getForm() 与 getTarget内容不一样 - FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName); + FormElementCaseProvider dataTable = getTarget().getElementCaseByName(widgetName); this.reportComposite.setSelectedWidget(dataTable); //下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC formDesign.setElementCase(dataTable); From 2bc7f74a3c70732bfb35298acd1a6a72499a0026 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Thu, 13 Jul 2017 19:27:24 +0800 Subject: [PATCH 21/92] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=B2=A1=E7=94=A8?= =?UTF-8?q?=E5=88=B0=E7=9A=84=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/module/DesignModuleFactory.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_base/src/com/fr/design/module/DesignModuleFactory.java b/designer_base/src/com/fr/design/module/DesignModuleFactory.java index 1e5b4d1ed4..2a4342a7dc 100644 --- a/designer_base/src/com/fr/design/module/DesignModuleFactory.java +++ b/designer_base/src/com/fr/design/module/DesignModuleFactory.java @@ -2,7 +2,6 @@ package com.fr.design.module; import com.fr.base.FRContext; import com.fr.base.chart.BaseChartCollection; -import com.fr.chart.chartattr.ChartCollection; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartDialog; From 6819c1c00dfc856fe18eb7496ebbfba7975513c4 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Fri, 14 Jul 2017 09:44:43 +0800 Subject: [PATCH 22/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=BC=E5=86=99?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/chart/ChartsConfigPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java index bebf6d2c23..595be873d4 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartsConfigPane.java @@ -14,11 +14,11 @@ public abstract class ChartsConfigPane extends AbstractChartA public final static String CHART_STYLE_TITLE = Inter.getLocText("Chart-Style_Name"); - public abstract Class accptType(); + public abstract Class acceptType(); @Override public void populate(ChartCollection collection) { - if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(),accptType())) { + if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(),acceptType())) { populate(collection, (T)collection.getSelectedChart()); } } @@ -27,7 +27,7 @@ public abstract class ChartsConfigPane extends AbstractChartA @Override public void update(ChartCollection collection) { - if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(),accptType())) { + if (StableUtils.classInstanceOf(collection.getSelectedChart().getClass(),acceptType())) { update(collection, (T)collection.getSelectedChart()); } } From b43d2185ec20ea375d0ad6eca4329d70019a562d Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 19 Jul 2017 09:45:36 +0800 Subject: [PATCH 23/92] jdk --- .../fr/design/report/VerifierListPane.java | 101 +++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/report/VerifierListPane.java b/designer/src/com/fr/design/report/VerifierListPane.java index 15b69398b5..6b34af21b3 100644 --- a/designer/src/com/fr/design/report/VerifierListPane.java +++ b/designer/src/com/fr/design/report/VerifierListPane.java @@ -1 +1,100 @@ -package com.fr.design.report; import com.fr.data.Verifier; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.VerifyDefineProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ObjectJControlPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.report.write.ReportWriteAttr; import com.fr.report.write.ValueVerifier; import com.fr.report.write.WClassVerifier; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import java.util.ArrayList; import java.util.Set; /** * 校验列表 */ public class VerifierListPane extends ObjectJControlPane { public VerifierListPane(ElementCasePane ePane) { super(ePane); } /** * 创建选项 * * @return 选项 */ public NameableCreator[] createNameableCreators() { NameableCreator[] creators = new NameableCreator[]{ new NameObjectCreator(Inter.getLocText(new String[]{"BuildIn", "Verify"}), "/com/fr/web/images/reportlet.png", ValueVerifier.class, BuildInVerifierPane.class) }; Set set = ExtraDesignClassManager.getInstance().getArray(VerifyDefineProvider.MARK_STRING); for (VerifyDefineProvider provider : set) { creators = ArrayUtils.add(creators, new NameObjectCreator( provider.nameForVerifier(), provider.iconPath(), provider.classForVerifier(), provider.appearanceForVerifier() ) { }); } creators = ArrayUtils.add(creators, new NameObjectCreator( Inter.getLocText(new String[]{"Custom", "Verify"}), "/com/fr/web/images/reportlet.png", WClassVerifier.class, CustomVerifierPane.class)); return creators; } @Override protected String title4PopupWindow() { return "Verify Collections"; } public void populate(ReportWriteAttr reportWriteAttr) { if (reportWriteAttr == null) { return; } java.util.List nameObjectList = new ArrayList(); int verifierCount = reportWriteAttr.getVerifierCount(); for (int i = 0; i < verifierCount; i++) { Verifier verifier = reportWriteAttr.getVerifier(i); nameObjectList.add(new NameObject(verifier.getName(), verifier)); } this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); } public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length]; java.util.Arrays.asList(res).toArray(res_array); reportWriteAttr.clearVerifiers(); for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; if (nameObject.getObject() instanceof Verifier) { Verifier verifier = (Verifier) nameObject.getObject(); verifier.setName(nameObject.getName()); reportWriteAttr.addVerifier(verifier); } } } } \ No newline at end of file +package com.fr.design.report; + +import com.fr.data.Verifier; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.fun.VerifyDefineProvider; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.controlpane.ObjectJControlPane; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.general.Inter; +import com.fr.general.NameObject; +import com.fr.report.write.ReportWriteAttr; +import com.fr.report.write.ValueVerifier; +import com.fr.report.write.WClassVerifier; +import com.fr.stable.ArrayUtils; +import com.fr.stable.Nameable; + +import java.util.ArrayList; +import java.util.Set; + +/** + * 校验列表 + */ +public class VerifierListPane extends ObjectJControlPane { + + public VerifierListPane(ElementCasePane ePane) { + super(ePane); + } + + /** + * 创建选项 + * + * @return 选项 + */ + public NameableCreator[] createNameableCreators() { + NameableCreator[] creators = new NameableCreator[]{ + new NameObjectCreator(Inter.getLocText(new String[]{"BuildIn", "Verify"}), + "/com/fr/web/images/reportlet.png", + ValueVerifier.class, + BuildInVerifierPane.class) + }; + Set set = ExtraDesignClassManager.getInstance().getArray(VerifyDefineProvider.MARK_STRING); + for (VerifyDefineProvider provider : set) { + creators = ArrayUtils.add(creators, new NameObjectCreator( + provider.nameForVerifier(), + provider.iconPath(), + provider.classForVerifier(), + provider.appearanceForVerifier() + ) { + }); + } + creators = ArrayUtils.add(creators, new NameObjectCreator( + Inter.getLocText(new String[]{"Custom", "Verify"}), + "/com/fr/web/images/reportlet.png", + WClassVerifier.class, + CustomVerifierPane.class)); + return creators; + } + + @Override + protected String title4PopupWindow() { + return "Verify Collections"; + } + + public void populate(ReportWriteAttr reportWriteAttr) { + if (reportWriteAttr == null) { + return; + } + + java.util.List nameObjectList = new ArrayList(); + + int verifierCount = reportWriteAttr.getVerifierCount(); + for (int i = 0; i < verifierCount; i++) { + Verifier verifier = reportWriteAttr.getVerifier(i); + nameObjectList.add(new NameObject(verifier.getName(), verifier)); + } + + this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); + } + + public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) { + // Nameable[]居然不能强转成NameObject[],一定要这么写... + Nameable[] res = this.update(); + NameObject[] res_array = new NameObject[res.length]; + java.util.Arrays.asList(res).toArray(res_array); + + reportWriteAttr.clearVerifiers(); + + for (int i = 0; i < res_array.length; i++) { + NameObject nameObject = res_array[i]; + if (nameObject.getObject() instanceof Verifier) { + Verifier verifier = (Verifier) nameObject.getObject(); + verifier.setName(nameObject.getName()); + reportWriteAttr.addVerifier(verifier); + } + } + } + + +} \ No newline at end of file From 842f99ec4bb0eb6228b97ad87753c4b0fddb711f Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Thu, 20 Jul 2017 14:29:22 +0800 Subject: [PATCH 24/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=81=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E9=82=A3=E8=BE=B9=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E7=9A=84=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E5=A4=9A=E5=88=86=E7=B1=BB=E8=BD=B4bug=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=9A=E5=88=86=E7=B1=BB=E6=97=B6=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E5=88=B7=E6=96=B0=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/CategoryPlotMoreCateReportDataContentPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 d63bafbae4..eb7ad057ed 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 @@ -3,9 +3,9 @@ package com.fr.design.mainframe.chart.gui.data.report; import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.base.chart.chartdata.TopDefinitionProvider; -import com.fr.chart.chartattr.Axis; 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; @@ -178,17 +178,17 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor super.updateBean(collection); TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); - Axis axis = collection.getSelectedChart().getPlot().getxAxis(); + Plot plot = collection.getSelectedChart().getPlot(); if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; reportDefinition.clearMoreCate(); - updateMoreCate(reportDefinition, axis); + updateMoreCate(reportDefinition, plot); } } - protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Axis axis) { + 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())); From 97d781caaf74a6f26ab98b15143a2333c6527d90 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Fri, 21 Jul 2017 11:47:36 +0800 Subject: [PATCH 25/92] =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=86=85=E6=89=93=E5=BC=80=E6=8F=92=E4=BB=B6=EF=BC=8C=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E8=B6=85=E9=93=BE=E4=B8=AD=E6=B7=BB=E5=8A=A0=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/controlpane/AbstractNameableCreator.java | 9 +++++++++ .../fr/design/gui/controlpane/NameableCreator.java | 5 ++++- .../chart/gui/other/ChartInteractivePane.java | 11 +++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) 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..b3bb6f9d5e 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.AbstractJavaScript; import javax.swing.*; @@ -70,6 +71,14 @@ public abstract class AbstractNameableCreator implements NameableCreator { return this.clazzOfEditor; } + /** + * get clazzOfObject + * @return clazzOfObject + */ + public Class getClazz() { + return this.clazzOfObject; + } + /** * * @param ob 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..eb26e21813 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java +++ b/designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java @@ -2,6 +2,7 @@ package com.fr.design.gui.controlpane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilist.ListModelElement; +import com.fr.js.AbstractJavaScript; import com.fr.stable.Nameable; import javax.swing.*; @@ -16,7 +17,9 @@ public interface NameableCreator { public Nameable createNameable(UnrepeatedNameHelper helper); public Class getUpdatePane(); - + + public Class getClazz(); + public Object acceptObject2Populate(Object ob); public void saveUpdatedBean(ListModelElement wrapper, Object bean); 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..0250000f9c 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,6 +56,7 @@ 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; @@ -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.getClazz(), nc.getUpdatePane()); + } + List list = refreshList(paneMap); superLink.refreshMenuAndAddMenuAction(list); From 59696f6e66523c09915a9d9071f5a92a9021d0de Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Fri, 21 Jul 2017 17:11:52 +0800 Subject: [PATCH 26/92] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/controlpane/AbstractNameableCreator.java | 4 ++-- .../src/com/fr/design/gui/controlpane/NameableCreator.java | 4 ++-- .../mainframe/chart/gui/other/ChartInteractivePane.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) 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 b3bb6f9d5e..d8eae8fd21 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/AbstractNameableCreator.java +++ b/designer_base/src/com/fr/design/gui/controlpane/AbstractNameableCreator.java @@ -4,7 +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.AbstractJavaScript; +import com.fr.js.JavaScript; import javax.swing.*; @@ -75,7 +75,7 @@ public abstract class AbstractNameableCreator implements NameableCreator { * get clazzOfObject * @return clazzOfObject */ - public Class getClazz() { + public Class getHyperlink() { return this.clazzOfObject; } 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 eb26e21813..ec03b371fa 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java +++ b/designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java @@ -2,7 +2,7 @@ package com.fr.design.gui.controlpane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilist.ListModelElement; -import com.fr.js.AbstractJavaScript; +import com.fr.js.JavaScript; import com.fr.stable.Nameable; import javax.swing.*; @@ -18,7 +18,7 @@ public interface NameableCreator { public Class getUpdatePane(); - public Class getClazz(); + public Class getHyperlink(); public Object acceptObject2Populate(Object ob); 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 0250000f9c..ac8c1efe67 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 @@ -663,7 +663,7 @@ public class ChartInteractivePane extends BasicScrollPane implements UIOb Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); for (HyperlinkProvider provider : providers) { NameableCreator nc = provider.createHyperlinkCreator(); - paneMap.put(nc.getClazz(), nc.getUpdatePane()); + paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); } List list = refreshList(paneMap); From 8fa56b136735ec07228a56648a1349ac327c2d82 Mon Sep 17 00:00:00 2001 From: hugh Date: Mon, 24 Jul 2017 21:34:25 +0800 Subject: [PATCH 27/92] =?UTF-8?q?SLN-280=20=E4=BA=8C=E5=BC=80=E9=9C=80?= =?UTF-8?q?=E6=B1=82=EF=BC=88=E5=B0=86=E5=8E=9F=E5=AF=BC=E5=87=BA=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E7=BA=B8=E5=BC=A0=E8=83=8C=E6=99=AF=EF=BC=8C=E5=88=86?= =?UTF-8?q?=E5=BC=80=E8=AE=BE=E7=BD=AE=EF=BC=89=EF=BC=8C=E7=BB=8F=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=86=B3=E5=AE=9A=E5=81=9A=E5=88=B0=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E9=87=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/report/ReportBackgroundPane.java | 102 ++++++++++-------- .../com/fr/design/locale/designer.properties | 2 + .../design/locale/designer_en_US.properties | 2 + .../design/locale/designer_ja_JP.properties | 2 + .../design/locale/designer_ko_KR.properties | 2 + .../design/locale/designer_zh_CN.properties | 2 + .../design/locale/designer_zh_TW.properties | 2 + 7 files changed, 68 insertions(+), 46 deletions(-) diff --git a/designer/src/com/fr/design/report/ReportBackgroundPane.java b/designer/src/com/fr/design/report/ReportBackgroundPane.java index a3e913fe41..33bfb58bd3 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("ReportGUI-BG_Print_Background")); + isExportBackgroundCheckBox = new UICheckBox(Inter.getLocText("ReportGUI-BG_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_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 836b30c98d..912dca65d0 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 +ReportGUI-BG_Print_Background=Print Background +ReportGUI-BG_Export_Background=Export Background Export-CSV=CSV M_Edit-Paste=Paste FR-Designer-Basic_Restart_Designer=Restart designer 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 c545b6f7e1..7d7f976bb3 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 +ReportGUI-BG_Print_Background=Print Background +ReportGUI-BG_Export_Background=Export Background Export-CSV=CSV M_Edit-Paste=Paste FR-Designer-Basic_Restart_Designer=Restart designer 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 3ebf48af52..ab5cf44ea1 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 +ReportGUI-BG_Print_Background=\u5E33\u7968\u80CC\u666F\u306E\u5370\u5237 +ReportGUI-BG_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 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 069cb57a8c..1f6335519f 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 +ReportGUI-BG_Print_Background=\uC778\uC1C4\uBB38\uC11C\uBC30\uACBD +ReportGUI-BG_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 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 dddd287f34..50554a4dc2 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 +ReportGUI-BG_Print_Background=\u6253\u5370\u62A5\u8868\u80CC\u666F +ReportGUI-BG_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 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 c85f1d3822..04ba756400 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 +ReportGUI-BG_Print_Background=\u5217\u5370\u5831\u8868\u80CC\u666F +ReportGUI-BG_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 From 06fff3dde04dffca511112a63fbe493e13fc9655 Mon Sep 17 00:00:00 2001 From: hugh Date: Tue, 25 Jul 2017 09:22:00 +0800 Subject: [PATCH 28/92] =?UTF-8?q?SLN-280=20=E8=A7=84=E8=8C=83=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/report/ReportBackgroundPane.java | 4 ++-- designer_base/src/com/fr/design/locale/designer.properties | 4 ++-- .../src/com/fr/design/locale/designer_en_US.properties | 4 ++-- .../src/com/fr/design/locale/designer_ja_JP.properties | 4 ++-- .../src/com/fr/design/locale/designer_ko_KR.properties | 4 ++-- .../src/com/fr/design/locale/designer_zh_CN.properties | 4 ++-- .../src/com/fr/design/locale/designer_zh_TW.properties | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/designer/src/com/fr/design/report/ReportBackgroundPane.java b/designer/src/com/fr/design/report/ReportBackgroundPane.java index 33bfb58bd3..dcf1247920 100644 --- a/designer/src/com/fr/design/report/ReportBackgroundPane.java +++ b/designer/src/com/fr/design/report/ReportBackgroundPane.java @@ -22,8 +22,8 @@ public class ReportBackgroundPane extends BasicPane { backgroundPane = new BackgroundPane(); this.add(backgroundPane, BorderLayout.CENTER); - isPrintBackgroundCheckBox = new UICheckBox(Inter.getLocText("ReportGUI-BG_Print_Background")); - isExportBackgroundCheckBox = new UICheckBox(Inter.getLocText("ReportGUI-BG_Export_Background")); + 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); diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 912dca65d0..67035a4fd1 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -1345,8 +1345,8 @@ Remove_All_Button=Remove_All_Button FR-Designer_Component_Interval=Components Interval ReportColumns-Columns_vertically=Columns vertically ReportGUI-Print_Background=Print Background -ReportGUI-BG_Print_Background=Print Background -ReportGUI-BG_Export_Background=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 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 7d7f976bb3..deabe7a0fe 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,8 +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 -ReportGUI-BG_Print_Background=Print Background -ReportGUI-BG_Export_Background=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 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 ab5cf44ea1..7126404b05 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,8 +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 -ReportGUI-BG_Print_Background=\u5E33\u7968\u80CC\u666F\u306E\u5370\u5237 -ReportGUI-BG_Export_Background=\u5E33\u7968\u80CC\u666F\u306E\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 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 1f6335519f..1c5ec78b4d 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,8 +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 -ReportGUI-BG_Print_Background=\uC778\uC1C4\uBB38\uC11C\uBC30\uACBD -ReportGUI-BG_Export_Background=\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 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 50554a4dc2..64a6c4f140 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,8 +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 -ReportGUI-BG_Print_Background=\u6253\u5370\u62A5\u8868\u80CC\u666F -ReportGUI-BG_Export_Background=\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 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 04ba756400..efbcde1b92 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,8 +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 -ReportGUI-BG_Print_Background=\u5217\u5370\u5831\u8868\u80CC\u666F -ReportGUI-BG_Export_Background=\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 From 117ea3b1175c9928212855f5a7e243f8fc86b9bd Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 25 Jul 2017 13:54:45 +0800 Subject: [PATCH 29/92] =?UTF-8?q?=E5=A2=9E=E5=8A=A0license?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100755 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000000..9cecc1d466 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From b189fa26abd588ea153e84f770cfff11cf686d26 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 25 Jul 2017 13:55:20 +0800 Subject: [PATCH 30/92] =?UTF-8?q?=E5=A2=9E=E5=8A=A0license?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100755 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000000..9cecc1d466 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From bcd4a7dedceedb50692adcb4ccfe6d0104e49f9f Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 25 Jul 2017 13:56:57 +0800 Subject: [PATCH 31/92] =?UTF-8?q?=E5=A2=9E=E5=8A=A0license?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100755 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000000..9cecc1d466 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From ed461daa1646e72771974d8dffd5d22bb2faae57 Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 26 Jul 2017 10:45:26 +0800 Subject: [PATCH 32/92] =?UTF-8?q?BI-6684=20License=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E7=B1=BB=E5=8A=A0=E5=AF=86=E5=81=9A=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/SwitchExistEnv.java | 16 +++++++++++++++- .../mainframe/loghandler/DesignerLogImpl.java | 6 ++++++ .../roleAuthority/ReportAndFSManagePane.java | 2 +- designer_base/src/com/fr/env/RemoteEnv.java | 15 ++++++++++++++- .../src/com/fr/design/chart/ChartTypePane.java | 17 ++++++++++++++++- 5 files changed, 52 insertions(+), 4 deletions(-) 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..da723c8ed0 100644 --- a/designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java @@ -26,9 +26,11 @@ import com.fr.stable.LicUtils; import com.fr.stable.ProductConstants; import com.fr.stable.EnvChangedListener; import com.fr.stable.StringUtils; +import com.fr.stable.help.FineClassLoader; import javax.swing.*; import java.awt.event.ActionEvent; +import java.lang.reflect.Method; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -118,7 +120,7 @@ public class SwitchExistEnv extends MenuDef { return; } SignIn.signIn(selectedEnv); - LicUtils.resetBytes(); + resetLicenseBytes(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); fireDSChanged(); } catch (Exception em) { @@ -127,5 +129,17 @@ public class SwitchExistEnv extends MenuDef { TemplatePane.getInstance().editItems(); } } + + private void resetLicenseBytes() { + FineClassLoader classLoader = new FineClassLoader(); + try { + Class clazz = classLoader.loadClass("com.fr.base.FRCoreContext"); + Method retryMethod = clazz.getMethod("retryLicLock"); + retryMethod.invoke(clazz); + } catch (Exception ignore) { + + } + } } + } \ No newline at end of file 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/roleAuthority/ReportAndFSManagePane.java b/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java index 9b1069056f..f6a78eab47 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.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 com.fr.stable.help.FineClassLoader; 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.lang.reflect.Method; 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() { FineClassLoader classLoader = new FineClassLoader(); byte[] bytes = null; try { Class clazz = classLoader.loadClass("com.fr.base.FRCoreContext"); Method method = clazz.getMethod("getBytes"); bytes = (byte[]) method.invoke(clazz); } catch (Exception ignore) { } 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..363b55c6cd 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -34,6 +34,7 @@ import com.fr.plugin.PluginLoader; import com.fr.share.ShareConstants; import com.fr.stable.*; import com.fr.stable.file.XMLFileManagerProvider; +import com.fr.stable.help.FineClassLoader; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLTools; @@ -46,6 +47,7 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.awt.*; import java.io.*; +import java.lang.reflect.Method; import java.net.HttpURLConnection; import java.net.NoRouteToHostException; import java.net.Socket; @@ -1387,13 +1389,24 @@ 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() { + FineClassLoader classLoader = new FineClassLoader(); + try { + Class clazz = classLoader.loadClass("com.fr.base.FRCoreContext"); + Method retryMethod = clazz.getMethod("retryLicLock"); + retryMethod.invoke(clazz); + } catch (Exception ignore) { + + } + } + /** * 停止连接 */ diff --git a/designer_chart/src/com/fr/design/chart/ChartTypePane.java b/designer_chart/src/com/fr/design/chart/ChartTypePane.java index 5cc09a3b4e..9f1da397e9 100644 --- a/designer_chart/src/com/fr/design/chart/ChartTypePane.java +++ b/designer_chart/src/com/fr/design/chart/ChartTypePane.java @@ -15,11 +15,13 @@ import com.fr.general.Inter; import com.fr.general.RegistEditionException; import com.fr.general.VT4FR; import com.fr.stable.StableUtils; +import com.fr.stable.help.FineClassLoader; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; +import java.lang.reflect.Method; public class ChartTypePane extends ChartCommonWizardPane { private static final long serialVersionUID = -1175602484968520546L; @@ -150,7 +152,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 +167,19 @@ public class ChartTypePane extends ChartCommonWizardPane { } } + private boolean supportMap() { + FineClassLoader classLoader = new FineClassLoader(); + byte[] bytes = null; + try { + Class clazz = classLoader.loadClass("com.fr.base.FRCoreContext"); + Method method = clazz.getMethod("getBytes"); + bytes = (byte[]) method.invoke(clazz); + } catch (Exception ignore) { + + } + return VT4FR.isLicAvailable(bytes) && VT4FR.CHART_MAP.support(); + } + public void update(ChartCollection cc) { if (cc == null) { return; From 869e5c633e10cb66f7fc2497a0d5d86fa7d077ec Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Wed, 26 Jul 2017 17:15:26 +0800 Subject: [PATCH 33/92] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E7=9A=84=E6=97=B6=E5=80=99=E5=9C=A8=E5=86=99?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E6=97=B6=E5=80=99=E6=9B=B4=E6=96=B0?= =?UTF-8?q?mapAttr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chart/report/MapCubeLayerPane.java | 4 +- .../chart/report/MapCubeSetDataPane.java | 2 +- .../PlotSeries/AbstrctMapAttrEditPane.java | 2 +- .../series/PlotSeries/MapCustomPane.java | 2 +- .../PlotSeries/MapDefiAreaNamePane.java | 4 +- .../PlotSeries/MapGroupExtensionPane.java | 2 +- .../series/PlotSeries/MapImageEditPane.java | 49 +++++++------------ .../PlotSeries/UIGroupExtensionPane.java | 2 +- .../com/fr/design/mainframe/MapEditPane.java | 4 +- 9 files changed, 30 insertions(+), 41 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java b/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java index 461fe220a0..5d54f78530 100644 --- a/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java +++ b/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java @@ -1,10 +1,10 @@ package com.fr.design.chart.report; +import com.fr.base.MapSvgAttr; +import com.fr.base.MapSvgXMLHelper; import com.fr.base.MapXMLHelper; import com.fr.base.Utils; import com.fr.chart.base.ChartConstants; -import com.fr.chart.base.MapSvgAttr; -import com.fr.chart.base.MapSvgXMLHelper; import com.fr.chart.chartglyph.MapAttr; import com.fr.design.DesignerEnvManager; import com.fr.design.beans.BasicBeanPane; diff --git a/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java b/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java index 4c175500eb..3110e241b5 100644 --- a/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java +++ b/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java @@ -1,7 +1,7 @@ package com.fr.design.chart.report; +import com.fr.base.MapSvgXMLHelper; import com.fr.base.MapXMLHelper; -import com.fr.chart.base.MapSvgXMLHelper; import com.fr.design.beans.BasicBeanPane; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java index d2d61909bd..254dfaec1a 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java @@ -1,6 +1,6 @@ package com.fr.design.chart.series.PlotSeries; -import com.fr.chart.base.MapSvgAttr; +import com.fr.base.MapSvgAttr; /** * Created by IntelliJ IDEA. diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index d844631c05..49fa97eee4 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -1,9 +1,9 @@ package com.fr.design.chart.series.PlotSeries; import com.fr.base.FRContext; +import com.fr.base.MapSvgAttr; import com.fr.base.TableData; import com.fr.base.Utils; -import com.fr.chart.base.MapSvgAttr; import com.fr.data.impl.EmbeddedTableData; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DesignTableDataManager; diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java index ca8d3a67dd..0a3928ae45 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java @@ -1,8 +1,8 @@ package com.fr.design.chart.series.PlotSeries; +import com.fr.base.MapSvgAttr; +import com.fr.base.MapSvgXMLHelper; import com.fr.base.Utils; -import com.fr.chart.base.MapSvgAttr; -import com.fr.chart.base.MapSvgXMLHelper; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.editor.ValueEditorPane; 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..74a8e687f5 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 @@ -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.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/PlotSeries/MapImageEditPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java index 6f9c15c55f..4aff10c379 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java @@ -1,34 +1,13 @@ package com.fr.design.chart.series.PlotSeries; -import java.awt.AlphaComposite; -import java.awt.BasicStroke; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.awt.geom.GeneralPath; -import java.util.*; - -import javax.swing.BoxLayout; -import javax.swing.DefaultListModel; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; - -import com.fr.base.*; -import com.fr.chart.base.MapSvgAttr; -import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.base.BaseUtils; +import com.fr.base.MapSvgAttr; +import com.fr.base.MapSvgXMLHelper; +import com.fr.base.Utils; import com.fr.chart.chartglyph.MapShapeValue; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.UIDialog; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.gui.icontainer.UIScrollPane; @@ -37,13 +16,23 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itable.UISelectTable; import com.fr.design.gui.itable.UITableNoOptionUI; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.dialog.UIDialog; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.CoreGraphHelper; import com.fr.stable.StringUtils; -import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.geom.GeneralPath; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; /** * 地图 图片编辑界面 选中图片 编辑. 支持鼠标选中等事件 diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java index 2ad670341c..1e26f37b01 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java @@ -1 +1 @@ -package com.fr.design.chart.series.PlotSeries; import com.fr.chart.base.MapSvgXMLHelper; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.gui.frpane.UIExtensionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UISearchTextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import javax.swing.*; import javax.swing.border.Border; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import java.util.List; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 12-12-29 * Time: 上午11:14 * 可收缩的面板,只有两层 */ public class UIGroupExtensionPane extends BasicPane { public static final String EDIT = "edit"; public static final String DELETE = "delete"; private static final int BUTTONWIDTH = 16; private static final int DIALOG_WIDTH = 140; private static final int DIALOG_HEIGHT = 100; private UISearchTextField searchTextFiled; private JList[] contentViews; private Component[][] components; private String[] titles; private java.util.List selectionListeners = new ArrayList(); private java.util.List editListeners = new ArrayList(); private List deleteListeners = new ArrayList(); private boolean isPressOnDelete = false; // 是否点击在删除按钮上 @Override protected String title4PopupWindow() { return "group"; } public UIGroupExtensionPane(String[] titles) { this.titles = titles; if (ArrayUtils.isEmpty(titles)) { return; } initComponents(titles); } private void initComponents(String[] titles) { setBackground(null); searchTextFiled = initSearchTextField(); int count = titles.length; contentViews = new JList[count]; components = new Component[count + 1][]; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] rowSize = new double[count + 1]; double[] columnSize = {f}; for (int i = 0; i < count + 1; i++) { rowSize[i] = p; if (i == 0) { components[i] = new Component[]{searchTextFiled}; } else if (i > 0 && i < count + 1) { JList li = new JList(new DefaultListModel()); li.addListSelectionListener(listSelectionListener); li.addMouseListener(mouseListener); li.setCellRenderer(listCellRenderer); li.setBackground(null); contentViews[i - 1] = li; components[i] = new UIExtensionPane[]{new UIExtensionPane(titles[i - 1], li, false)}; } } JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); setLayout(new BorderLayout()); add(new UIScrollPane(centerPane), BorderLayout.CENTER); } private UISearchTextField initSearchTextField() { UISearchTextField searchTextFiled = new UISearchTextField() { public Dimension getPreferredSize() { return new Dimension(120, 22); } }; searchTextFiled.setIconPosition(SwingConstants.RIGHT); searchTextFiled.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { doFilter(); } @Override public void removeUpdate(DocumentEvent e) { doFilter(); } @Override public void changedUpdate(DocumentEvent e) { doFilter(); } }); return searchTextFiled; } /** * 返回index列表的数据 */ public Object[] getData(int index) { if (index < 0 || index > contentViews.length) { return ArrayUtils.EMPTY_OBJECT_ARRAY; } ListModel model = contentViews[index].getModel(); Object[] items = new Object[model.getSize()]; for (int i = 0, len = model.getSize(); i < len; i++) { items[i] = model.getElementAt(i); } return items; } /** * 返回对应Title的列表数组 */ public Object[] getData(String title) { int dataIndex = ArrayUtils.indexOf(titles, title); if (dataIndex != ArrayUtils.INDEX_NOT_FOUND) { return getData(dataIndex); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } private void doFilter() { for (JList list : contentViews) { ListDataListener[] ls = ((DefaultListModel) list.getModel()).getListDataListeners(); for (ListDataListener l : ls) { l.contentsChanged(new ListDataEvent(l, ListDataEvent.CONTENTS_CHANGED, 0, list.getModel().getSize())); } } for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(true); } } /** * 获取选中的值 * * @return 选中的值 */ public Object getSelectedObject() { for (JList list : contentViews) { if (list.getSelectedValue() != null) { return list.getSelectedValue(); } } return null; } /** * 返回选中的类别 * @return 类别 */ public String getSelectedType(){ for (int i = 0, len = contentViews.length; i < len; i++) { if(contentViews[i].getSelectedValue() != null){ return titles[i]; } } return ""; } /** * 设置选中的数据 */ public void setSelectedObject(Object value) { for (int i = 0, len = contentViews.length; i < len; i++) { UIExtensionPane extensionPane = (UIExtensionPane) components[i + 1][0]; JList list = contentViews[i]; DefaultListModel model = (DefaultListModel) list.getModel(); extensionPane.setExpand(model.contains(value)); if (model.contains(value)) { list.setSelectedValue(value, true); } } } /** * 设置数据选中的序号. */ public void setValueAtCurrentSelectIndex(Object value) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1) { ((DefaultListModel) list.getModel()).setElementAt(value, list.getSelectedIndex()); } } } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 */ public void addData(Object data, int index) { addData(data, index, false); } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, int index, boolean checkRepeat) { if (contentViews == null || index < 0 || index > contentViews.length - 1) { return; } JList list = contentViews[index]; DefaultListModel model = (DefaultListModel) list.getModel(); if (data instanceof String) { model.addElement(createUnrepeatedName(model, (String) data, checkRepeat)); } if (checkRepeat) { // 将添加类型以外的其他类型都收起来 for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(false); } ((UIExtensionPane) components[index + 1][0]).setExpand(true); int selectedIndex = list.getModel().getSize() - 1; list.setSelectedIndex(selectedIndex); dealNewAddedDataIndex(((DefaultListModel) list.getModel()).elementAt(selectedIndex)); } } /** * 新添加的数据的序号 * @param data 数据 */ protected void dealNewAddedDataIndex(Object data){ } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 */ public void addData(Object data, String title) { addData(data, title, false); } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, String title, boolean checkRepeat) { int addIndex = ArrayUtils.indexOf(titles, title); if (addIndex != ArrayUtils.INDEX_NOT_FOUND) { addData(data, addIndex, checkRepeat); } } /** * 清除所有的数据 */ public void clearData() { for (JList list : contentViews) { ((DefaultListModel) list.getModel()).clear(); } } private String createUnrepeatedName(DefaultListModel model, String name, boolean checkRepeat) { if (!checkRepeat) { return name; } int count = model.getSize(); int extra = 1; String newName = name + (count + extra); boolean hasRepeated = false; do { hasRepeated = false; newName = name + (count + extra); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(model.getElementAt(i), newName)) { hasRepeated = true; extra++; } } } while (hasRepeated); return name + (count + extra); } /** * 判断该控件是否应该有编辑操作 * * @param list 列表组件 * @return 如果有编辑操作则需要显示相应的图标 */ private boolean hasEditOperation(JList list) { return true; } private DefaultListCellRenderer listCellRenderer = new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JComponent c = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (!hasEditOperation(list)) { return c; } Border border = null; c.setBorder(border); UILabel editLabel = new UILabel(UIConstants.EDIT_ICON); UILabel deleteLabel = new UILabel(UIConstants.DELETE_ICON); JPanel editPane = GUICoreUtils.createFlowPane(new Component[]{editLabel, deleteLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE); editPane.setBackground(isSelected ? c.getBackground() : null); editPane.setBorder(border); JPanel renderPane = GUICoreUtils.createBorderLayoutPane(c, BorderLayout.CENTER, editPane, BorderLayout.EAST); if (shouldFilter(value)) { renderPane.setPreferredSize(new Dimension(0, 0)); } return renderPane; } }; //事件发生的顺序是ListSelection、MousePressed、ListSelection、MouseReleased private ListSelectionListener listSelectionListener = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { //在鼠标按下的时候的值改变事件,重置属性 if(e.getValueIsAdjusting()){ isPressOnDelete = false; } if(!isRespondToValueChange(e)){ return; } fireSelectionChangeListener(new ChangeEvent(e.getSource())); if (((JList) e.getSource()).getSelectedIndex() == -1) { return; } for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, e.getSource())) { try { list.setSelectedIndices(null); } catch (Exception ee) { } } } } }; /** * 是否响应list值改变 * @return 响应 */ protected boolean isRespondToValueChange(ListSelectionEvent e){ return true; } private boolean shouldFilter(Object value) { return !GeneralUtils.objectToString(value).toLowerCase().contains(searchTextFiled.getText().toLowerCase()); } private MouseListener mouseListener = new MouseAdapter() { /** * {@inheritDoc} */ @Override public void mousePressed(final MouseEvent e) { isPressOnDelete = false; final JList list = (JList) e.getSource(); Point point = e.getPoint(); final int index = list.locationToIndex(point); int width = list.getWidth(); if (hasEditOperation(list)) { // 删除按钮 if (point.x > width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { BasicPane bp = new BasicPane() { protected String title4PopupWindow() { return ""; } }; isPressOnDelete = true; bp.setLayout(new BorderLayout()); bp.add(new BoldFontTextLabel(Inter.getLocText(new String[]{"Delete", "Chart-Map"}) + "?", SwingConstants.CENTER)); clearLastListSelection(list); final String selectedType = UIGroupExtensionPane.this.getSelectedType(); UIDialog dialog = bp.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { public void doOk() { Object name = getSelectedObject(); ((DefaultListModel) list.getModel()).removeElementAt(index); MapSvgXMLHelper.getInstance().removeMapAttr(GeneralUtils.objectToString(name)); MapSvgXMLHelper.getInstance().removeCateNames(selectedType,GeneralUtils.objectToString(name)); fireDeleteListener(new ChangeEvent(e)); } }); dialog.setResizable(true); dialog.setSize(DIALOG_WIDTH, DIALOG_HEIGHT); dialog.setResizable(false); GUICoreUtils.centerWindow(dialog); dialog.setVisible(true); } // 编辑按钮 else if (point.x > width - (BUTTONWIDTH * 2 + 2 * LayoutConstants.HGAP_LARGE) && point.x < width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { fireItemEditListener(new ChangeEvent(e)); } } } public void mouseReleased(MouseEvent e) { isPressOnDelete = false; } }; /** * 直接跨list点击删除按钮,要置之前list的选中项为空(因为删除操作不触发更新) * @param currentList 当前选中的list */ public void clearLastListSelection (JList currentList) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, currentList)) { try { list.setSelectedIndices(null); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } } } } /** * 是否点击在删除按钮上 * @return 是则返回true */ public boolean isPressOnDelete(){ return isPressOnDelete; } /** * 添加选中变化监听事件 * @param listener 监听 */ public void addSelectionChangeListener(ChangeListener listener) { selectionListeners.add(listener); } private void fireSelectionChangeListener(ChangeEvent e) { for (int i = selectionListeners.size(); i > 0; i--) { selectionListeners.get(i - 1).fireChanged(e); } } /** * 添加Item的监听事件 * @param listener 监听器 */ public void addItemEditListener(ChangeListener listener) { editListeners.add(listener); } private void fireItemEditListener(ChangeEvent e) { for (int i = editListeners.size(); i > 0; i--) { editListeners.get(i - 1).fireChanged(e); } } /** * 添加删除事件的监听事件 * @param listener 监听 */ public void addDeleteListener(ChangeListener listener) { deleteListeners.add(listener); } private void fireDeleteListener(ChangeEvent e) { for(int i = deleteListeners.size(); i > 0; i--) { deleteListeners.get(i - 1).fireChanged(e); } } public void setEnabled(boolean isEnabled){ super.setEnabled(isEnabled); if(searchTextFiled != null){ searchTextFiled.setEnabled(isEnabled); } if(this.components != null){ for(int i = 0; i < this.components.length; i++){ Component[] comp = this.components[i]; for(int j = 0; j < comp.length; j++){ comp[j].setEnabled(isEnabled); } } } } /** * 测试程序 * @param args 参数 */ public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = f.getContentPane(); c.setBackground(Color.WHITE); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); final UIGroupExtensionPane g = new UIGroupExtensionPane(new String[]{"title1", "title2", "title3"}); c.add(g, BorderLayout.CENTER); JPanel pp = new JPanel(new FlowLayout()); c.add(pp, BorderLayout.SOUTH); UIButton test = new UIButton("add1"); test.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test111", 0); } }); pp.add(test); UIButton test2 = new UIButton("add2"); test2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test222", 1); } }); pp.add(test2); f.setSize(360, 500); f.setLocation(200, 100); f.setVisible(true); } } \ No newline at end of file +package com.fr.design.chart.series.PlotSeries; import com.fr.base.MapSvgXMLHelper; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.gui.frpane.UIExtensionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UISearchTextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import javax.swing.*; import javax.swing.border.Border; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import java.util.List; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 12-12-29 * Time: 上午11:14 * 可收缩的面板,只有两层 */ public class UIGroupExtensionPane extends BasicPane { public static final String EDIT = "edit"; public static final String DELETE = "delete"; private static final int BUTTONWIDTH = 16; private static final int DIALOG_WIDTH = 140; private static final int DIALOG_HEIGHT = 100; private UISearchTextField searchTextFiled; private JList[] contentViews; private Component[][] components; private String[] titles; private java.util.List selectionListeners = new ArrayList(); private java.util.List editListeners = new ArrayList(); private List deleteListeners = new ArrayList(); private boolean isPressOnDelete = false; // 是否点击在删除按钮上 @Override protected String title4PopupWindow() { return "group"; } public UIGroupExtensionPane(String[] titles) { this.titles = titles; if (ArrayUtils.isEmpty(titles)) { return; } initComponents(titles); } private void initComponents(String[] titles) { setBackground(null); searchTextFiled = initSearchTextField(); int count = titles.length; contentViews = new JList[count]; components = new Component[count + 1][]; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] rowSize = new double[count + 1]; double[] columnSize = {f}; for (int i = 0; i < count + 1; i++) { rowSize[i] = p; if (i == 0) { components[i] = new Component[]{searchTextFiled}; } else if (i > 0 && i < count + 1) { JList li = new JList(new DefaultListModel()); li.addListSelectionListener(listSelectionListener); li.addMouseListener(mouseListener); li.setCellRenderer(listCellRenderer); li.setBackground(null); contentViews[i - 1] = li; components[i] = new UIExtensionPane[]{new UIExtensionPane(titles[i - 1], li, false)}; } } JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); setLayout(new BorderLayout()); add(new UIScrollPane(centerPane), BorderLayout.CENTER); } private UISearchTextField initSearchTextField() { UISearchTextField searchTextFiled = new UISearchTextField() { public Dimension getPreferredSize() { return new Dimension(120, 22); } }; searchTextFiled.setIconPosition(SwingConstants.RIGHT); searchTextFiled.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { doFilter(); } @Override public void removeUpdate(DocumentEvent e) { doFilter(); } @Override public void changedUpdate(DocumentEvent e) { doFilter(); } }); return searchTextFiled; } /** * 返回index列表的数据 */ public Object[] getData(int index) { if (index < 0 || index > contentViews.length) { return ArrayUtils.EMPTY_OBJECT_ARRAY; } ListModel model = contentViews[index].getModel(); Object[] items = new Object[model.getSize()]; for (int i = 0, len = model.getSize(); i < len; i++) { items[i] = model.getElementAt(i); } return items; } /** * 返回对应Title的列表数组 */ public Object[] getData(String title) { int dataIndex = ArrayUtils.indexOf(titles, title); if (dataIndex != ArrayUtils.INDEX_NOT_FOUND) { return getData(dataIndex); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } private void doFilter() { for (JList list : contentViews) { ListDataListener[] ls = ((DefaultListModel) list.getModel()).getListDataListeners(); for (ListDataListener l : ls) { l.contentsChanged(new ListDataEvent(l, ListDataEvent.CONTENTS_CHANGED, 0, list.getModel().getSize())); } } for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(true); } } /** * 获取选中的值 * * @return 选中的值 */ public Object getSelectedObject() { for (JList list : contentViews) { if (list.getSelectedValue() != null) { return list.getSelectedValue(); } } return null; } /** * 返回选中的类别 * @return 类别 */ public String getSelectedType(){ for (int i = 0, len = contentViews.length; i < len; i++) { if(contentViews[i].getSelectedValue() != null){ return titles[i]; } } return ""; } /** * 设置选中的数据 */ public void setSelectedObject(Object value) { for (int i = 0, len = contentViews.length; i < len; i++) { UIExtensionPane extensionPane = (UIExtensionPane) components[i + 1][0]; JList list = contentViews[i]; DefaultListModel model = (DefaultListModel) list.getModel(); extensionPane.setExpand(model.contains(value)); if (model.contains(value)) { list.setSelectedValue(value, true); } } } /** * 设置数据选中的序号. */ public void setValueAtCurrentSelectIndex(Object value) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1) { ((DefaultListModel) list.getModel()).setElementAt(value, list.getSelectedIndex()); } } } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 */ public void addData(Object data, int index) { addData(data, index, false); } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, int index, boolean checkRepeat) { if (contentViews == null || index < 0 || index > contentViews.length - 1) { return; } JList list = contentViews[index]; DefaultListModel model = (DefaultListModel) list.getModel(); if (data instanceof String) { model.addElement(createUnrepeatedName(model, (String) data, checkRepeat)); } if (checkRepeat) { // 将添加类型以外的其他类型都收起来 for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(false); } ((UIExtensionPane) components[index + 1][0]).setExpand(true); int selectedIndex = list.getModel().getSize() - 1; list.setSelectedIndex(selectedIndex); dealNewAddedDataIndex(((DefaultListModel) list.getModel()).elementAt(selectedIndex)); } } /** * 新添加的数据的序号 * @param data 数据 */ protected void dealNewAddedDataIndex(Object data){ } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 */ public void addData(Object data, String title) { addData(data, title, false); } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, String title, boolean checkRepeat) { int addIndex = ArrayUtils.indexOf(titles, title); if (addIndex != ArrayUtils.INDEX_NOT_FOUND) { addData(data, addIndex, checkRepeat); } } /** * 清除所有的数据 */ public void clearData() { for (JList list : contentViews) { ((DefaultListModel) list.getModel()).clear(); } } private String createUnrepeatedName(DefaultListModel model, String name, boolean checkRepeat) { if (!checkRepeat) { return name; } int count = model.getSize(); int extra = 1; String newName = name + (count + extra); boolean hasRepeated = false; do { hasRepeated = false; newName = name + (count + extra); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(model.getElementAt(i), newName)) { hasRepeated = true; extra++; } } } while (hasRepeated); return name + (count + extra); } /** * 判断该控件是否应该有编辑操作 * * @param list 列表组件 * @return 如果有编辑操作则需要显示相应的图标 */ private boolean hasEditOperation(JList list) { return true; } private DefaultListCellRenderer listCellRenderer = new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JComponent c = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (!hasEditOperation(list)) { return c; } Border border = null; c.setBorder(border); UILabel editLabel = new UILabel(UIConstants.EDIT_ICON); UILabel deleteLabel = new UILabel(UIConstants.DELETE_ICON); JPanel editPane = GUICoreUtils.createFlowPane(new Component[]{editLabel, deleteLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE); editPane.setBackground(isSelected ? c.getBackground() : null); editPane.setBorder(border); JPanel renderPane = GUICoreUtils.createBorderLayoutPane(c, BorderLayout.CENTER, editPane, BorderLayout.EAST); if (shouldFilter(value)) { renderPane.setPreferredSize(new Dimension(0, 0)); } return renderPane; } }; //事件发生的顺序是ListSelection、MousePressed、ListSelection、MouseReleased private ListSelectionListener listSelectionListener = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { //在鼠标按下的时候的值改变事件,重置属性 if(e.getValueIsAdjusting()){ isPressOnDelete = false; } if(!isRespondToValueChange(e)){ return; } fireSelectionChangeListener(new ChangeEvent(e.getSource())); if (((JList) e.getSource()).getSelectedIndex() == -1) { return; } for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, e.getSource())) { try { list.setSelectedIndices(null); } catch (Exception ee) { } } } } }; /** * 是否响应list值改变 * @return 响应 */ protected boolean isRespondToValueChange(ListSelectionEvent e){ return true; } private boolean shouldFilter(Object value) { return !GeneralUtils.objectToString(value).toLowerCase().contains(searchTextFiled.getText().toLowerCase()); } private MouseListener mouseListener = new MouseAdapter() { /** * {@inheritDoc} */ @Override public void mousePressed(final MouseEvent e) { isPressOnDelete = false; final JList list = (JList) e.getSource(); Point point = e.getPoint(); final int index = list.locationToIndex(point); int width = list.getWidth(); if (hasEditOperation(list)) { // 删除按钮 if (point.x > width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { BasicPane bp = new BasicPane() { protected String title4PopupWindow() { return ""; } }; isPressOnDelete = true; bp.setLayout(new BorderLayout()); bp.add(new BoldFontTextLabel(Inter.getLocText(new String[]{"Delete", "Chart-Map"}) + "?", SwingConstants.CENTER)); clearLastListSelection(list); final String selectedType = UIGroupExtensionPane.this.getSelectedType(); UIDialog dialog = bp.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { public void doOk() { Object name = getSelectedObject(); ((DefaultListModel) list.getModel()).removeElementAt(index); MapSvgXMLHelper.getInstance().removeMapAttr(GeneralUtils.objectToString(name)); MapSvgXMLHelper.getInstance().removeCateNames(selectedType,GeneralUtils.objectToString(name)); fireDeleteListener(new ChangeEvent(e)); } }); dialog.setResizable(true); dialog.setSize(DIALOG_WIDTH, DIALOG_HEIGHT); dialog.setResizable(false); GUICoreUtils.centerWindow(dialog); dialog.setVisible(true); } // 编辑按钮 else if (point.x > width - (BUTTONWIDTH * 2 + 2 * LayoutConstants.HGAP_LARGE) && point.x < width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { fireItemEditListener(new ChangeEvent(e)); } } } public void mouseReleased(MouseEvent e) { isPressOnDelete = false; } }; /** * 直接跨list点击删除按钮,要置之前list的选中项为空(因为删除操作不触发更新) * @param currentList 当前选中的list */ public void clearLastListSelection (JList currentList) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, currentList)) { try { list.setSelectedIndices(null); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } } } } /** * 是否点击在删除按钮上 * @return 是则返回true */ public boolean isPressOnDelete(){ return isPressOnDelete; } /** * 添加选中变化监听事件 * @param listener 监听 */ public void addSelectionChangeListener(ChangeListener listener) { selectionListeners.add(listener); } private void fireSelectionChangeListener(ChangeEvent e) { for (int i = selectionListeners.size(); i > 0; i--) { selectionListeners.get(i - 1).fireChanged(e); } } /** * 添加Item的监听事件 * @param listener 监听器 */ public void addItemEditListener(ChangeListener listener) { editListeners.add(listener); } private void fireItemEditListener(ChangeEvent e) { for (int i = editListeners.size(); i > 0; i--) { editListeners.get(i - 1).fireChanged(e); } } /** * 添加删除事件的监听事件 * @param listener 监听 */ public void addDeleteListener(ChangeListener listener) { deleteListeners.add(listener); } private void fireDeleteListener(ChangeEvent e) { for(int i = deleteListeners.size(); i > 0; i--) { deleteListeners.get(i - 1).fireChanged(e); } } public void setEnabled(boolean isEnabled){ super.setEnabled(isEnabled); if(searchTextFiled != null){ searchTextFiled.setEnabled(isEnabled); } if(this.components != null){ for(int i = 0; i < this.components.length; i++){ Component[] comp = this.components[i]; for(int j = 0; j < comp.length; j++){ comp[j].setEnabled(isEnabled); } } } } /** * 测试程序 * @param args 参数 */ public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = f.getContentPane(); c.setBackground(Color.WHITE); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); final UIGroupExtensionPane g = new UIGroupExtensionPane(new String[]{"title1", "title2", "title3"}); c.add(g, BorderLayout.CENTER); JPanel pp = new JPanel(new FlowLayout()); c.add(pp, BorderLayout.SOUTH); UIButton test = new UIButton("add1"); test.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test111", 0); } }); pp.add(test); UIButton test2 = new UIButton("add2"); test2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test222", 1); } }); pp.add(test2); f.setSize(360, 500); f.setLocation(200, 100); f.setVisible(true); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/MapEditPane.java b/designer_chart/src/com/fr/design/mainframe/MapEditPane.java index 4c137afb7c..2950a4d1fd 100644 --- a/designer_chart/src/com/fr/design/mainframe/MapEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/MapEditPane.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe; -import com.fr.chart.base.MapSvgAttr; -import com.fr.chart.base.MapSvgXMLHelper; +import com.fr.base.MapSvgAttr; +import com.fr.base.MapSvgXMLHelper; import com.fr.chart.chartglyph.MapShapeValue; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.series.PlotSeries.AbstrctMapAttrEditPane; From 7963ee591353d47e4afe85551ad8d4b912870382 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Thu, 27 Jul 2017 10:50:21 +0800 Subject: [PATCH 34/92] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/chart/report/MapCubeLayerPane.java | 4 ++-- .../src/com/fr/design/chart/report/MapCubeSetDataPane.java | 2 +- .../chart/series/PlotSeries/AbstrctMapAttrEditPane.java | 2 +- .../com/fr/design/chart/series/PlotSeries/MapCustomPane.java | 2 +- .../design/chart/series/PlotSeries/MapDefiAreaNamePane.java | 4 ++-- .../design/chart/series/PlotSeries/MapGroupExtensionPane.java | 2 +- .../fr/design/chart/series/PlotSeries/MapImageEditPane.java | 4 ++-- .../design/chart/series/PlotSeries/UIGroupExtensionPane.java | 2 +- designer_chart/src/com/fr/design/mainframe/MapEditPane.java | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java b/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java index 5d54f78530..461fe220a0 100644 --- a/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java +++ b/designer_chart/src/com/fr/design/chart/report/MapCubeLayerPane.java @@ -1,10 +1,10 @@ package com.fr.design.chart.report; -import com.fr.base.MapSvgAttr; -import com.fr.base.MapSvgXMLHelper; import com.fr.base.MapXMLHelper; import com.fr.base.Utils; import com.fr.chart.base.ChartConstants; +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; import com.fr.chart.chartglyph.MapAttr; import com.fr.design.DesignerEnvManager; import com.fr.design.beans.BasicBeanPane; diff --git a/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java b/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java index 3110e241b5..4c175500eb 100644 --- a/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java +++ b/designer_chart/src/com/fr/design/chart/report/MapCubeSetDataPane.java @@ -1,7 +1,7 @@ package com.fr.design.chart.report; -import com.fr.base.MapSvgXMLHelper; import com.fr.base.MapXMLHelper; +import com.fr.chart.base.MapSvgXMLHelper; import com.fr.design.beans.BasicBeanPane; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java index 254dfaec1a..d2d61909bd 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/AbstrctMapAttrEditPane.java @@ -1,6 +1,6 @@ package com.fr.design.chart.series.PlotSeries; -import com.fr.base.MapSvgAttr; +import com.fr.chart.base.MapSvgAttr; /** * Created by IntelliJ IDEA. diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index 49fa97eee4..d844631c05 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -1,9 +1,9 @@ package com.fr.design.chart.series.PlotSeries; import com.fr.base.FRContext; -import com.fr.base.MapSvgAttr; import com.fr.base.TableData; import com.fr.base.Utils; +import com.fr.chart.base.MapSvgAttr; import com.fr.data.impl.EmbeddedTableData; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DesignTableDataManager; diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java index 0a3928ae45..ca8d3a67dd 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapDefiAreaNamePane.java @@ -1,8 +1,8 @@ package com.fr.design.chart.series.PlotSeries; -import com.fr.base.MapSvgAttr; -import com.fr.base.MapSvgXMLHelper; import com.fr.base.Utils; +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.editor.ValueEditorPane; 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 74a8e687f5..36b0ec8477 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 @@ -package com.fr.design.chart.series.PlotSeries; import com.fr.base.*; 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 +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/PlotSeries/MapImageEditPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java index 4aff10c379..55a3e079ee 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/MapImageEditPane.java @@ -1,9 +1,9 @@ package com.fr.design.chart.series.PlotSeries; import com.fr.base.BaseUtils; -import com.fr.base.MapSvgAttr; -import com.fr.base.MapSvgXMLHelper; import com.fr.base.Utils; +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; import com.fr.chart.chartglyph.MapShapeValue; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; diff --git a/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java b/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java index 1e26f37b01..2ad670341c 100644 --- a/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java +++ b/designer_chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java @@ -1 +1 @@ -package com.fr.design.chart.series.PlotSeries; import com.fr.base.MapSvgXMLHelper; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.gui.frpane.UIExtensionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UISearchTextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import javax.swing.*; import javax.swing.border.Border; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import java.util.List; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 12-12-29 * Time: 上午11:14 * 可收缩的面板,只有两层 */ public class UIGroupExtensionPane extends BasicPane { public static final String EDIT = "edit"; public static final String DELETE = "delete"; private static final int BUTTONWIDTH = 16; private static final int DIALOG_WIDTH = 140; private static final int DIALOG_HEIGHT = 100; private UISearchTextField searchTextFiled; private JList[] contentViews; private Component[][] components; private String[] titles; private java.util.List selectionListeners = new ArrayList(); private java.util.List editListeners = new ArrayList(); private List deleteListeners = new ArrayList(); private boolean isPressOnDelete = false; // 是否点击在删除按钮上 @Override protected String title4PopupWindow() { return "group"; } public UIGroupExtensionPane(String[] titles) { this.titles = titles; if (ArrayUtils.isEmpty(titles)) { return; } initComponents(titles); } private void initComponents(String[] titles) { setBackground(null); searchTextFiled = initSearchTextField(); int count = titles.length; contentViews = new JList[count]; components = new Component[count + 1][]; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] rowSize = new double[count + 1]; double[] columnSize = {f}; for (int i = 0; i < count + 1; i++) { rowSize[i] = p; if (i == 0) { components[i] = new Component[]{searchTextFiled}; } else if (i > 0 && i < count + 1) { JList li = new JList(new DefaultListModel()); li.addListSelectionListener(listSelectionListener); li.addMouseListener(mouseListener); li.setCellRenderer(listCellRenderer); li.setBackground(null); contentViews[i - 1] = li; components[i] = new UIExtensionPane[]{new UIExtensionPane(titles[i - 1], li, false)}; } } JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); setLayout(new BorderLayout()); add(new UIScrollPane(centerPane), BorderLayout.CENTER); } private UISearchTextField initSearchTextField() { UISearchTextField searchTextFiled = new UISearchTextField() { public Dimension getPreferredSize() { return new Dimension(120, 22); } }; searchTextFiled.setIconPosition(SwingConstants.RIGHT); searchTextFiled.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { doFilter(); } @Override public void removeUpdate(DocumentEvent e) { doFilter(); } @Override public void changedUpdate(DocumentEvent e) { doFilter(); } }); return searchTextFiled; } /** * 返回index列表的数据 */ public Object[] getData(int index) { if (index < 0 || index > contentViews.length) { return ArrayUtils.EMPTY_OBJECT_ARRAY; } ListModel model = contentViews[index].getModel(); Object[] items = new Object[model.getSize()]; for (int i = 0, len = model.getSize(); i < len; i++) { items[i] = model.getElementAt(i); } return items; } /** * 返回对应Title的列表数组 */ public Object[] getData(String title) { int dataIndex = ArrayUtils.indexOf(titles, title); if (dataIndex != ArrayUtils.INDEX_NOT_FOUND) { return getData(dataIndex); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } private void doFilter() { for (JList list : contentViews) { ListDataListener[] ls = ((DefaultListModel) list.getModel()).getListDataListeners(); for (ListDataListener l : ls) { l.contentsChanged(new ListDataEvent(l, ListDataEvent.CONTENTS_CHANGED, 0, list.getModel().getSize())); } } for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(true); } } /** * 获取选中的值 * * @return 选中的值 */ public Object getSelectedObject() { for (JList list : contentViews) { if (list.getSelectedValue() != null) { return list.getSelectedValue(); } } return null; } /** * 返回选中的类别 * @return 类别 */ public String getSelectedType(){ for (int i = 0, len = contentViews.length; i < len; i++) { if(contentViews[i].getSelectedValue() != null){ return titles[i]; } } return ""; } /** * 设置选中的数据 */ public void setSelectedObject(Object value) { for (int i = 0, len = contentViews.length; i < len; i++) { UIExtensionPane extensionPane = (UIExtensionPane) components[i + 1][0]; JList list = contentViews[i]; DefaultListModel model = (DefaultListModel) list.getModel(); extensionPane.setExpand(model.contains(value)); if (model.contains(value)) { list.setSelectedValue(value, true); } } } /** * 设置数据选中的序号. */ public void setValueAtCurrentSelectIndex(Object value) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1) { ((DefaultListModel) list.getModel()).setElementAt(value, list.getSelectedIndex()); } } } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 */ public void addData(Object data, int index) { addData(data, index, false); } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, int index, boolean checkRepeat) { if (contentViews == null || index < 0 || index > contentViews.length - 1) { return; } JList list = contentViews[index]; DefaultListModel model = (DefaultListModel) list.getModel(); if (data instanceof String) { model.addElement(createUnrepeatedName(model, (String) data, checkRepeat)); } if (checkRepeat) { // 将添加类型以外的其他类型都收起来 for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(false); } ((UIExtensionPane) components[index + 1][0]).setExpand(true); int selectedIndex = list.getModel().getSize() - 1; list.setSelectedIndex(selectedIndex); dealNewAddedDataIndex(((DefaultListModel) list.getModel()).elementAt(selectedIndex)); } } /** * 新添加的数据的序号 * @param data 数据 */ protected void dealNewAddedDataIndex(Object data){ } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 */ public void addData(Object data, String title) { addData(data, title, false); } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, String title, boolean checkRepeat) { int addIndex = ArrayUtils.indexOf(titles, title); if (addIndex != ArrayUtils.INDEX_NOT_FOUND) { addData(data, addIndex, checkRepeat); } } /** * 清除所有的数据 */ public void clearData() { for (JList list : contentViews) { ((DefaultListModel) list.getModel()).clear(); } } private String createUnrepeatedName(DefaultListModel model, String name, boolean checkRepeat) { if (!checkRepeat) { return name; } int count = model.getSize(); int extra = 1; String newName = name + (count + extra); boolean hasRepeated = false; do { hasRepeated = false; newName = name + (count + extra); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(model.getElementAt(i), newName)) { hasRepeated = true; extra++; } } } while (hasRepeated); return name + (count + extra); } /** * 判断该控件是否应该有编辑操作 * * @param list 列表组件 * @return 如果有编辑操作则需要显示相应的图标 */ private boolean hasEditOperation(JList list) { return true; } private DefaultListCellRenderer listCellRenderer = new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JComponent c = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (!hasEditOperation(list)) { return c; } Border border = null; c.setBorder(border); UILabel editLabel = new UILabel(UIConstants.EDIT_ICON); UILabel deleteLabel = new UILabel(UIConstants.DELETE_ICON); JPanel editPane = GUICoreUtils.createFlowPane(new Component[]{editLabel, deleteLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE); editPane.setBackground(isSelected ? c.getBackground() : null); editPane.setBorder(border); JPanel renderPane = GUICoreUtils.createBorderLayoutPane(c, BorderLayout.CENTER, editPane, BorderLayout.EAST); if (shouldFilter(value)) { renderPane.setPreferredSize(new Dimension(0, 0)); } return renderPane; } }; //事件发生的顺序是ListSelection、MousePressed、ListSelection、MouseReleased private ListSelectionListener listSelectionListener = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { //在鼠标按下的时候的值改变事件,重置属性 if(e.getValueIsAdjusting()){ isPressOnDelete = false; } if(!isRespondToValueChange(e)){ return; } fireSelectionChangeListener(new ChangeEvent(e.getSource())); if (((JList) e.getSource()).getSelectedIndex() == -1) { return; } for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, e.getSource())) { try { list.setSelectedIndices(null); } catch (Exception ee) { } } } } }; /** * 是否响应list值改变 * @return 响应 */ protected boolean isRespondToValueChange(ListSelectionEvent e){ return true; } private boolean shouldFilter(Object value) { return !GeneralUtils.objectToString(value).toLowerCase().contains(searchTextFiled.getText().toLowerCase()); } private MouseListener mouseListener = new MouseAdapter() { /** * {@inheritDoc} */ @Override public void mousePressed(final MouseEvent e) { isPressOnDelete = false; final JList list = (JList) e.getSource(); Point point = e.getPoint(); final int index = list.locationToIndex(point); int width = list.getWidth(); if (hasEditOperation(list)) { // 删除按钮 if (point.x > width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { BasicPane bp = new BasicPane() { protected String title4PopupWindow() { return ""; } }; isPressOnDelete = true; bp.setLayout(new BorderLayout()); bp.add(new BoldFontTextLabel(Inter.getLocText(new String[]{"Delete", "Chart-Map"}) + "?", SwingConstants.CENTER)); clearLastListSelection(list); final String selectedType = UIGroupExtensionPane.this.getSelectedType(); UIDialog dialog = bp.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { public void doOk() { Object name = getSelectedObject(); ((DefaultListModel) list.getModel()).removeElementAt(index); MapSvgXMLHelper.getInstance().removeMapAttr(GeneralUtils.objectToString(name)); MapSvgXMLHelper.getInstance().removeCateNames(selectedType,GeneralUtils.objectToString(name)); fireDeleteListener(new ChangeEvent(e)); } }); dialog.setResizable(true); dialog.setSize(DIALOG_WIDTH, DIALOG_HEIGHT); dialog.setResizable(false); GUICoreUtils.centerWindow(dialog); dialog.setVisible(true); } // 编辑按钮 else if (point.x > width - (BUTTONWIDTH * 2 + 2 * LayoutConstants.HGAP_LARGE) && point.x < width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { fireItemEditListener(new ChangeEvent(e)); } } } public void mouseReleased(MouseEvent e) { isPressOnDelete = false; } }; /** * 直接跨list点击删除按钮,要置之前list的选中项为空(因为删除操作不触发更新) * @param currentList 当前选中的list */ public void clearLastListSelection (JList currentList) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, currentList)) { try { list.setSelectedIndices(null); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } } } } /** * 是否点击在删除按钮上 * @return 是则返回true */ public boolean isPressOnDelete(){ return isPressOnDelete; } /** * 添加选中变化监听事件 * @param listener 监听 */ public void addSelectionChangeListener(ChangeListener listener) { selectionListeners.add(listener); } private void fireSelectionChangeListener(ChangeEvent e) { for (int i = selectionListeners.size(); i > 0; i--) { selectionListeners.get(i - 1).fireChanged(e); } } /** * 添加Item的监听事件 * @param listener 监听器 */ public void addItemEditListener(ChangeListener listener) { editListeners.add(listener); } private void fireItemEditListener(ChangeEvent e) { for (int i = editListeners.size(); i > 0; i--) { editListeners.get(i - 1).fireChanged(e); } } /** * 添加删除事件的监听事件 * @param listener 监听 */ public void addDeleteListener(ChangeListener listener) { deleteListeners.add(listener); } private void fireDeleteListener(ChangeEvent e) { for(int i = deleteListeners.size(); i > 0; i--) { deleteListeners.get(i - 1).fireChanged(e); } } public void setEnabled(boolean isEnabled){ super.setEnabled(isEnabled); if(searchTextFiled != null){ searchTextFiled.setEnabled(isEnabled); } if(this.components != null){ for(int i = 0; i < this.components.length; i++){ Component[] comp = this.components[i]; for(int j = 0; j < comp.length; j++){ comp[j].setEnabled(isEnabled); } } } } /** * 测试程序 * @param args 参数 */ public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = f.getContentPane(); c.setBackground(Color.WHITE); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); final UIGroupExtensionPane g = new UIGroupExtensionPane(new String[]{"title1", "title2", "title3"}); c.add(g, BorderLayout.CENTER); JPanel pp = new JPanel(new FlowLayout()); c.add(pp, BorderLayout.SOUTH); UIButton test = new UIButton("add1"); test.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test111", 0); } }); pp.add(test); UIButton test2 = new UIButton("add2"); test2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test222", 1); } }); pp.add(test2); f.setSize(360, 500); f.setLocation(200, 100); f.setVisible(true); } } \ No newline at end of file +package com.fr.design.chart.series.PlotSeries; import com.fr.chart.base.MapSvgXMLHelper; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.gui.frpane.UIExtensionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UISearchTextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import javax.swing.*; import javax.swing.border.Border; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import java.util.List; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 12-12-29 * Time: 上午11:14 * 可收缩的面板,只有两层 */ public class UIGroupExtensionPane extends BasicPane { public static final String EDIT = "edit"; public static final String DELETE = "delete"; private static final int BUTTONWIDTH = 16; private static final int DIALOG_WIDTH = 140; private static final int DIALOG_HEIGHT = 100; private UISearchTextField searchTextFiled; private JList[] contentViews; private Component[][] components; private String[] titles; private java.util.List selectionListeners = new ArrayList(); private java.util.List editListeners = new ArrayList(); private List deleteListeners = new ArrayList(); private boolean isPressOnDelete = false; // 是否点击在删除按钮上 @Override protected String title4PopupWindow() { return "group"; } public UIGroupExtensionPane(String[] titles) { this.titles = titles; if (ArrayUtils.isEmpty(titles)) { return; } initComponents(titles); } private void initComponents(String[] titles) { setBackground(null); searchTextFiled = initSearchTextField(); int count = titles.length; contentViews = new JList[count]; components = new Component[count + 1][]; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] rowSize = new double[count + 1]; double[] columnSize = {f}; for (int i = 0; i < count + 1; i++) { rowSize[i] = p; if (i == 0) { components[i] = new Component[]{searchTextFiled}; } else if (i > 0 && i < count + 1) { JList li = new JList(new DefaultListModel()); li.addListSelectionListener(listSelectionListener); li.addMouseListener(mouseListener); li.setCellRenderer(listCellRenderer); li.setBackground(null); contentViews[i - 1] = li; components[i] = new UIExtensionPane[]{new UIExtensionPane(titles[i - 1], li, false)}; } } JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); setLayout(new BorderLayout()); add(new UIScrollPane(centerPane), BorderLayout.CENTER); } private UISearchTextField initSearchTextField() { UISearchTextField searchTextFiled = new UISearchTextField() { public Dimension getPreferredSize() { return new Dimension(120, 22); } }; searchTextFiled.setIconPosition(SwingConstants.RIGHT); searchTextFiled.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { doFilter(); } @Override public void removeUpdate(DocumentEvent e) { doFilter(); } @Override public void changedUpdate(DocumentEvent e) { doFilter(); } }); return searchTextFiled; } /** * 返回index列表的数据 */ public Object[] getData(int index) { if (index < 0 || index > contentViews.length) { return ArrayUtils.EMPTY_OBJECT_ARRAY; } ListModel model = contentViews[index].getModel(); Object[] items = new Object[model.getSize()]; for (int i = 0, len = model.getSize(); i < len; i++) { items[i] = model.getElementAt(i); } return items; } /** * 返回对应Title的列表数组 */ public Object[] getData(String title) { int dataIndex = ArrayUtils.indexOf(titles, title); if (dataIndex != ArrayUtils.INDEX_NOT_FOUND) { return getData(dataIndex); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } private void doFilter() { for (JList list : contentViews) { ListDataListener[] ls = ((DefaultListModel) list.getModel()).getListDataListeners(); for (ListDataListener l : ls) { l.contentsChanged(new ListDataEvent(l, ListDataEvent.CONTENTS_CHANGED, 0, list.getModel().getSize())); } } for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(true); } } /** * 获取选中的值 * * @return 选中的值 */ public Object getSelectedObject() { for (JList list : contentViews) { if (list.getSelectedValue() != null) { return list.getSelectedValue(); } } return null; } /** * 返回选中的类别 * @return 类别 */ public String getSelectedType(){ for (int i = 0, len = contentViews.length; i < len; i++) { if(contentViews[i].getSelectedValue() != null){ return titles[i]; } } return ""; } /** * 设置选中的数据 */ public void setSelectedObject(Object value) { for (int i = 0, len = contentViews.length; i < len; i++) { UIExtensionPane extensionPane = (UIExtensionPane) components[i + 1][0]; JList list = contentViews[i]; DefaultListModel model = (DefaultListModel) list.getModel(); extensionPane.setExpand(model.contains(value)); if (model.contains(value)) { list.setSelectedValue(value, true); } } } /** * 设置数据选中的序号. */ public void setValueAtCurrentSelectIndex(Object value) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1) { ((DefaultListModel) list.getModel()).setElementAt(value, list.getSelectedIndex()); } } } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 */ public void addData(Object data, int index) { addData(data, index, false); } /** * 根据索引来添加数据 * * @param data 要添加的数据 * @param index 要添加的数据向的索引 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, int index, boolean checkRepeat) { if (contentViews == null || index < 0 || index > contentViews.length - 1) { return; } JList list = contentViews[index]; DefaultListModel model = (DefaultListModel) list.getModel(); if (data instanceof String) { model.addElement(createUnrepeatedName(model, (String) data, checkRepeat)); } if (checkRepeat) { // 将添加类型以外的其他类型都收起来 for (int i = 1, len = components.length; i < len; i++) { ((UIExtensionPane) components[i][0]).setExpand(false); } ((UIExtensionPane) components[index + 1][0]).setExpand(true); int selectedIndex = list.getModel().getSize() - 1; list.setSelectedIndex(selectedIndex); dealNewAddedDataIndex(((DefaultListModel) list.getModel()).elementAt(selectedIndex)); } } /** * 新添加的数据的序号 * @param data 数据 */ protected void dealNewAddedDataIndex(Object data){ } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 */ public void addData(Object data, String title) { addData(data, title, false); } /** * 根据标题来添加数据 * * @param data 要添加的数据 * @param title 要添加数据的项的标题文字 * @param checkRepeat 是否检查名字重复 */ public void addData(Object data, String title, boolean checkRepeat) { int addIndex = ArrayUtils.indexOf(titles, title); if (addIndex != ArrayUtils.INDEX_NOT_FOUND) { addData(data, addIndex, checkRepeat); } } /** * 清除所有的数据 */ public void clearData() { for (JList list : contentViews) { ((DefaultListModel) list.getModel()).clear(); } } private String createUnrepeatedName(DefaultListModel model, String name, boolean checkRepeat) { if (!checkRepeat) { return name; } int count = model.getSize(); int extra = 1; String newName = name + (count + extra); boolean hasRepeated = false; do { hasRepeated = false; newName = name + (count + extra); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(model.getElementAt(i), newName)) { hasRepeated = true; extra++; } } } while (hasRepeated); return name + (count + extra); } /** * 判断该控件是否应该有编辑操作 * * @param list 列表组件 * @return 如果有编辑操作则需要显示相应的图标 */ private boolean hasEditOperation(JList list) { return true; } private DefaultListCellRenderer listCellRenderer = new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JComponent c = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (!hasEditOperation(list)) { return c; } Border border = null; c.setBorder(border); UILabel editLabel = new UILabel(UIConstants.EDIT_ICON); UILabel deleteLabel = new UILabel(UIConstants.DELETE_ICON); JPanel editPane = GUICoreUtils.createFlowPane(new Component[]{editLabel, deleteLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE); editPane.setBackground(isSelected ? c.getBackground() : null); editPane.setBorder(border); JPanel renderPane = GUICoreUtils.createBorderLayoutPane(c, BorderLayout.CENTER, editPane, BorderLayout.EAST); if (shouldFilter(value)) { renderPane.setPreferredSize(new Dimension(0, 0)); } return renderPane; } }; //事件发生的顺序是ListSelection、MousePressed、ListSelection、MouseReleased private ListSelectionListener listSelectionListener = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { //在鼠标按下的时候的值改变事件,重置属性 if(e.getValueIsAdjusting()){ isPressOnDelete = false; } if(!isRespondToValueChange(e)){ return; } fireSelectionChangeListener(new ChangeEvent(e.getSource())); if (((JList) e.getSource()).getSelectedIndex() == -1) { return; } for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, e.getSource())) { try { list.setSelectedIndices(null); } catch (Exception ee) { } } } } }; /** * 是否响应list值改变 * @return 响应 */ protected boolean isRespondToValueChange(ListSelectionEvent e){ return true; } private boolean shouldFilter(Object value) { return !GeneralUtils.objectToString(value).toLowerCase().contains(searchTextFiled.getText().toLowerCase()); } private MouseListener mouseListener = new MouseAdapter() { /** * {@inheritDoc} */ @Override public void mousePressed(final MouseEvent e) { isPressOnDelete = false; final JList list = (JList) e.getSource(); Point point = e.getPoint(); final int index = list.locationToIndex(point); int width = list.getWidth(); if (hasEditOperation(list)) { // 删除按钮 if (point.x > width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { BasicPane bp = new BasicPane() { protected String title4PopupWindow() { return ""; } }; isPressOnDelete = true; bp.setLayout(new BorderLayout()); bp.add(new BoldFontTextLabel(Inter.getLocText(new String[]{"Delete", "Chart-Map"}) + "?", SwingConstants.CENTER)); clearLastListSelection(list); final String selectedType = UIGroupExtensionPane.this.getSelectedType(); UIDialog dialog = bp.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { public void doOk() { Object name = getSelectedObject(); ((DefaultListModel) list.getModel()).removeElementAt(index); MapSvgXMLHelper.getInstance().removeMapAttr(GeneralUtils.objectToString(name)); MapSvgXMLHelper.getInstance().removeCateNames(selectedType,GeneralUtils.objectToString(name)); fireDeleteListener(new ChangeEvent(e)); } }); dialog.setResizable(true); dialog.setSize(DIALOG_WIDTH, DIALOG_HEIGHT); dialog.setResizable(false); GUICoreUtils.centerWindow(dialog); dialog.setVisible(true); } // 编辑按钮 else if (point.x > width - (BUTTONWIDTH * 2 + 2 * LayoutConstants.HGAP_LARGE) && point.x < width - (BUTTONWIDTH + LayoutConstants.HGAP_LARGE)) { fireItemEditListener(new ChangeEvent(e)); } } } public void mouseReleased(MouseEvent e) { isPressOnDelete = false; } }; /** * 直接跨list点击删除按钮,要置之前list的选中项为空(因为删除操作不触发更新) * @param currentList 当前选中的list */ public void clearLastListSelection (JList currentList) { for (JList list : contentViews) { if (list.getSelectedIndex() != -1 && !ComparatorUtils.equals(list, currentList)) { try { list.setSelectedIndices(null); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } } } } /** * 是否点击在删除按钮上 * @return 是则返回true */ public boolean isPressOnDelete(){ return isPressOnDelete; } /** * 添加选中变化监听事件 * @param listener 监听 */ public void addSelectionChangeListener(ChangeListener listener) { selectionListeners.add(listener); } private void fireSelectionChangeListener(ChangeEvent e) { for (int i = selectionListeners.size(); i > 0; i--) { selectionListeners.get(i - 1).fireChanged(e); } } /** * 添加Item的监听事件 * @param listener 监听器 */ public void addItemEditListener(ChangeListener listener) { editListeners.add(listener); } private void fireItemEditListener(ChangeEvent e) { for (int i = editListeners.size(); i > 0; i--) { editListeners.get(i - 1).fireChanged(e); } } /** * 添加删除事件的监听事件 * @param listener 监听 */ public void addDeleteListener(ChangeListener listener) { deleteListeners.add(listener); } private void fireDeleteListener(ChangeEvent e) { for(int i = deleteListeners.size(); i > 0; i--) { deleteListeners.get(i - 1).fireChanged(e); } } public void setEnabled(boolean isEnabled){ super.setEnabled(isEnabled); if(searchTextFiled != null){ searchTextFiled.setEnabled(isEnabled); } if(this.components != null){ for(int i = 0; i < this.components.length; i++){ Component[] comp = this.components[i]; for(int j = 0; j < comp.length; j++){ comp[j].setEnabled(isEnabled); } } } } /** * 测试程序 * @param args 参数 */ public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = f.getContentPane(); c.setBackground(Color.WHITE); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); final UIGroupExtensionPane g = new UIGroupExtensionPane(new String[]{"title1", "title2", "title3"}); c.add(g, BorderLayout.CENTER); JPanel pp = new JPanel(new FlowLayout()); c.add(pp, BorderLayout.SOUTH); UIButton test = new UIButton("add1"); test.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test111", 0); } }); pp.add(test); UIButton test2 = new UIButton("add2"); test2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { g.addData("test222", 1); } }); pp.add(test2); f.setSize(360, 500); f.setLocation(200, 100); f.setVisible(true); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/MapEditPane.java b/designer_chart/src/com/fr/design/mainframe/MapEditPane.java index 2950a4d1fd..4c137afb7c 100644 --- a/designer_chart/src/com/fr/design/mainframe/MapEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/MapEditPane.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe; -import com.fr.base.MapSvgAttr; -import com.fr.base.MapSvgXMLHelper; +import com.fr.chart.base.MapSvgAttr; +import com.fr.chart.base.MapSvgXMLHelper; import com.fr.chart.chartglyph.MapShapeValue; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.series.PlotSeries.AbstrctMapAttrEditPane; From 3afae533473b7c75d72913d02cbe12dc1b9f556f Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Thu, 27 Jul 2017 11:57:19 +0800 Subject: [PATCH 35/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=9B=9E=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/chart/gui/type/AbstractChartTypePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..299d878d03 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 @@ -133,7 +133,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ } //子类覆盖 - protected Plot getSelectedClonedPlot(){ + protected T getSelectedClonedPlot(){ return null; } From 65762d17f7e06eff0bcc4243c4dbd81ab3ff3260 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Thu, 27 Jul 2017 14:26:06 +0800 Subject: [PATCH 36/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlotSeries/MapGroupExtensionPane.java | 485 +++++++++++++++++- 1 file changed, 484 insertions(+), 1 deletion(-) 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 36b0ec8477..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.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 +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 From 5004bd19eebf0d1b9433d9a98062470aa8ba7c0b Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 28 Jul 2017 15:31:07 +0800 Subject: [PATCH 37/92] =?UTF-8?q?REPORT-3216=20=E6=97=A5=E6=96=87=E7=89=88?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=BA=9B=E7=BF=BB=E8=AF=91=E5=92=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=9820170708?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/webattr/WriteWebSettingPane.java | 2 +- .../src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java | 2 +- .../src/com/fr/design/widget/ui/NumberEditorDefinePane.java | 2 +- .../com/fr/design/gui/frpane/UICorrelationComboBoxPane.java | 3 ++- designer_base/src/com/fr/design/locale/designer.properties | 3 +++ .../src/com/fr/design/locale/designer_en_US.properties | 3 +++ .../src/com/fr/design/locale/designer_ja_JP.properties | 3 +++ .../src/com/fr/design/locale/designer_ko_KR.properties | 3 +++ .../src/com/fr/design/locale/designer_zh_CN.properties | 3 +++ .../src/com/fr/design/locale/designer_zh_TW.properties | 3 +++ .../com/fr/design/mainframe/loghandler/LogDetailPane.java | 3 ++- designer_base/src/com/fr/start/BaseDesigner.java | 5 +++-- .../src/com/fr/design/designer/creator/XCheckBoxGroup.java | 2 +- 13 files changed, 29 insertions(+), 8 deletions(-) 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/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 67035a4fd1..643fbf16a0 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2005,3 +2005,6 @@ 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: 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 deabe7a0fe..3cd8b9e327 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 @@ -2006,3 +2006,6 @@ 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: 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 7126404b05..c89c2a9d3e 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 @@ -2005,3 +2005,6 @@ 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-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: \ 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 1c5ec78b4d..5fd517ee1d 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 @@ -2005,3 +2005,6 @@ 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-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: \ 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 64a6c4f140..c0912e6b66 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 @@ -2005,3 +2005,6 @@ 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 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 efbcde1b92..f9875911eb 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 @@ -2006,3 +2006,6 @@ 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 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/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 4c9329c243..4c98ea1999 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -61,11 +61,12 @@ public abstract class BaseDesigner extends ToolBarMenuDock { } BuildContext.setBuildFilePath(buildPropertiesPath()); + //下面这两句的位置不能随便调换,因为会影响语言切换的问题 + initLanguage(); + // 先加载设计器的国际化文件 Inter.loadLocaleFile(GeneralContext.getLocale(), DesignModule.LOCALE_FILE_PATH); - //下面这两句的位置不能随便调换,因为会影响语言切换的问题 - initLanguage(); SplashWindow splashWindow = new SplashWindow(createSplashPane()); if (args != null) { 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) From 2369145cbfeff4cf9830093c92e2b7190e5c785e Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Mon, 31 Jul 2017 15:18:17 +0800 Subject: [PATCH 38/92] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=9A=E5=B0=86=E5=9B=BE=E8=A1=A8dev=E4=B8=AD=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=90=88=E5=B9=B6=E5=88=B0release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor/editor/ColumnSelectedEditor.java | 18 +- .../controlpane/AbstractNameableCreator.java | 27 +- .../gui/controlpane/NameableCreator.java | 17 +- .../PlotSeries/MapGroupExtensionPane.java | 485 +++++++++++++++++- .../SeriesCondition/dlp/DataLabelPane.java | 29 +- ...goryPlotMoreCateReportDataContentPane.java | 161 +++--- ...egoryPlotMoreCateTableDataContentPane.java | 177 ++++--- .../chart/gui/other/ChartInteractivePane.java | 347 +++++++------ .../chart/gui/type/AbstractChartTypePane.java | 2 +- 9 files changed, 891 insertions(+), 372 deletions(-) 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_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/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..299d878d03 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 @@ -133,7 +133,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ } //子类覆盖 - protected Plot getSelectedClonedPlot(){ + protected T getSelectedClonedPlot(){ return null; } From 4e827e5f24ac6c1c9797aa7b753eb14cad441e66 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Mon, 31 Jul 2017 18:29:57 +0800 Subject: [PATCH 39/92] =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/chart/gui/ChartTypePane.java | 4 ++++ .../chart/gui/type/AbstractChartTypePane.java | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) 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/type/AbstractChartTypePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java index 299d878d03..fb96709bec 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; //样式布局的面板 + protected 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); } @@ -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]; } From c438614dbb59f90376f2e942b96c25ab96cb27e6 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Mon, 31 Jul 2017 18:33:59 +0800 Subject: [PATCH 40/92] pmd --- .../design/mainframe/chart/gui/type/AbstractChartTypePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fb96709bec..1f9be209f3 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 @@ -39,7 +39,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ protected static final int BAIDU = 0; protected static final int GOOGLE = 1; - protected List typeDemo; + private List typeDemo; protected List styleList; protected JPanel stylePane; //样式布局的面板 From 116b0e7c0ace5fbb1a4c0cb2122e1037404e5503 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Mon, 31 Jul 2017 18:34:42 +0800 Subject: [PATCH 41/92] pmd --- .../mainframe/chart/gui/type/AbstractChartTypePane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 1f9be209f3..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 @@ -39,11 +39,11 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ protected static final int BAIDU = 0; protected static final int GOOGLE = 1; - private List typeDemo; + protected List typeDemo; protected List styleList; protected JPanel stylePane; //样式布局的面板 - protected JPanel typePane; + private JPanel typePane; protected abstract String[] getTypeIconPath(); protected abstract String[] getTypeTipName(); protected abstract String[] getTypeLayoutPath(); From 94a59be635ad7592e3a31f0724ade9345c47c834 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Tue, 1 Aug 2017 11:43:27 +0800 Subject: [PATCH 42/92] =?UTF-8?q?REPORT-3406=20win10=E5=86=85=E5=AD=98?= =?UTF-8?q?=E4=B8=8D=E8=B6=B3=E6=97=B6=E6=89=BE=E4=B8=8D=E5=88=B0=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E6=B5=8F=E8=A7=88=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/start/StartServer.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/designer_base/src/com/fr/start/StartServer.java b/designer_base/src/com/fr/start/StartServer.java index e21beef7b1..7c5b77f524 100644 --- a/designer_base/src/com/fr/start/StartServer.java +++ b/designer_base/src/com/fr/start/StartServer.java @@ -14,10 +14,7 @@ import com.fr.env.SignIn; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.Inter; -import com.fr.stable.EnvChangedListener; -import com.fr.stable.ProductConstants; -import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; +import com.fr.stable.*; import com.fr.stable.project.ProjectConstants; import com.fr.start.server.JettyHost; @@ -154,8 +151,7 @@ public class StartServer { Desktop.getDesktop().browse(new URI(uri)); } catch (IOException e) { - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); - FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); + startBrowserFromCommand(uri, e); } catch (URISyntaxException e) { FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); } catch (Exception e) { @@ -164,6 +160,20 @@ public class StartServer { } } + private static void startBrowserFromCommand(String uri, IOException e) { + if (OperatingSystem.isWindows()) { + try { + // win10 内存用到到80%左右的时候, Desktop.browser经常提示"存储空间不足, 无法处理改命令", 用rundll32可以打开. + Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri); + } catch (IOException ee) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); + FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); + } + } else { + FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); + } + } + private static class InformationPane extends BasicPane { private static final long serialVersionUID = 1L; From 1347e32ec7eea878cb53ada500c47ffa8ac3fcbc Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 1 Aug 2017 14:45:17 +0800 Subject: [PATCH 43/92] =?UTF-8?q?BI-6684=20License=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E8=BF=98=E5=8E=9F=EF=BC=8C=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=88=B0=E9=80=92=E5=BD=92=EF=BC=8C=E5=A4=84=E7=90=86=E6=AF=94?= =?UTF-8?q?=E8=BE=83=E9=BA=BB=E7=83=A6=EF=BC=8C=E6=94=BE9.0=E4=B8=AD?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/SwitchExistEnv.java | 21 ++----- .../roleAuthority/ReportAndFSManagePane.java | 2 +- designer_base/src/com/fr/env/RemoteEnv.java | 63 ++++++++++++++----- .../com/fr/design/chart/ChartTypePane.java | 20 +++--- 4 files changed, 61 insertions(+), 45 deletions(-) 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 da723c8ed0..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,22 +17,18 @@ 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 com.fr.stable.help.FineClassLoader; import javax.swing.*; import java.awt.event.ActionEvent; -import java.lang.reflect.Method; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -131,14 +129,7 @@ public class SwitchExistEnv extends MenuDef { } private void resetLicenseBytes() { - FineClassLoader classLoader = new FineClassLoader(); - try { - Class clazz = classLoader.loadClass("com.fr.base.FRCoreContext"); - Method retryMethod = clazz.getMethod("retryLicLock"); - retryMethod.invoke(clazz); - } catch (Exception ignore) { - - } + FRCoreContext.retryLicLock(); } } diff --git a/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java index f6a78eab47..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 com.fr.stable.help.FineClassLoader; 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.lang.reflect.Method; 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() { FineClassLoader classLoader = new FineClassLoader(); byte[] bytes = null; try { Class clazz = classLoader.loadClass("com.fr.base.FRCoreContext"); Method method = clazz.getMethod("getBytes"); bytes = (byte[]) method.invoke(clazz); } catch (Exception ignore) { } 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 +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 363b55c6cd..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,9 +45,15 @@ 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.help.FineClassLoader; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLTools; @@ -42,18 +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.lang.reflect.Method; +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; @@ -1397,14 +1435,7 @@ public class RemoteEnv extends AbstractEnv { } private void resetLicenseBytes() { - FineClassLoader classLoader = new FineClassLoader(); - try { - Class clazz = classLoader.loadClass("com.fr.base.FRCoreContext"); - Method retryMethod = clazz.getMethod("retryLicLock"); - retryMethod.invoke(clazz); - } catch (Exception ignore) { - - } + FRCoreContext.retryLicLock(); } /** diff --git a/designer_chart/src/com/fr/design/chart/ChartTypePane.java b/designer_chart/src/com/fr/design/chart/ChartTypePane.java index 9f1da397e9..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,14 +19,11 @@ 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 com.fr.stable.help.FineClassLoader; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; -import java.lang.reflect.Method; public class ChartTypePane extends ChartCommonWizardPane { private static final long serialVersionUID = -1175602484968520546L; @@ -168,15 +170,7 @@ public class ChartTypePane extends ChartCommonWizardPane { } private boolean supportMap() { - FineClassLoader classLoader = new FineClassLoader(); - byte[] bytes = null; - try { - Class clazz = classLoader.loadClass("com.fr.base.FRCoreContext"); - Method method = clazz.getMethod("getBytes"); - bytes = (byte[]) method.invoke(clazz); - } catch (Exception ignore) { - - } + byte[] bytes = FRCoreContext.getBytes(); return VT4FR.isLicAvailable(bytes) && VT4FR.CHART_MAP.support(); } From d344e92e8baa91c94b70e374dfd324cb74e31233 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Tue, 1 Aug 2017 15:30:28 +0800 Subject: [PATCH 44/92] 1 --- .../editor/editor/ColumnSelectedEditor.java | 16 +-- ...egoryPlotMoreCateTableDataContentPane.java | 130 +++++++++--------- 2 files changed, 73 insertions(+), 73 deletions(-) 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 d8ae98bbca..71014d4c8a 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.data.SimpleDSColumn; import com.fr.design.data.DesignTableDataManager; +import com.fr.data.SimpleDSColumn; import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.icombobox.UIComboBox; @@ -36,13 +36,13 @@ public class ColumnSelectedEditor extends Editor { @Override public void itemStateChanged(ItemEvent e) { - TableDataWrapper tableDataWrapper = tableDataComboBox.getSelectedItem(); - if (tableDataWrapper == null) { - return; - } - //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 - List nameList = tableDataWrapper.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++) { 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 0b1909f985..aae7e35400 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 @@ -37,10 +37,10 @@ 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() { @@ -50,31 +50,31 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD 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) { @@ -82,11 +82,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD addNewCombox(); relayoutPane(); } - + checkSeriseUse(categoryCombox.getSelectedItem() != null); } }); - + categoryCombox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { checkSeriseUse(categoryCombox.getSelectedItem() != null); @@ -96,45 +96,45 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD } }); } - + 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); + + 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() { + + delButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boxPane.remove(buttonPane); @@ -143,11 +143,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD 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); @@ -156,11 +156,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD protected void checkComponent() { checkAddButton(); } - + private void relayoutPane() { this.revalidate(); } - + /** *检查 某些Box是否可用 @@ -171,14 +171,14 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD 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); + } + } /** * 给组件登记一个观察者监听事件 @@ -204,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; @@ -216,11 +216,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD box.setSelectedItem(normal.getMoreCateWithIndex(i)); } } - + checkAddButton(); checkSeriseUse(categoryCombox.getSelectedItem() != null); } - + /** * 保存多分类界面到collection * @param collection From ebe97033437e9c5b7427850cbfb3dc94729888ea Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Tue, 1 Aug 2017 15:31:05 +0800 Subject: [PATCH 45/92] 1 --- designer/src/com/fr/start/Designer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index 09b7fa76e0..e5502fde28 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -51,7 +51,7 @@ public class Designer extends BaseDesigner { private static final int PREVIEW_DOWN_X_GAP = 92; private static final int GAP = 7; - private static final String OLD_ENV_FOLDER_71 = ".FineReport71"; + private static final String OLD_ENV_FOLDER_71 = ".Fine Report71"; private static final String OLD_ENV_FOLDER_70 = ".FineReport70"; private UserInfoPane userInfoPane; From 5afea688089dc08e761d0bdc01e050a721a7b131 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Tue, 1 Aug 2017 15:31:15 +0800 Subject: [PATCH 46/92] 1 --- designer/src/com/fr/start/Designer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index e5502fde28..09b7fa76e0 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -51,7 +51,7 @@ public class Designer extends BaseDesigner { private static final int PREVIEW_DOWN_X_GAP = 92; private static final int GAP = 7; - private static final String OLD_ENV_FOLDER_71 = ".Fine Report71"; + private static final String OLD_ENV_FOLDER_71 = ".FineReport71"; private static final String OLD_ENV_FOLDER_70 = ".FineReport70"; private UserInfoPane userInfoPane; From 24cd9cf3a55673c3ea512fa5aac46dfad50b62c5 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 1 Aug 2017 15:35:38 +0800 Subject: [PATCH 47/92] build change --- build.performance.gradle | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/build.performance.gradle b/build.performance.gradle index 1022056799..1efdd55cc8 100644 --- a/build.performance.gradle +++ b/build.performance.gradle @@ -3,22 +3,32 @@ tasks.withType(JavaCompile){ options.encoding = "UTF-8" } -def basicDir="../" -def libDir="${basicDir}/lib" +def basicDir="../../" +def libDir="${basicDir}/finereport-lib-stable" +//获取什么分支名 +FileTree files =fileTree(dir:"./",include:"build.*.gradle") +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) +def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) task appletJar<<{ + ant{ mkdir(dir:"./tmp") - mkdir(dir:"build/classes/main") + mkdir(dir:"build/classes/") copy(todir:"build/classes/"){ - fileset(dir:"${basicDir}/core/build/classes/main") - fileset(dir:"${basicDir}/chart/build/classes/main") - fileset(dir:"${basicDir}/report/build/classes/main") - fileset(dir:"${basicDir}/platform/build/classes/main") - fileset(dir:"${basicDir}/performance/build/classes/main") + fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") + + fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") + } - unjar(src:"${libDir}/3rd.jar",dest:"./tmp") - unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") + unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"./tmp") + unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"./tmp") jar(jarfile:"build/libs/fr-applet-8.0.jar"){ fileset(dir:"build/classes"){ exclude(name:"*.*") From 92c856e1c0c4147d0135b5b5db2bc45d4895e5ab Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 1 Aug 2017 15:48:17 +0800 Subject: [PATCH 48/92] revert --- build.performance.gradle | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/build.performance.gradle b/build.performance.gradle index 1efdd55cc8..1022056799 100644 --- a/build.performance.gradle +++ b/build.performance.gradle @@ -3,32 +3,22 @@ tasks.withType(JavaCompile){ options.encoding = "UTF-8" } -def basicDir="../../" -def libDir="${basicDir}/finereport-lib-stable" -//获取什么分支名 -FileTree files =fileTree(dir:"./",include:"build.*.gradle") -def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) -def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) +def basicDir="../" +def libDir="${basicDir}/lib" task appletJar<<{ - ant{ mkdir(dir:"./tmp") - mkdir(dir:"build/classes/") + mkdir(dir:"build/classes/main") copy(todir:"build/classes/"){ - fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") - - fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") - - fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") - - fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") - - fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") - + fileset(dir:"${basicDir}/core/build/classes/main") + fileset(dir:"${basicDir}/chart/build/classes/main") + fileset(dir:"${basicDir}/report/build/classes/main") + fileset(dir:"${basicDir}/platform/build/classes/main") + fileset(dir:"${basicDir}/performance/build/classes/main") } - unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"./tmp") - unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"./tmp") + unjar(src:"${libDir}/3rd.jar",dest:"./tmp") + unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") jar(jarfile:"build/libs/fr-applet-8.0.jar"){ fileset(dir:"build/classes"){ exclude(name:"*.*") From 0144fe22e0522f091b65c52621d71cfd03c65c6a Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 1 Aug 2017 15:50:33 +0800 Subject: [PATCH 49/92] =?UTF-8?q?=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.performance.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.performance.gradle b/build.performance.gradle index 1022056799..fe011898f3 100644 --- a/build.performance.gradle +++ b/build.performance.gradle @@ -15,7 +15,6 @@ task appletJar<<{ fileset(dir:"${basicDir}/chart/build/classes/main") fileset(dir:"${basicDir}/report/build/classes/main") fileset(dir:"${basicDir}/platform/build/classes/main") - fileset(dir:"${basicDir}/performance/build/classes/main") } unjar(src:"${libDir}/3rd.jar",dest:"./tmp") unjar(src:"${libDir}/servlet-api.jar",dest:"./tmp") From 60cb686faceb2330b5048f57e510947e8a527981 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Tue, 1 Aug 2017 20:16:30 +0800 Subject: [PATCH 50/92] =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E7=81=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/chart/gui/ChartTypePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d5f170ef8d..8c5e84dcdf 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 @@ -240,7 +240,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ FurtherBasicBeanPane pane = cards.get(i); if (pane.accept(ob)) { - GUICoreUtils.setEnabled(this, ob.isValidPlot()); + GUICoreUtils.setEnabled(chartTypeComBox.getUIComboBox(), ob.isValidPlot()); pane.populateBean(ob); Object item = pane.title4PopupWindow(); From 581ca6572547a9e31c81f343e594c9d600173996 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Wed, 2 Aug 2017 09:50:39 +0800 Subject: [PATCH 51/92] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/chart/gui/ChartTypePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d5f170ef8d..8c5e84dcdf 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 @@ -240,7 +240,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ FurtherBasicBeanPane pane = cards.get(i); if (pane.accept(ob)) { - GUICoreUtils.setEnabled(this, ob.isValidPlot()); + GUICoreUtils.setEnabled(chartTypeComBox.getUIComboBox(), ob.isValidPlot()); pane.populateBean(ob); Object item = pane.title4PopupWindow(); From 90b3de2fcfc5da170e08ad96339a73fd90bd8aa0 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 4 Aug 2017 09:31:17 +0800 Subject: [PATCH 52/92] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=BD=B1=E5=93=8D=E6=A8=A1=E6=9D=BF=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/mainframe/JTemplate.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index a275d3d5df..28d71f9888 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -121,7 +121,10 @@ public abstract class JTemplate> ex return; } long saveTime = System.currentTimeMillis(); // 保存模板的时间点 - tic.collectInfo(template, this, openTime, saveTime); + try { + tic.collectInfo(template, this, openTime, saveTime); + } catch (Throwable th) { // 不管收集过程中出现任何异常,都不应该影响模版保存 + } openTime = saveTime; // 更新 openTime,准备下一次计算 } From 80d9f3e59a80fe74e11198122c66003efc9a5d37 Mon Sep 17 00:00:00 2001 From: syoki Date: Mon, 7 Aug 2017 14:09:17 +0900 Subject: [PATCH 53/92] =?UTF-8?q?=E3=80=90=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=91=E6=98=BE=E7=A4=BAbug=EF=BC=88REPORT?= =?UTF-8?q?-3216=EF=BC=89=E7=9B=B8=E5=85=B3key=E7=9A=84=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/locale/designer_ja_JP.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 c89c2a9d3e..ca55e19127 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 @@ -228,7 +228,7 @@ FR-Designer-Collect_Information_free=\u7121\u6599 FR-Designer-Collect_Information_Description=\u8AAC\u660E FR-Designer-Collect_Information_Successfully=\u53CE\u96C6\u6210\u529F FR-Designer_Event_Set=\u30A4\u30D9\u30F3\u30C8\u8A2D\u5B9A -FR-Designer_Blow_set=\u4EE5\u4E0B\u8A2D\u5B9A +FR-Designer_Blow_set=\u6B21\u306E\u8A2D\u5B9A FR-Designer_I_Want_To_Set_Single=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u500B\u5225\u8A2D\u5B9A FR-Designer_Using_Server_Report_View_Settings=\u30B5\u30FC\u30D0\u8A2D\u5B9A FR-Designer_ErrorHandlerTemplate=\u30A8\u30E9\u30FC\u60C5\u5831\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u5B9A\u7FA9 @@ -507,7 +507,7 @@ FR-Designer_Property_panel=\u5C5E\u6027 FR-Designer_Select_panel=\u9078\u629E FR-Designer_LayoutTable_Column_Width=160 FR-Designer_Set_BG_Of_Current_Row=\u7DE8\u96C6\u884C\u80CC\u666F\u8A2D\u5B9A -FR-Designer_Unload_Check=\u672A\u66F8\u304D\u8FBC\u307F\u6642\u6CE8\u610F +FR-Designer_Unload_Check=\u672A\u30B3\u30DF\u30C3\u30C8\u30D2\u30F3\u30C8 FR-Designer_ReportColumns_Columns_Optional=\u6BB5\u7D44\u307F FR-Designer_Row_Icon_File_Name=row.png FR-Designer_Center_Display=\u4E2D\u592E\u63C3\u3048 @@ -2005,6 +2005,6 @@ 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-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: \ No newline at end of file +FR-Designer_Sheet_Label_Page_Display_Position=Sheet\u30E9\u30D9\u30EB\u30DA\u30FC\u30B8\u306E\u8868\u793A\u4F4D\u7F6E +FR-Designer_Provide_Choose_All=\u5168\u9078\u629E\u53EF\u80FD +FR-Designer_Decimal_Places=\u5C0F\u6570\u67A0\u6570: \ No newline at end of file From 58c327744504e75056e53400e722d6de02ac8e39 Mon Sep 17 00:00:00 2001 From: hugh Date: Tue, 8 Aug 2017 16:36:22 +0800 Subject: [PATCH 54/92] =?UTF-8?q?SLN-280=20=E6=89=93=E5=8D=B0=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=EF=BC=8C=E6=BC=8F?= =?UTF-8?q?=E5=88=A0=E4=B8=80=E8=A1=8C=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=AF=BC=E5=87=BA=E6=8C=89=E9=92=AE=E6=B2=A1=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=87=BA=E6=9D=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/report/ReportBackgroundPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer/src/com/fr/design/report/ReportBackgroundPane.java b/designer/src/com/fr/design/report/ReportBackgroundPane.java index dcf1247920..1abc33c354 100644 --- a/designer/src/com/fr/design/report/ReportBackgroundPane.java +++ b/designer/src/com/fr/design/report/ReportBackgroundPane.java @@ -28,8 +28,6 @@ public class ReportBackgroundPane extends BasicPane { sourth.add(isExportBackgroundCheckBox); sourth.add(isPrintBackgroundCheckBox); this.add(sourth, BorderLayout.SOUTH); - - this.add(isPrintBackgroundCheckBox, BorderLayout.SOUTH); } @Override From 8c73bc8175a640e17d2e241c10a7ecd5a43559e4 Mon Sep 17 00:00:00 2001 From: zhouping Date: Tue, 8 Aug 2017 20:27:02 +0800 Subject: [PATCH 55/92] =?UTF-8?q?REPORT-2975=209.0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=20UILabel=E5=8A=A0=E4=B8=AA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=8D=E5=8F=AF=E7=94=A8=E7=9A=84=E6=9E=84=E9=80=A0?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/gui/ilable/UILabel.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer_base/src/com/fr/design/gui/ilable/UILabel.java b/designer_base/src/com/fr/design/gui/ilable/UILabel.java index b1c90d8ff5..c0b921dee1 100644 --- a/designer_base/src/com/fr/design/gui/ilable/UILabel.java +++ b/designer_base/src/com/fr/design/gui/ilable/UILabel.java @@ -29,6 +29,11 @@ public class UILabel extends JLabel { super(text); } + public UILabel(String text, boolean enable) { + super(text); + this.setEnabled(enable); + } + public UILabel(Icon image, int horizontalAlignment) { super(image, horizontalAlignment); } From 6ee8026f5a6469ed30e5943ae24d4c1a0c01eacd Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Thu, 17 Aug 2017 15:58:27 +0800 Subject: [PATCH 56/92] =?UTF-8?q?=E6=8F=92=E4=BB=B6EnvVersion=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginHelper.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 1230cbfae6..1b6fde0d7b 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -6,10 +6,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.extra.plugindependence.DownLoadDependenceUI; import com.fr.general.*; import com.fr.general.http.HttpClient; -import com.fr.plugin.Plugin; -import com.fr.plugin.PluginConfigManager; -import com.fr.plugin.PluginLoader; -import com.fr.plugin.PluginManagerHelper; +import com.fr.plugin.*; import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; @@ -268,6 +265,12 @@ public class PluginHelper { FRLogger.getLogger().error(jarExpiredInfo); throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo); } + if (isHigherEnvVersion(plugin.getEnvVersion())) { + String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Jar_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); + FRLogger.getLogger().error(envVersionNotSupport); + throw new com.fr.plugin.PluginVerifyException(envVersionNotSupport); + } + File fileToCheck = getTempPluginFileDirectory(); File oldfile = new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), ProjectConstants.PLUGINS_NAME, "plugin-" + plugin.getId())); if (!PluginManagerHelper.checkLic(plugin, fileToCheck)) { @@ -278,7 +281,12 @@ public class PluginHelper { } } } - + + private static boolean isHigherEnvVersion(String envVersion) { + //高于8.0 + return PluginUtils.compareVersion(envVersion, "8.0") > 0; + } + /** * 获取插件解压的临时文件夹 * From da225f08dba82f4ea3af0113a4e57a9ef28dec0d Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Thu, 17 Aug 2017 16:11:57 +0800 Subject: [PATCH 57/92] =?UTF-8?q?=E6=8F=92=E4=BB=B6EnvVersion=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/extra/PluginHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 1b6fde0d7b..798b732947 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -266,7 +266,7 @@ public class PluginHelper { throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo); } if (isHigherEnvVersion(plugin.getEnvVersion())) { - String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Jar_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); + String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Env_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); FRLogger.getLogger().error(envVersionNotSupport); throw new com.fr.plugin.PluginVerifyException(envVersionNotSupport); } From 3d8723c9fd26d9b2819623368838ad8001f80781 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Thu, 17 Aug 2017 17:22:51 +0800 Subject: [PATCH 58/92] pmd --- .../src/com/fr/design/extra/PluginHelper.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 798b732947..613d887e71 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -4,9 +4,17 @@ import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.extra.plugindependence.DownLoadDependenceUI; -import com.fr.general.*; +import com.fr.general.FRLogger; +import com.fr.general.GeneralUtils; +import com.fr.general.IOUtils; +import com.fr.general.Inter; +import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; -import com.fr.plugin.*; +import com.fr.plugin.Plugin; +import com.fr.plugin.PluginConfigManager; +import com.fr.plugin.PluginLoader; +import com.fr.plugin.PluginManagerHelper; +import com.fr.plugin.PluginUtils; import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; @@ -112,8 +120,8 @@ public class PluginHelper { */ public static Plugin readPlugin(File chosenFile) throws Exception { // 需要先删除临时目录保证加压出来的文件不会和安装失败的文件混合到一起 - StableUtils.deleteFile(new File(TEMP_PATH)); - + StableUtils.deleteFile(new File(TEMP_PATH)) + IOUtils.unzip(chosenFile, TEMP_PATH); File pluginFileDir = getTempPluginFileDirectory(); if (pluginFileDir == null) { From 03562267356656c74b945178477fcdd8db6b219d Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 09:26:15 +0800 Subject: [PATCH 59/92] fix --- designer_base/src/com/fr/design/extra/PluginHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 613d887e71..cab0a6dbde 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -20,6 +20,7 @@ import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; +import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.plugin.PluginConstants; @@ -120,7 +121,7 @@ public class PluginHelper { */ public static Plugin readPlugin(File chosenFile) throws Exception { // 需要先删除临时目录保证加压出来的文件不会和安装失败的文件混合到一起 - StableUtils.deleteFile(new File(TEMP_PATH)) + StableUtils.deleteFile(new File(TEMP_PATH)); IOUtils.unzip(chosenFile, TEMP_PATH); File pluginFileDir = getTempPluginFileDirectory(); @@ -292,7 +293,7 @@ public class PluginHelper { private static boolean isHigherEnvVersion(String envVersion) { //高于8.0 - return PluginUtils.compareVersion(envVersion, "8.0") > 0; + return PluginUtils.compareVersion(envVersion, ProductConstants.MAIN_VERSION) > 0; } /** From 5aa527e37e6ace165e5c9d6070ddbfa77a2d199c Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 11:07:52 +0800 Subject: [PATCH 60/92] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Env=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8C=BA=E9=97=B4=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginHelper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index cab0a6dbde..e79231a3ad 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -15,6 +15,8 @@ import com.fr.plugin.PluginConfigManager; import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginManagerHelper; import com.fr.plugin.PluginUtils; +import com.fr.plugin.basic.Version; +import com.fr.plugin.basic.VersionIntervalFactory; import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; @@ -274,7 +276,7 @@ public class PluginHelper { FRLogger.getLogger().error(jarExpiredInfo); throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo); } - if (isHigherEnvVersion(plugin.getEnvVersion())) { + if (!isSupportCurrentEnv(plugin.getEnvVersion())) { String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Env_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); FRLogger.getLogger().error(envVersionNotSupport); throw new com.fr.plugin.PluginVerifyException(envVersionNotSupport); @@ -291,9 +293,9 @@ public class PluginHelper { } } - private static boolean isHigherEnvVersion(String envVersion) { - //高于8.0 - return PluginUtils.compareVersion(envVersion, ProductConstants.MAIN_VERSION) > 0; + private static boolean isSupportCurrentEnv(String envVersion) { + //包含8.0 + return !VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); } /** From c465dc4b106ad734b52c73b738d525c377e8ae70 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 11:10:24 +0800 Subject: [PATCH 61/92] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index e79231a3ad..2524412c04 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -295,7 +295,7 @@ public class PluginHelper { private static boolean isSupportCurrentEnv(String envVersion) { //包含8.0 - return !VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); + return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); } /** From 06fcc30d00e2e1e6bc88b1b36e8a3f2e4a46692a Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 11:11:51 +0800 Subject: [PATCH 62/92] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 2524412c04..65cd74a2cb 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -14,15 +14,13 @@ import com.fr.plugin.Plugin; import com.fr.plugin.PluginConfigManager; import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginManagerHelper; -import com.fr.plugin.PluginUtils; -import com.fr.plugin.basic.Version; -import com.fr.plugin.basic.VersionIntervalFactory; +import com.fr.plugin.basic.version.Version; +import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; -import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.plugin.PluginConstants; From 78f790501594a656cfc3a535241c1448ffcd3b1f Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:11:16 +0800 Subject: [PATCH 63/92] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20=E7=A7=BB=E6=A4=8D9.0=E7=9A=84?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/start/BaseDesigner.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 4c98ea1999..49c49d9b5e 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -24,6 +24,7 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.*; import com.fr.plugin.PluginCollector; +import com.fr.plugin.manager.PluginManager; import com.fr.stable.*; import javax.swing.*; @@ -83,6 +84,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock { DesignUtils.initLookAndFeel(); DesignUtils.creatListeningServer(getStartPort(), startFileSuffix()); + //初始化插件引擎 + PluginManager.init(); // 初始化Log Handler DesignerEnvManager.loadLogSetting(); DesignerFrame df = createDesignerFrame(); From ba2a78b8aefa1929877c9f3621c00dcaf74a7f33 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:39:39 +0800 Subject: [PATCH 64/92] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 65cd74a2cb..c0aeff8e74 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -20,6 +20,7 @@ import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -133,7 +134,7 @@ public class PluginHelper { File[] pluginFiles = pluginFileDir.listFiles(); if (ArrayUtils.isNotEmpty(pluginFiles)) { for (File f : pluginFiles) { - if (f.getName().equals("plugin.xml")) { + if (AssistUtils.equals(f.getName(), "plugin.xml")) { plugin = new Plugin(); InputStream inputStream = plugin.readEncryptXml(new FileInputStream(f)); XMLTools.readInputStreamXML(plugin, inputStream); @@ -323,7 +324,7 @@ public class PluginHelper { File[] files = dir.listFiles(); if (ArrayUtils.isNotEmpty(files)) { for (File f : files) { - if ("plugin.xml".equals(f.getName())) { + if (AssistUtils.equals("plugin.xml",f.getName())) { return true; } } From ba1e541f1458248b2e8365c0fbe9bca9048888d3 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:40:19 +0800 Subject: [PATCH 65/92] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index c0aeff8e74..dcf5a6c89c 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -283,12 +283,11 @@ public class PluginHelper { File fileToCheck = getTempPluginFileDirectory(); File oldfile = new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), ProjectConstants.PLUGINS_NAME, "plugin-" + plugin.getId())); - if (!PluginManagerHelper.checkLic(plugin, fileToCheck)) { - if (!PluginManagerHelper.checkLic(plugin, oldfile)) {//安装时,在安装目录下和压缩包里都没有才弹框 + if (!PluginManagerHelper.checkLic(plugin, fileToCheck) && !PluginManagerHelper.checkLic(plugin, oldfile)) { + //安装时,在安装目录下和压缩包里都没有才弹框 String checkLicFail = Inter.getLocText("FR-Designer-PluginLicense_Check_Failed"); FRLogger.getLogger().error(checkLicFail); throw new com.fr.plugin.PluginVerifyException(checkLicFail); - } } } From 2a5a2e10054f78574975f94e22794e9a32a56797 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:40:43 +0800 Subject: [PATCH 66/92] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index dcf5a6c89c..0d7bc4eac5 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -307,7 +307,7 @@ public class PluginHelper { File[] files = file.listFiles(); if (ArrayUtils.isNotEmpty(files)) { for (File f : files) { - if (foundConfigFile(f)) { + if (hasFoundConfigFile(f)) { return f; } } @@ -316,7 +316,7 @@ public class PluginHelper { return null; } - private static boolean foundConfigFile(File dir) { + private static boolean hasFoundConfigFile(File dir) { if (!dir.isDirectory()) { return false; } From c9e30586ecf68c7ae092db9f19b385b0705ae78b Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:40:58 +0800 Subject: [PATCH 67/92] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 0d7bc4eac5..c2bb480ecb 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -86,7 +86,7 @@ public class PluginHelper { } } - private static boolean invalidUser(String id, String username, String password) { + private static boolean isInvalidUser(String id, String username, String password) { if (StringUtils.isEmpty(id)) { return false; } else if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)){ From 016f5c2af133b1a2a63cda5e55eaebf003432b91 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 17:13:19 +0800 Subject: [PATCH 68/92] bugfix --- designer_base/src/com/fr/start/BaseDesigner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 49c49d9b5e..5d76b6a19e 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -24,7 +24,7 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.*; import com.fr.plugin.PluginCollector; -import com.fr.plugin.manager.PluginManager; +import com.fr.plugin.manage.PluginManager; import com.fr.stable.*; import javax.swing.*; From 01fcdf0740a4df44667977dd1dedecdb7a391a80 Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 24 Aug 2017 11:31:46 +0800 Subject: [PATCH 69/92] =?UTF-8?q?PFC-982=20=E4=BF=AE=E5=A4=8D=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E6=9D=83=E9=99=90=E9=A2=97=E7=B2=92=E5=BA=A6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=B6=E5=8D=A1=E6=AD=BB=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/AuthorityEditToolBarPane.java | 31 ++++++++++--------- .../mainframe/AuthorityToolBarPane.java | 31 ++++++++++--------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java index a760e0043b..d26b2d6eb7 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.base.FRContext; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListPane; @@ -20,6 +21,7 @@ import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.ArrayList; import java.util.List; /** @@ -96,23 +98,22 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { null || selectedPathArray == null) { return; } - for (int t = 0; t < selectedPathArray.length; t++) { - for (int i = 0; i < buttonlists.size(); i++) { - if (buttonlists.get(i).isSelected()) { - buttonlists.get(i).changeAuthorityState(selectedPathArray[t], buttonVisible.isSelected()); - authorityToolBarPane.repaint(); - } + ToolBarButton selectedButton = null; + //是否可见的checkbox + UICheckBox checkbox = (UICheckBox) e.getSource(); + for (int i = 0; i < buttonlists.size(); i++) { + if (buttonlists.get(i).isSelected()) { + selectedButton = buttonlists.get(i); } - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); - RolesAlreadyEditedPane.getInstance().refreshDockingView(); - UICheckBox checkbox = (UICheckBox) e.getSource(); - List btns = AuthorityEditPane.this.buttonlists; - for (int j = 0; j < btns.size(); j++) { - if (btns.get(j).isSelected()) { - //由引擎实现保存进模板报表 - authorityToolBarPane.setAuthorityWebAttr(btns.get(j).getWidget(), checkbox.isSelected(), selectedPathArray[t]); - } + } + if (selectedButton != null) { + for (int t = 0; t < selectedPathArray.length; t++) { + selectedButton.changeAuthorityState(selectedPathArray[t], buttonVisible.isSelected()); + authorityToolBarPane.repaint(); + authorityToolBarPane.setAuthorityWebAttr(selectedButton.getWidget(), checkbox.isSelected(), selectedPathArray[t]); } + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();//模版更新 + RolesAlreadyEditedPane.getInstance().refreshDockingView();//已配置角色视图刷新 } } }; diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index da856173a7..53c8893ecb 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -219,23 +219,24 @@ public class AuthorityToolBarPane extends BasicBeanPane Date: Thu, 24 Aug 2017 11:38:27 +0800 Subject: [PATCH 70/92] =?UTF-8?q?=E6=97=A0JIAR=E4=BB=BB=E5=8A=A1=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/DesignTableDataManager.java | 7 ++--- .../mainframe/loghandler/LogHandlerBar.java | 26 +------------------ 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/designer_base/src/com/fr/design/data/DesignTableDataManager.java b/designer_base/src/com/fr/design/data/DesignTableDataManager.java index 621e303b1b..5248c9626a 100644 --- a/designer_base/src/com/fr/design/data/DesignTableDataManager.java +++ b/designer_base/src/com/fr/design/data/DesignTableDataManager.java @@ -36,6 +36,7 @@ import java.io.ByteArrayOutputStream; import java.text.Collator; import java.util.*; import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; /** * 设计器管理操作数据集的类: @@ -54,11 +55,11 @@ public abstract class DesignTableDataManager { * 其实globalDsCache没有绝对的必要,只是为了操作方便。如果没有它,那么每次清空服务器数据集或者存储过程的时候,还要去遍历找一下, * 这个操作可能比较复杂 。 从减少代码复杂度的角度看,还是很有必要的 */ - private static java.util.Map globalDsCache = new java.util.HashMap(); - private static java.util.Map dsNameChangedMap = new HashMap(); + private static java.util.Map globalDsCache = new ConcurrentHashMap(); + private static java.util.Map dsNameChangedMap = new ConcurrentHashMap(); // private static List dsListeners = new ArrayList(); - private static Map> dsListenersMap = new HashMap>(); + private static Map> dsListenersMap = new ConcurrentHashMap>();; public static String NO_PARAMETER = "no_paramater_pane"; diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java b/designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java index eeba6c2fd6..9b33b3c111 100644 --- a/designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java +++ b/designer_base/src/com/fr/design/mainframe/loghandler/LogHandlerBar.java @@ -33,8 +33,6 @@ public class LogHandlerBar extends JPanel implements ItemSelectable { private int SERVERNUM = 0; private boolean isWithSerious; - private int i; - private Timer timer; public LogHandlerBar() { this(null); @@ -95,29 +93,7 @@ public class LogHandlerBar extends JPanel implements ItemSelectable { } public synchronized void timerPaint() { - isWithSerious = true; - timer = new Timer(500, null); - ActionListener taskAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (i < 5) { - isWithSerious = i % 2 == 0 ? true : false; - repaint(); - } else if (i == 5) { - if (timer == null) - return; - timer.stop(); - timer = null; - i = 0; - isWithSerious = true; - return; - } - i++; - } - }; - if (timer != null) { - timer.addActionListener(taskAction); - timer.start(); - } + repaint(); } public int getInfo() { From 0846a98d07e1047d0852cecfd907f5dbbe2c0b4b Mon Sep 17 00:00:00 2001 From: rinoux Date: Thu, 24 Aug 2017 14:51:24 +0800 Subject: [PATCH 71/92] sonarCube --- .../mainframe/AuthorityEditToolBarPane.java | 28 +++++++++------- .../mainframe/AuthorityToolBarPane.java | 33 ++++++++++--------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java index d26b2d6eb7..0b016c57e3 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java @@ -15,6 +15,7 @@ import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.webattr.ToolBarButton; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.tree.TreePath; @@ -37,8 +38,12 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { private AuthorityToolBarPane authorityToolBarPane; private String[] selectedPathArray; - public AuthorityEditToolBarPane(List buttonlists) { + public AuthorityEditToolBarPane(List buttonList) { super(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + this.init(buttonList); + } + + private void init(List buttonList) { this.setLayout(new BorderLayout()); this.setBorder(null); UILabel authorityTitle = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Permissions", @@ -54,7 +59,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { northPane.add(authorityTitle, BorderLayout.CENTER); northPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); this.add(northPane, BorderLayout.NORTH); - authorityEditPane = new AuthorityEditPane(buttonlists); + authorityEditPane = new AuthorityEditPane(buttonList); this.add(authorityEditPane, BorderLayout.CENTER); } @@ -94,8 +99,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { public void itemStateChanged(ItemEvent e) { String selectedRole = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); initSelectedPathArray(); - if (ComparatorUtils.equals(selectedRole, Inter.getLocText("FR-Designer_Role")) || selectedRole == - null || selectedPathArray == null) { + if (ComparatorUtils.equals(selectedRole, Inter.getLocText("FR-Designer_Role")) || selectedRole == null || selectedPathArray == null) { return; } ToolBarButton selectedButton = null; @@ -210,29 +214,29 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane { public void populateType() { - if (name.getText() == "") { - type.setText(""); + if (StringUtils.EMPTY.equals(name.getText())) { + type.setText(StringUtils.EMPTY); } else { type.setText(Inter.getLocText(new String[]{"ReportServerP-Toolbar", "FR-Designer_Form_Button"})); } } public void populateName() { - String names = ""; + StringBuilder names = new StringBuilder(); for (int i = 0; i < buttonlists.size(); i++) { if (buttonlists.get(i).isSelected()) { - names += "," + buttonlists.get(i).getNameOption().optionName(); + names.append(",").append(buttonlists.get(i).getNameOption().optionName()); } } - if (names != "") { - names = names.substring(1); + if (names.length() > 0) { + names.deleteCharAt(0); } - name.setText(names); + name.setText(names.toString()); } public void populateCheckPane() { checkPane.removeAll(); - if (name.getText() == "") { + if (StringUtils.EMPTY.equals(name.getText())) { return; } double f = TableLayout.FILL; diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index 53c8893ecb..44125ce1b2 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -215,26 +215,27 @@ public class AuthorityToolBarPane extends BasicBeanPane Date: Thu, 24 Aug 2017 14:55:24 +0800 Subject: [PATCH 72/92] sonarCube2 --- .../fr/design/mainframe/AuthorityToolBarPane.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index 44125ce1b2..682ddc3081 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -215,7 +215,7 @@ public class AuthorityToolBarPane extends BasicBeanPane extends BasicBeanPane Date: Thu, 24 Aug 2017 15:06:46 +0800 Subject: [PATCH 73/92] Sonar --- .../fr/design/mainframe/AuthorityToolBarPane.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java index 682ddc3081..7cd1930868 100644 --- a/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java +++ b/designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java @@ -242,14 +242,11 @@ public class AuthorityToolBarPane extends BasicBeanPane Date: Fri, 25 Aug 2017 12:50:52 +0800 Subject: [PATCH 74/92] =?UTF-8?q?DEC-8=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=87=8A=E6=94=BE=E6=8C=81=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E7=8E=AF=E5=A2=83=E7=9A=84=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 05e023135c..7df9da9249 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -574,7 +574,8 @@ public class RemoteEnv extends AbstractEnv { clock.stop(); // richer:把轮训使用的定时器也去掉 timer.cancel(); - + // 当前环境可能用了远程环境的缓存目录,释放一下 + CacheManager.getProviderInstance().setCacheDirectory(null); HashMap para = new HashMap(); para.put("op", "fr_remote_design"); para.put("cmd", "r_sign_out"); From 08ba12c27d148a138d89cf56e9faac704cb038a8 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 25 Aug 2017 14:52:24 +0800 Subject: [PATCH 75/92] =?UTF-8?q?DEC-8=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E5=B9=B2=E6=B6=89=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 7df9da9249..ee76793ead 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -574,8 +574,6 @@ public class RemoteEnv extends AbstractEnv { clock.stop(); // richer:把轮训使用的定时器也去掉 timer.cancel(); - // 当前环境可能用了远程环境的缓存目录,释放一下 - CacheManager.getProviderInstance().setCacheDirectory(null); HashMap para = new HashMap(); para.put("op", "fr_remote_design"); para.put("cmd", "r_sign_out"); @@ -2283,4 +2281,9 @@ public class RemoteEnv extends AbstractEnv { return StringUtils.EMPTY; } } + + @Override + public boolean isRemoteEnv() { + return true; + } } \ No newline at end of file From 0f52b449e8bc6bb9921eba48f4b675ae5cb0c81a Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 25 Aug 2017 15:40:12 +0800 Subject: [PATCH 76/92] =?UTF-8?q?DEC-8=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E5=B9=B2=E6=B6=89=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/start/Designer.java | 7 ++++++- designer_base/src/com/fr/env/RemoteEnv.java | 6 +----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index 09b7fa76e0..9c45691832 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -1,6 +1,7 @@ package com.fr.start; import com.fr.base.BaseUtils; +import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.core.ActionFactory; @@ -30,6 +31,7 @@ import com.fr.design.menu.ShortCut; import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignerModule; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.env.RemoteEnv; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.ProductConstants; @@ -432,7 +434,10 @@ public class Designer extends BaseDesigner { InformationCollector collector = InformationCollector.getInstance(); collector.collectStopTime(); collector.saveXMLFile(); - ServletContext.fireServletStopListener(); + Env currentEnv = FRContext.getCurrentEnv(); + if (!(currentEnv instanceof RemoteEnv)) {//远程环境不需要触发stop + ServletContext.fireServletStopListener(); + } } } \ 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 ee76793ead..05e023135c 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -574,6 +574,7 @@ public class RemoteEnv extends AbstractEnv { clock.stop(); // richer:把轮训使用的定时器也去掉 timer.cancel(); + HashMap para = new HashMap(); para.put("op", "fr_remote_design"); para.put("cmd", "r_sign_out"); @@ -2281,9 +2282,4 @@ public class RemoteEnv extends AbstractEnv { return StringUtils.EMPTY; } } - - @Override - public boolean isRemoteEnv() { - return true; - } } \ No newline at end of file From 2d315acc6f18593f09e67a283f59c253ac0fcfba Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 25 Aug 2017 16:02:23 +0800 Subject: [PATCH 77/92] =?UTF-8?q?DEC-8=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E5=B9=B2=E6=B6=89=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/start/Designer.java | 3 +-- designer_base/src/com/fr/env/RemoteEnv.java | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index 9c45691832..e8aa73f89b 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -31,7 +31,6 @@ import com.fr.design.menu.ShortCut; import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignerModule; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.env.RemoteEnv; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.ProductConstants; @@ -435,7 +434,7 @@ public class Designer extends BaseDesigner { collector.collectStopTime(); collector.saveXMLFile(); Env currentEnv = FRContext.getCurrentEnv(); - if (!(currentEnv instanceof RemoteEnv)) {//远程环境不需要触发stop + if (!currentEnv.isRemoteEnv()) {//远程环境不需要触发stop ServletContext.fireServletStopListener(); } } diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 05e023135c..440efed9f0 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -2282,4 +2282,9 @@ public class RemoteEnv extends AbstractEnv { return StringUtils.EMPTY; } } + + @Override + public boolean isRemoteEnv() { + return true; + } } \ No newline at end of file From 661a47614e267bf16904a5c709e6d8ba69747f1a Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Fri, 25 Aug 2017 16:07:56 +0800 Subject: [PATCH 78/92] 1 --- .../com/fr/design/locale/designer_ja_JP.properties | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 ca55e19127..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 @@ -228,7 +228,7 @@ FR-Designer-Collect_Information_free=\u7121\u6599 FR-Designer-Collect_Information_Description=\u8AAC\u660E FR-Designer-Collect_Information_Successfully=\u53CE\u96C6\u6210\u529F FR-Designer_Event_Set=\u30A4\u30D9\u30F3\u30C8\u8A2D\u5B9A -FR-Designer_Blow_set=\u6B21\u306E\u8A2D\u5B9A +FR-Designer_Blow_set=\u4EE5\u4E0B\u8A2D\u5B9A FR-Designer_I_Want_To_Set_Single=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u500B\u5225\u8A2D\u5B9A FR-Designer_Using_Server_Report_View_Settings=\u30B5\u30FC\u30D0\u8A2D\u5B9A FR-Designer_ErrorHandlerTemplate=\u30A8\u30E9\u30FC\u60C5\u5831\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u5B9A\u7FA9 @@ -507,7 +507,7 @@ FR-Designer_Property_panel=\u5C5E\u6027 FR-Designer_Select_panel=\u9078\u629E FR-Designer_LayoutTable_Column_Width=160 FR-Designer_Set_BG_Of_Current_Row=\u7DE8\u96C6\u884C\u80CC\u666F\u8A2D\u5B9A -FR-Designer_Unload_Check=\u672A\u30B3\u30DF\u30C3\u30C8\u30D2\u30F3\u30C8 +FR-Designer_Unload_Check=\u672A\u66F8\u304D\u8FBC\u307F\u6642\u6CE8\u610F FR-Designer_ReportColumns_Columns_Optional=\u6BB5\u7D44\u307F FR-Designer_Row_Icon_File_Name=row.png FR-Designer_Center_Display=\u4E2D\u592E\u63C3\u3048 @@ -2005,6 +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-Designer_Sheet_Label_Page_Display_Position=Sheet\u30E9\u30D9\u30EB\u30DA\u30FC\u30B8\u306E\u8868\u793A\u4F4D\u7F6E -FR-Designer_Provide_Choose_All=\u5168\u9078\u629E\u53EF\u80FD -FR-Designer_Decimal_Places=\u5C0F\u6570\u67A0\u6570: \ No newline at end of file +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 From 9570cd5645eb0216dd0ad927dc0c2820a16b9fd1 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Fri, 25 Aug 2017 16:11:22 +0800 Subject: [PATCH 79/92] 1 --- designer_base/src/com/fr/design/locale/designer.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 643fbf16a0..5bac16ca99 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -1,4 +1,4 @@ -FR-Designer-BBSLogin_Account= + FR-Designer-BBSLogin_Account= FR-Designer-BBSLogin_Connection-Failure= FR-Designer-BBSLogin_Connection-Failure-Tip= FR-Designer-BBSLogin_Forgot-Password= From 96269140176b56a0401819f547254c4260f96356 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Fri, 25 Aug 2017 16:12:23 +0800 Subject: [PATCH 80/92] 1 --- designer_base/src/com/fr/design/locale/designer.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 5bac16ca99..643fbf16a0 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -1,4 +1,4 @@ - FR-Designer-BBSLogin_Account= +FR-Designer-BBSLogin_Account= FR-Designer-BBSLogin_Connection-Failure= FR-Designer-BBSLogin_Connection-Failure-Tip= FR-Designer-BBSLogin_Forgot-Password= From b48b354e0e9e9000f1b5ac75be8960e34a343042 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 25 Aug 2017 16:17:52 +0800 Subject: [PATCH 81/92] =?UTF-8?q?DEC-8=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E5=B9=B2=E6=B6=89=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/start/Designer.java | 5 +---- designer_base/src/com/fr/env/RemoteEnv.java | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index e8aa73f89b..8fa1b5e6a3 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -36,7 +36,6 @@ import com.fr.general.Inter; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import com.fr.stable.web.ServletContext; import com.fr.stable.xml.XMLTools; import javax.swing.*; @@ -434,9 +433,7 @@ public class Designer extends BaseDesigner { collector.collectStopTime(); collector.saveXMLFile(); Env currentEnv = FRContext.getCurrentEnv(); - if (!currentEnv.isRemoteEnv()) {//远程环境不需要触发stop - ServletContext.fireServletStopListener(); - } + currentEnv.envQuit(); } } \ 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 440efed9f0..afacea95d0 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -2284,7 +2284,7 @@ public class RemoteEnv extends AbstractEnv { } @Override - public boolean isRemoteEnv() { - return true; + public void envQuit() { + } } \ No newline at end of file From bf350565668f18e8221f75e9d4058e6ebfb6761e Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Fri, 25 Aug 2017 16:29:42 +0800 Subject: [PATCH 82/92] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=20=E5=9B=BD=E9=99=85=E5=8C=96=E5=86=B2=E7=AA=81=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledata/tabledatapane/ClassTableDataPane.java | 5 +++++ .../src/com/fr/design/locale/designer_ja_JP.properties | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java index 7a40959ed2..0c32bcbabc 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java @@ -18,6 +18,7 @@ import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.script.Calculator; import com.fr.stable.ParameterProvider; +import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import javax.swing.*; @@ -160,6 +161,10 @@ public class ClassTableDataPane extends AbstractTableDataPane { @Override public void populateBean(ClassTableData ob) { + if(StringUtils.isEmpty(ob.getClassName())) { + return; + } + this.editorPane.populate(ob.getParameters(Calculator.createCalculator())); this.classNameTextField.setText(ob.getClassName()); } 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 11f0fb0d96..7fd4fb541d 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 @@ -228,7 +228,7 @@ FR-Designer-Collect_Information_free=\u7121\u6599 FR-Designer-Collect_Information_Description=\u8AAC\u660E FR-Designer-Collect_Information_Successfully=\u53CE\u96C6\u6210\u529F FR-Designer_Event_Set=\u30A4\u30D9\u30F3\u30C8\u8A2D\u5B9A -FR-Designer_Blow_set=\u4EE5\u4E0B\u8A2D\u5B9A +FR-Designer_Blow_set=\u6B21\u306E\u8A2D\u5B9A FR-Designer_I_Want_To_Set_Single=\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u500B\u5225\u8A2D\u5B9A FR-Designer_Using_Server_Report_View_Settings=\u30B5\u30FC\u30D0\u8A2D\u5B9A FR-Designer_ErrorHandlerTemplate=\u30A8\u30E9\u30FC\u60C5\u5831\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u5B9A\u7FA9 @@ -507,7 +507,7 @@ FR-Designer_Property_panel=\u5C5E\u6027 FR-Designer_Select_panel=\u9078\u629E FR-Designer_LayoutTable_Column_Width=160 FR-Designer_Set_BG_Of_Current_Row=\u7DE8\u96C6\u884C\u80CC\u666F\u8A2D\u5B9A -FR-Designer_Unload_Check=\u672A\u66F8\u304D\u8FBC\u307F\u6642\u6CE8\u610F +FR-Designer_Unload_Check=\u672A\u30B3\u30DF\u30C3\u30C8\u30D2\u30F3\u30C8 FR-Designer_ReportColumns_Columns_Optional=\u6BB5\u7D44\u307F FR-Designer_Row_Icon_File_Name=row.png FR-Designer_Center_Display=\u4E2D\u592E\u63C3\u3048 @@ -2005,7 +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-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-Designer_Sheet_Label_Page_Display_Position=Sheet\u30E9\u30D9\u30EB\u30DA\u30FC\u30B8\u306E\u8868\u793A\u4F4D\u7F6E +FR-Designer_Provide_Choose_All=\u5168\u9078\u629E\u53EF\u80FD +FR-Designer_Decimal_Places=\u5C0F\u6570\u67A0\u6570: FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9 \ No newline at end of file From 325d8b188c0d3093ff0560711e692fd64129779c Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 28 Aug 2017 14:38:28 +0800 Subject: [PATCH 83/92] =?UTF-8?q?DEC-8=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AF=AF=E5=88=A0=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/start/Designer.java | 2 +- designer_base/src/com/fr/env/RemoteEnv.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index 8fa1b5e6a3..526df8f096 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -433,7 +433,7 @@ public class Designer extends BaseDesigner { collector.collectStopTime(); collector.saveXMLFile(); Env currentEnv = FRContext.getCurrentEnv(); - currentEnv.envQuit(); + currentEnv.doWhenServerShutDown(); } } \ 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 afacea95d0..3c25fc7ff0 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -2284,7 +2284,7 @@ public class RemoteEnv extends AbstractEnv { } @Override - public void envQuit() { + public void doWhenServerShutDown() { } } \ No newline at end of file From 0e54c3d03a0d847b36e3e74660e0ac62c22d7a19 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Wed, 30 Aug 2017 11:32:37 +0800 Subject: [PATCH 84/92] =?UTF-8?q?=E6=B7=BB=E5=8A=A0echarts=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E7=B1=BB=EF=BC=8C=E8=A7=A3=E5=86=B3echart?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E4=B8=8D=E8=83=BD=E4=BD=BF=E7=94=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/type/UserDefinedChartTypePane.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java new file mode 100644 index 0000000000..1f40de8be2 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java @@ -0,0 +1,42 @@ +package com.fr.design.mainframe.chart.gui.type; + +import com.fr.chart.chartattr.Chart; + +/** + * Created by mengao on 2017/8/30. + * 不能删掉这个类,echarts插件中用到 + */ +public abstract class UserDefinedChartTypePane extends AbstractChartTypePane { + protected String[] getTypeLayoutPath() { + return new String[0]; + } + + protected String[] getTypeLayoutTipName(){ + return new String[0]; + } + + protected String[] getTypeIconPath(){ + return new String[]{"/com/fr/design/images/chart/default.png"}; + } + + protected String[] getTypeTipName() { + return new String[]{title4PopupWindow()}; + } + + public void updateBean(Chart chart) { + + } + + public void populateBean(Chart chart){ + typeDemo.get(0).isPressing = true; + checkDemosBackground(); + } + + /** + * 弹出界面的标题 + * @return 标题 + */ + public String title4PopupWindow(){ + return ""; + } +} From ee3fb9697eb2615f6fbea57750d0804b786d3e4b Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Fri, 1 Sep 2017 10:30:42 +0800 Subject: [PATCH 85/92] =?UTF-8?q?=E5=8E=BB=E6=8E=89ChartEditPane=E5=AF=B9P?= =?UTF-8?q?repare4DataSourceChange=E6=8E=A5=E5=8F=A3=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E3=80=82=20=E8=A7=A3=E5=86=B3=20=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=88=87=E6=8D=A2=E6=A8=A1=E6=9D=BF=E6=97=B6=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E8=A7=A6=E5=8F=91=E6=9F=A5=E8=AF=A2=20=20=20=E5=AE=A2?= =?UTF-8?q?=E6=88=B7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/chart/ChartEditPane.java | 62 ++++++++----------- 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index fc3b70108e..3397fe9f9c 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -6,8 +6,6 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.data.DesignTableDataManager; -import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.AttributeChangeListener; @@ -24,14 +22,12 @@ import com.fr.general.FRLogger; import com.fr.general.Inter; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange, ChartEditPaneProvider { +public class ChartEditPane extends BasicPane implements AttributeChange, ChartEditPaneProvider { private final static int CHANGE_MIN_TIME = 80; @@ -69,7 +65,9 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 paneList.add(otherPane); createTabsPane(); - registerDSChangeListener(); + + //TableDataComboBox 中有注册DSChangeListener,这里没有必要再次注册。 + //registerDSChangeListener(); } //构建主面板 @@ -119,7 +117,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } catch (CloneNotSupportedException e) { FRLogger.getLogger().error("error in clone ChartEditPane"); } - if(ComparatorUtils.equals(selectedPane.title4PopupWindow(),PaneTitleConstants.CHART_STYLE_TITLE)){ + if (ComparatorUtils.equals(selectedPane.title4PopupWindow(), PaneTitleConstants.CHART_STYLE_TITLE)) { dealWithStyleChange(); } @@ -130,10 +128,11 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 /** * 重新构造面板 + * * @param currentChart 图表 */ - public void reLayout(Chart currentChart){ - if(currentChart != null){ + public void reLayout(Chart currentChart) { + if (currentChart != null) { int chartIndex = getSelectedChartIndex(currentChart); this.removeAll(); this.setLayout(new BorderLayout()); @@ -142,21 +141,21 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 boolean isDefault = true; String plotID = ""; - if(currentChart.getPlot() != null){ + if (currentChart.getPlot() != null) { plotID = currentChart.getPlot().getPlotID(); isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); } - if(isDefault){ + if (isDefault) { paneList.add(dataPane4SupportCell); paneList.add(stylePane); paneList.add(otherPane); this.isDefaultPane = true; - }else{ + } else { ChartDataPane chartDataPane = createChartDataPane(plotID); paneList.add(chartDataPane); AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(plotID, listener); - for(int i = 0; i < otherPaneList.length; i++){ + for (int i = 0; i < otherPaneList.length; i++) { otherPaneList[i].addAttributeChangeListener(listener); paneList.add(otherPaneList[i]); } @@ -223,7 +222,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 return; } - if(checkNeedsReLayout(collection.getSelectedChart())){ + if (checkNeedsReLayout(collection.getSelectedChart())) { reLayout(collection.getSelectedChart()); } @@ -250,12 +249,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } } - public int getSelectedChartIndex(Chart chart){ + public int getSelectedChartIndex(Chart chart) { int index = 0; - if(typePane != null){ + if (typePane != null) { FurtherBasicBeanPane[] paneList = typePane.getPaneList(); - for(; index < paneList.length; index++){ - if(paneList[index].accept(chart)){ + for (; index < paneList.length; index++) { + if (paneList[index].accept(chart)) { return index; } } @@ -264,12 +263,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } //populate的时候看看要不要重构面板 - private boolean checkNeedsReLayout(Chart chart){ - if(chart != null){ + private boolean checkNeedsReLayout(Chart chart) { + if (chart != null) { int lastIndex = typePane.getSelectedIndex(); int currentIndex = getSelectedChartIndex(chart); boolean currentPane = true; - if(chart.getPlot() != null){ + if (chart.getPlot() != null) { String plotID = chart.getPlot().getPlotID(); currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); } @@ -280,9 +279,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 /** * 当前界面是否是默认的界面 + * * @return 是否是默认的界面 */ - public boolean isDefaultPane(){ + public boolean isDefaultPane() { return this.isDefaultPane; } @@ -314,15 +314,16 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } } - protected void dealWithStyleChange(){ + protected void dealWithStyleChange() { } /** - *主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 + * 主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 + * * @param isFromToolBar 是否来自工具栏 */ - public void styleChange(boolean isFromToolBar){ + public void styleChange(boolean isFromToolBar) { } @@ -335,15 +336,4 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 paneList.get(index).addAttributeChangeListener(listener); } - /** - * 数据集改变的事件监听 - */ - public void registerDSChangeListener() { - DesignTableDataManager.addDsChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); - attrPane.refreshChartDataPane(collection); - } - }); - } } \ No newline at end of file From 0c79b531631a51954882f5410faf20aab89f5a46 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 4 Sep 2017 14:19:43 +0800 Subject: [PATCH 86/92] =?UTF-8?q?REPORT-4296=20frm=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=A0=8F=E6=97=A0=E6=B3=95=E6=AD=A3=E5=B8=B8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/FormParaWidgetPane.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index 929e10110a..bfc7406dea 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -286,7 +286,9 @@ public class FormParaWidgetPane extends JPanel { private int calculateWidgetWindowRowNum() { //向上取整 - int rowNum = (int) Math.ceil((double) predifinedwidgeList.size() / (double) preWidgetShowMaxNum); + int eastRowNum = (int) Math.ceil((double) predifinedwidgeList.size() / (double) preWidgetShowMaxNum); + int westRowNum = (int) Math.ceil((double) loadWidgetOptions().length / (double) commonWidgetNum); + int rowNum = Math.max(eastRowNum, westRowNum); rowNum = Math.max(rowNum, 2); rowNum = Math.min(rowNum, preWidgetShowMaxRow); return rowNum; From db3afdf2838ff3236950c9b7189d1e8e50aafa5e Mon Sep 17 00:00:00 2001 From: MoMeak Date: Mon, 4 Sep 2017 15:42:35 +0800 Subject: [PATCH 87/92] =?UTF-8?q?REPORT-4345=20=E8=AE=BE=E7=BD=AE=E4=BA=86?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E7=9A=84=E5=8D=95=E5=85=83=E6=A0=BC=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E5=A4=8D=E5=88=B6=E5=90=8E=EF=BC=8C=E5=9C=A8=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E9=9D=A2=E6=9D=BF=E7=BB=99=E5=85=B6=E4=B8=AD=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=8D=95=E5=85=83=E6=A0=BC=E6=9B=B4=E6=94=B9=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E8=AE=BE=E7=BD=AE=EF=BC=8C=E5=88=99=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E7=9A=84=E8=BF=87=E6=BB=A4=E9=83=BD?= =?UTF-8?q?=E4=BC=9A=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/grid/IntelliElements.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/grid/IntelliElements.java b/designer/src/com/fr/grid/IntelliElements.java index 475235e568..a5d8055637 100644 --- a/designer/src/com/fr/grid/IntelliElements.java +++ b/designer/src/com/fr/grid/IntelliElements.java @@ -194,7 +194,12 @@ public class IntelliElements { TemplateCellElement newCellElement = new DefaultTemplateCellElement(colIndex, rowIndex); applyStyle(newCellElement, sourceCellElement);//style if (sourceCellElement.getValue() instanceof DSColumn) { - DSColumn dsColumn = (DSColumn) sourceCellElement.getValue(); + DSColumn dsColumn = null; + try { + dsColumn = (DSColumn) ((DSColumn) sourceCellElement.getValue()).clone(); + } catch (CloneNotSupportedException e) { + FRContext.getLogger().error(e.getMessage(), e); + } newCellElement.setValue(dsColumn); newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr()); } else if (sourceCellElement.getValue() instanceof Number) { From 4124ad704b8f230b13cc9814eb35916e01396ffc Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 5 Sep 2017 17:40:22 +0800 Subject: [PATCH 88/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E6=9F=A5=E8=AF=A2bug=EF=BC=8C=E6=95=B4?= =?UTF-8?q?=E7=90=86chartEditPane=E5=8A=A0=E8=BD=BD=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/impl/AbstractIndependentChartUI.java | 3 +- ...bstractIndependentChartUIWithAPILevel.java | 3 +- .../fun/impl/AbstractIndependentChartsUI.java | 2 +- .../design/mainframe/ChartPropertyPane.java | 8 ++- .../mainframe/MiddleChartPropertyPane.java | 6 +- .../design/mainframe/chart/ChartEditPane.java | 71 ++++++++++++------- .../mainframe/chart/ChartsEditPane.java | 9 +++ 7 files changed, 64 insertions(+), 38 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java index 848fc44367..b5cd25a7f5 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java @@ -12,7 +12,6 @@ import com.fr.design.mainframe.chart.ChartsConfigPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.ComparatorUtils; -import com.fr.stable.StableUtils; /** @@ -58,7 +57,7 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr return new DataSeriesConditionPane(); } - public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} + public ChartEditPane getChartEditPane(String plotID){ return ChartEditPane.getInstance();} public ChartsConfigPane getChartConfigPane(String plotID){return null;} diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java index 8aa412a6e3..cd8dbdcfcd 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -12,7 +12,6 @@ import com.fr.design.mainframe.chart.ChartsConfigPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.ComparatorUtils; -import com.fr.stable.StableUtils; /** * Created by Mitisky on 16/3/7. @@ -69,7 +68,7 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ return getPlotTypePane().title4PopupWindow(); } - public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} + public ChartEditPane getChartEditPane(String plotID){ return ChartEditPane.getInstance();} public ChartsConfigPane getChartConfigPane(String plotID){return null;} } diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java index fbd3ce36f1..703852c206 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java @@ -97,7 +97,7 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple @Override public ChartEditPane getChartEditPane(String plotID) { - return new ChartsEditPane(); + return ChartsEditPane.getInstance(); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java index f29efe7af6..64e2c0f79f 100644 --- a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java @@ -14,9 +14,10 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ * 创建图表属性表实例. */ private synchronized static ChartPropertyPane getInstance() { - //todo //创建新图表时,创建属性表配置面板 - singleton = new ChartPropertyPane(); + if (singleton == null) { + singleton = new ChartPropertyPane(); + } return singleton; } @@ -36,6 +37,9 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ @Override protected void createMainPane() { + this.removeAll(); + createNameLabel(); + this.add(createNorthComponent(), BorderLayout.NORTH); this.add(chartEditPane, BorderLayout.CENTER); } diff --git a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java index 1d9732205d..5548e1ba79 100644 --- a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java @@ -15,7 +15,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.general.Inter; -import com.fr.stable.StableUtils; import javax.swing.*; import java.awt.*; @@ -34,10 +33,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ protected void initComponenet() { this.setLayout(new BorderLayout()); this.setBorder(null); - - createNameLabel(); - this.add(createNorthComponent(), BorderLayout.NORTH); - chartEditPane = StableUtils.construct(ChartEditPane.class); + chartEditPane = ChartEditPane.getInstance(); chartEditPane.setSupportCellData(true); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index 3397fe9f9c..5784293d1f 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -6,6 +6,8 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.AttributeChangeListener; @@ -22,12 +24,23 @@ import com.fr.general.FRLogger; import com.fr.general.Inter; import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -public class ChartEditPane extends BasicPane implements AttributeChange, ChartEditPaneProvider { +public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange, ChartEditPaneProvider { + + public synchronized static ChartEditPane getInstance() { + if (singleton == null) { + singleton = new ChartEditPane(); + } + return singleton; + } + + private static ChartEditPane singleton; private final static int CHANGE_MIN_TIME = 80; @@ -65,9 +78,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd paneList.add(otherPane); createTabsPane(); - - //TableDataComboBox 中有注册DSChangeListener,这里没有必要再次注册。 - //registerDSChangeListener(); + registerDSChangeListener(); } //构建主面板 @@ -117,7 +128,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd } catch (CloneNotSupportedException e) { FRLogger.getLogger().error("error in clone ChartEditPane"); } - if (ComparatorUtils.equals(selectedPane.title4PopupWindow(), PaneTitleConstants.CHART_STYLE_TITLE)) { + if(ComparatorUtils.equals(selectedPane.title4PopupWindow(),PaneTitleConstants.CHART_STYLE_TITLE)){ dealWithStyleChange(); } @@ -128,11 +139,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd /** * 重新构造面板 - * * @param currentChart 图表 */ - public void reLayout(Chart currentChart) { - if (currentChart != null) { + public void reLayout(Chart currentChart){ + if(currentChart != null){ int chartIndex = getSelectedChartIndex(currentChart); this.removeAll(); this.setLayout(new BorderLayout()); @@ -141,21 +151,21 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd boolean isDefault = true; String plotID = ""; - if (currentChart.getPlot() != null) { + if(currentChart.getPlot() != null){ plotID = currentChart.getPlot().getPlotID(); isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); } - if (isDefault) { + if(isDefault){ paneList.add(dataPane4SupportCell); paneList.add(stylePane); paneList.add(otherPane); this.isDefaultPane = true; - } else { + }else{ ChartDataPane chartDataPane = createChartDataPane(plotID); paneList.add(chartDataPane); AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(plotID, listener); - for (int i = 0; i < otherPaneList.length; i++) { + for(int i = 0; i < otherPaneList.length; i++){ otherPaneList[i].addAttributeChangeListener(listener); paneList.add(otherPaneList[i]); } @@ -222,7 +232,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd return; } - if (checkNeedsReLayout(collection.getSelectedChart())) { + if(checkNeedsReLayout(collection.getSelectedChart())){ reLayout(collection.getSelectedChart()); } @@ -249,12 +259,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd } } - public int getSelectedChartIndex(Chart chart) { + public int getSelectedChartIndex(Chart chart){ int index = 0; - if (typePane != null) { + if(typePane != null){ FurtherBasicBeanPane[] paneList = typePane.getPaneList(); - for (; index < paneList.length; index++) { - if (paneList[index].accept(chart)) { + for(; index < paneList.length; index++){ + if(paneList[index].accept(chart)){ return index; } } @@ -263,12 +273,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd } //populate的时候看看要不要重构面板 - private boolean checkNeedsReLayout(Chart chart) { - if (chart != null) { + private boolean checkNeedsReLayout(Chart chart){ + if(chart != null){ int lastIndex = typePane.getSelectedIndex(); int currentIndex = getSelectedChartIndex(chart); boolean currentPane = true; - if (chart.getPlot() != null) { + if(chart.getPlot() != null){ String plotID = chart.getPlot().getPlotID(); currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); } @@ -279,10 +289,9 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd /** * 当前界面是否是默认的界面 - * * @return 是否是默认的界面 */ - public boolean isDefaultPane() { + public boolean isDefaultPane(){ return this.isDefaultPane; } @@ -314,16 +323,15 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd } } - protected void dealWithStyleChange() { + protected void dealWithStyleChange(){ } /** - * 主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 - * + *主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 * @param isFromToolBar 是否来自工具栏 */ - public void styleChange(boolean isFromToolBar) { + public void styleChange(boolean isFromToolBar){ } @@ -336,4 +344,15 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd paneList.get(index).addAttributeChangeListener(listener); } + /** + * 数据集改变的事件监听 + */ + public void registerDSChangeListener() { + DesignTableDataManager.addDsChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); + attrPane.refreshChartDataPane(collection); + } + }); + } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java index 3f35c585dc..87873cfd85 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java @@ -13,6 +13,15 @@ import java.util.ArrayList; public class ChartsEditPane extends ChartEditPane { protected ChartsConfigPane chartsConfigPane; + private static ChartEditPane single; + + public synchronized static ChartEditPane getInstance() { + if (single == null) { + single = new ChartsEditPane(); + } + return single; + } + public ChartsEditPane() { this.setLayout(new BorderLayout()); From f8cd4e13c5161888fd12066277551b915b07475f Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 5 Sep 2017 19:16:40 +0800 Subject: [PATCH 89/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E6=9F=A5=E8=AF=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/impl/AbstractIndependentChartUI.java | 3 +- ...bstractIndependentChartUIWithAPILevel.java | 3 +- .../fun/impl/AbstractIndependentChartsUI.java | 2 +- .../design/mainframe/ChartPropertyPane.java | 10 +--- .../mainframe/MiddleChartPropertyPane.java | 60 ++++++++++--------- .../design/mainframe/chart/ChartEditPane.java | 13 +--- .../mainframe/chart/ChartsEditPane.java | 9 --- 7 files changed, 43 insertions(+), 57 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java index b5cd25a7f5..848fc44367 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java @@ -12,6 +12,7 @@ import com.fr.design.mainframe.chart.ChartsConfigPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.ComparatorUtils; +import com.fr.stable.StableUtils; /** @@ -57,7 +58,7 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr return new DataSeriesConditionPane(); } - public ChartEditPane getChartEditPane(String plotID){ return ChartEditPane.getInstance();} + public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} public ChartsConfigPane getChartConfigPane(String plotID){return null;} diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java index cd8dbdcfcd..8aa412a6e3 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -12,6 +12,7 @@ import com.fr.design.mainframe.chart.ChartsConfigPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.ComparatorUtils; +import com.fr.stable.StableUtils; /** * Created by Mitisky on 16/3/7. @@ -68,7 +69,7 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ return getPlotTypePane().title4PopupWindow(); } - public ChartEditPane getChartEditPane(String plotID){ return ChartEditPane.getInstance();} + public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} public ChartsConfigPane getChartConfigPane(String plotID){return null;} } diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java index 703852c206..fbd3ce36f1 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java @@ -97,7 +97,7 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple @Override public ChartEditPane getChartEditPane(String plotID) { - return ChartsEditPane.getInstance(); + return new ChartsEditPane(); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java index 64e2c0f79f..868fefbf76 100644 --- a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java @@ -14,10 +14,9 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ * 创建图表属性表实例. */ private synchronized static ChartPropertyPane getInstance() { + //todo //创建新图表时,创建属性表配置面板 - if (singleton == null) { - singleton = new ChartPropertyPane(); - } + singleton = new ChartPropertyPane(); return singleton; } @@ -31,15 +30,12 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ return new Dimension(super.getPreferredSize().width, 18); } }; - nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); + nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); nameLabel.setHorizontalAlignment(SwingConstants.CENTER); } @Override protected void createMainPane() { - this.removeAll(); - createNameLabel(); - this.add(createNorthComponent(), BorderLayout.NORTH); this.add(chartEditPane, BorderLayout.CENTER); } diff --git a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java index 5548e1ba79..4ddd8740c2 100644 --- a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java @@ -15,6 +15,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.general.Inter; +import com.fr.stable.StableUtils; import javax.swing.*; import java.awt.*; @@ -29,11 +30,14 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ public MiddleChartPropertyPane() { initComponenet(); } - + protected void initComponenet() { this.setLayout(new BorderLayout()); this.setBorder(null); - chartEditPane = ChartEditPane.getInstance(); + + createNameLabel(); + this.add(createNorthComponent(), BorderLayout.NORTH); + chartEditPane = StableUtils.construct(ChartEditPane.class); chartEditPane.setSupportCellData(true); } @@ -43,11 +47,11 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ this.createMainPane(); setSureProperty(); } - + protected abstract void createNameLabel(); - + protected abstract JComponent createNorthComponent(); - + protected abstract void createMainPane(); @@ -63,7 +67,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); resetChartEditPane(); } - + protected void resetChartEditPane() { remove(chartEditPane); add(chartEditPane, BorderLayout.CENTER); @@ -71,20 +75,20 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ repaint(); revalidate(); } - + protected TitleChangeListener titleListener = new TitleChangeListener() { - + @Override public void fireTitleChange(String addName) { nameLabel.setText(Inter.getLocText("Chart-Property_Table") + '-' + addName); } }; - /** - * 感觉ChartCollection加载图表属性界面. - * @param collection 收集图表 - * @param ePane 面板 - */ + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ public void populateChartPropertyPane(ChartCollection collection, TargetComponent ePane) { addChartEditPane(collection.getSelectedChart().getPlot().getPlotID()); setSupportCellData(true); @@ -92,11 +96,11 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ chartEditPane.populate(collection); } - /** - * 感觉ChartCollection加载图表属性界面. - * @param collection 收集图表 - * @param ePane 面板 - */ + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent ePane) { if (collection instanceof ChartCollection) { populateChartPropertyPane((ChartCollection)collection, ePane); @@ -123,18 +127,18 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ return BaseUtils.readIcon("/com/fr/design/images/m_report/qb.png"); } - /** - * 预定义定位 - * @return 定位 - */ + /** + * 预定义定位 + * @return 定位 + */ public Location preferredLocation() { return Location.WEST_BELOW; } - /** - * 创建标题Panel - * @return 标题panel - */ + /** + * 创建标题Panel + * @return 标题panel + */ public UITitlePanel createTitlePanel() { return new UITitlePanel(this); } @@ -144,9 +148,9 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ */ public void refreshDockingView() { // TODO Auto-generated method stub - + } - + /** * 设置是否支持单元格数据. */ diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index 5784293d1f..fed9d2a824 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -33,15 +33,6 @@ import java.util.List; public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange, ChartEditPaneProvider { - public synchronized static ChartEditPane getInstance() { - if (singleton == null) { - singleton = new ChartEditPane(); - } - return singleton; - } - - private static ChartEditPane singleton; - private final static int CHANGE_MIN_TIME = 80; protected ChartCollection collection; @@ -351,7 +342,9 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); - attrPane.refreshChartDataPane(collection); + if (attrPane.isShowing()) { + attrPane.refreshChartDataPane(collection); + } } }); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java index 87873cfd85..3f35c585dc 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java @@ -13,15 +13,6 @@ import java.util.ArrayList; public class ChartsEditPane extends ChartEditPane { protected ChartsConfigPane chartsConfigPane; - private static ChartEditPane single; - - public synchronized static ChartEditPane getInstance() { - if (single == null) { - single = new ChartsEditPane(); - } - return single; - } - public ChartsEditPane() { this.setLayout(new BorderLayout()); From a2e131d0cfd164866e90ffcbd2a879a9be71062f Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 5 Sep 2017 19:17:49 +0800 Subject: [PATCH 90/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E6=9F=A5=E8=AF=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/chart/ChartEditPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index fed9d2a824..f141f092f3 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -342,6 +342,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); + //不显示,没有处于编辑状态,没必要更新。 if (attrPane.isShowing()) { attrPane.refreshChartDataPane(collection); } From f4e5bf1ec6995afd5a01242eb1867911e4866f16 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 5 Sep 2017 19:19:48 +0800 Subject: [PATCH 91/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/chart/ChartEditPane.java | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index f141f092f3..e66ac1da70 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -31,7 +31,7 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.List; -public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange, ChartEditPaneProvider { +public class ChartEditPane extends BasicPane implements AttributeChange, Prepare4DataSourceChange, ChartEditPaneProvider { private final static int CHANGE_MIN_TIME = 80; @@ -119,7 +119,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } catch (CloneNotSupportedException e) { FRLogger.getLogger().error("error in clone ChartEditPane"); } - if(ComparatorUtils.equals(selectedPane.title4PopupWindow(),PaneTitleConstants.CHART_STYLE_TITLE)){ + if (ComparatorUtils.equals(selectedPane.title4PopupWindow(), PaneTitleConstants.CHART_STYLE_TITLE)) { dealWithStyleChange(); } @@ -130,10 +130,11 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 /** * 重新构造面板 + * * @param currentChart 图表 */ - public void reLayout(Chart currentChart){ - if(currentChart != null){ + public void reLayout(Chart currentChart) { + if (currentChart != null) { int chartIndex = getSelectedChartIndex(currentChart); this.removeAll(); this.setLayout(new BorderLayout()); @@ -142,21 +143,21 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 boolean isDefault = true; String plotID = ""; - if(currentChart.getPlot() != null){ + if (currentChart.getPlot() != null) { plotID = currentChart.getPlot().getPlotID(); isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); } - if(isDefault){ + if (isDefault) { paneList.add(dataPane4SupportCell); paneList.add(stylePane); paneList.add(otherPane); this.isDefaultPane = true; - }else{ + } else { ChartDataPane chartDataPane = createChartDataPane(plotID); paneList.add(chartDataPane); AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(plotID, listener); - for(int i = 0; i < otherPaneList.length; i++){ + for (int i = 0; i < otherPaneList.length; i++) { otherPaneList[i].addAttributeChangeListener(listener); paneList.add(otherPaneList[i]); } @@ -223,7 +224,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 return; } - if(checkNeedsReLayout(collection.getSelectedChart())){ + if (checkNeedsReLayout(collection.getSelectedChart())) { reLayout(collection.getSelectedChart()); } @@ -250,12 +251,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } } - public int getSelectedChartIndex(Chart chart){ + public int getSelectedChartIndex(Chart chart) { int index = 0; - if(typePane != null){ + if (typePane != null) { FurtherBasicBeanPane[] paneList = typePane.getPaneList(); - for(; index < paneList.length; index++){ - if(paneList[index].accept(chart)){ + for (; index < paneList.length; index++) { + if (paneList[index].accept(chart)) { return index; } } @@ -264,12 +265,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } //populate的时候看看要不要重构面板 - private boolean checkNeedsReLayout(Chart chart){ - if(chart != null){ + private boolean checkNeedsReLayout(Chart chart) { + if (chart != null) { int lastIndex = typePane.getSelectedIndex(); int currentIndex = getSelectedChartIndex(chart); boolean currentPane = true; - if(chart.getPlot() != null){ + if (chart.getPlot() != null) { String plotID = chart.getPlot().getPlotID(); currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); } @@ -280,9 +281,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 /** * 当前界面是否是默认的界面 + * * @return 是否是默认的界面 */ - public boolean isDefaultPane(){ + public boolean isDefaultPane() { return this.isDefaultPane; } @@ -314,15 +316,16 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } } - protected void dealWithStyleChange(){ + protected void dealWithStyleChange() { } /** - *主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 + * 主要用于图表设计器,判断样式改变是否来自工具栏的全局样式按钮 + * * @param isFromToolBar 是否来自工具栏 */ - public void styleChange(boolean isFromToolBar){ + public void styleChange(boolean isFromToolBar) { } From ff3cd152cb4a5d06d42b917552f58db4d4f88d16 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 5 Sep 2017 19:27:23 +0800 Subject: [PATCH 92/92] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/MiddleChartPropertyPane.java | 5 +++-- .../com/fr/design/mainframe/chart/ChartEditPane.java | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java index 4ddd8740c2..53609b49d5 100644 --- a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java @@ -16,6 +16,7 @@ import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.general.Inter; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -64,7 +65,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ chartEditPane.setContainer(container); chartEditPane.addTitleChangeListener(titleListener); String tabname = chartEditPane.getSelectedTabName(); - nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); + nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : StringUtils.EMPTY)); resetChartEditPane(); } @@ -155,7 +156,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ * 设置是否支持单元格数据. */ public void setSupportCellData(boolean supportCellData) { - if(chartEditPane != null) { + if (chartEditPane != null) { chartEditPane.setSupportCellData(supportCellData); } } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index e66ac1da70..f681f275e8 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -22,6 +22,7 @@ import com.fr.design.mainframe.chart.gui.ChartTypePane; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -142,7 +143,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare addTypePane(); boolean isDefault = true; - String plotID = ""; + String plotID = StringUtils.EMPTY; if (currentChart.getPlot() != null) { plotID = currentChart.getPlot().getPlotID(); isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); @@ -179,6 +180,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare } protected void setSelectedTab() { + //doNothing } /** @@ -224,7 +226,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare return; } - if (checkNeedsReLayout(collection.getSelectedChart())) { + if (isNeedsReLayout(collection.getSelectedChart())) { reLayout(collection.getSelectedChart()); } @@ -265,7 +267,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare } //populate的时候看看要不要重构面板 - private boolean checkNeedsReLayout(Chart chart) { + private boolean isNeedsReLayout(Chart chart) { if (chart != null) { int lastIndex = typePane.getSelectedIndex(); int currentIndex = getSelectedChartIndex(chart); @@ -317,7 +319,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare } protected void dealWithStyleChange() { - + //doNothing } /** @@ -326,7 +328,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare * @param isFromToolBar 是否来自工具栏 */ public void styleChange(boolean isFromToolBar) { - + //doNothing } /**