From 2dec51c51e3f55f3b997d23264e55ca87b667710 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 26 Sep 2016 19:12:25 +0800 Subject: [PATCH 001/244] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 6aff74d7ca..5b5d233c47 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -2098,7 +2098,7 @@ public class RemoteEnv implements Env { * @param serviceID */ @Override - public void pluginServiceStart(String serviceID){ + public void pluginServiceStart(String serviceID, String customAttr){ } @Override From bd35dadab75a84e0404ada00419dfa29c9924c9a Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 27 Sep 2016 10:59:33 +0800 Subject: [PATCH 002/244] update --- .../src/com/fr/design/extra/PluginHelper.java | 33 +++++++++++++++++++ designer_base/src/com/fr/env/RemoteEnv.java | 2 +- 2 files changed, 34 insertions(+), 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 5d0c9fa1a9..b258d495d2 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -140,6 +140,14 @@ public class PluginHelper { List list = dependence.getDependPlugins(); for (int i = 0;list != null && i < list.size(); i++){ PluginDependenceUnit dependenceUnit = list.get(i); + //覆盖型依赖,立即下载安装 + if (dependenceUnit.isCover()){ + try { + installCoverDependence(dependenceUnit); + } catch (Exception e) { + throw new PluginDependenceException(); + } + } if (!dependenceUnit.checkFileEnv()){ needInstallDependence.add(dependenceUnit); } @@ -153,6 +161,31 @@ public class PluginHelper { installDependenceOnline(currentID, needInstallDependence); } + public static void installCoverDependence(PluginDependenceUnit dependenceUnit) throws Exception { + HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceUnit.getDependenceID())); + if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { + InputStream reader = httpClient.getResponseStream(); + String temp = StableUtils.pathJoin(PluginHelper.DEPENDENCE_DOWNLOAD_PATH, PluginHelper.TEMP_FILE); + StableUtils.makesureFileExist(new File(temp)); + FileOutputStream writer = new FileOutputStream(temp); + byte[] buffer = new byte[PluginConstants.BYTES_NUM]; + int bytesRead = 0; + while ((bytesRead = reader.read(buffer)) > 0) { + writer.write(buffer, 0, bytesRead); + buffer = new byte[PluginConstants.BYTES_NUM]; + } + reader.close(); + writer.flush(); + writer.close(); + + + //安装文件 + IOUtils.unZipFilesGBK(temp, FRContext.getCurrentEnv().getPath() + dependenceUnit.getDependenceDir()); + }else { + throw new PluginDependenceException(); + } + } + /** * 构造一个下载UI diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 5b5d233c47..6aff74d7ca 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -2098,7 +2098,7 @@ public class RemoteEnv implements Env { * @param serviceID */ @Override - public void pluginServiceStart(String serviceID, String customAttr){ + public void pluginServiceStart(String serviceID){ } @Override From cd7e2f1b5d27621f01b1f13a69f3c29e7a58b937 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 10 Oct 2016 20:27:04 +0800 Subject: [PATCH 003/244] uu --- .../fr/design/ChartTypeInterfaceManager.java | 8 +++ .../chart/gui/ChartTypeButtonPane.java | 19 ++++++ .../mainframe/chart/gui/ChartTypePane.java | 66 ++++++++++++++++++- 3 files changed, 91 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 2dfb2b8cdd..534c0ed2d7 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -55,12 +55,17 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh private static ChartTypeInterfaceManager classManager = null; + //所有图表存储器 private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); + //插件图表存储器 + private static LinkedHashMap vanChartTypeInterfaces = new LinkedHashMap(); + public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); + vanChartTypeInterfaces.clear(); } return classManager; } @@ -149,6 +154,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (chartTypeInterfaces != null && !chartTypeInterfaces.containsKey(plotID)) { chartTypeInterfaces.put(plotID, provider); } + if (vanChartTypeInterfaces != null && !vanChartTypeInterfaces.containsKey(plotID)) { + vanChartTypeInterfaces.put(plotID, provider); + } } /** diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 0d6891050f..69e67b9c0f 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui; import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.SwitchState; import com.fr.chart.charttypes.ColumnIndependentChart; import com.fr.design.beans.BasicBeanPane; import com.fr.design.event.UIObserver; @@ -11,6 +12,7 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; @@ -34,6 +36,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private static final int B_H = 20; private static final int COL_COUNT = 3; + private AbstractChartAttrPane parent; private UIButton addButton; private ArrayList indexList = new ArrayList(); @@ -89,6 +92,11 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); } + public ChartTypeButtonPane(AbstractChartAttrPane parent){ + this(); + this.parent = parent; + } + ActionListener addListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -101,6 +109,13 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen indexList.add(button); if (editingCollection != null) { + //判断当前编辑的图表类型 + if(!ComparatorUtils.equals(editingCollection.getSelectedChart().getClass(), Chart.class)){ + editingCollection.setState(SwitchState.NEW); + }else { + editingCollection.setState(SwitchState.DEFAULT); + } + Chart[] barChart = ColumnIndependentChart.columnChartTypes; try { Chart newChart = (Chart) barChart[0].clone(); @@ -112,6 +127,10 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } layoutPane(buttonPane); + + if (parent != null){ + parent.populate(editingCollection); + } } }; 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 2203f4963b..8112866fdb 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 @@ -4,15 +4,19 @@ import com.fr.base.FRContext; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.SwitchState; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; import javax.swing.*; import java.awt.*; @@ -34,7 +38,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ protected JPanel createContentPane() { JPanel content = new JPanel(new BorderLayout()); - buttonPane = new ChartTypeButtonPane(); + buttonPane = new ChartTypeButtonPane(this); content.add(buttonPane, BorderLayout.NORTH); chartTypePane = new ComboBoxPane(); @@ -130,14 +134,72 @@ public class ChartTypePane extends AbstractChartAttrPane{ } } } + + public void populateBean(ChartCollection collection) { + Chart chart = collection.getSelectedChart(); + switch (collection.getState()){ + case NEW:{ + reactorComboBoxItem(chart, true); + break; + } + case DEFAULT:{ + reactorComboBoxItem(chart, false); + break; + } + case NONE:{ + populateBean(chart); + break; + } + default:{ + populateBean(chart); + } + } + } + + private void reactorComboBoxItem(Chart chart, boolean isVanChart){ + //重构下拉选项 + if (jcb != null) { + jcb.removeAllItems(); + } + //重构下拉框选项 + for (int i = 0; i < this.cards.size(); i++) { + String name = cards.get(i).title4PopupWindow(); + if (name.contains(Inter.getLocText("Plugin-ChartF_NewChart")) && isVanChart){ + jcb.addItem(cards.get(i).title4PopupWindow()); + }else if (!name.contains(Inter.getLocText("Plugin-ChartF_NewChart")) && !isVanChart) { + jcb.addItem(cards.get(i).title4PopupWindow()); + } + } + + for (int i = 0; i < this.cards.size(); i++) { + FurtherBasicBeanPane pane = cards.get(i); + if (pane.accept(chart)) { + pane.populateBean(chart); + int index = getJcbIndex(pane, jcb); + jcb.setSelectedIndex(index); + return; + } + } + } + + private int getJcbIndex(FurtherBasicBeanPane pane, UIComboBox jcb) { + String name = pane.title4PopupWindow(); + for (int i = 0; i < jcb.getItemCount(); i++){ + if (ComparatorUtils.equals(name, jcb.getItemAt(i))){ + return i; + } + } + return 0; + } } + /** * 更新界面属性 用于展示 */ public void populate(ChartCollection collection) { Chart chart = collection.getSelectedChart(); - chartTypePane.populateBean(chart); + chartTypePane.populateBean(collection); buttonPane.populateBean(collection); } From 583ce08dc9e13d9a7dd0d46c3cdd6ec81df965c1 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 13 Oct 2016 13:32:35 +0800 Subject: [PATCH 004/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2-?= =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/frpane/UIComboBoxPane.java | 14 +- .../fr/design/gui/icombobox/UIComboBox.java | 6 +- .../chart/gui/ChartTypeButtonPane.java | 31 ++-- .../mainframe/chart/gui/ChartTypePane.java | 139 ++++++++++++------ .../chart/gui/item/FlexibleComboBox.java | 95 ++++++++++++ .../chart/gui/item/ItemEvenType.java | 37 +++++ 6 files changed, 254 insertions(+), 68 deletions(-) create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEvenType.java diff --git a/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java b/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java index 9d31cd4f35..73b065f069 100644 --- a/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java @@ -25,7 +25,7 @@ public abstract class UIComboBoxPane extends BasicBeanPane { protected JPanel cardPane; protected List> cards; - private String[] cardNames; + protected String[] cardNames; public UIComboBoxPane() { cards = initPaneList(); @@ -49,6 +49,14 @@ public abstract class UIComboBoxPane extends BasicBeanPane { addComboBoxItem(cards, i); } + addItemChangeEvent(); + + initLayout(); + + jcb.setSelectedIndex(0); + } + + protected void addItemChangeEvent() { jcb.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { @@ -57,10 +65,6 @@ public abstract class UIComboBoxPane extends BasicBeanPane { cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); } }); - - initLayout(); - - jcb.setSelectedIndex(0); } protected UIComboBox createComboBox() { diff --git a/designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java b/designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java index 90944c4496..d6d1496746 100644 --- a/designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java +++ b/designer_base/src/com/fr/design/gui/icombobox/UIComboBox.java @@ -37,7 +37,7 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser private static final int SIZE5 = 5; - private UIObserverListener uiObserverListener; + protected UIObserverListener uiObserverListener; private String comboBoxName = ""; @@ -71,7 +71,7 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser initListener(); } - private void initListener() { + protected void initListener() { if (shouldResponseChangeListener()) { this.addFocusListener(new FocusAdapter() { @Override @@ -94,7 +94,7 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser } } - private void fireSetGlobalName() { + protected void fireSetGlobalName() { if (globalNameListener != null && shouldResponseNameListener()) { globalNameListener.setGlobalName(comboBoxName); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 69e67b9c0f..c25f031a2a 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -12,7 +12,6 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; @@ -36,7 +35,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private static final int B_H = 20; private static final int COL_COUNT = 3; - private AbstractChartAttrPane parent; + private ChartTypePane parent; private UIButton addButton; private ArrayList indexList = new ArrayList(); @@ -92,7 +91,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); } - public ChartTypeButtonPane(AbstractChartAttrPane parent){ + public ChartTypeButtonPane(ChartTypePane parent){ this(); this.parent = parent; } @@ -109,13 +108,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen indexList.add(button); if (editingCollection != null) { - //判断当前编辑的图表类型 - if(!ComparatorUtils.equals(editingCollection.getSelectedChart().getClass(), Chart.class)){ - editingCollection.setState(SwitchState.NEW); - }else { - editingCollection.setState(SwitchState.DEFAULT); - } - Chart[] barChart = ColumnIndependentChart.columnChartTypes; try { Chart newChart = (Chart) barChart[0].clone(); @@ -128,12 +120,22 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } layoutPane(buttonPane); - if (parent != null){ - parent.populate(editingCollection); - } + //刷新下拉框 + refreshChangeMode(); } + + }; + private void refreshChangeMode() { + //判断当前编辑的图表,对否开启多图表切换模式 + boolean stateChange = editingCollection.setMultiChartMode(); + //只有状态切换了才会重构下拉选项 + if (parent != null && stateChange){ + parent.fireReactor(editingCollection); + } + } + MouseListener mouseListener = new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { @@ -391,8 +393,9 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } } } - relayoutPane(); + + refreshChangeMode(); } private void relayoutPane() { 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 8112866fdb..7d43b91256 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 @@ -4,22 +4,24 @@ import com.fr.base.FRContext; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; -import com.fr.chart.chartattr.SwitchState; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.mainframe.chart.gui.item.ItemEvenType; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; -import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import javax.swing.*; import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; @@ -33,7 +35,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ private ChartTypeButtonPane buttonPane; private ChartEditPane editPane; private ChartCollection editingCollection; - @Override protected JPanel createContentPane() { JPanel content = new JPanel(new BorderLayout()); @@ -84,7 +85,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ public String title4PopupWindow() { return PaneTitleConstants.CHART_TYPE_TITLE; } - + class ComboBoxPane extends UIComboBoxPane{ @Override protected List> initPaneList() { @@ -100,9 +101,10 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void updateBean(Chart chart) { int lastSelectIndex = editPane.getSelectedChartIndex(chart); + FlexibleComboBox fcb = (FlexibleComboBox)jcb; try{ - Chart newDefaultChart = (Chart)((AbstractChartTypePane)cards.get(jcb.getSelectedIndex())).getDefaultChart().clone(); + Chart newDefaultChart = (Chart)((AbstractChartTypePane)cards.get(fcb.getRelatedSelectedIndex())).getDefaultChart().clone(); if(!chart.accept(newDefaultChart.getClass())){ //vanChart 和 chart 之间切换 editingCollection.removeNameObject(editingCollection.getSelectedIndex()); @@ -114,7 +116,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ } //这一步会替换plot - ((AbstractChartTypePane) cards.get(jcb.getSelectedIndex())).updateBean(chart); + ((AbstractChartTypePane) cards.get(fcb.getRelatedSelectedIndex())).updateBean(chart); Plot plot = chart.getPlot(); @@ -129,77 +131,122 @@ public class ChartTypePane extends AbstractChartAttrPane{ boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && lastSelectIndex != jcb.getSelectedIndex())){ + if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && lastSelectIndex != fcb.getRelatedSelectedIndex())){ editPane.reLayout(chart); } } } - public void populateBean(ChartCollection collection) { - Chart chart = collection.getSelectedChart(); - switch (collection.getState()){ - case NEW:{ - reactorComboBoxItem(chart, true); - break; - } - case DEFAULT:{ - reactorComboBoxItem(chart, false); - break; - } - case NONE:{ - populateBean(chart); - break; + @Override + public void populateBean(Chart ob) { + for (int i = 0; i < this.cards.size(); i++) { + FurtherBasicBeanPane pane = cards.get(i); + if (pane.accept(ob)) { + pane.populateBean(ob); + ((FlexibleComboBox)jcb).setRelatedSelectedIndex(i); + return; } - default:{ - populateBean(chart); + } + } + + @Override + protected UIComboBox createComboBox() { + FlexibleComboBox comboBox = new FlexibleComboBox(); + //初始化分界线 + int partition = 0; + for (int i = 0; i < this.cards.size(); i++) { + String name = cards.get(i).title4PopupWindow(); + if (name.contains(Inter.getLocText("Plugin-ChartF_NewChart"))) { + partition++; } } + comboBox.setPartition(partition); + return comboBox; } - private void reactorComboBoxItem(Chart chart, boolean isVanChart){ - //重构下拉选项 - if (jcb != null) { - jcb.removeAllItems(); + + /** + * 下拉框重构条件 + * 1、从None->Default(multiMode) + * 2、从None->New(multiMode) + * 3、从Default->None(singleMode) + * 4、从New->None(singleMode) + * @param is2MultiMode + * @param isVanChart + */ + private void reactorComboBoxItem(boolean is2MultiMode, boolean isVanChart){ + if (jcb == null){ + return; } + //重构下拉选项 + FlexibleComboBox fcb = (FlexibleComboBox)jcb; + //重构前,保存相对下标 + int relativeIndex = is2MultiMode ? fcb.getSelectedIndex() : fcb.getRelatedSelectedIndex(); + //多图表切换模式 + fcb.setMultiMode(is2MultiMode); + //设置当前切换是新图表还是老图表 + fcb.setBottom(!isVanChart); //重构下拉框选项 + fcb.setItemEvenType(ItemEvenType.REACTOR); + jcb.removeAllItems(); for (int i = 0; i < this.cards.size(); i++) { String name = cards.get(i).title4PopupWindow(); - if (name.contains(Inter.getLocText("Plugin-ChartF_NewChart")) && isVanChart){ + if (is2MultiMode && (name.contains(Inter.getLocText("Plugin-ChartF_NewChart")) && isVanChart)) { jcb.addItem(cards.get(i).title4PopupWindow()); - }else if (!name.contains(Inter.getLocText("Plugin-ChartF_NewChart")) && !isVanChart) { + } else if (is2MultiMode && (!name.contains(Inter.getLocText("Plugin-ChartF_NewChart")) && !isVanChart)) { + jcb.addItem(cards.get(i).title4PopupWindow()); + }else if (!is2MultiMode){ jcb.addItem(cards.get(i).title4PopupWindow()); } } + //重构完成 + fcb.setItemEvenType(ItemEvenType.DEFAULT); + //重置选择项 + fcb.setRelatedSelectedIndex(relativeIndex); + } - for (int i = 0; i < this.cards.size(); i++) { - FurtherBasicBeanPane pane = cards.get(i); - if (pane.accept(chart)) { - pane.populateBean(chart); - int index = getJcbIndex(pane, jcb); - jcb.setSelectedIndex(index); - return; + @Override + protected void addItemChangeEvent() { + jcb.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + //如果是在进行重构,则不触发状态改变事件 + FlexibleComboBox fcb = (FlexibleComboBox)jcb; + if (fcb.isReactor()){ + return; + } + comboBoxItemStateChanged(); + CardLayout cl = (CardLayout)cardPane.getLayout(); + cl.show(cardPane, cardNames[((FlexibleComboBox)jcb).getRelatedSelectedIndex()]); } - } + }); } + } - private int getJcbIndex(FurtherBasicBeanPane pane, UIComboBox jcb) { - String name = pane.title4PopupWindow(); - for (int i = 0; i < jcb.getItemCount(); i++){ - if (ComparatorUtils.equals(name, jcb.getItemAt(i))){ - return i; - } + public void fireReactor(ChartCollection collection) { + switch (collection.getState()){ + case NEW:{ + this.chartTypePane.reactorComboBoxItem(true, true); + break; } - return 0; + case DEFAULT:{ + this.chartTypePane.reactorComboBoxItem(true, false); + break; + } + case NONE:{ + this.chartTypePane.reactorComboBoxItem(false, false); + break; + } + default:this.chartTypePane.reactorComboBoxItem(false, false); } } - /** * 更新界面属性 用于展示 */ public void populate(ChartCollection collection) { Chart chart = collection.getSelectedChart(); - chartTypePane.populateBean(collection); + chartTypePane.populateBean(chart); buttonPane.populateBean(collection); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java new file mode 100644 index 0000000000..0bec554f4f --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java @@ -0,0 +1,95 @@ +package com.fr.design.mainframe.chart.gui.item; + +import com.fr.design.gui.icombobox.UIComboBox; + +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * Created by hufan on 2016/10/11. + */ +public class FlexibleComboBox extends UIComboBox { + //新旧分界线 + private int partition = 0; + //分界线上还是分界线下 + private boolean bottom = true; + //图表是否开启切换模式 + private boolean multiMode = false; + //当前下拉框处理的事件类型 + private ItemEvenType itemEvenType = ItemEvenType.DEFAULT; + + public boolean isReactor(){ + return itemEvenType == ItemEvenType.REACTOR; + } + + public int getPartition() { + return partition; + } + + public void setPartition(int partition) { + this.partition = partition; + } + + public boolean isBottom() { + return bottom; + } + + public void setBottom(boolean bottom) { + this.bottom = bottom; + } + + public boolean isMultiMode() { + return multiMode; + } + + public void setMultiMode(boolean multiMode) { + this.multiMode = multiMode; + } + + public ItemEvenType getItemEvenType() { + return itemEvenType; + } + + public void setItemEvenType(ItemEvenType itemEvenType) { + this.itemEvenType = itemEvenType; + } + + public int getRelatedSelectedIndex(){ + return isMultiMode() && isBottom() ? (super.getSelectedIndex() + partition) : super.getSelectedIndex(); + } + + public void setRelatedSelectedIndex(int index){ + if (isMultiMode() && isBottom()){ + super.setSelectedIndex(index - partition); + }else { + super.setSelectedIndex(index); + } + } + + @Override + protected void initListener() { + if (shouldResponseChangeListener()) { + this.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + fireSetGlobalName(); + } + }); + this.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (uiObserverListener == null) { + return; + } + fireSetGlobalName(); + //只有不在重构状态才会触发下拉框选择时的改变事件 + if (e.getStateChange() == ItemEvent.SELECTED && !isReactor()) { + uiObserverListener.doChange(); + } + } + }); + } + } +} diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEvenType.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEvenType.java new file mode 100644 index 0000000000..5ef941a69c --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEvenType.java @@ -0,0 +1,37 @@ +package com.fr.design.mainframe.chart.gui.item; + +import com.fr.general.ComparatorUtils; + +/** + * Created by hufan on 2016/10/11. + */ +public enum ItemEvenType { + REACTOR("reactor"),//重构选项 + DEFAULT("default")//默认选项操作 + ; + + //这个String会存起来的,不能随意更改。 + private String type; + + private ItemEvenType(String type){ + this.type = type; + } + + public String getType() { + return this.type; + } + + private static ItemEvenType[] types; + + public static ItemEvenType parse(String type){ + if(types == null){ + types = ItemEvenType.values(); + } + for(ItemEvenType itemEvenType : types){ + if(ComparatorUtils.equals(itemEvenType.getType(), type)){ + return itemEvenType; + } + } + return DEFAULT; + } +} From ef5d820b000220a6ccf8af674d3f4e1eeec3c741 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 13 Oct 2016 13:45:05 +0800 Subject: [PATCH 005/244] update --- .../src/com/fr/design/ChartTypeInterfaceManager.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 534c0ed2d7..e92a6156e3 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -58,14 +58,10 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh //所有图表存储器 private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); - //插件图表存储器 - private static LinkedHashMap vanChartTypeInterfaces = new LinkedHashMap(); - public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); - vanChartTypeInterfaces.clear(); } return classManager; } @@ -154,9 +150,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (chartTypeInterfaces != null && !chartTypeInterfaces.containsKey(plotID)) { chartTypeInterfaces.put(plotID, provider); } - if (vanChartTypeInterfaces != null && !vanChartTypeInterfaces.containsKey(plotID)) { - vanChartTypeInterfaces.put(plotID, provider); - } } /** From 586625a568d2270653d028b10a8258cf807b924d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 13 Oct 2016 13:45:50 +0800 Subject: [PATCH 006/244] update --- designer_base/src/com/fr/design/extra/PluginHelper.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index b258d495d2..302b6df8e3 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -140,14 +140,6 @@ public class PluginHelper { List list = dependence.getDependPlugins(); for (int i = 0;list != null && i < list.size(); i++){ PluginDependenceUnit dependenceUnit = list.get(i); - //覆盖型依赖,立即下载安装 - if (dependenceUnit.isCover()){ - try { - installCoverDependence(dependenceUnit); - } catch (Exception e) { - throw new PluginDependenceException(); - } - } if (!dependenceUnit.checkFileEnv()){ needInstallDependence.add(dependenceUnit); } From 239c32b85e68a055428648f07aa81e6e252dadf4 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 13 Oct 2016 13:46:36 +0800 Subject: [PATCH 007/244] update --- .../src/com/fr/design/extra/PluginHelper.java | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 302b6df8e3..f510646f84 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -153,32 +153,6 @@ public class PluginHelper { installDependenceOnline(currentID, needInstallDependence); } - public static void installCoverDependence(PluginDependenceUnit dependenceUnit) throws Exception { - HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceUnit.getDependenceID())); - if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { - InputStream reader = httpClient.getResponseStream(); - String temp = StableUtils.pathJoin(PluginHelper.DEPENDENCE_DOWNLOAD_PATH, PluginHelper.TEMP_FILE); - StableUtils.makesureFileExist(new File(temp)); - FileOutputStream writer = new FileOutputStream(temp); - byte[] buffer = new byte[PluginConstants.BYTES_NUM]; - int bytesRead = 0; - while ((bytesRead = reader.read(buffer)) > 0) { - writer.write(buffer, 0, bytesRead); - buffer = new byte[PluginConstants.BYTES_NUM]; - } - reader.close(); - writer.flush(); - writer.close(); - - - //安装文件 - IOUtils.unZipFilesGBK(temp, FRContext.getCurrentEnv().getPath() + dependenceUnit.getDependenceDir()); - }else { - throw new PluginDependenceException(); - } - } - - /** * 构造一个下载UI * @param currentID From fb7c74f2d78250cae6d93c81c95ea1f6c1603e2e Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 14 Oct 2016 09:13:44 +0800 Subject: [PATCH 008/244] =?UTF-8?q?=E9=87=8D=E7=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_chart/src/com/fr/design/chart/gui/ChartComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java index d898640feb..9dd851c340 100644 --- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java +++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java @@ -312,7 +312,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene // chartGlyph.draw(g2d, ScreenResolution.getScreenResolution()); //不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单 //其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边 - Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution()); + Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this); g2d.drawImage(chartImage, 0, 0, null); } } From 3a52b254013f156df3c9ae33e58784eb125b5ac9 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 14 Oct 2016 14:12:54 +0800 Subject: [PATCH 009/244] =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/ChartTypeInterfaceManager.java | 4 +++- .../mainframe/chart/gui/ChartTypeButtonPane.java | 14 ++++++++++---- .../design/mainframe/chart/gui/ChartTypePane.java | 7 +++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index e92a6156e3..d11f3cd464 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -78,7 +78,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh GeneralContext.addPluginReadListener(new PluginReadListener() { @Override public void success() { - ChartTypeInterfaceManager.getInstance().readDefault(); + if (chartTypeInterfaces.size() == 0) { + ChartTypeInterfaceManager.getInstance().readDefault(); + } //重新注册designModuleFactory DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index c25f031a2a..8326966065 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -108,9 +108,15 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen indexList.add(button); if (editingCollection != null) { - Chart[] barChart = ColumnIndependentChart.columnChartTypes; + //这个地方应该判断是clone VanChart还是clone Chart + Chart[] clonedChart = null; + if (editingCollection.getState() == SwitchState.NEW) { + + }else { + clonedChart = ColumnIndependentChart.columnChartTypes; + } try { - Chart newChart = (Chart) barChart[0].clone(); + Chart newChart = (Chart) clonedChart[0].clone(); editingCollection.addNamedChart(name, newChart); editingCollection.addFunctionRecord(newChart); } catch (CloneNotSupportedException e1) { @@ -275,9 +281,9 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //新建一个collection if(editingCollection != null && editingCollection.getChartCount() == 1){ //vanChart 不支持图表切换 目前 - if(!ComparatorUtils.equals(editingCollection.getSelectedChart().getClass(), Chart.class)){ + /*if(!ComparatorUtils.equals(editingCollection.getSelectedChart().getClass(), Chart.class)){ addButton.setVisible(false); - } + }*/ } } 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 7d43b91256..df0e4858c2 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 @@ -118,6 +118,8 @@ public class ChartTypePane extends AbstractChartAttrPane{ //这一步会替换plot ((AbstractChartTypePane) cards.get(fcb.getRelatedSelectedIndex())).updateBean(chart); + String chartID = chart.getChartID(); + Plot plot = chart.getPlot(); if(plot != null){ @@ -199,10 +201,11 @@ public class ChartTypePane extends AbstractChartAttrPane{ jcb.addItem(cards.get(i).title4PopupWindow()); } } - //重构完成 - fcb.setItemEvenType(ItemEvenType.DEFAULT); //重置选择项 fcb.setRelatedSelectedIndex(relativeIndex); + //重构完成 + fcb.setItemEvenType(ItemEvenType.DEFAULT); + } @Override From 5df5d10bf29d5fb0d7aa0df613716002c58a7503 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 14 Oct 2016 16:04:55 +0800 Subject: [PATCH 010/244] =?UTF-8?q?=E6=8F=90=E5=8D=87=E5=B0=B1=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=BA=A7=E5=88=AB=EF=BC=8C=E5=BD=93=E5=81=9A=E6=96=B0?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java | 2 +- .../src/com/fr/design/mainframe/chart/gui/ChartTypePane.java | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) 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 ffe91cd0d0..6c7ba66d80 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 @@ -15,7 +15,7 @@ import com.fr.general.ComparatorUtils; * Created by Mitisky on 16/3/7. */ public abstract class AbstractIndependentChartUIWithAPILevel implements IndependentChartUIProvider { - private static final int OLD_PLUGIN_LEVEL = -2; + private static final int OLD_PLUGIN_LEVEL = 3; @Override //以前的插件没有覆写这个方法,所以始终获取到-2,比当前level低,提示更新. 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 df0e4858c2..0604d32663 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 @@ -118,8 +118,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ //这一步会替换plot ((AbstractChartTypePane) cards.get(fcb.getRelatedSelectedIndex())).updateBean(chart); - String chartID = chart.getChartID(); - Plot plot = chart.getPlot(); if(plot != null){ From 0d8e87ef311570f837299ff5e75f4f0b61c0b747 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 14 Oct 2016 18:44:58 +0800 Subject: [PATCH 011/244] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/widget/UITreeComboBox.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index 7f55ddeafe..a3a68ee83a 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -107,14 +107,16 @@ public class UITreeComboBox extends JComboBox{ class UITreeComboBoxRenderer extends DefaultListCellRenderer { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ - if(value != null){ - TreePath path = (TreePath)value; + if(tree != null ){ + TreePath path = tree.getSelectedTreePath()[0]; + tree.setAndScrollSelectionPath(path); Object node = path.getLastPathComponent(); value = node; TreeCellRenderer r = tree.getCellRenderer(); JLabel lb = (JLabel)r.getTreeCellRendererComponent( tree, value, isSelected, false, false, index, cellHasFocus); + return lb; } return super.getListCellRendererComponent(list, value, index, @@ -138,6 +140,9 @@ public class UITreeComboBox extends JComboBox{ setSelectedItem(paths[0]); MenuSelectionManager.defaultManager().clearSelectedPath(); } else { + tree.refreshUI(); + tree.refreshTreeRoot(); + repaint(); return; } From eef8d94ed79723885e9fe7733b4755bd8b9c0d41 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 14 Oct 2016 18:48:05 +0800 Subject: [PATCH 012/244] rt --- .../src/com/fr/design/mainframe/widget/UITreeComboBox.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index a3a68ee83a..ef01c7b711 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -141,9 +141,7 @@ public class UITreeComboBox extends JComboBox{ MenuSelectionManager.defaultManager().clearSelectedPath(); } else { tree.refreshUI(); - tree.refreshTreeRoot(); repaint(); - return; } } From 59ec7cb7259ca8f74c4906b1e9dc5d8bb38ac227 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 14 Oct 2016 18:54:04 +0800 Subject: [PATCH 013/244] rt --- .../fr/design/mainframe/ComponentTree.java | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index 2b490e8bef..a2c5b55e5e 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -39,11 +39,8 @@ public class ComponentTree extends JTree { this.setDropMode(DropMode.ON_OR_INSERT); this.setTransferHandler(new TreeTransferHandler()); this.refreshTreeRoot(); - TreePath[] paths = getSelectedTreePath(); addTreeSelectionListener(designer); - setSelectionPaths(paths); - designer.addDesignerEditListener(new TreeDesignerEditAdapter()); this.addMouseListener(new MouseAdapter() { @Override @@ -162,40 +159,7 @@ public class ComponentTree extends JTree { return paths; } - private class TreeDesignerEditAdapter implements DesignerEditListener { - @Override - public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { - TreePath[] paths = getSelectedTreePath(); - - if (paths.length == 1) { - setAndScrollSelectionPath(paths[0]); - } else { - setSelectionPaths(paths); - } - } else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { - ComponentTree.this.refreshUI(); - TreePath[] paths = getSelectedTreePath(); - - if (paths.length == 1) { - setAndScrollSelectionPath(paths[0]); - } else { - setSelectionPaths(paths); - } - ComponentTree.this.repaint(); - - } else { - ComponentTree.this.refreshUI(); - ComponentTree.this.repaint(); - } - } - - @Override - public boolean equals(Object o) { - return o.getClass() == this.getClass(); - } - } /** From dfdcec7eacc3f018947d9044b1759b2db57ed02c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 14 Oct 2016 18:54:29 +0800 Subject: [PATCH 014/244] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/WidgetPropertyPane.java | 145 ++++++++++++++++-- 1 file changed, 136 insertions(+), 9 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index a385aed284..67524bfbbe 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -4,17 +4,26 @@ import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.WidgetPropertyTable; +import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.parameter.ParameterPropertyPane; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; + import javax.swing.*; +import javax.swing.border.LineBorder; import java.awt.*; import java.util.ArrayList; import java.util.List; @@ -29,6 +38,18 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper private EventPropertyTable eventTable; private List widgetPropertyTables; private FormDesigner designer; + private ComponentTree componentTree; + private JPanel wsp; + private ParameterPropertyPane parameterPropertyPane; + private MobileWidgetTable mobileWidgetTable; + private MobileBodyWidgetTable mobileBodyWidgetTable; + private UIScrollPane downPanel; + private JPanel centerPane; + private CardLayout cardLayout; + public static final String PARA = "para"; + public static final String BODY = "body"; + public static final int NODE_LENGTH = 2; + public boolean isrefresh = true; public static WidgetPropertyPane getInstance() { if (HOLDER.singleton == null) { @@ -52,6 +73,37 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper setLayout(FRGUIPaneFactory.createBorderLayout()); } + public class mobileWidgetDesignerAdapter implements DesignerEditListener { + + public mobileWidgetDesignerAdapter() { + } + + /** + * 响应界面改变事件 + * @param evt 事件 + */ + public void fireCreatorModified(DesignerEvent evt) { + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED + || evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED + || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED + || evt.getCreatorEventID() == DesignerEvent.CREATOR_ADDED) { + int value = downPanel.getVerticalScrollBar().getValue(); + if(hasSelectParaPane(getEditingFormDesigner())){ + cardLayout.show(centerPane,PARA); + mobileWidgetTable.refresh(); + } else { + cardLayout.show(centerPane,BODY); + mobileBodyWidgetTable.refresh(); + } + //出现滚动条 + downPanel.doLayout(); + //控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0 + //此处设置滚动条值为刷新前 + downPanel.getVerticalScrollBar().setValue(value); + } + } + } + @Override public String getViewTitle() { return Inter.getLocText("Form-Widget_Property_Table"); @@ -64,12 +116,24 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper @Override public void refreshDockingView() { + designer = this.getEditingFormDesigner(); removeAll(); if (designer == null) { clearDockingView(); return; } + + componentTree = new ComponentTree(designer); + + ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel(); + XCreator root = (XCreator)treeModel.getRoot(); + int childCount = treeModel.getChildCount(root); + //按照节点添加para在下的,但这里需要para节点在上,调整一下位置 + if(childCount == NODE_LENGTH){ + adjustPosition(treeModel, designer); + } + widgetPropertyTables = new ArrayList(); propertyTable = new WidgetPropertyTable(designer); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); @@ -81,30 +145,93 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper eventTable.setBorder(null); UIScrollPane esp = new UIScrollPane(eventTable); esp.setBorder(null); -// JTabbedPane tabbedPane = new JTabbedPane(); + + wsp = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wsp.setBorder(null); + mobileWidgetTable = new MobileWidgetTable(designer); + mobileBodyWidgetTable = new MobileBodyWidgetTable(designer); + designer.addDesignerEditListener(new mobileWidgetDesignerAdapter()); + centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + cardLayout = (CardLayout) centerPane.getLayout(); + centerPane.add(mobileWidgetTable,PARA); + centerPane.add(mobileBodyWidgetTable,BODY); + if(hasSelectParaPane(designer)){ + cardLayout.show(centerPane,PARA); + + } else { + cardLayout.show(centerPane,BODY); + } + downPanel = new UIScrollPane(centerPane); + downPanel.setBorder(new LineBorder(Color.gray)); + wsp.add(downPanel,BorderLayout.CENTER); + UITabbedPane tabbedPane = new UITabbedPane(); + tabbedPane.setOpaque(true); tabbedPane.setBorder(null); tabbedPane.setTabPlacement(SwingConstants.BOTTOM); tabbedPane.addTab(Inter.getLocText("Form-Properties"), psp); tabbedPane.addTab(Inter.getLocText("Form-Events"), esp); + tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp); WidgetPropertyUIProvider[] widgetAttrProviders = getExtraPropertyUIProviders(); - for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { - AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable(); - widgetPropertyTables.add(propertyTable); - designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); - UIScrollPane uiScrollPane = new UIScrollPane(propertyTable); - uiScrollPane.setBorder(null); - tabbedPane.addTab(widgetAttrProvider.tableTitle(), uiScrollPane); + if (widgetAttrProviders.length == 0) { + UILabel upLabel = new UILabel(Inter.getLocText("FR-Widget_Mobile_Table"),SwingConstants.CENTER); + upLabel.setBorder(BorderFactory.createEmptyBorder(6,0,6,0)); + wsp.add(upLabel,BorderLayout.NORTH); + } else { + for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { + AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable(); + widgetPropertyTables.add(propertyTable); + designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); + UIScrollPane uiScrollPane = new UIScrollPane(propertyTable); + uiScrollPane.setBorder(null); + wsp.add(uiScrollPane); + + } } - add(tabbedPane, BorderLayout.CENTER); + parameterPropertyPane = ParameterPropertyPane.getInstance(designer); + parameterPropertyPane.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 4)); + add(parameterPropertyPane, BorderLayout.NORTH); + add(tabbedPane, BorderLayout.CENTER); propertyTable.initPropertyGroups(null); eventTable.refresh(); for (AbstractPropertyTable propertyTable : widgetPropertyTables) { propertyTable.initPropertyGroups(designer); } + isrefresh = false; + } + + + /** + * 调整结构树para和body的位置 + * + * @param treeModel + * @param formDesigner + */ + private void adjustPosition(ComponentTreeModel treeModel,FormDesigner formDesigner){ + XCreator root = (XCreator)treeModel.getRoot(); + if(treeModel.getChild(root,0) instanceof XWParameterLayout){ + return; + } + root.add((Component)(treeModel.getChild(root,0)),1); + treeModel.setRoot(root); + componentTree = new ComponentTree(formDesigner,treeModel); + } + // + /** + * 选中的组件是否在参数面板里 + * @param designer 设计器 + * @return 是则返回true + */ + public boolean hasSelectParaPane(FormDesigner designer){ + XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); + if(xCreator == null){ + xCreator = designer.getRootComponent(); + } + XLayoutContainer container = XCreatorUtils.getHotspotContainer(xCreator); + return xCreator.acceptType(XWParameterLayout.class) || container.acceptType(XWParameterLayout.class); } /** From 1b0ed5b2fbe6353d9ac580843fedeba8b333a1e5 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 14 Oct 2016 18:55:28 +0800 Subject: [PATCH 015/244] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A0=91=E6=94=BE?= =?UTF-8?q?=E5=88=B0=E4=B8=8B=E6=8B=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormHierarchyTreePane.java | 314 +++++++++--------- 1 file changed, 165 insertions(+), 149 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java index 34fb5c6014..bf88a9fc51 100644 --- a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -1,12 +1,14 @@ package com.fr.design.mainframe; -import java.awt.BorderLayout; -import java.awt.Component; +import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.BorderFactory; import javax.swing.Icon; +import com.fr.design.actions.community.NeedAction; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.mainframe.widget.UITreeComboBox; import com.fr.design.parameter.HierarchyTreePane; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWParameterLayout; @@ -43,11 +45,13 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree public static final int NODE_LENGTH = 2; public static final int PARA = 0; public static final int BODY = 1; - + private ComponentTree componentTree; + private UITreeComboBox treeComboBox; + private JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); // richer:搜寻树节点的的文本框 - private UITextField searchTextField; - private SearchResultPane searchResult; +// private UITextField searchTextField; +// private SearchResultPane searchResult; public static FormHierarchyTreePane getInstance() { return HOLDER.singleton; @@ -86,8 +90,8 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree */ public void clearDockingView() { this.componentTree = null; - this.searchTextField = null; - this.searchResult = null; +// this.searchTextField = null; +// this.searchResult = null; add(new JScrollPane(), BorderLayout.CENTER); } @@ -103,53 +107,65 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree return; } componentTree = new ComponentTree(formDesigner); - + ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel(); XCreator root = (XCreator)treeModel.getRoot(); int childCount = treeModel.getChildCount(root); //按照节点添加para在下的,但这里需要para节点在上,调整一下位置 if(childCount == NODE_LENGTH){ - adjustPosition(treeModel,formDesigner); + adjustPosition(treeModel, formDesigner); + } + widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 2, 3, 0)); + add(widgetPane, BorderLayout.NORTH); + + if(treeComboBox == null) { + widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ", + SwingConstants.HORIZONTAL), BorderLayout.WEST); + treeComboBox = new UITreeComboBox(componentTree); + widgetPane.add(treeComboBox, BorderLayout.CENTER); + add(widgetPane, BorderLayout.CENTER); } - UIScrollPane scrollPane = new UIScrollPane(componentTree); - scrollPane.setBorder(null); - add(scrollPane, BorderLayout.CENTER); - JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - add(searchPane, BorderLayout.NORTH); - searchPane.add(new UILabel(Inter.getLocText("FR-Designer_Search") + ":", - SwingConstants.HORIZONTAL), BorderLayout.WEST); - searchTextField = new UITextField(); - searchPane.add(searchTextField, BorderLayout.CENTER); - searchTextField.getDocument().addDocumentListener(new DocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - search(); - } - - @Override - public void removeUpdate(DocumentEvent e) { - search(); - } - - @Override - public void changedUpdate(DocumentEvent e) { - search(); - } - - private void search() { - String text = searchTextField.getText(); - if (StringUtils.isEmpty(text)) { - removeSearchResult(); - } else { - populate(componentTree.search(text)); - } - } - }); + + +// UIScrollPane scrollPane = new UIScrollPane(componentTree); +// scrollPane.setBorder(null); +// add(scrollPane, BorderLayout.CENTER); +// JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); +// add(searchPane, BorderLayout.NORTH); +// searchPane.add(new UILabel(Inter.getLocText("FR-Designer_Search") + ":", +// SwingConstants.HORIZONTAL), BorderLayout.WEST); +// searchTextField = new UITextField(); +// searchPane.add(searchTextField, BorderLayout.CENTER); +// searchTextField.getDocument().addDocumentListener(new DocumentListener() { +// @Override +// public void insertUpdate(DocumentEvent e) { +// search(); +// } +// +// @Override +// public void removeUpdate(DocumentEvent e) { +// search(); +// } +// +// @Override +// public void changedUpdate(DocumentEvent e) { +// search(); +// } +// +// private void search() { +// String text = searchTextField.getText(); +// if (StringUtils.isEmpty(text)) { +// removeSearchResult(); +// } else { +// populate(componentTree.search(text)); +// } +// } +// }); } - + /** * 调整结构树para和body的位置 - * + * * @param treeModel * @param formDesigner */ @@ -176,114 +192,114 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree /** * 删除搜索结果 */ - public void removeSearchResult() { - componentTree.setSelectionPath(null); - if (searchResult != null) { - this.remove(searchResult); - } - } - - public void populate(TreePath[] treepath) { - if (this.searchResult == null) { - searchResult = new SearchResultPane(); - } - if (((BorderLayout) getLayout()).getLayoutComponent(BorderLayout.SOUTH) == null) { - add(searchResult, BorderLayout.SOUTH); - } - searchResult.populate(treepath); - } - - private class SearchResultPane extends JPanel { - private UILabel resultLabel = new UILabel(); - private BackAction backAction = new BackAction(); - private ForWardAction forwardAction = new ForWardAction(); - private TreePath[] tree; - private int number = 0; - - SearchResultPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel actionJPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - addButtonToJPanel(actionJPanel, backAction.createToolBarComponent()); - addButtonToJPanel(actionJPanel, forwardAction.createToolBarComponent()); - - this.add(actionJPanel, BorderLayout.EAST); - this.add(resultLabel, BorderLayout.WEST); - } - - private void addButtonToJPanel(JPanel actionLabel, - JComponent toolBarComponent) { - actionLabel.add(toolBarComponent); - if (toolBarComponent instanceof UIButton) { - toolBarComponent.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - } - } - - public void populate(TreePath[] search) { - tree = search; - resultLabel.setText(Inter.getLocText("FR-Designer_Total") + ":" + tree.length); - number = 0; - check(); - } - - public void next() { - if (number < tree.length - 1) { - componentTree.setAndScrollSelectionPath(tree[++number]); - } - check(); - } - - public void last() { - if (number > 0) { - componentTree.setAndScrollSelectionPath(tree[--number]); - } - check(); - } - - public void check() { - if (tree.length < 1) { - backAction.setEnabled(false); - forwardAction.setEnabled(false); - } else { - backAction.setEnabled(number > 0); - forwardAction.setEnabled(number < tree.length - 1); - } - - } - - } - - private class BackAction extends UpdateAction { - - public BackAction() { - this.setName(Inter.getLocText("Form-Hierarchy_Tree_Last")); - this.setSmallIcon(BaseUtils - .readIcon("com/fr/design/images/m_help/back.png")); - this.setEnabled(false); - } - - public void actionPerformed(ActionEvent e) { - searchResult.last(); - } - } - - private class ForWardAction extends UpdateAction { - - public ForWardAction() { - this.setName(Inter.getLocText("Form-Hierarchy_Tree_Next")); - this.setSmallIcon(BaseUtils - .readIcon("com/fr/design/images/m_help/forward.png")); - this.setEnabled(false); - } - - public void actionPerformed(ActionEvent e) { - searchResult.next(); - } - } +// public void removeSearchResult() { +// componentTree.setSelectionPath(null); +// if (searchResult != null) { +// this.remove(searchResult); +// } +// } +// +// public void populate(TreePath[] treepath) { +// if (this.searchResult == null) { +// searchResult = new SearchResultPane(); +// } +// if (((BorderLayout) getLayout()).getLayoutComponent(BorderLayout.SOUTH) == null) { +// add(searchResult, BorderLayout.SOUTH); +// } +// searchResult.populate(treepath); +// } + +// private class SearchResultPane extends JPanel { +// private UILabel resultLabel = new UILabel(); +// private BackAction backAction = new BackAction(); +// private ForWardAction forwardAction = new ForWardAction(); +// private TreePath[] tree; +// private int number = 0; +// +// SearchResultPane() { +// this.setLayout(FRGUIPaneFactory.createBorderLayout()); +// JPanel actionJPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); +// addButtonToJPanel(actionJPanel, backAction.createToolBarComponent()); +// addButtonToJPanel(actionJPanel, forwardAction.createToolBarComponent()); +// +// this.add(actionJPanel, BorderLayout.EAST); +// this.add(resultLabel, BorderLayout.WEST); +// } +// +// private void addButtonToJPanel(JPanel actionLabel, +// JComponent toolBarComponent) { +// actionLabel.add(toolBarComponent); +// if (toolBarComponent instanceof UIButton) { +// toolBarComponent.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); +// } +// } +// +// public void populate(TreePath[] search) { +// tree = search; +// resultLabel.setText(Inter.getLocText("FR-Designer_Total") + ":" + tree.length); +// number = 0; +// check(); +// } +// +// public void next() { +// if (number < tree.length - 1) { +// componentTree.setAndScrollSelectionPath(tree[++number]); +// } +// check(); +// } +// +// public void last() { +// if (number > 0) { +// componentTree.setAndScrollSelectionPath(tree[--number]); +// } +// check(); +// } +// +// public void check() { +// if (tree.length < 1) { +// backAction.setEnabled(false); +// forwardAction.setEnabled(false); +// } else { +// backAction.setEnabled(number > 0); +// forwardAction.setEnabled(number < tree.length - 1); +// } +// +// } + + //} + +// private class BackAction extends UpdateAction { +// +// public BackAction() { +// this.setName(Inter.getLocText("Form-Hierarchy_Tree_Last")); +// this.setSmallIcon(BaseUtils +// .readIcon("com/fr/design/images/m_help/back.png")); +// this.setEnabled(false); +// } +// +// public void actionPerformed(ActionEvent e) { +// searchResult.last(); +// } +// } +// +// private class ForWardAction extends UpdateAction { +// +// public ForWardAction() { +// this.setName(Inter.getLocText("Form-Hierarchy_Tree_Next")); +// this.setSmallIcon(BaseUtils +// .readIcon("com/fr/design/images/m_help/forward.png")); +// this.setEnabled(false); +// } +// +// public void actionPerformed(ActionEvent e) { +// searchResult.next(); +// } +// } @Override /** * 位置 - * + * * @return 位置 */ public Location preferredLocation() { From c50f5ba51323911f1a0d46e27ea8aff273f41e53 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 14 Oct 2016 18:56:58 +0800 Subject: [PATCH 016/244] rt --- .../com/fr/design/mainframe/ShareWidgetButton.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index 3054bea328..e1e1844671 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -46,16 +46,18 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot private void initUI() { this.setBackground(Color.WHITE); this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - setPreferredSize(new Dimension(110, 70)); + setPreferredSize(new Dimension(108, 72)); setLayout(FRGUIPaneFactory.createBorderLayout()); ImagePanel imagePanel = new ImagePanel((BufferedImage) bindInfo.getCover()); + imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.add(imagePanel, BorderLayout.NORTH); JPanel panel = new JPanel(); + panel.setPreferredSize(new Dimension(108, 20)); UILabel label = new UILabel(bindInfo.getName(), SwingConstants.HORIZONTAL); - panel.setBackground(new Color(184, 220, 242)); - panel.add(label); - this.add(panel, BorderLayout.SOUTH); + label.setOpaque(true); + label.setBackground(new Color(184, 220, 242)); + this.add(label, BorderLayout.SOUTH); } private class ImagePanel extends JPanel { @@ -64,12 +66,12 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot public ImagePanel(BufferedImage image) { this.image = image; - this.setPreferredSize(new Dimension(110, 50)); + this.setPreferredSize(new Dimension(108, 52)); } @Override public void paintComponent(Graphics g) { - g.drawImage(image, 0, 0, 110, 70, null); + g.drawImage(image, 0, 0, null); } } From 26b940e0e201924d82d5eb070869d84104b59d5e Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 14 Oct 2016 19:26:22 +0800 Subject: [PATCH 017/244] rt --- .../mainframe/FormHierarchyTreePane.java | 2 +- .../mainframe/FormWidgetDetailPane.java | 147 +++++++----------- 2 files changed, 57 insertions(+), 92 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java index bf88a9fc51..410519cafb 100644 --- a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -68,7 +68,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree } private FormHierarchyTreePane() { - setLayout(new BorderLayout(0, 6)); + setLayout(new BorderLayout(0, 0)); } @Override diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index b412f42026..9f1983f31d 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,28 +1,22 @@ package com.fr.design.mainframe; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; - -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.SwingConstants; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; + +import javax.swing.*; import javax.swing.border.LineBorder; import com.fr.base.BaseUtils; import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.parameter.ParameterPropertyPane; -import com.fr.design.designer.beans.events.DesignerEditListener; -import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.ElCaseBindInfo; import com.fr.general.Inter; /** @@ -32,16 +26,11 @@ import com.fr.general.Inter; * Time: 下午8:18 */ public class FormWidgetDetailPane extends FormDockView{ - public static final String PARA = "para"; - public static final String BODY = "body"; private UITabbedPane tabbedPane; - private ParameterPropertyPane parameterPropertyPane; - private MobileWidgetTable mobileWidgetTable; - private MobileBodyWidgetTable mobileBodyWidgetTable; - private UIScrollPane downPanel; - private JPanel centerPane; - private CardLayout cardLayout; + private JScrollPane downPanel; + private JPanel reuWidgetPanel; + private ArrayList elCaseBindInfoList; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -84,100 +73,76 @@ public class FormWidgetDetailPane extends FormDockView{ clearDockingView(); return; } - parameterPropertyPane = ParameterPropertyPane.getInstance(designer); - parameterPropertyPane.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); JPanel esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); esp.setBorder(null); - mobileWidgetTable = new MobileWidgetTable(designer); - mobileBodyWidgetTable = new MobileBodyWidgetTable(designer); - designer.addDesignerEditListener(new mobileWidgetDesignerAdapter()); - centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - cardLayout = (CardLayout) centerPane.getLayout(); - centerPane.add(mobileWidgetTable,PARA); - centerPane.add(mobileBodyWidgetTable,BODY); - if(hasSelectParaPane(designer)){ - cardLayout.show(centerPane,PARA); - - } else { - cardLayout.show(centerPane,BODY); + if (elCaseBindInfoList == null) { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } - downPanel = new UIScrollPane(centerPane); - downPanel.setBorder(new LineBorder(Color.gray)); - esp.add(downPanel,BorderLayout.CENTER); - UILabel upLabel = new UILabel(Inter.getLocText("FR-Widget_Mobile_Table"),SwingConstants.CENTER); - upLabel.setBorder(BorderFactory.createEmptyBorder(6,0,6,0)); - esp.add(upLabel,BorderLayout.NORTH); - + downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); + downPanel.setPreferredSize(new Dimension(240, 400)); + reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); + UIComboBox comboBox = new UIComboBox(getCategories()); + comboBox.setPreferredSize(new Dimension(240, 30)); + comboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + String filterName = (String) e.getItem(); + elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); + refreshUI(); + reuWidgetPanel.repaint(); + } + }); + reuWidgetPanel.add(comboBox, BorderLayout.NORTH); + reuWidgetPanel.add(downPanel, BorderLayout.SOUTH); + reuWidgetPanel.setBorder(new LineBorder(Color.gray)); + esp.add(reuWidgetPanel, BorderLayout.CENTER); + UIButton button = new UIButton(); + button.setIcon(BaseUtils.readIcon("/com/fr/design/images/control/download.png")); + button.set4ToolbarButton(); + JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 3)); + widgetPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), + SwingConstants.HORIZONTAL), BorderLayout.WEST); + widgetPane.add(button, BorderLayout.EAST); + esp.add(widgetPane,BorderLayout.NORTH); tabbedPane = new UITabbedPane(); tabbedPane.setOpaque(true); tabbedPane.setBorder(null); tabbedPane.setTabPlacement(SwingConstants.BOTTOM); - tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Tree"), parameterPropertyPane); - tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), esp); + tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), esp); + tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel()); add(tabbedPane, BorderLayout.CENTER); } + public String[] getCategories() { + return new String[]{Inter.getLocText("FR-Designer_AllCategories"), "" }; + } + + public void refreshUI() { + reuWidgetPanel.remove(downPanel); + downPanel = new JScrollPane(new ShareWidgetPane(elCaseBindInfoList), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + reuWidgetPanel.add(downPanel); + + } + + public void setSelectedIndex(int index){ tabbedPane.setSelectedIndex(index); } - /** - * 选中的组件是否在参数面板里 - * @param designer 设计器 - * @return 是则返回true - */ - public boolean hasSelectParaPane(FormDesigner designer){ - XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); - if(xCreator == null){ - xCreator = designer.getRootComponent(); - } - XLayoutContainer container = XCreatorUtils.getHotspotContainer(xCreator); - return xCreator.acceptType(XWParameterLayout.class) || container.acceptType(XWParameterLayout.class); - } /** * 清除数据 */ public void clearDockingView() { - parameterPropertyPane = null; - mobileWidgetTable = null; JScrollPane psp = new JScrollPane(); psp.setBorder(null); this.add(psp, BorderLayout.CENTER); } - public class mobileWidgetDesignerAdapter implements DesignerEditListener { - public mobileWidgetDesignerAdapter() { - } - - /** - * 响应界面改变事件 - * @param evt 事件 - */ - public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED - || evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED - || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED - || evt.getCreatorEventID() == DesignerEvent.CREATOR_ADDED) { - int value = downPanel.getVerticalScrollBar().getValue(); - if(hasSelectParaPane(getEditingFormDesigner())){ - cardLayout.show(centerPane,PARA); - mobileWidgetTable.refresh(); - } else { - cardLayout.show(centerPane,BODY); - mobileBodyWidgetTable.refresh(); - } - //出现滚动条 - downPanel.doLayout(); - //控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0 - //此处设置滚动条值为刷新前 - downPanel.getVerticalScrollBar().setValue(value); - } - } - } /** * 定位 From 366f89956b12dafaeccdb23d1fcb8020226b9231 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sun, 16 Oct 2016 22:18:16 +0800 Subject: [PATCH 018/244] rt --- .../mainframe/FormWidgetDetailPane.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 9f1983f31d..efd6c0b7e4 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -80,7 +80,7 @@ public class FormWidgetDetailPane extends FormDockView{ elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - downPanel.setPreferredSize(new Dimension(240, 400)); + downPanel.setPreferredSize(new Dimension(235, 480)); reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); UIComboBox comboBox = new UIComboBox(getCategories()); comboBox.setPreferredSize(new Dimension(240, 30)); @@ -89,12 +89,11 @@ public class FormWidgetDetailPane extends FormDockView{ public void itemStateChanged(ItemEvent e) { String filterName = (String) e.getItem(); elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); - refreshUI(); - reuWidgetPanel.repaint(); + refreshDownPanel(); } }); reuWidgetPanel.add(comboBox, BorderLayout.NORTH); - reuWidgetPanel.add(downPanel, BorderLayout.SOUTH); + reuWidgetPanel.add(downPanel, BorderLayout.CENTER); reuWidgetPanel.setBorder(new LineBorder(Color.gray)); esp.add(reuWidgetPanel, BorderLayout.CENTER); UIButton button = new UIButton(); @@ -120,11 +119,19 @@ public class FormWidgetDetailPane extends FormDockView{ return new String[]{Inter.getLocText("FR-Designer_AllCategories"), "" }; } - public void refreshUI() { + public void refreshDownPanel() { reuWidgetPanel.remove(downPanel); - downPanel = new JScrollPane(new ShareWidgetPane(elCaseBindInfoList), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); + downPanel.setPreferredSize(new Dimension(235, 480)); reuWidgetPanel.add(downPanel); + repaintContainer(); + + } + public void repaintContainer() { + validate(); + repaint(); + revalidate(); } From e9647900600721ecd7178c2a8d65fe41b5a2dc3a Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sun, 16 Oct 2016 23:54:38 +0800 Subject: [PATCH 019/244] rt --- .../src/com/fr/design/form/images/download.png | Bin 0 -> 98 bytes .../fr/design/mainframe/FormWidgetDetailPane.java | 2 +- .../fr/design/parameter/ParameterPropertyPane.java | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 designer_form/src/com/fr/design/form/images/download.png diff --git a/designer_form/src/com/fr/design/form/images/download.png b/designer_form/src/com/fr/design/form/images/download.png new file mode 100644 index 0000000000000000000000000000000000000000..fa7b09dea32a9cce0962b2da23a6cfa34bc59baf GIT binary patch literal 98 zcmeAS@N?(olHy`uVBq!ia0vp^JV4CF!3HE7boT!OQjEnx?oJHr&dIz4a%4PR977}| vlh;Iier3 Date: Mon, 17 Oct 2016 00:03:56 +0800 Subject: [PATCH 020/244] rt --- .../src/com/fr/design/parameter/ParameterPropertyPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java index 37dc0d4e65..3ecfd53eda 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java @@ -47,7 +47,7 @@ public class ParameterPropertyPane extends JPanel{ initParameterListener(); this.setLayout(new BorderLayout(0, 6)); - this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.add(toolbarPane, BorderLayout.CENTER); } From 29cbdf4b560b132380cabb8ba82fa775a996bf28 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 17 Oct 2016 09:14:10 +0800 Subject: [PATCH 021/244] =?UTF-8?q?=E6=96=B0=E8=80=81=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E9=83=BD=E5=81=9A=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 18 +++ .../chart/gui/ChartTypeButtonPane.java | 50 +++---- .../mainframe/chart/gui/ChartTypePane.java | 132 +++--------------- .../chart/gui/item/FlexibleComboBox.java | 95 ------------- .../chart/gui/item/ItemEvenType.java | 37 ----- 5 files changed, 52 insertions(+), 280 deletions(-) delete mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEvenType.java diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index d11f3cd464..00487318dd 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -203,6 +203,24 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } + /** + * 把chartID的pane加到list里 + * + * @param chartID 图表类型 + * @param paneList pane容器 + */ + public void addPlotTypePaneList(List> paneList, String chartID) { + ///////////////////////////待更改/////////////////////////////// + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = (Map.Entry) iterator.next(); + IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); + paneList.add(creator.getPlotTypePane()); + } + + } + + public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { return chartTypeInterfaces.get(plotID).getChartDataPane(listener); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 8326966065..a5f96b1ee8 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -35,7 +35,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private static final int B_H = 20; private static final int COL_COUNT = 3; - private ChartTypePane parent; private UIButton addButton; private ArrayList indexList = new ArrayList(); @@ -45,6 +44,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private ComboBoxPane editChartType; private UITextField currentEditingEditor = null; + private ChartTypePane parent = null; + private boolean mouseOnChartTypeButtonPane = false; /** @@ -70,6 +71,11 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } }; + public ChartTypeButtonPane(ChartTypePane chartTypePane){ + this(); + parent = chartTypePane; + } + public ChartTypeButtonPane() { this.setLayout(new BorderLayout()); addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); @@ -91,11 +97,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); } - public ChartTypeButtonPane(ChartTypePane parent){ - this(); - this.parent = parent; - } - ActionListener addListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -108,40 +109,26 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen indexList.add(button); if (editingCollection != null) { - //这个地方应该判断是clone VanChart还是clone Chart - Chart[] clonedChart = null; - if (editingCollection.getState() == SwitchState.NEW) { - - }else { - clonedChart = ColumnIndependentChart.columnChartTypes; - } + //点击添加按钮,则会触发切换状态 + Chart chart = editingCollection.getChangeStateNewChart(); try { - Chart newChart = (Chart) clonedChart[0].clone(); + Chart newChart = (Chart) chart.clone(); editingCollection.addNamedChart(name, newChart); editingCollection.addFunctionRecord(newChart); } catch (CloneNotSupportedException e1) { FRLogger.getLogger().error("Error in Clone"); } + //获取图表收集器的状态 + SwitchState state = editingCollection.calculateMultiChartMode(); + if (SwitchState.isDynamicState(state) && parent != null){ + parent.reactorChartTypePane(state, editingCollection); + } } layoutPane(buttonPane); - - //刷新下拉框 - refreshChangeMode(); } - - }; - private void refreshChangeMode() { - //判断当前编辑的图表,对否开启多图表切换模式 - boolean stateChange = editingCollection.setMultiChartMode(); - //只有状态切换了才会重构下拉选项 - if (parent != null && stateChange){ - parent.fireReactor(editingCollection); - } - } - MouseListener mouseListener = new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { @@ -281,9 +268,9 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //新建一个collection if(editingCollection != null && editingCollection.getChartCount() == 1){ //vanChart 不支持图表切换 目前 - /*if(!ComparatorUtils.equals(editingCollection.getSelectedChart().getClass(), Chart.class)){ + if(!ComparatorUtils.equals(editingCollection.getSelectedChart().getClass(), Chart.class)){ addButton.setVisible(false); - }*/ + } } } @@ -399,9 +386,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } } } - relayoutPane(); - refreshChangeMode(); + relayoutPane(); } private void relayoutPane() { 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 0604d32663..e7271a77a5 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 @@ -4,24 +4,19 @@ import com.fr.base.FRContext; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.SwitchState; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.UIComboBoxPane; -import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; -import com.fr.design.mainframe.chart.gui.item.ItemEvenType; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; -import com.fr.general.Inter; import javax.swing.*; import java.awt.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; @@ -35,6 +30,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ private ChartTypeButtonPane buttonPane; private ChartEditPane editPane; private ChartCollection editingCollection; + @Override protected JPanel createContentPane() { JPanel content = new JPanel(new BorderLayout()); @@ -71,6 +67,10 @@ public class ChartTypePane extends AbstractChartAttrPane{ return content; } + public void reactorChartTypePane(SwitchState state, ChartCollection collection){ + + } + /** * 界面做为按钮时的图片位置. design_base */ @@ -85,12 +85,17 @@ public class ChartTypePane extends AbstractChartAttrPane{ public String title4PopupWindow() { return PaneTitleConstants.CHART_TYPE_TITLE; } - + class ComboBoxPane extends UIComboBoxPane{ @Override protected List> initPaneList() { List> paneList = new ArrayList>(); - ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList); + if (editingCollection.getState() == SwitchState.DEFAULT) { + ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList); + }else { + Chart chart = editingCollection.getSelectedChart(); + ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, chart.getChartID()); + } return paneList; } @@ -101,10 +106,9 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void updateBean(Chart chart) { int lastSelectIndex = editPane.getSelectedChartIndex(chart); - FlexibleComboBox fcb = (FlexibleComboBox)jcb; try{ - Chart newDefaultChart = (Chart)((AbstractChartTypePane)cards.get(fcb.getRelatedSelectedIndex())).getDefaultChart().clone(); + Chart newDefaultChart = (Chart)((AbstractChartTypePane)cards.get(jcb.getSelectedIndex())).getDefaultChart().clone(); if(!chart.accept(newDefaultChart.getClass())){ //vanChart 和 chart 之间切换 editingCollection.removeNameObject(editingCollection.getSelectedIndex()); @@ -116,7 +120,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ } //这一步会替换plot - ((AbstractChartTypePane) cards.get(fcb.getRelatedSelectedIndex())).updateBean(chart); + ((AbstractChartTypePane) cards.get(jcb.getSelectedIndex())).updateBean(chart); Plot plot = chart.getPlot(); @@ -131,115 +135,11 @@ public class ChartTypePane extends AbstractChartAttrPane{ boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && lastSelectIndex != fcb.getRelatedSelectedIndex())){ + if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && lastSelectIndex != jcb.getSelectedIndex())){ editPane.reLayout(chart); } } } - - @Override - public void populateBean(Chart ob) { - for (int i = 0; i < this.cards.size(); i++) { - FurtherBasicBeanPane pane = cards.get(i); - if (pane.accept(ob)) { - pane.populateBean(ob); - ((FlexibleComboBox)jcb).setRelatedSelectedIndex(i); - return; - } - } - } - - @Override - protected UIComboBox createComboBox() { - FlexibleComboBox comboBox = new FlexibleComboBox(); - //初始化分界线 - int partition = 0; - for (int i = 0; i < this.cards.size(); i++) { - String name = cards.get(i).title4PopupWindow(); - if (name.contains(Inter.getLocText("Plugin-ChartF_NewChart"))) { - partition++; - } - } - comboBox.setPartition(partition); - return comboBox; - } - - - /** - * 下拉框重构条件 - * 1、从None->Default(multiMode) - * 2、从None->New(multiMode) - * 3、从Default->None(singleMode) - * 4、从New->None(singleMode) - * @param is2MultiMode - * @param isVanChart - */ - private void reactorComboBoxItem(boolean is2MultiMode, boolean isVanChart){ - if (jcb == null){ - return; - } - //重构下拉选项 - FlexibleComboBox fcb = (FlexibleComboBox)jcb; - //重构前,保存相对下标 - int relativeIndex = is2MultiMode ? fcb.getSelectedIndex() : fcb.getRelatedSelectedIndex(); - //多图表切换模式 - fcb.setMultiMode(is2MultiMode); - //设置当前切换是新图表还是老图表 - fcb.setBottom(!isVanChart); - //重构下拉框选项 - fcb.setItemEvenType(ItemEvenType.REACTOR); - jcb.removeAllItems(); - for (int i = 0; i < this.cards.size(); i++) { - String name = cards.get(i).title4PopupWindow(); - if (is2MultiMode && (name.contains(Inter.getLocText("Plugin-ChartF_NewChart")) && isVanChart)) { - jcb.addItem(cards.get(i).title4PopupWindow()); - } else if (is2MultiMode && (!name.contains(Inter.getLocText("Plugin-ChartF_NewChart")) && !isVanChart)) { - jcb.addItem(cards.get(i).title4PopupWindow()); - }else if (!is2MultiMode){ - jcb.addItem(cards.get(i).title4PopupWindow()); - } - } - //重置选择项 - fcb.setRelatedSelectedIndex(relativeIndex); - //重构完成 - fcb.setItemEvenType(ItemEvenType.DEFAULT); - - } - - @Override - protected void addItemChangeEvent() { - jcb.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - //如果是在进行重构,则不触发状态改变事件 - FlexibleComboBox fcb = (FlexibleComboBox)jcb; - if (fcb.isReactor()){ - return; - } - comboBoxItemStateChanged(); - CardLayout cl = (CardLayout)cardPane.getLayout(); - cl.show(cardPane, cardNames[((FlexibleComboBox)jcb).getRelatedSelectedIndex()]); - } - }); - } - } - - public void fireReactor(ChartCollection collection) { - switch (collection.getState()){ - case NEW:{ - this.chartTypePane.reactorComboBoxItem(true, true); - break; - } - case DEFAULT:{ - this.chartTypePane.reactorComboBoxItem(true, false); - break; - } - case NONE:{ - this.chartTypePane.reactorComboBoxItem(false, false); - break; - } - default:this.chartTypePane.reactorComboBoxItem(false, false); - } } /** diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java deleted file mode 100644 index 0bec554f4f..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.fr.design.mainframe.chart.gui.item; - -import com.fr.design.gui.icombobox.UIComboBox; - -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -/** - * Created by hufan on 2016/10/11. - */ -public class FlexibleComboBox extends UIComboBox { - //新旧分界线 - private int partition = 0; - //分界线上还是分界线下 - private boolean bottom = true; - //图表是否开启切换模式 - private boolean multiMode = false; - //当前下拉框处理的事件类型 - private ItemEvenType itemEvenType = ItemEvenType.DEFAULT; - - public boolean isReactor(){ - return itemEvenType == ItemEvenType.REACTOR; - } - - public int getPartition() { - return partition; - } - - public void setPartition(int partition) { - this.partition = partition; - } - - public boolean isBottom() { - return bottom; - } - - public void setBottom(boolean bottom) { - this.bottom = bottom; - } - - public boolean isMultiMode() { - return multiMode; - } - - public void setMultiMode(boolean multiMode) { - this.multiMode = multiMode; - } - - public ItemEvenType getItemEvenType() { - return itemEvenType; - } - - public void setItemEvenType(ItemEvenType itemEvenType) { - this.itemEvenType = itemEvenType; - } - - public int getRelatedSelectedIndex(){ - return isMultiMode() && isBottom() ? (super.getSelectedIndex() + partition) : super.getSelectedIndex(); - } - - public void setRelatedSelectedIndex(int index){ - if (isMultiMode() && isBottom()){ - super.setSelectedIndex(index - partition); - }else { - super.setSelectedIndex(index); - } - } - - @Override - protected void initListener() { - if (shouldResponseChangeListener()) { - this.addFocusListener(new FocusAdapter() { - @Override - public void focusGained(FocusEvent e) { - fireSetGlobalName(); - } - }); - this.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (uiObserverListener == null) { - return; - } - fireSetGlobalName(); - //只有不在重构状态才会触发下拉框选择时的改变事件 - if (e.getStateChange() == ItemEvent.SELECTED && !isReactor()) { - uiObserverListener.doChange(); - } - } - }); - } - } -} diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEvenType.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEvenType.java deleted file mode 100644 index 5ef941a69c..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEvenType.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.mainframe.chart.gui.item; - -import com.fr.general.ComparatorUtils; - -/** - * Created by hufan on 2016/10/11. - */ -public enum ItemEvenType { - REACTOR("reactor"),//重构选项 - DEFAULT("default")//默认选项操作 - ; - - //这个String会存起来的,不能随意更改。 - private String type; - - private ItemEvenType(String type){ - this.type = type; - } - - public String getType() { - return this.type; - } - - private static ItemEvenType[] types; - - public static ItemEvenType parse(String type){ - if(types == null){ - types = ItemEvenType.values(); - } - for(ItemEvenType itemEvenType : types){ - if(ComparatorUtils.equals(itemEvenType.getType(), type)){ - return itemEvenType; - } - } - return DEFAULT; - } -} From c9c351c5519f395ec5d36790453dc5546219eaac Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 17 Oct 2016 16:18:20 +0800 Subject: [PATCH 022/244] rt --- .../mainframe/FormWidgetDetailPane.java | 26 ++++++++++++------- .../fr/design/mainframe/ShareWidgetPane.java | 7 +++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 625f9a544c..987740dffa 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -3,7 +3,8 @@ package com.fr.design.mainframe; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.ArrayList; +import java.util.*; +import java.util.List; import javax.swing.*; import javax.swing.border.LineBorder; @@ -15,6 +16,7 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.general.Inter; @@ -30,7 +32,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UITabbedPane tabbedPane; private JScrollPane downPanel; private JPanel reuWidgetPanel; - private ArrayList elCaseBindInfoList; + private List elCaseBindInfoList; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -80,16 +82,22 @@ public class FormWidgetDetailPane extends FormDockView{ elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - downPanel.setPreferredSize(new Dimension(235, 480)); + downPanel.setPreferredSize(new Dimension(236, 480)); reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - UIComboBox comboBox = new UIComboBox(getCategories()); - comboBox.setPreferredSize(new Dimension(240, 30)); + final UIComboBox comboBox = new UIComboBox(getCategories()); + comboBox.setPreferredSize(new Dimension(236, 30)); comboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - String filterName = (String) e.getItem(); - elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); + int filterIndex = comboBox.getSelectedIndex(); + if (filterIndex == 0) { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + } else { + String filterName = (String) e.getItem(); + elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); + } refreshDownPanel(); + } }); reuWidgetPanel.add(comboBox, BorderLayout.NORTH); @@ -116,13 +124,13 @@ public class FormWidgetDetailPane extends FormDockView{ } public String[] getCategories() { - return new String[]{Inter.getLocText("FR-Designer_AllCategories"), "" }; + return ShareConstants.WIDGET_CATEGORIES; } public void refreshDownPanel() { reuWidgetPanel.remove(downPanel); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - downPanel.setPreferredSize(new Dimension(235, 480)); + //todo:这个地方有问题 reuWidgetPanel.add(downPanel); repaintContainer(); diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index 79f15b3646..d788d77e3d 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -6,14 +6,16 @@ import com.fr.form.ui.ElCaseBindInfo; import javax.swing.*; import java.awt.*; -import java.util.ArrayList; +import java.util.*; +import java.util.List; /** * Created by xiaxiang on 2016/10/10. */ public class ShareWidgetPane extends JPanel { - public ShareWidgetPane(ArrayList elCaseBindInfoList) { + + public ShareWidgetPane(List elCaseBindInfoList) { this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离 int rowCount = (elCaseBindInfoList.size() + 1)/2; this.setLayout(new GridLayout(rowCount, 2, 10, 10)); @@ -26,4 +28,5 @@ public class ShareWidgetPane extends JPanel { } } + } From bc58aa385d3acd6e99b497bbd8098fe6d5986a99 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 17 Oct 2016 16:23:13 +0800 Subject: [PATCH 023/244] rt --- .../mainframe/FormWidgetDetailPane.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 987740dffa..54bd31cc9f 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -32,6 +32,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UITabbedPane tabbedPane; private JScrollPane downPanel; private JPanel reuWidgetPanel; + private UIComboBox comboBox; private List elCaseBindInfoList; public static FormWidgetDetailPane getInstance() { @@ -84,22 +85,10 @@ public class FormWidgetDetailPane extends FormDockView{ downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); downPanel.setPreferredSize(new Dimension(236, 480)); reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - final UIComboBox comboBox = new UIComboBox(getCategories()); + comboBox = new UIComboBox(getCategories()); comboBox.setPreferredSize(new Dimension(236, 30)); - comboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - int filterIndex = comboBox.getSelectedIndex(); - if (filterIndex == 0) { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - } else { - String filterName = (String) e.getItem(); - elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); - } - refreshDownPanel(); + initComboBoxSelectedListener(); - } - }); reuWidgetPanel.add(comboBox, BorderLayout.NORTH); reuWidgetPanel.add(downPanel, BorderLayout.CENTER); reuWidgetPanel.setBorder(new LineBorder(Color.gray)); @@ -123,6 +112,23 @@ public class FormWidgetDetailPane extends FormDockView{ } + private void initComboBoxSelectedListener() { + comboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + int filterIndex = comboBox.getSelectedIndex(); + if (filterIndex == 0) { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + } else { + String filterName = (String) e.getItem(); + elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); + } + refreshDownPanel(); + + } + }); + } + public String[] getCategories() { return ShareConstants.WIDGET_CATEGORIES; } From f68ae9af64a520dcc02a40a200b16e15eab04592 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 17 Oct 2016 16:49:28 +0800 Subject: [PATCH 024/244] rt --- .../mainframe/FormWidgetDetailPane.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 54bd31cc9f..a293d1f0d4 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -82,16 +82,7 @@ public class FormWidgetDetailPane extends FormDockView{ if (elCaseBindInfoList == null) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } - downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - downPanel.setPreferredSize(new Dimension(236, 480)); - reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - comboBox = new UIComboBox(getCategories()); - comboBox.setPreferredSize(new Dimension(236, 30)); - initComboBoxSelectedListener(); - - reuWidgetPanel.add(comboBox, BorderLayout.NORTH); - reuWidgetPanel.add(downPanel, BorderLayout.CENTER); - reuWidgetPanel.setBorder(new LineBorder(Color.gray)); + initReuWidgetPanel(); esp.add(reuWidgetPanel, BorderLayout.CENTER); UIButton button = new UIButton(); button.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download.png")); @@ -112,6 +103,22 @@ public class FormWidgetDetailPane extends FormDockView{ } + /** + * 初始化组件共享和复用面板 + */ + private void initReuWidgetPanel() { + int rowCount = (elCaseBindInfoList.size() + 1)/2; + downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); + downPanel.setPreferredSize(new Dimension(236, rowCount * 82)); + reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); + comboBox = new UIComboBox(getCategories()); + comboBox.setPreferredSize(new Dimension(236, 30)); + initComboBoxSelectedListener(); + reuWidgetPanel.add(comboBox, BorderLayout.NORTH); + reuWidgetPanel.add(downPanel, BorderLayout.CENTER); + reuWidgetPanel.setBorder(new LineBorder(Color.gray)); + } + private void initComboBoxSelectedListener() { comboBox.addItemListener(new ItemListener() { @Override From e80e9ea05fdfd638d5b9c77ebbfc17113e965fe1 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 17 Oct 2016 16:52:30 +0800 Subject: [PATCH 025/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2-?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/frpane/UIComboBoxPane.java | 7 + .../fr/design/images/buttonicon/config.png | Bin 0 -> 404 bytes .../fr/design/ChartTypeInterfaceManager.java | 258 ++++++++++++++---- .../design/mainframe/chart/ChartEditPane.java | 1 + .../chart/gui/ChartTypeButtonPane.java | 35 ++- .../mainframe/chart/gui/ChartTypePane.java | 105 ++++++- .../chart/gui/item/FlexibleComboBox.java | 54 ++++ .../chart/gui/item/ItemEventType.java | 37 +++ 8 files changed, 419 insertions(+), 78 deletions(-) create mode 100644 designer_base/src/com/fr/design/images/buttonicon/config.png create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEventType.java diff --git a/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java b/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java index 73b065f069..e903aa95a0 100644 --- a/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java @@ -56,6 +56,11 @@ public abstract class UIComboBoxPane extends BasicBeanPane { jcb.setSelectedIndex(0); } + public FurtherBasicBeanPane getSelectedPane(){ + return cards.get(jcb.getSelectedIndex()); + } + + protected void addItemChangeEvent() { jcb.addItemListener(new ItemListener() { @Override @@ -121,6 +126,8 @@ public abstract class UIComboBoxPane extends BasicBeanPane { } } + + @Override public T updateBean() { return cards.get(jcb.getSelectedIndex()).updateBean(); diff --git a/designer_base/src/com/fr/design/images/buttonicon/config.png b/designer_base/src/com/fr/design/images/buttonicon/config.png new file mode 100644 index 0000000000000000000000000000000000000000..377bb9247d466886360c511aa848210fd880493b GIT binary patch literal 404 zcmV;F0c-w=P) zBN4;xEg*ax*G>O%DVzf$(};{>_bEodGW-d%Dc0&&g&E5MHSHs5azse@Sb zgp)xAXVEk~r_7WCiat}GVJ*mT70L~yEumO chartTypeInterfaces = new LinkedHashMap(); + private static LinkedHashMap> chartTypeInterfaces = new LinkedHashMap>(); + //private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { @@ -121,36 +117,64 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private static void readDefault() { - chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); + LinkedHashMap chartUIList = new LinkedHashMap(); + chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); + chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); + chartUIList.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); + chartUIList.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); + chartUIList.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); + chartUIList.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); + chartUIList.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); + chartUIList.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); + chartUIList.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); + chartUIList.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); + chartUIList.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); + chartUIList.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); + chartUIList.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); + chartUIList.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); + chartUIList.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); + chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); + chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); + + chartTypeInterfaces.put(ChartConstants.CHART_ID, chartUIList); } public String getIconPath(String plotID) { - if (chartTypeInterfaces.get(plotID) != null) { - return chartTypeInterfaces.get(plotID).getIconPath(); + if (chartTypeInterfaces != null) { + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = (Map.Entry) iterator.next(); + String chartID = (String) entry.getKey(); + String imagePath = getIconPath(chartID, plotID); + if (!StringUtils.isEmpty(imagePath)) { + return imagePath; + } + } + } + return StringUtils.EMPTY; + } + + private String getIconPath(String chartID, String plotID) { + if (chartTypeInterfaces.get(chartID) != null && chartTypeInterfaces.get(chartID).get(plotID) != null) { + return chartTypeInterfaces.get(chartID).get(plotID).getIconPath(); }else { return StringUtils.EMPTY; } } - public static void addChartTypeInterface(IndependentChartUIProvider provider, String plotID) { - if (chartTypeInterfaces != null && !chartTypeInterfaces.containsKey(plotID)) { - chartTypeInterfaces.put(plotID, provider); + public static void addChartTypeInterface(IndependentChartUIProvider provider, String chartID, String plotID) { + if (chartTypeInterfaces != null){ + if (!chartTypeInterfaces.containsKey(chartID)){ + //新建一个具体图表列表 + LinkedHashMap chartUIList = new LinkedHashMap(); + chartUIList.put(plotID, provider); + chartTypeInterfaces.put(chartID, chartUIList); + }else { + LinkedHashMap chartUIList = chartTypeInterfaces.get(chartID); + if (!chartUIList.containsKey(plotID)) { + chartUIList.put(plotID, provider); + } + } } } @@ -160,7 +184,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param className 类名 * @param plotID 标志ID */ - public void addChartInterface(String className, String plotID, PluginSimplify simplify) { + public void addChartInterface(String className, String chartID, String plotID, PluginSimplify simplify) { if (StringUtils.isNotBlank(className)) { try { Class clazz = Class.forName(className); @@ -172,7 +196,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) { PluginMessage.remindUpdate(className); } else { - ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, plotID); + ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, chartID, plotID); } } catch (ClassNotFoundException e) { FRLogger.getLogger().error("class not found:" + e.getMessage()); @@ -193,56 +217,165 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList) { - Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); - paneList.add(creator.getPlotTypePane()); + String chartID = (String) entry.getKey(); + Iterator chartUIIterator = chartTypeInterfaces.get(chartID).entrySet().iterator(); + while (chartUIIterator.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) chartUIIterator.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + paneList.add(provider.getPlotTypePane()); + } } + } + public String[] getTitle4PopupWindow(String chartID){ + if (chartID.isEmpty()){ + return getTitle4PopupWindow(); + } + String[] names = new String[getChartSize(chartID)]; + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){ + HashMap chartUIList = chartTypeInterfaces.get(chartID); + Iterator iterator = chartUIList.entrySet().iterator(); + int i = 0; + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) entry.getValue(); + names[i++] = provider.getPlotTypePane().title4PopupWindow(); + } + return names; + } + return new String[0]; } - /** - * 把chartID的pane加到list里 - * - * @param chartID 图表类型 - * @param paneList pane容器 - */ - public void addPlotTypePaneList(List> paneList, String chartID) { - ///////////////////////////待更改/////////////////////////////// + private String[] getTitle4PopupWindow(){ + int size = 0; + if (chartTypeInterfaces != null){ + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + String chartID = (String) entry.getKey(); + size += getChartSize(chartID); + } + String[] names = new String[size]; + + int index = 0; + + Iterator i = chartTypeInterfaces.entrySet().iterator(); + while (i.hasNext()){ + Map.Entry entry = (Map.Entry) i.next(); + String chartID = (String) entry.getKey(); + Iterator chartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); + while (chartUI.hasNext()){ + Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); + } + } + return names; + } + + return new String[0]; + } + + public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { Iterator iterator = chartTypeInterfaces.entrySet().iterator(); - while (iterator.hasNext()) { + while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); - paneList.add(creator.getPlotTypePane()); + String chartID = (String) entry.getKey(); + return getChartDataPane(chartID, plotID, listener); } - + return getChartDataPane(ChartConstants.DEFAULT_CHART_ID, plotID, listener); } + private ChartDataPane getChartDataPane(String chartID, String plotID, AttributeChangeListener listener) { + return chartTypeInterfaces.get(chartID).get(plotID).getChartDataPane(listener); + } - public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { - return chartTypeInterfaces.get(plotID).getChartDataPane(listener); + /** + * 获取对应ID的图表数量 + * @param chartID + * @return + */ + private int getChartSize(String chartID){ + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){ + return chartTypeInterfaces.get(chartID).size(); + } + return 0; } public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) { - return chartTypeInterfaces.get(plotID).getAttrPaneArray(listener); + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + String chartID = (String) entry.getKey(); + return getAttrPaneArray(chartID, plotID, listener); + } + return getAttrPaneArray(ChartConstants.DEFAULT_CHART_ID, plotID, listener); + } + + private AbstractChartAttrPane[] getAttrPaneArray(String chartID, String plotID, AttributeChangeListener listener) { + return chartTypeInterfaces.get(chartID).get(plotID).getAttrPaneArray(listener); } public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { - return chartTypeInterfaces.get(plot.getPlotID()).getTableDataSourcePane(plot, parent); + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + String chartID = (String) entry.getKey(); + return getTableDataSourcePane(chartID, plot, parent); + } + return getTableDataSourcePane(ChartConstants.DEFAULT_CHART_ID, plot, parent); + } + + private AbstractTableDataContentPane getTableDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getTableDataSourcePane(plot, parent); } + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { - return chartTypeInterfaces.get(plot.getPlotID()).getReportDataSourcePane(plot, parent); + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + String chartID = (String) entry.getKey(); + return getReportDataSourcePane(chartID, plot, parent); + } + return getReportDataSourcePane(ChartConstants.DEFAULT_CHART_ID, plot, parent); + } + + private AbstractReportDataContentPane getReportDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getReportDataSourcePane(plot, parent); } + public ConditionAttributesPane getPlotConditionPane(Plot plot) { - return chartTypeInterfaces.get(plot.getPlotID()).getPlotConditionPane(plot); + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + String chartID = (String) entry.getKey(); + return getPlotConditionPane(chartID, plot); + } + return getPlotConditionPane(ChartConstants.DEFAULT_CHART_ID, plot); + } + + private ConditionAttributesPane getPlotConditionPane(String chartID, Plot plot) { + return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotConditionPane(plot); } + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { - return chartTypeInterfaces.get(plot.getPlotID()).getPlotSeriesPane(parent, plot); + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + String chartID = (String) entry.getKey(); + return getPlotSeriesPane(chartID, parent, plot); + } + return getPlotSeriesPane(ChartConstants.DEFAULT_CHART_ID, parent, plot); + } + + private BasicBeanPane getPlotSeriesPane(String chartID, ChartStylePane parent, Plot plot) { + return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotSeriesPane(parent, plot); } /** @@ -252,9 +385,22 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @return 是否使用默认的界面 */ public boolean isUseDefaultPane(String plotID) { + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + String chartID = (String) entry.getKey(); + if (chartTypeInterfaces.get(chartID).containsKey(plotID)){ + return isUseDefaultPane(chartID, plotID); + } + } + + return true; + } + + private boolean isUseDefaultPane(String chartID, String plotID){ - if (chartTypeInterfaces.containsKey(plotID)) { - return chartTypeInterfaces.get(plotID).isUseDefaultPane(); + if (chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)) { + return chartTypeInterfaces.get(chartID).get(plotID).isUseDefaultPane(); } return true; @@ -272,7 +418,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh extraChartDesignInterfaceList.add(tagName); } if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { - addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("plotID", ""), simplify); + addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", ChartConstants.DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); } } } 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 c3a2e1d502..57b57380d9 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -4,6 +4,7 @@ package com.fr.design.mainframe.chart; import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.SwitchState; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.data.DesignTableDataManager; diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index a5f96b1ee8..461c5501e7 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -36,6 +36,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private static final int COL_COUNT = 3; private UIButton addButton; + private UIButton configButton; private ArrayList indexList = new ArrayList(); private JPanel buttonPane; @@ -79,6 +80,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen public ChartTypeButtonPane() { this.setLayout(new BorderLayout()); addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); buttonPane = new JPanel(); this.add(buttonPane, BorderLayout.CENTER); @@ -88,8 +90,13 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen eastPane.setLayout(new BorderLayout()); - eastPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 20)); - eastPane.add(addButton, BorderLayout.NORTH); + eastPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 15)); + JPanel button = new JPanel(); + button.setPreferredSize(new Dimension(45, 20)); + button.setLayout(new GridLayout(1, 2, 5, 0)); + button.add(addButton); + button.add(configButton); + eastPane.add(button, BorderLayout.NORTH); addButton.setPreferredSize(new Dimension(20, 20)); addButton.addActionListener(addListener); @@ -121,7 +128,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //获取图表收集器的状态 SwitchState state = editingCollection.calculateMultiChartMode(); if (SwitchState.isDynamicState(state) && parent != null){ - parent.reactorChartTypePane(state, editingCollection); + parent.reactorChartTypePane(editingCollection); } } @@ -260,17 +267,16 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } layoutPane(buttonPane); - checkAddButtonVisible(); + checkConfigButtonVisible(); } - private void checkAddButtonVisible() { + private void checkConfigButtonVisible() { addButton.setVisible(true); + configButton.setVisible(true); //新建一个collection - if(editingCollection != null && editingCollection.getChartCount() == 1){ - //vanChart 不支持图表切换 目前 - if(!ComparatorUtils.equals(editingCollection.getSelectedChart().getClass(), Chart.class)){ - addButton.setVisible(false); - } + if(editingCollection.getState() == SwitchState.CHANGE){ + //Chart 不支持图表切换 + configButton.setVisible(editingCollection.getSelectedChart().supportChange()); } } @@ -381,12 +387,21 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(getButtonName(), editingCollection.getChartName(i))) { editingCollection.removeNameObject(i); + if (i <= editingCollection.getSelectedIndex()){ + editingCollection.setSelectedIndex(editingCollection.getSelectedIndex()-1); + } break; } } } } + //获取图表收集器的状态 + SwitchState state = editingCollection.calculateMultiChartMode(); + if (SwitchState.isDynamicState(state) && parent != null){ + parent.reactorChartTypePane(editingCollection); + } + relayoutPane(); } 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 e7271a77a5..84cfbd52ba 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 @@ -10,13 +10,20 @@ import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.ChartEditPane; 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.general.ComparatorUtils; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; @@ -47,6 +54,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ @Override protected void layoutContentPane() { + leftcontentPane = createContentPane(); this.add(leftcontentPane); } @@ -67,10 +75,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ return content; } - public void reactorChartTypePane(SwitchState state, ChartCollection collection){ - - } - /** * 界面做为按钮时的图片位置. design_base */ @@ -90,12 +94,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ @Override protected List> initPaneList() { List> paneList = new ArrayList>(); - if (editingCollection.getState() == SwitchState.DEFAULT) { - ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList); - }else { - Chart chart = editingCollection.getSelectedChart(); - ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, chart.getChartID()); - } + ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList); return paneList; } @@ -108,7 +107,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ int lastSelectIndex = editPane.getSelectedChartIndex(chart); try{ - Chart newDefaultChart = (Chart)((AbstractChartTypePane)cards.get(jcb.getSelectedIndex())).getDefaultChart().clone(); + Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone(); if(!chart.accept(newDefaultChart.getClass())){ //vanChart 和 chart 之间切换 editingCollection.removeNameObject(editingCollection.getSelectedIndex()); @@ -120,7 +119,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ } //这一步会替换plot - ((AbstractChartTypePane) cards.get(jcb.getSelectedIndex())).updateBean(chart); + ((AbstractChartTypePane)getSelectedPane()).updateBean(chart); Plot plot = chart.getPlot(); @@ -140,6 +139,88 @@ public class ChartTypePane extends AbstractChartAttrPane{ } } } + + protected UIComboBox createComboBox() { + return new FlexibleComboBox(); + } + + @Override + protected void addItemChangeEvent() { + jcb.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + FlexibleComboBox fcb = (FlexibleComboBox)jcb; + if (fcb.isReactor()){ + return; + } + comboBoxItemStateChanged(); + CardLayout cl = (CardLayout)cardPane.getLayout(); + cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); + } + }); + } + + public void reactor(ChartCollection collection){ + //重构前存储所选择的下拉选项 + Object item = jcb.getSelectedItem(); + //重构需要重构下拉框选项和cardNames + Chart chart = collection.getSelectedChart(); + String chartID = chart.getChartID(); + if (collection.getState() == SwitchState.DEFAULT){ + chartID = StringUtils.EMPTY; + } + //第一步就是重构cardNames + cardNames = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID); + //重构下拉框选项 + FlexibleComboBox fcb = (FlexibleComboBox)jcb; + fcb.setItemEvenType(ItemEventType.REACTOR); + fcb.removeAllItems(); + for (int i = 0; i < this.cardNames.length; i++) { + fcb.addItem(cardNames[i]); + } + //重新选择选中的下拉项 + jcb.setSelectedItem(item); + fcb.setItemEvenType(ItemEventType.DEFAULT); + } + + @Override + public void populateBean(Chart ob) { + for (int i = 0; i < this.cards.size(); i++) { + FurtherBasicBeanPane pane = cards.get(i); + if (pane.accept(ob)) { + pane.populateBean(ob); + Object item = pane.title4PopupWindow(); + for (int j = 0; j < cardNames.length; j++) { + if (ComparatorUtils.equals(item, cardNames[j])) { + jcb.setSelectedIndex(j); + } + } + return; + } + } + } + + @Override + public Chart updateBean() { + return getSelectedPane().updateBean(); + } + + @Override + public FurtherBasicBeanPane getSelectedPane(){ + Object item = jcb.getSelectedItem(); + for (int i = 0; i < cards.size(); i++){ + if (ComparatorUtils.equals(item, cards.get(i).title4PopupWindow())){ + return cards.get(i); + } + } + return cards.get(0); + } + + } + + + public void reactorChartTypePane(ChartCollection collection){ + chartTypePane.reactor(collection); } /** diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java new file mode 100644 index 0000000000..991858a9a5 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/FlexibleComboBox.java @@ -0,0 +1,54 @@ +package com.fr.design.mainframe.chart.gui.item; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.icombobox.UIComboBox; + +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * Created by hufan on 2016/10/11. + */ +public class FlexibleComboBox extends UIComboBox { + //当前下拉框处理的事件类型 + private ItemEventType itemEvenType = ItemEventType.DEFAULT; + + public boolean isReactor(){ + return itemEvenType == ItemEventType.REACTOR; + } + + public ItemEventType getItemEvenType() { + return itemEvenType; + } + + public void setItemEvenType(ItemEventType itemEvenType) { + this.itemEvenType = itemEvenType; + } + + @Override + protected void initListener() { + if (shouldResponseChangeListener()) { + this.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + fireSetGlobalName(); + } + }); + this.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (uiObserverListener == null) { + return; + } + fireSetGlobalName(); + //只有不在重构状态才会触发下拉框选择时的改变事件 + if (e.getStateChange() == ItemEvent.SELECTED && !isReactor()) { + uiObserverListener.doChange(); + } + } + }); + } + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEventType.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEventType.java new file mode 100644 index 0000000000..4a7332d537 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/item/ItemEventType.java @@ -0,0 +1,37 @@ +package com.fr.design.mainframe.chart.gui.item; + +import com.fr.general.ComparatorUtils; + +/** + * Created by hufan on 2016/10/11. + */ +public enum ItemEventType { + REACTOR("reactor"),//重构选项 + DEFAULT("default")//默认选项操作 + ; + + //这个String会存起来的,不能随意更改。 + private String type; + + private ItemEventType(String type){ + this.type = type; + } + + public String getType() { + return this.type; + } + + private static ItemEventType[] types; + + public static ItemEventType parse(String type){ + if(types == null){ + types = ItemEventType.values(); + } + for(ItemEventType itemEventType : types){ + if(ComparatorUtils.equals(itemEventType.getType(), type)){ + return itemEventType; + } + } + return DEFAULT; + } +} \ No newline at end of file From c84679f2468a4f3151f5ca5acacb68f7ef2c07fc Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 17 Oct 2016 17:19:49 +0800 Subject: [PATCH 026/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 4 ++-- .../src/com/fr/design/mainframe/ShareWidgetPane.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index a293d1f0d4..ae5bc069dc 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -33,7 +33,7 @@ public class FormWidgetDetailPane extends FormDockView{ private JScrollPane downPanel; private JPanel reuWidgetPanel; private UIComboBox comboBox; - private List elCaseBindInfoList; + private ElCaseBindInfo[] elCaseBindInfoList; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -107,7 +107,7 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化组件共享和复用面板 */ private void initReuWidgetPanel() { - int rowCount = (elCaseBindInfoList.size() + 1)/2; + int rowCount = (elCaseBindInfoList.length + 1)/2; downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); downPanel.setPreferredSize(new Dimension(236, rowCount * 82)); reuWidgetPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index d788d77e3d..f5e8e0126f 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -15,15 +15,15 @@ import java.util.List; */ public class ShareWidgetPane extends JPanel { - public ShareWidgetPane(List elCaseBindInfoList) { + public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) { this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离 - int rowCount = (elCaseBindInfoList.size() + 1)/2; + int rowCount = (elCaseBindInfoList.length + 1)/2; this.setLayout(new GridLayout(rowCount, 2, 10, 10)); for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); this.add(widgetButton); } - if (elCaseBindInfoList.size() == 1) { + if (elCaseBindInfoList.length == 1) { this.add(new JPanel()); } From bee93e7613f84cc1ef10ef8a7006f6469f45e674 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 17 Oct 2016 17:35:50 +0800 Subject: [PATCH 027/244] =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/chart/ChartEditPane.java | 1 - .../com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 3 +-- 2 files changed, 1 insertion(+), 3 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 57b57380d9..c3a2e1d502 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -4,7 +4,6 @@ package com.fr.design.mainframe.chart; import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; -import com.fr.chart.chartattr.SwitchState; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.data.DesignTableDataManager; diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 461c5501e7..8833e5269d 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -272,9 +272,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private void checkConfigButtonVisible() { addButton.setVisible(true); - configButton.setVisible(true); //新建一个collection - if(editingCollection.getState() == SwitchState.CHANGE){ + if(editingCollection.getState() == SwitchState.DEFAULT){ //Chart 不支持图表切换 configButton.setVisible(editingCollection.getSelectedChart().supportChange()); } From a24081dc3113edc444795b372dabdc5dd7cea269 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 17 Oct 2016 17:56:45 +0800 Subject: [PATCH 028/244] rt --- .../src/com/fr/design/mainframe/ShareWidgetButton.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index e1e1844671..955e54822a 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -52,8 +52,6 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); this.add(imagePanel, BorderLayout.NORTH); - JPanel panel = new JPanel(); - panel.setPreferredSize(new Dimension(108, 20)); UILabel label = new UILabel(bindInfo.getName(), SwingConstants.HORIZONTAL); label.setOpaque(true); label.setBackground(new Color(184, 220, 242)); From 131ffac75bdb5e237224d23dfbf6bf17b84726c0 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 17 Oct 2016 20:14:06 +0800 Subject: [PATCH 029/244] updae --- .../fr/design/chart/gui/ChartComponent.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java index 9dd851c340..99b97df989 100644 --- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java +++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java @@ -5,6 +5,7 @@ import com.fr.base.ScreenResolution; import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartGlyph; +import com.fr.base.chart.chartdata.ChartDataEvent; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Chart; @@ -31,7 +32,7 @@ import java.util.List; * 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件 右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件 */ -public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener { +public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener, ChartDataEvent { private static final long serialVersionUID = 744164838619052097L; private final List listeners = new ArrayList(); private ChartCollection chartCollection4Design; @@ -309,13 +310,24 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene } else { chartGlyph.setBounds(new Rectangle2D.Double(0, 0, chartWidth, chartHeight)); } - // chartGlyph.draw(g2d, ScreenResolution.getScreenResolution()); + //不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单 //其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边 - Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this); + //注册获取图片后续事件 + registerChartDataEvent(chartGlyph); + Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution()); g2d.drawImage(chartImage, 0, 0, null); } } + @Override + public void registerChartDataEvent(BaseChartGlyph glyph) { + glyph.registerChartDataEvent(this); + } + + @Override + public void fire() { + this.repaint(); + } } \ No newline at end of file From 4c273165e5e329e379ceff9f718849c6f3f55ad7 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 18 Oct 2016 09:09:27 +0800 Subject: [PATCH 030/244] update --- designer_chart/src/com/fr/design/chart/gui/ChartComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java index 99b97df989..6aa05925e4 100644 --- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java +++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java @@ -323,7 +323,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene @Override public void registerChartDataEvent(BaseChartGlyph glyph) { - glyph.registerChartDataEvent(this); + glyph.addChartDataEvent(this); } @Override From fd566dea0388d92bc88253bbde6c22f05980e910 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 18 Oct 2016 09:29:46 +0800 Subject: [PATCH 031/244] update --- designer_chart/src/com/fr/design/chart/gui/ChartComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java index 6aa05925e4..1000efc8b6 100644 --- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java +++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java @@ -327,7 +327,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene } @Override - public void fire() { + public void callback() { this.repaint(); } } \ No newline at end of file From 64ee69555a71ca4f23ae9cc6f340394c25d99400 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 18 Oct 2016 09:36:28 +0800 Subject: [PATCH 032/244] update --- .../fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 8833e5269d..aeb9cb0d96 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -127,7 +127,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } //获取图表收集器的状态 SwitchState state = editingCollection.calculateMultiChartMode(); - if (SwitchState.isDynamicState(state) && parent != null){ + if (state.isDynamicState() && parent != null){ parent.reactorChartTypePane(editingCollection); } @@ -397,7 +397,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //获取图表收集器的状态 SwitchState state = editingCollection.calculateMultiChartMode(); - if (SwitchState.isDynamicState(state) && parent != null){ + if (state.isDynamicState() && parent != null){ parent.reactorChartTypePane(editingCollection); } From 5eb8b4337ea4603017809e704f229f76a33c92a5 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 18 Oct 2016 10:04:59 +0800 Subject: [PATCH 033/244] update --- .../com/fr/design/chart/gui/ChartComponent.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java index 1000efc8b6..2509d1e2bd 100644 --- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java +++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java @@ -32,7 +32,7 @@ import java.util.List; * 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件 右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件 */ -public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener, ChartDataEvent { +public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener { private static final long serialVersionUID = 744164838619052097L; private final List listeners = new ArrayList(); private ChartCollection chartCollection4Design; @@ -313,21 +313,8 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene //不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单 //其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边 - //注册获取图片后续事件 - registerChartDataEvent(chartGlyph); Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution()); g2d.drawImage(chartImage, 0, 0, null); } } - - - @Override - public void registerChartDataEvent(BaseChartGlyph glyph) { - glyph.addChartDataEvent(this); - } - - @Override - public void callback() { - this.repaint(); - } } \ No newline at end of file From 5c78f8708127f6111dded1f44e667d8d76f30f12 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 18 Oct 2016 16:51:50 +0800 Subject: [PATCH 034/244] =?UTF-8?q?REPORT-562=20=E6=97=A5=E6=96=87?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E2=80=9C=E4=BF=AE=E6=94=B9=E2=80=9D=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/condition/LiteConditionPane.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/condition/LiteConditionPane.java b/designer_base/src/com/fr/design/condition/LiteConditionPane.java index a32a112396..d6e4a2af40 100644 --- a/designer_base/src/com/fr/design/condition/LiteConditionPane.java +++ b/designer_base/src/com/fr/design/condition/LiteConditionPane.java @@ -542,13 +542,12 @@ public abstract class LiteConditionPane extends BasicBeanPa andRadioButton.setSelected(true); - JPanel radioPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(3); + JPanel radioPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); addControlPane.add(radioPane); radioPane.add(andRadioButton); - addControlPane.add(Box.createHorizontalStrut(4)); radioPane.add(orRadioButton); - addControlPane.add(Box.createHorizontalStrut(12)); + addControlPane.add(Box.createHorizontalStrut(35)); addButton = new UIButton(Inter.getLocText("FR-Designer_Add"), BaseUtils.readIcon("com/fr/base/images/cell/control/add.png")); addButton.setMnemonic('A'); From 2b468da2874f1a483e7b047446712299f13ddf32 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 18 Oct 2016 17:20:25 +0800 Subject: [PATCH 035/244] update --- designer_chart/src/com/fr/design/chart/gui/ChartComponent.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java index 2509d1e2bd..7321f9a64e 100644 --- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java +++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java @@ -5,7 +5,6 @@ import com.fr.base.ScreenResolution; import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartGlyph; -import com.fr.base.chart.chartdata.ChartDataEvent; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Chart; From 19ba11f8a4195a96bce01a8f52a3c1c1b8321136 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Wed, 19 Oct 2016 02:10:20 +0800 Subject: [PATCH 036/244] =?UTF-8?q?REPORT-364=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=88=B7=E6=96=B0=E6=8E=A5=E5=8F=A3=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...FormElementRefreshCaseEditorProcessor.java | 18 ++++++++++++ ...FormElementRefreshCaseEditorProcessor.java | 28 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 designer_base/src/com/fr/design/fun/FormElementRefreshCaseEditorProcessor.java create mode 100644 designer_base/src/com/fr/design/fun/impl/AbstractFormElementRefreshCaseEditorProcessor.java diff --git a/designer_base/src/com/fr/design/fun/FormElementRefreshCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/FormElementRefreshCaseEditorProcessor.java new file mode 100644 index 0000000000..ceb1881a29 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/FormElementRefreshCaseEditorProcessor.java @@ -0,0 +1,18 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.ReportRefreshAttrProvider; +import com.fr.stable.fun.mark.Immutable; + +import java.beans.PropertyDescriptor; + +/** + * Created by Slpire on 16/10/12. + */ +public interface FormElementRefreshCaseEditorProcessor extends Immutable { + + String MARK_STRING = "PropertyEditor"; + + int CURRENT_LEVEL = 1; + + PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportRefreshAttrProvider reportefreshAttr); +} diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementRefreshCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementRefreshCaseEditorProcessor.java new file mode 100644 index 0000000000..5bbf34bc71 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementRefreshCaseEditorProcessor.java @@ -0,0 +1,28 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.FormElementRefreshCaseEditorProcessor; +import com.fr.stable.fun.RefreshProvider; +import com.fr.stable.fun.ReportRefreshAttrProvider; +import com.fr.stable.fun.mark.API; + +import java.beans.PropertyDescriptor; + +/** + * Created by Slpire on 16/10/12. + */ +@API(level = FormElementRefreshCaseEditorProcessor.CURRENT_LEVEL) +public abstract class AbstractFormElementRefreshCaseEditorProcessor implements FormElementRefreshCaseEditorProcessor { + + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + + @Override + public PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportRefreshAttrProvider refreshAttrProvider) { + return new PropertyDescriptor[0]; + } +} From 3594d91026721659b6732299c382eb70f939696e Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 19 Oct 2016 09:37:14 +0800 Subject: [PATCH 037/244] update --- .../fr/design/ChartTypeInterfaceManager.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index d9574a09c4..866d039667 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -52,7 +52,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh private static ChartTypeInterfaceManager classManager = null; private static LinkedHashMap> chartTypeInterfaces = new LinkedHashMap>(); - //private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); + private static final String DEFAULT_CHART_ID = "DefaultChart"; public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { @@ -136,7 +136,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.CHART_ID, chartUIList); + chartTypeInterfaces.put(DEFAULT_CHART_ID, chartUIList); } public String getIconPath(String plotID) { @@ -286,7 +286,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); return getChartDataPane(chartID, plotID, listener); } - return getChartDataPane(ChartConstants.DEFAULT_CHART_ID, plotID, listener); + return getChartDataPane(DEFAULT_CHART_ID, plotID, listener); } private ChartDataPane getChartDataPane(String chartID, String plotID, AttributeChangeListener listener) { @@ -312,7 +312,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); return getAttrPaneArray(chartID, plotID, listener); } - return getAttrPaneArray(ChartConstants.DEFAULT_CHART_ID, plotID, listener); + return getAttrPaneArray(DEFAULT_CHART_ID, plotID, listener); } private AbstractChartAttrPane[] getAttrPaneArray(String chartID, String plotID, AttributeChangeListener listener) { @@ -326,7 +326,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); return getTableDataSourcePane(chartID, plot, parent); } - return getTableDataSourcePane(ChartConstants.DEFAULT_CHART_ID, plot, parent); + return getTableDataSourcePane(DEFAULT_CHART_ID, plot, parent); } private AbstractTableDataContentPane getTableDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { @@ -341,7 +341,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); return getReportDataSourcePane(chartID, plot, parent); } - return getReportDataSourcePane(ChartConstants.DEFAULT_CHART_ID, plot, parent); + return getReportDataSourcePane(DEFAULT_CHART_ID, plot, parent); } private AbstractReportDataContentPane getReportDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { @@ -356,7 +356,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); return getPlotConditionPane(chartID, plot); } - return getPlotConditionPane(ChartConstants.DEFAULT_CHART_ID, plot); + return getPlotConditionPane(DEFAULT_CHART_ID, plot); } private ConditionAttributesPane getPlotConditionPane(String chartID, Plot plot) { @@ -371,7 +371,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); return getPlotSeriesPane(chartID, parent, plot); } - return getPlotSeriesPane(ChartConstants.DEFAULT_CHART_ID, parent, plot); + return getPlotSeriesPane(DEFAULT_CHART_ID, parent, plot); } private BasicBeanPane getPlotSeriesPane(String chartID, ChartStylePane parent, Plot plot) { @@ -418,7 +418,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh extraChartDesignInterfaceList.add(tagName); } if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { - addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", ChartConstants.DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); + addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); } } } From 3f236acdc5c07470bafc63ae2e17b5a4e5de96df Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 19 Oct 2016 22:39:21 +0800 Subject: [PATCH 038/244] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/form/images/download.png | Bin 98 -> 186 bytes .../com/fr/design/form/images/showmenu.png | Bin 0 -> 98 bytes .../mainframe/FormWidgetDetailPane.java | 57 ++++++++++++++++-- 3 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 designer_form/src/com/fr/design/form/images/showmenu.png diff --git a/designer_form/src/com/fr/design/form/images/download.png b/designer_form/src/com/fr/design/form/images/download.png index fa7b09dea32a9cce0962b2da23a6cfa34bc59baf..57c328d73bdae515704173aac5c3c8e32480f4c9 100644 GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^d_c^@!3HFQ8hUO4DaPU;cPEB*=VV?2IVGMhjv*SN z$q5G-wXW^?#ec|RiR6p|PXVFj``yH5*jqUrk>IrCSK$x#w_P5#w)QTAv1l5z2hR~V zHVLzBtlee?hDK(GL>g}>7)r>yZ9X7z!o)-Ig4hNDGhYSHHByd3J4_m$I5Y^}v=>l( hGks;7n^}<%ASW}?=44$rjF6*2UngAg%HYWf8 literal 98 zcmeAS@N?(olHy`uVBq!ia0vp^JV4CF!3HE7boT!OQjEnx?oJHr&dIz4a%4PR977}| vlh;Iier3 jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt == null) { + return; + } + + UIPopupMenu menu = new UIPopupMenu(); + + UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + menu.add(downloadItem); + downloadItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + BasicPane managerPane = new WebManagerPaneFactory().createReusePane(); + UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane); + PluginWebBridge.getHelper().setDialogHandle(dlg); + dlg.setVisible(true); + } + }); + GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + 140, tabbedPane.getY() + 26); + + } + }); + } public String[] getCategories() { return ShareConstants.WIDGET_CATEGORIES; } From 1d67b72335988eaa8a4f91781ec2d1e47a6f9491 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 19 Oct 2016 22:41:30 +0800 Subject: [PATCH 039/244] rt --- .../com/fr/design/mainframe/FormWidgetDetailPane.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 1f5c170f9f..84600ecb49 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -101,7 +101,7 @@ public class FormWidgetDetailPane extends FormDockView{ } initReuWidgetPanel(); esp.add(reuWidgetPanel, BorderLayout.CENTER); - createDownButton(); + createDownloadButton(); JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 3)); widgetPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), @@ -151,20 +151,14 @@ public class FormWidgetDetailPane extends FormDockView{ }); } - private void createDownButton() { + private void createDownloadButton() { downloadButton = new UIButton(); downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png")); downloadButton.set4ToolbarButton(); downloadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - final JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - UIPopupMenu menu = new UIPopupMenu(); - UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); menu.add(downloadItem); downloadItem.addActionListener(new ActionListener() { From be824ed22ac3f9e79182666d384d431df7036360 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 19 Oct 2016 22:47:06 +0800 Subject: [PATCH 040/244] rt --- .../fr/design/mainframe/FormWidgetDetailPane.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 84600ecb49..62128240cc 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -126,7 +126,7 @@ public class FormWidgetDetailPane extends FormDockView{ downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); downPanel.setPreferredSize(new Dimension(236, rowCount * 82)); reuWidgetPanel = new JPanel(); - comboBox = new UIComboBox(getCategories()); + comboBox = new UIComboBox(getFormCategories()); comboBox.setPreferredSize(new Dimension(236, 30)); initComboBoxSelectedListener(); reuWidgetPanel.add(comboBox, BorderLayout.NORTH); @@ -151,6 +151,9 @@ public class FormWidgetDetailPane extends FormDockView{ }); } + /** + * 创建下载模板的按钮 + */ private void createDownloadButton() { downloadButton = new UIButton(); downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png")); @@ -175,10 +178,16 @@ public class FormWidgetDetailPane extends FormDockView{ } }); } - public String[] getCategories() { + + /** + * 获取报表块组件分类 + */ + public String[] getFormCategories() { return ShareConstants.WIDGET_CATEGORIES; } + + public void refreshDownPanel() { reuWidgetPanel.remove(downPanel); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); From 5f0ead4b9a3505411cc0c04b8df510dc4361e93e Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 20 Oct 2016 00:32:24 +0800 Subject: [PATCH 041/244] RT --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 62128240cc..372377077e 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -51,6 +51,8 @@ public class FormWidgetDetailPane extends FormDockView{ private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; private UIButton downloadButton; + private static final int OFFSET_X = 140; + private static final int OFFSET_Y = 26; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -173,7 +175,7 @@ public class FormWidgetDetailPane extends FormDockView{ dlg.setVisible(true); } }); - GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + 140, tabbedPane.getY() + 26); + GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, tabbedPane.getY() + OFFSET_Y); } }); @@ -186,7 +188,7 @@ public class FormWidgetDetailPane extends FormDockView{ return ShareConstants.WIDGET_CATEGORIES; } - + public void refreshDownPanel() { reuWidgetPanel.remove(downPanel); From 477854d2af1d34be24f9717d77de96322611d574 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Oct 2016 01:21:39 +0800 Subject: [PATCH 042/244] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=9D=97=E5=85=B1?= =?UTF-8?q?=E4=BA=AB=EF=BC=8C=E5=B8=AE=E5=8A=A9=E4=BF=A1=E6=81=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E6=95=B0=E6=8D=AE=E9=9B=86=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=88=B0=E8=A1=A8=E5=8D=95=E3=80=82=E4=BB=A5=E5=8F=8A=E5=86=85?= =?UTF-8?q?=E8=BE=B9=E8=B7=9D=E7=9A=84=E4=B8=80=E4=B8=AAbug=E6=94=B9?= =?UTF-8?q?=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/BasicTableDataTreePane.java | 4 + .../data/datapane/TableDataTreePane.java | 20 ++ .../com/fr/design/icon/IconPathConstants.java | 2 +- .../fr/design/images/control/help_close.png | Bin 0 -> 801 bytes .../fr/design/images/control/help_open.png | Bin 0 -> 895 bytes .../fr/design/designer/creator/XCreator.java | 21 ++ .../designer/creator/XCreatorUtils.java | 1 + .../design/designer/creator/XElementCase.java | 22 +- .../fr/design/mainframe/CoverReportPane.java | 140 ++++++-- .../mainframe/EditingMouseListener.java | 38 +- .../mainframe/ElementCaseHelpDialog.java | 73 ++++ .../mainframe/FormCreatorDropTarget.java | 340 +++++++++--------- 12 files changed, 441 insertions(+), 220 deletions(-) create mode 100644 designer_base/src/com/fr/design/images/control/help_close.png create mode 100644 designer_base/src/com/fr/design/images/control/help_open.png create mode 100644 designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java diff --git a/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java b/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java index 32049380d5..a6fd601a82 100644 --- a/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java @@ -3,6 +3,7 @@ package com.fr.design.data; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.TableData; +import com.fr.data.TableDataSource; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; @@ -423,4 +424,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_CONNECTION_ICON_PATH)); } } + public void addTableData(TableDataSource tableDataSource){ + + } } diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java index 162957ebf4..911b0d9c94 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java @@ -39,6 +39,7 @@ import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; public class TableDataTreePane extends BasicTableDataTreePane { @@ -138,6 +139,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { populate(new TableDataSourceOP(tc)); this.checkButtonEnabled(); } + protected void initbuttonGroup() { Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/data/datasource.png"), BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png")}; final Integer[] modeArray = {TEMPLATE_TABLE_DATA, SERVER_TABLE_DATA}; @@ -267,4 +269,22 @@ public class TableDataTreePane extends BasicTableDataTreePane { public TableDataTree getDataTree() { return dataTree; } + + public void addTableData(TableDataSource tableDataSource) { + DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); + TableDataSource tds = tc.getBook(); + Iterator tdIterator = tableDataSource.getTableDataNameIterator(); + while (tdIterator.hasNext()) { + String tdName = (String) tdIterator.next(); + TableData td = tableDataSource.getTableData(tdName); + if (tds.getTableData(tdName) != null) { + tds.putTableData(tdName + "-fr-el", td); + } else { + tds.putTableData(tdName, td); + } + } + tc.fireTargetModified(); + tc.parameterChanged(); + dataTree.refresh(); + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/icon/IconPathConstants.java b/designer_base/src/com/fr/design/icon/IconPathConstants.java index c254e04d67..4a86bcf6f1 100644 --- a/designer_base/src/com/fr/design/icon/IconPathConstants.java +++ b/designer_base/src/com/fr/design/icon/IconPathConstants.java @@ -1 +1 @@ -package com.fr.design.icon; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 6.5.6 * Date: 12-12-18 * Time: 上午9:42 * 用于保存所有图标路径的类 */ public class IconPathConstants { private IconPathConstants() { } public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png"; public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png"; public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png"; public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/base/images/cell/control/remove.png"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; public static final String FORBID_ICON_PATH ="/com/fr/web/images/form/forbid.png"; } \ No newline at end of file +package com.fr.design.icon; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 6.5.6 * Date: 12-12-18 * Time: 上午9:42 * 用于保存所有图标路径的类 */ public class IconPathConstants { private IconPathConstants() { } public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png"; public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png"; public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png"; public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/base/images/cell/control/remove.png"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; public static final String FORBID_ICON_PATH ="/com/fr/web/images/form/forbid.png"; } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/images/control/help_close.png b/designer_base/src/com/fr/design/images/control/help_close.png new file mode 100644 index 0000000000000000000000000000000000000000..036865c18968c1647044a5b5f1dbb75a6d590b9d GIT binary patch literal 801 zcmV++1K#|JP)Px%+et)0R7efIRy}W1F%-RaQ#C;WwF&LesldjDK!TMCrXUpf3msV)2tuMS15!G4 zVdO7BKx8T`U5f-_W8-7$&^Ad06)zR-Gxzw#iQkL;g3^e)_~Ra*CX3}KQ$(Pz=(nymFNw5 z0?+euwh`Q2I7oQ<4X4sAi|YJ?gdhcDX(h-XM5* zt3(S-_ThVv-hLjvMt80h>H38{b$>^+@vcJ=Up|M0`SRkDj4$k{5C)tpNG&9Upc@wp zRJ~eE@Su%;_%R{iJyw7Yd!vd6KnFZqtjO54m7ySn&^87f@P3ObIiw&zfb`bocuIyC z$?CR;ubG6OEGF$kG6LTLvLaM_tgwj^FyCL4yDVdnB@80pNw zPY-Q>8wwc+1kn#aG6?V<3!%fSBdRrb8yuC7TtMtIGDFsd#fl*0NmU4r^+t86rt=G) za%5+h7znb2Fa~~~5O~24oED4Izg*=c$JA3a=EE1k{7JMJ==%>`eTq_`s+)%s4Si;) z!0-oo{CfW>SJzJUV#hmFx4#77Pl%xd_FsNiu~fXJc*+q)+~>R&25Xi0H?Cuxy>*t~ fy)qjx%^&e!Dn3F>!HmBV00000NkvXXu0mjfGk9d# literal 0 HcmV?d00001 diff --git a/designer_base/src/com/fr/design/images/control/help_open.png b/designer_base/src/com/fr/design/images/control/help_open.png new file mode 100644 index 0000000000000000000000000000000000000000..b988d678fe13913c1e76e8dd2ac22a08cb41362f GIT binary patch literal 895 zcmV-_1AzRAP)Px&IY~r8R7efIR!wMAK@gtZyfjU$ttLdYf}lNEV{amQw1`+Q1*u*XuO2;0MX>2X zXs_P%`IhOUO^poXXd8;_c zhOeE`uy${&q`(D3wHBiX22rro+1_ZQ_}GSi6u$$>g@}ONA+^D zmZ6jqgO3)5%EEfE6(HDx9`s?S);7i-&ujsu()B`Ho(qv48AuMh`c*K54m%?D&RyL0 zR|pkS@}e73+c1*BESJ7D8@gy%P^?AJ@;aX^r=*T>hLMobg`_bcXlEUfHW?&u>-3Qr z_3V#Oa%YHy5L9NQ4>Kk`o6J(y^hbpQ75jq%_b8uPm}ktu^oAFgPqx#cWQ(s8GnpdY zeYK+VGS`|&?vc)g4F-bsLP=4+=%bFKFd~BkiK972CXcCKaRO2c3K} z`8@BxUZtYmF_e~sMD^ZmE|`Nv=)(eQVLdZR~ScfEa%*LGv8Ea#J*#Y zot!lrB*lhB;20dsX&xNgVCzR&)1oN`0e$@CeDxa6DsVXUg?;dCFqD6^a@N!y z!zWG*)J5*-Tq`YlF}+48Wr4)@VAp+d=)b(K94I2Z8PLjkE2GTAwP=R$ZXAW4`{t-u^7X7%=wH5w{{XmS VQVTmPss;c6002ovPDHLkV1i?!vbF#K literal 0 HcmV?d00001 diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index 552402398a..d030104a23 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -12,6 +12,10 @@ import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.*; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.AbstractFormSharableEditor; +import com.fr.form.ui.ElCaseBindInfo; +import com.fr.form.ui.FormSharableEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.stable.StableUtils; @@ -590,4 +594,21 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * @param msg 帮助信息 */ public void setSharedMsg(String msg){} + + /** + * 根据widget设置Xcreator共享信息 + * @param widget + */ + public void setShareMsgByWidget(Widget widget){ + if (widget != null && (widget instanceof FormSharableEditor)) { + String shareId = ((AbstractFormSharableEditor) widget).getShareId(); + ElCaseBindInfo info = ShareLoader.getLoader().getElCaseBindInfoById(shareId); + if (info != null) { + + setSharedMsg(info.getGuideInfo()); + + } + } + + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java b/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java index e0fc683552..36158f821b 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java @@ -157,6 +157,7 @@ public class XCreatorUtils { FRContext.getLogger().error("Error to create xcreator!"); creator = new NullCreator(widget, d); } + creator.setShareMsgByWidget(widget);//设置共享信息 return creator; } diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 252ec35c78..0e0d35637b 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -35,7 +35,7 @@ import java.beans.PropertyDescriptor; public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ private UILabel imageLable; - private JPanel coverPanel; + private CoverReportPane coverPanel; private FormDesigner designer; //缩略图 private BufferedImage thumbnailImage; @@ -181,11 +181,10 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme * @param display 是否 */ public void displayCoverPane(boolean display){ - coverPanel.setVisible(display); - coverPanel.setPreferredSize(editor.getPreferredSize()); - coverPanel.setBounds(editor.getBounds()); - editor.repaint(); - } + coverPanel.setVisible(display); + coverPanel.setBounds(1, 1, (int) editor.getBounds().getWidth(), (int) editor.getBounds().getHeight()); + editor.repaint(); + } public JComponent getCoverPane(){ return coverPanel; @@ -263,7 +262,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme */ public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ super.respondClick(editingMouseListener, e); - switchTab(e,editingMouseListener); + if (this.isHelpBtnOnFocus()) { + coverPanel.setMsgDisplay(e); + }else { + switchTab(e,editingMouseListener); + } } @@ -280,4 +283,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { return new WidgetPropertyUIProvider[]{ new ElementCasePropertyUI(this)}; } + + @Override + public void setSharedMsg(String msg) { + coverPanel.setHelpMsg(msg); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java index 183cf24eea..42dc62040c 100644 --- a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java +++ b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java @@ -1,12 +1,19 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; +import com.fr.design.designer.beans.events.DesignerEditListener; +import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; +import com.fr.form.share.ShareConstants; +import com.fr.general.FRScreen; +import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; +import java.awt.event.MouseEvent; /** * Created with IntelliJ IDEA. @@ -14,59 +21,122 @@ import java.awt.*; * Date: 14-7-24 * Time: 上午9:09 */ -public class CoverReportPane extends JPanel{ +public class CoverReportPane extends JPanel { private UIButton editButton; + private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); + private JComponent controlButton = new JComponent() { + protected void paintComponent(Graphics g) { + g.setColor(UIConstants.NORMAL_BACKGROUND); + g.fillArc(0, 0, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW, + 0, 360); + controlMode.paintIcon(this, g, 0, 0); + } + }; + + + private String helpMsg;//帮助信息(后续帮助信息可能会变成标配,就直接放这边了) + + private ElementCaseHelpDialog helpDialog = null; private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); - public CoverReportPane(){ - setLayout(coverLayout); + public CoverReportPane() { + this(StringUtils.EMPTY); + } + + public CoverReportPane(String helpMsg) { + this.helpMsg = helpMsg; + setLayout(getCoverLayout()); setBackground(null); setOpaque(false); - editButton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)){ + editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) { @Override public Dimension getPreferredSize() { - return new Dimension(60,24); + return new Dimension(60, 24); } }; editButton.setBorderPainted(false); editButton.setExtraPainted(false); - editButton.setBackground(new Color(176,196,222)); + editButton.setBackground(new Color(176, 196, 222)); add(editButton); + add(controlButton); + WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { + @Override + public void fireCreatorModified(DesignerEvent evt) { + if (evt.getCreatorEventID() == (DesignerEvent.CREATOR_DELETED) + || evt.getCreatorEventID() == (DesignerEvent.CREATOR_RESIZED)) { + destroyHelpDialog(); + } + } + }); + } + public String getHelpMsg() { + return helpMsg; } - private LayoutManager coverLayout = new LayoutManager() { + public void setHelpMsg(String helpMsg) { + this.helpMsg = helpMsg; + } - @Override - public void removeLayoutComponent(Component comp) { + public void setMsgDisplay(MouseEvent e) { + if (helpDialog == null) { + controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); + controlButton.repaint(); + helpDialog = new ElementCaseHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); + double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); + int offsetX = 0; + if (screenValue < FormArea.DEFAULT_SLIDER) { + offsetX = (int) ((1 - screenValue / FormArea.DEFAULT_SLIDER) + * WidgetPropertyPane.getInstance().getEditingFormDesigner().getRootComponent().getWidth() / 2); + } + int rX = WestRegionContainerPane.getInstance().getWidth() + e.getX() + offsetX - 227;//弹出框宽度190加上图标的宽度27加上10的偏移 + int rY = 165 + e.getY();//165是设计器最上面几个面板的高度 + helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); + helpDialog.showWindow(); + } else { + controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); + controlButton.repaint(); + helpDialog.dispose(); + helpDialog = null; } + } - @Override - public Dimension preferredLayoutSize(Container parent) { - return parent.getPreferredSize(); - } + protected LayoutManager getCoverLayout() { + return new LayoutManager() { - @Override - public Dimension minimumLayoutSize(Container parent) { - return null; - } + @Override + public void removeLayoutComponent(Component comp) { + } - @Override - public void layoutContainer(Container parent) { - int width = parent.getParent().getWidth(); - int height = parent.getParent().getHeight(); - int preferWidth = editButton.getPreferredSize().width; - int preferHeight = editButton.getPreferredSize().height; - editButton.setBounds((width - preferWidth)/2, (height - preferHeight)/2, preferWidth, preferHeight); - } + @Override + public Dimension preferredLayoutSize(Container parent) { + return parent.getPreferredSize(); + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return null; + } + + @Override + public void layoutContainer(Container parent) { + int width = parent.getParent().getWidth(); + int height = parent.getParent().getHeight(); + int preferWidth = editButton.getPreferredSize().width; + int preferHeight = editButton.getPreferredSize().height; + editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight); + controlButton.setBounds((width - 28), 0, 27, 27); + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + }; + } - @Override - public void addLayoutComponent(String name, Component comp) { - } - }; public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; @@ -77,4 +147,14 @@ public class CoverReportPane extends JPanel{ g2d.setComposite(oldComposite); super.paint(g); } + + public void destroyHelpDialog() { + if (helpDialog != null) { + controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); + controlButton.repaint(); + helpDialog.dispose(); + helpDialog = null; + } + } + } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index fc25bd1245..0aa77281d1 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -1,14 +1,5 @@ package com.fr.design.mainframe; -import java.awt.Color; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Rectangle; -import java.awt.event.MouseEvent; - -import javax.swing.*; -import javax.swing.event.MouseInputAdapter; - import com.fr.base.BaseUtils; import com.fr.design.beans.location.MoveUtils; import com.fr.design.designer.beans.AdapterBus; @@ -29,6 +20,11 @@ import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.Inter; import com.fr.stable.Constants; +import javax.swing.*; +import javax.swing.event.MouseInputAdapter; +import java.awt.*; +import java.awt.event.MouseEvent; + /** * 普通模式下的鼠标点击、位置处理器 */ @@ -291,18 +287,28 @@ public class EditingMouseListener extends MouseInputAdapter { if (component.isReport()) { xElementCase = (XElementCase)component; - UIButton button = (UIButton)xElementCase.getCoverPane().getComponent(0); + UIButton button = (UIButton)xElementCase.getCoverPane().getComponent(0); + JComponent button1= (JComponent) xElementCase.getCoverPane().getComponent(1); if(designer.getCursor().getType() ==Cursor.HAND_CURSOR) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } // component.getParent() 是报表块所在的XWTitleLayout int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); + int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); - if(e.getX() + GAP > minX && e.getX() - GAP < minX + button.getWidth()){ - if( e.getY() + GAP > minY && e.getY() - GAP < minY + button.getHeight()){ - designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } - } - xElementCase.displayCoverPane(true); + int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); + if (e.getX() + GAP - xElementCase.getInsets().left > minX && e.getX() - GAP - xElementCase.getInsets().left < minX + button.getWidth()) { + if (e.getY() + GAP - xElementCase.getInsets().top > minY && e.getY() - GAP - xElementCase.getInsets().top < minY + button.getHeight()) { + designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + } + xElementCase.setHelpBtnOnFocus(false); + if (e.getX() + GAP - xElementCase.getInsets().left > minX1 && e.getX() - GAP - xElementCase.getInsets().left < minX1 + button1.getWidth()) { + if (e.getY() + GAP - xElementCase.getInsets().top > minY1 && e.getY() - GAP - xElementCase.getInsets().top < minY1 + button1.getHeight()) { + designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + xElementCase.setHelpBtnOnFocus(true); + } + } + xElementCase.displayCoverPane(true); xElementCase.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT); designer.repaint(); diff --git a/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java b/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java new file mode 100644 index 0000000000..60b699107c --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java @@ -0,0 +1,73 @@ +package com.fr.design.mainframe; + +import com.fr.design.dialog.UIDialog; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.itextarea.UITextArea; + +import javax.swing.*; +import java.awt.*; + +/** + * @author zack + * @date 2016-10-14 + * @since 8.0 + */ +public class ElementCaseHelpDialog extends UIDialog { + + private static final int OUTER_WIDTH = 190; + private static final int OUTER_HEIGHT = 120; + + + private String helpMsg; + private UIScrollPane helpArea; + + + public ElementCaseHelpDialog(Frame parent, String helpMsg) { + super(parent); + this.helpMsg = helpMsg; + setUndecorated(true); + initHelpArea(); + JPanel panel = (JPanel) getContentPane(); + initComponents(panel); + setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT)); + } + + private void initHelpArea() { + UITextArea textArea = new UITextArea(helpMsg); + textArea.setEditable(false); + textArea.setBorder(null); + helpArea = new UIScrollPane(textArea); + helpArea.setBounds(0, 0, 190, 120); + helpArea.setBorder(null); + } + + private void initComponents(JPanel contentPane) { + contentPane.setLayout(new BorderLayout()); + add(helpArea, BorderLayout.CENTER); + } + + /** + * 打开帮助框 + */ + public void showWindow() { + setVisible(true); + this.setResizable(false); + } + + /** + * 略 + */ + @Override + public void checkValid() throws Exception { + + } + + public void setLocationRelativeTo(JFrame c, int x, int y) { + int dx = 0, dy = 0; + Point compLocation = c.getLocationOnScreen();//获取设计器Jframe坐标作为相对位置原点 + setLocation(dx + x, dy + y); + dx = compLocation.x; + dy = compLocation.y + c.getRootPane().getY();//加上底层容器的y坐标(其实就是设计器最上方图标栏的高度) + setLocation(dx + x, dy + y); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java index 1172a4b645..91c39f988f 100644 --- a/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -1,20 +1,8 @@ package com.fr.design.mainframe; -import java.awt.Color; -import java.awt.Component; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.dnd.DropTarget; -import java.awt.dnd.DropTargetDragEvent; -import java.awt.dnd.DropTargetDropEvent; -import java.awt.dnd.DropTargetEvent; -import java.util.ArrayList; - -import javax.swing.BorderFactory; -import javax.swing.JWindow; - import com.fr.base.BaseUtils; +import com.fr.design.DesignModelAdapter; +import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.Painter; @@ -25,177 +13,192 @@ import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; import com.fr.design.utils.ComponentUtils; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.SharableElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.general.Inter; import com.fr.stable.Constants; +import javax.swing.*; +import java.awt.*; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; + /** * 添加模式下鼠标事件处理器。 */ public class FormCreatorDropTarget extends DropTarget { - private FormDesigner designer; - /** - * 当前鼠标的设计组件 - */ - private Component current; - /** - * 当前添加模式对应的model - */ - private AddingModel addingModel; + private FormDesigner designer; + /** + * 当前鼠标的设计组件 + */ + private Component current; + /** + * 当前添加模式对应的model + */ + private AddingModel addingModel; private final static int GAP = 30; private JWindow promptWindow = new JWindow(); private UIButton promptButton = new UIButton("", BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); - public FormCreatorDropTarget(FormDesigner designer) { - this.designer = designer; - this.addingModel = designer.getAddingModel(); + public FormCreatorDropTarget(FormDesigner designer) { + this.designer = designer; + this.addingModel = designer.getAddingModel(); this.promptWindow.add(promptButton); - } + } + + private void adding(int x, int y) { + // 当前鼠标所在的组件 + XCreator hoveredComponent = designer.getComponentAt(x, y); - private void adding(int x, int y) { - // 当前鼠标所在的组件 - XCreator hoveredComponent = designer.getComponentAt(x, y); + // 获取该组件所在的焦点容器 + XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent); - // 获取该组件所在的焦点容器 - XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent); - - //cardTagLayout里用到 - container.stopAddingState(designer); + //cardTagLayout里用到 + container.stopAddingState(designer); - boolean success = false; + boolean success = false; - if (container != null) { - // 如果是容器,则调用其acceptComponent接受组件 - AddingModel model = designer.getAddingModel(); + if (container != null) { + // 如果是容器,则调用其acceptComponent接受组件 + AddingModel model = designer.getAddingModel(); - boolean chartEnter2Para =!addingModel.getXCreator().canEnterIntoParaPane() && container.acceptType(XWParameterLayout.class); + boolean chartEnter2Para = !addingModel.getXCreator().canEnterIntoParaPane() && container.acceptType(XWParameterLayout.class); boolean formSubmit2Adapt = !addingModel.getXCreator().canEnterIntoAdaptPane() && container.acceptType(XWFitLayout.class); - if (model != null && !chartEnter2Para && !formSubmit2Adapt) { - success = model.add2Container(designer, container, x, y); - } + if (model != null && !chartEnter2Para && !formSubmit2Adapt) { + success = model.add2Container(designer, container, x, y); + } cancelPromptWidgetForbidEnter(); - } + } - if (success) { - // 如果添加成功,则触发相应事件 + if (success) { + // 如果添加成功,则触发相应事件 XCreator xCreator = container.acceptType(XWParameterLayout.class) ? designer.getParaComponent() : designer.getRootComponent(); - //SetSelection时要确保选中的是最顶层的布局 - //tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout - XCreator addingXCreator = addingModel.getXCreator(); - Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); - designer.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); - designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); - } else { - Toolkit.getDefaultToolkit().beep(); - } - - // 取消提示 - designer.setPainter(null); - // 切换添加状态到普通状态 - designer.stopAddingState(); - } - - private void entering(int x, int y) { - // 将要添加的组件图标移动到鼠标下的位置 - addingModel.moveTo(x, y); - designer.repaint(); - } - - private void exiting() { + //SetSelection时要确保选中的是最顶层的布局 + //tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout + XCreator addingXCreator = addingModel.getXCreator(); + if (addingXCreator.isShared()) { + SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(addingXCreator.getShareId()); + if (sharableEditor != null) { + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(sharableEditor.getTableDataSource()); + } + } + Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); + designer.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); + designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + } else { + Toolkit.getDefaultToolkit().beep(); + } + + // 取消提示 + designer.setPainter(null); + // 切换添加状态到普通状态 + designer.stopAddingState(); + } + + private void entering(int x, int y) { + // 将要添加的组件图标移动到鼠标下的位置 + addingModel.moveTo(x, y); + designer.repaint(); + } + + private void exiting() { cancelPromptWidgetForbidEnter(); - // 隐藏组件图标 - addingModel.reset(); - designer.setPainter(null); - designer.repaint(); - } - - private void hovering(int x, int y) { - // 当前位置移植鼠标e所在的位置 - addingModel.moveTo(x, y); - // 获取e所在的焦点组件 - XCreator hotspot = designer.getComponentAt(x, y); - // 获取焦点组件所在的焦点容器 - XLayoutContainer container = XCreatorUtils.getHotspotContainer(hotspot); + // 隐藏组件图标 + addingModel.reset(); + designer.setPainter(null); + designer.repaint(); + } + + private void hovering(int x, int y) { + // 当前位置移植鼠标e所在的位置 + addingModel.moveTo(x, y); + // 获取e所在的焦点组件 + XCreator hotspot = designer.getComponentAt(x, y); + // 获取焦点组件所在的焦点容器 + XLayoutContainer container = XCreatorUtils.getHotspotContainer(hotspot); //提示组件是否可以拖入 promptUser(x, y, container); - if (container != null) { - HoverPainter painter = null; - - if (container != current || designer.getPainter() == null) { - // 如果焦点容器不是当前容器 - if (current != null) { - // 取消前一个焦点容器的提示渲染器 - designer.setPainter(null); - } - //获取painter的时候要考虑布局之间嵌套的问题 - XLayoutContainer xLayoutContainer = container.getTopLayout(); - if (xLayoutContainer != null && xLayoutContainer.getParent() != null - && ((XLayoutContainer)xLayoutContainer.getParent()).acceptType(XWAbsoluteLayout.class)){ - if(!xLayoutContainer.isEditable()){ - xLayoutContainer = (XLayoutContainer)xLayoutContainer.getParent(); - } - } - painter = AdapterBus.getContainerPainter(designer, - xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class) ? xLayoutContainer : container); - - // 为界面设计器设置提示渲染提示器 - designer.setPainter(painter); - - // 将当前容器更新为新的容器 - current = container; - } else { - // 获取当前设计界面的提示渲染器 - Painter p = designer.getPainter(); - if (p instanceof HoverPainter) { - painter = (HoverPainter) p; - } - } - - if (painter != null) { - // 为提示渲染器设置焦点位置、区域等渲染参数 - Rectangle rect = ComponentUtils.getRelativeBounds(container); - rect.x -= designer.getArea().getHorizontalValue(); - rect.y -= designer.getArea().getVerticalValue(); - painter.setRenderingBounds(rect); - painter.setHotspot(new Point(x, y)); - painter.setCreator(addingModel.getXCreator()); - } - } else { - // 如果鼠标不在任何组件上,则取消提示器 - designer.setPainter(null); - current = null; - } - designer.repaint(); - } - - private void promptUser(int x, int y, XLayoutContainer container){ - if (!addingModel.getXCreator().canEnterIntoParaPane() && container.acceptType(XWParameterLayout.class)){ + if (container != null) { + HoverPainter painter = null; + + if (container != current || designer.getPainter() == null) { + // 如果焦点容器不是当前容器 + if (current != null) { + // 取消前一个焦点容器的提示渲染器 + designer.setPainter(null); + } + //获取painter的时候要考虑布局之间嵌套的问题 + XLayoutContainer xLayoutContainer = container.getTopLayout(); + if (xLayoutContainer != null && xLayoutContainer.getParent() != null + && ((XLayoutContainer) xLayoutContainer.getParent()).acceptType(XWAbsoluteLayout.class)) { + if (!xLayoutContainer.isEditable()) { + xLayoutContainer = (XLayoutContainer) xLayoutContainer.getParent(); + } + } + painter = AdapterBus.getContainerPainter(designer, + xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class) ? xLayoutContainer : container); + + // 为界面设计器设置提示渲染提示器 + designer.setPainter(painter); + + // 将当前容器更新为新的容器 + current = container; + } else { + // 获取当前设计界面的提示渲染器 + Painter p = designer.getPainter(); + if (p instanceof HoverPainter) { + painter = (HoverPainter) p; + } + } + + if (painter != null) { + // 为提示渲染器设置焦点位置、区域等渲染参数 + Rectangle rect = ComponentUtils.getRelativeBounds(container); + rect.x -= designer.getArea().getHorizontalValue(); + rect.y -= designer.getArea().getVerticalValue(); + painter.setRenderingBounds(rect); + painter.setHotspot(new Point(x, y)); + painter.setCreator(addingModel.getXCreator()); + } + } else { + // 如果鼠标不在任何组件上,则取消提示器 + designer.setPainter(null); + current = null; + } + designer.repaint(); + } + + private void promptUser(int x, int y, XLayoutContainer container) { + if (!addingModel.getXCreator().canEnterIntoParaPane() && container.acceptType(XWParameterLayout.class)) { promptButton.setText(Inter.getLocText("FR-Designer_Forbid_Drag_into_Para_Pane")); - promptWidgetForbidEnter(x ,y ,container); - } else if (!addingModel.getXCreator().canEnterIntoAdaptPane() && container.acceptType(XWFitLayout.class)){ + promptWidgetForbidEnter(x, y, container); + } else if (!addingModel.getXCreator().canEnterIntoAdaptPane() && container.acceptType(XWFitLayout.class)) { promptButton.setText(Inter.getLocText("FR-Designer_Forbid_Drag_into_Adapt_Pane")); - promptWidgetForbidEnter(x ,y , container); + promptWidgetForbidEnter(x, y, container); } else { cancelPromptWidgetForbidEnter(); } } - private void promptWidgetForbidEnter(int x,int y, XLayoutContainer container){ + private void promptWidgetForbidEnter(int x, int y, XLayoutContainer container) { container.setBorder(BorderFactory.createLineBorder(Color.RED, Constants.LINE_MEDIUM)); - int screen_X = (int)designer.getArea().getLocationOnScreen().getX(); - int screen_Y = (int)designer.getArea().getLocationOnScreen().getY(); + int screen_X = (int) designer.getArea().getLocationOnScreen().getX(); + int screen_Y = (int) designer.getArea().getLocationOnScreen().getY(); this.promptWindow.setSize(promptWindow.getPreferredSize()); this.promptWindow.setPreferredSize(promptWindow.getPreferredSize()); - promptWindow.setLocation( screen_X + x + GAP ,screen_Y + y + GAP); + promptWindow.setLocation(screen_X + x + GAP, screen_Y + y + GAP); promptWindow.setVisible(true); } - private void cancelPromptWidgetForbidEnter(){ - if (designer.getParaComponent() != null){ + private void cancelPromptWidgetForbidEnter() { + if (designer.getParaComponent() != null) { designer.getParaComponent().setBorder(BorderFactory.createLineBorder(XCreatorConstants.LAYOUT_SEP_COLOR, Constants.LINE_THIN)); } designer.getRootComponent().setBorder(BorderFactory.createLineBorder(XCreatorConstants.LAYOUT_SEP_COLOR, Constants.LINE_THIN)); @@ -204,45 +207,50 @@ public class FormCreatorDropTarget extends DropTarget { /** * 拖拽进入 - * @param dtde 事件 + * + * @param dtde 事件 */ - public void dragEnter(DropTargetDragEvent dtde) { - Point loc = dtde.getLocation(); - this.entering(loc.x, loc.y); - } + public void dragEnter(DropTargetDragEvent dtde) { + Point loc = dtde.getLocation(); + this.entering(loc.x, loc.y); + } /** * 拖拽移动经过 - * @param dtde 事件 + * + * @param dtde 事件 */ - public void dragOver(DropTargetDragEvent dtde) { - Point loc = dtde.getLocation(); - hovering(loc.x, loc.y); - } + public void dragOver(DropTargetDragEvent dtde) { + Point loc = dtde.getLocation(); + hovering(loc.x, loc.y); + } /** * 拖拽事件 - * @param dtde 事件 + * + * @param dtde 事件 */ - public void dropActionChanged(DropTargetDragEvent dtde) { - } + public void dropActionChanged(DropTargetDragEvent dtde) { + } /** * 拖拽离开 - * @param dte 事件 + * + * @param dte 事件 */ - public void dragExit(DropTargetEvent dte) { - this.exiting(); - } + public void dragExit(DropTargetEvent dte) { + this.exiting(); + } /** * 拖拽释放 - * @param dtde 事件 + * + * @param dtde 事件 */ - public void drop(DropTargetDropEvent dtde) { - Point loc = dtde.getLocation(); - this.adding(loc.x, loc.y); + public void drop(DropTargetDropEvent dtde) { + Point loc = dtde.getLocation(); + this.adding(loc.x, loc.y); //针对在表单中拖入一个控件直接ctrl+s无反应 designer.requestFocus(); - } + } } \ No newline at end of file From 76363600114a06d5f7f9646bfec66d4ff66dd7c1 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Oct 2016 09:37:32 +0800 Subject: [PATCH 043/244] =?UTF-8?q?=E6=BC=8F=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/ShareWidgetButton.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index 955e54822a..531c52fee6 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -6,7 +6,9 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.share.ShareLoader; +import com.fr.form.ui.AbstractFormSharableEditor; import com.fr.form.ui.ElCaseBindInfo; +import com.fr.form.ui.FormSharableEditor; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; @@ -118,6 +120,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot Object source = e.getSource(); Widget creatorSource = null; String shareId = StringUtils.EMPTY; + String helpMsg = StringUtils.EMPTY; if (source instanceof ShareWidgetButton) { ShareWidgetButton no = (ShareWidgetButton) e.getSource(); if (no == null) { @@ -125,10 +128,15 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot } shareId = no.getBindInfo().getId(); creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId); + ElCaseBindInfo info = ShareLoader.getLoader().getElCaseBindInfoById(shareId); + if (info != null) { + helpMsg = info.getGuideInfo(); + } } if (creatorSource != null) { XCreator xCreator = XCreatorUtils.createXCreator(creatorSource); xCreator.setShareId(shareId); + xCreator.setSharedMsg(helpMsg); WidgetToolBarPane.getTarget().startDraggingBean(xCreator); lastPressEvent = null; this.setBorder(null); @@ -152,6 +160,9 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot ShareWidgetButton shareWidgetButton = (ShareWidgetButton) dge.getComponent(); if (shareWidgetButton != null) { Widget widget = ShareLoader.getLoader().getElCaseEditorById(shareWidgetButton.getBindInfo().getId()); + if (widget instanceof FormSharableEditor) { + ((AbstractFormSharableEditor) widget).setShareId(shareWidgetButton.getBindInfo().getId()); + } DragAndDropTransferable dragAndDropTransferable = new DragAndDropTransferable(widget); dge.startDrag(DragSource.DefaultCopyDrop, dragAndDropTransferable, this); } From f1b68a1798bdff583d3f387fc18e0667b591d6b2 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Oct 2016 10:04:27 +0800 Subject: [PATCH 044/244] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/BasicTableDataTreePane.java | 8 +++++++- .../data/datapane/TableDataTreePane.java | 19 ++++++++++++++----- .../mainframe/FormCreatorDropTarget.java | 9 ++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java b/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java index a6fd601a82..45cd0cea70 100644 --- a/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java @@ -424,7 +424,13 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_CONNECTION_ICON_PATH)); } } - public void addTableData(TableDataSource tableDataSource){ + + /** + * 合并数据集 + * @param srcName 数据集来源(比如报表块,就是报表块的名称) + * @param tableDataSource 数据集 + */ + public void addTableData(String srcName, TableDataSource tableDataSource) { } } diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java index 911b0d9c94..618c2edec2 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java @@ -270,18 +270,27 @@ public class TableDataTreePane extends BasicTableDataTreePane { return dataTree; } - public void addTableData(TableDataSource tableDataSource) { + /** + * 合并数据集 + * @param srcName 数据集来源(比如报表块,就是报表块的名称) + * @param tableDataSource 数据集 + */ + public void addTableData(String srcName, TableDataSource tableDataSource) { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); TableDataSource tds = tc.getBook(); Iterator tdIterator = tableDataSource.getTableDataNameIterator(); while (tdIterator.hasNext()) { String tdName = (String) tdIterator.next(); TableData td = tableDataSource.getTableData(tdName); - if (tds.getTableData(tdName) != null) { - tds.putTableData(tdName + "-fr-el", td); - } else { - tds.putTableData(tdName, td); + if (tds.getTableData(tdName) != null) {//如果有同名的就拼上来源名称 + tdName = srcName + tdName; + } + int i = 0; + while (tds.getTableData(tdName) != null) { + i++;//如果拼上名字后依然已经存在就加编号 + tdName += i; } + tds.putTableData(tdName, td); } tc.fireTargetModified(); tc.parameterChanged(); diff --git a/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java index 91c39f988f..7e7035bb73 100644 --- a/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -14,6 +14,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; import com.fr.design.utils.ComponentUtils; import com.fr.form.share.ShareLoader; +import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.SharableElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.general.Inter; @@ -83,9 +84,11 @@ public class FormCreatorDropTarget extends DropTarget { //tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout XCreator addingXCreator = addingModel.getXCreator(); if (addingXCreator.isShared()) { - SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(addingXCreator.getShareId()); - if (sharableEditor != null) { - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(sharableEditor.getTableDataSource()); + String shareId = addingXCreator.getShareId(); + SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); + ElCaseBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); + if (sharableEditor != null && bindInfo != null) { + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(),sharableEditor.getTableDataSource()); } } Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); From bcb2311ac9cff45926ba6ba6ecb0083d063e7e80 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 20 Oct 2016 10:09:46 +0800 Subject: [PATCH 045/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/ChartTypeButtonPane.java | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index aeb9cb0d96..082037aa48 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,13 +4,19 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; +import com.fr.chart.chartglyph.ChangeConfigAttr; +import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.charttypes.ColumnIndependentChart; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.series.SeriesCondition.impl.LinePlotDataSeriesConditionPane; +import com.fr.design.dialog.DialogActionListener; +import com.fr.design.dialog.UIDialog; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.general.ComparatorUtils; @@ -18,6 +24,8 @@ 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.awt.event.*; import java.awt.geom.Rectangle2D; @@ -47,8 +55,12 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private ChartTypePane parent = null; + //记录鼠标当前是否在操作添加按钮 private boolean mouseOnChartTypeButtonPane = false; + //配置窗口属性 + private UIMenuNameableCreator configCreator; + /** * 鼠标事件是否在这个面板 * @return 返回是否 @@ -98,10 +110,26 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen button.add(configButton); eastPane.add(button, BorderLayout.NORTH); + initAddButton(); + initConfigButton(); + initConfigCreator(); + + Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + } + + private void initConfigCreator() { + + } + + private void initAddButton() { addButton.setPreferredSize(new Dimension(20, 20)); addButton.addActionListener(addListener); addButton.addMouseListener(mouseListener); - Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + } + + private void initConfigButton() { + configButton.setPreferredSize(new Dimension(20, 20)); + configButton.addActionListener(configListener); } ActionListener addListener = new ActionListener() { @@ -136,6 +164,33 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } }; + ActionListener configListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + } + }; + + /** + * 响应事件 + */ + public void fireTargetChanged() { + this.validate(); + this.repaint(); + this.revalidate(); + fireChanged(); + } + + protected void fireChanged() { + Object[] listeners = listenerList.getListenerList(); + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + ((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this)); + } + } + } + MouseListener mouseListener = new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { From 4cd780bd3a71f1b94ca23e3fab140fc653b92c89 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 20 Oct 2016 10:13:54 +0800 Subject: [PATCH 046/244] update --- .../fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 082037aa48..37d17eee7c 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,11 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; -import com.fr.chart.chartglyph.ChangeConfigAttr; -import com.fr.chart.chartglyph.ConditionAttr; -import com.fr.chart.charttypes.ColumnIndependentChart; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chart.series.SeriesCondition.impl.LinePlotDataSeriesConditionPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; import com.fr.design.event.UIObserver; @@ -118,7 +114,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initConfigCreator() { - } private void initAddButton() { @@ -167,7 +162,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen ActionListener configListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - + } }; From a3a1a1044cff5c9767efe333a6614e94e212834d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 20 Oct 2016 13:49:45 +0800 Subject: [PATCH 047/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/layout/TableLayoutHelper.java | 34 ++++ .../mainframe/chart/gui/ChangeConfigPane.java | 145 ++++++++++++++++++ .../chart/gui/ChartTypeButtonPane.java | 37 +++-- .../gui/ColorSelectBoxWithOutTransparent.java | 20 +++ .../ColorSelectPaneWithOutTransparent.java | 33 ++++ 5 files changed, 250 insertions(+), 19 deletions(-) create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java diff --git a/designer_base/src/com/fr/design/layout/TableLayoutHelper.java b/designer_base/src/com/fr/design/layout/TableLayoutHelper.java index 97dcf816b9..b15aa99ba7 100644 --- a/designer_base/src/com/fr/design/layout/TableLayoutHelper.java +++ b/designer_base/src/com/fr/design/layout/TableLayoutHelper.java @@ -47,6 +47,40 @@ public class TableLayoutHelper { return createCommonTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM); } + /** + * 标题布局(二级菜单距左边框46) + * @param title 标题 + * @param component 组件 + * @return 布局好的组件 + */ + public static JPanel createTableLayoutPaneWithTitle(String title, Component component){ + return createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN); + } + + public static JPanel createTitlePane(String title, Component component, int gap){ + return createTitlePaneWithUILabel(new UILabel(title), component, gap); + } + + /** + * 标题布局(指定gap) + * @param label 标题label + * @param component 组件 + * @param gap 距左侧距离 + * @return 布局好的组件 + */ + public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){ + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {gap, f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{label,null}, + new Component[]{null,component}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + public static JPanel createCommonTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize, double gap) { return createGapTableLayoutPane(components, rowSize, columnSize, gap, gap); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java new file mode 100644 index 0000000000..5c65bc276e --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -0,0 +1,145 @@ +package com.fr.design.mainframe.chart.gui; + +/** + * Created by hufan on 2016/10/20. + */ + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.general.Inter; +import com.fr.third.org.hsqldb.lib.Collection; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 图表切换设置面板 + */ +public class ChangeConfigPane extends BasicBeanPane { + private JPanel contentPane; + //配置方式按钮 + private UIButtonGroup configStyleButton; + //配置界面 + private JPanel configPane; + //按钮切换方式配置界面 + private JPanel buttonConfigPane; + private ChartTextAttrPane textAttrPane; + private ColorSelectBoxWithOutTransparent colorSelectBox; + //轮播切换方式配置接界面 + private JPanel carouselConfigPane; + + public ChangeConfigPane(){ + initButtonGroup(); + contentPane = createContentPane(); + configPane = createConfigPane(); + this.add(contentPane, BorderLayout.CENTER); + } + + private JPanel createContentPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p,p,p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style") + ":"),configStyleButton}, + new Component[]{new JSeparator(), null}, + new Component[]{configPane, null}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + private JPanel createConfigPane() { + + buttonConfigPane = createButtonConfigPane(); + carouselConfigPane = createCarouseConfigPane(); + + JPanel panel = new JPanel(new CardLayout()){ + @Override + public Dimension getPreferredSize() { + if(configStyleButton.getSelectedIndex() == 0){ + return new Dimension(buttonConfigPane.getWidth(), 0); + } else{ + return carouselConfigPane.getPreferredSize(); + } + } + }; + + panel.add(buttonConfigPane, "button"); + panel.add(carouselConfigPane, "carousel"); + + return panel; + } + + private JPanel createCarouseConfigPane() { + return new JPanel(); + } + + private JPanel createTitleStylePane(){ + textAttrPane = new ChartTextAttrPane(); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); + } + + + private JPanel createBackgroundColorPane(){ + colorSelectBox = new ColorSelectBoxWithOutTransparent(100); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); + } + + private JPanel createButtonConfigPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p,p,p}; + Component[][] components = new Component[][]{ + new Component[]{createTitleStylePane(),null}, + new Component[]{new JSeparator(),null}, + new Component[]{createBackgroundColorPane(),null}, + }; + + return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + } + + private void initButtonGroup() { + configStyleButton = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Button_Style"), + Inter.getLocText("Plugin-ChartF_Carousel_Style")}); + configStyleButton.setSelectedIndex(0); + configStyleButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + } + }); + } + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) configPane.getLayout(); + if (configStyleButton.getSelectedIndex() == 0) { + cardLayout.show(configPane, "button"); + } else { + cardLayout.show(configPane, "carousel"); + } + } + + @Override + public void populateBean(Collection ob) { + + } + + @Override + public Collection updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 37d17eee7c..a98e00260b 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; +import com.fr.chart.chartglyph.ChangeConfigAttr; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; @@ -114,6 +115,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initConfigCreator() { + configCreator = new UIMenuNameableCreator(Inter.getLocText("Chart-Change_Config_Attributes"), new ChangeConfigAttr(), ChangeConfigPane.class); } private void initAddButton() { @@ -162,29 +164,26 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen ActionListener configListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - - } - }; + UIMenuNameableCreator ui = configCreator.clone(); + final Object obj = ui.getObj(); + final BasicBeanPane pane = ui.getPane(); - /** - * 响应事件 - */ - public void fireTargetChanged() { - this.validate(); - this.repaint(); - this.revalidate(); - fireChanged(); - } - protected void fireChanged() { - Object[] listeners = listenerList.getListenerList(); + UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() { + @Override + public void doOk() { - for (int i = listeners.length - 2; i >= 0; i -= 2) { - if (listeners[i] == ChangeListener.class) { - ((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this)); - } + } + + @Override + public void doCancel() { + } + }); + dialog.setSize(500, 500); + dialog.setVisible(true); } - } + }; + MouseListener mouseListener = new MouseAdapter() { @Override diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java new file mode 100644 index 0000000000..ba0b032411 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java @@ -0,0 +1,20 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.style.color.ColorSelectPane; + +/** + * Created by Fangjie on 2016/4/8. + * 没有透明度的颜色选择器 + */ +public class ColorSelectBoxWithOutTransparent extends ColorSelectBox { + public ColorSelectBoxWithOutTransparent(int preferredWidth){ + super(preferredWidth); + } + + + @Override + protected ColorSelectPane getColorSelectPane(){ + return new ColorSelectPaneWithOutTransparent(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java new file mode 100644 index 0000000000..a32d5d9291 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java @@ -0,0 +1,33 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.style.color.ColorCell; +import com.fr.design.style.color.ColorSelectPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/8. + */ +public class ColorSelectPaneWithOutTransparent extends ColorSelectPane { + + public ColorSelectPaneWithOutTransparent(){ + super(false); + } + + public void initCenterPaneChildren(JPanel centerPane) { + JPanel menuColorPane1 = new JPanel(); + centerPane.add(menuColorPane1); + menuColorPane1.setLayout(new GridLayout(5, 8, 5, 5)); + for (int i = 0; i < ChartConstants.MAP_COLOR_ARRAY.length; i++) { + menuColorPane1.add(new ColorCell(ChartConstants.MAP_COLOR_ARRAY[i], this)); + } + centerPane.add(Box.createVerticalStrut(5)); + centerPane.add(new JSeparator()); + } + + protected Color[] getColorArray(){ + return ChartConstants.MAP_COLOR_ARRAY; + } +} From 76856c4e5fe1a2681d7bd912b5c3ab2a0dd7843a Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Oct 2016 15:59:53 +0800 Subject: [PATCH 048/244] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=B8=AE=E5=8A=A9?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=94=B9=E4=B8=80=E4=B8=8B=E6=96=B9=E6=A1=88?= =?UTF-8?q?=EF=BC=8C=E9=80=9A=E8=BF=87widget=E5=A2=9E=E5=8A=A0description?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCreator.java | 22 +++++-------------- .../designer/creator/XCreatorUtils.java | 2 +- .../design/designer/creator/XElementCase.java | 2 +- .../src/com/fr/design/mainframe/JForm.java | 11 +++++++++- .../design/mainframe/ShareWidgetButton.java | 11 ---------- 5 files changed, 18 insertions(+), 30 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index d030104a23..d47009ff95 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -12,10 +12,6 @@ import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.*; import com.fr.design.utils.gui.LayoutUtils; -import com.fr.form.share.ShareLoader; -import com.fr.form.ui.AbstractFormSharableEditor; -import com.fr.form.ui.ElCaseBindInfo; -import com.fr.form.ui.FormSharableEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.stable.StableUtils; @@ -590,24 +586,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } /** - * 设置共享帮助信息 + * 设置描述信息 * @param msg 帮助信息 */ - public void setSharedMsg(String msg){} + public void setXDescrption(String msg){} /** - * 根据widget设置Xcreator共享信息 + * 根据widget设置Xcreator描述信息 * @param widget */ - public void setShareMsgByWidget(Widget widget){ - if (widget != null && (widget instanceof FormSharableEditor)) { - String shareId = ((AbstractFormSharableEditor) widget).getShareId(); - ElCaseBindInfo info = ShareLoader.getLoader().getElCaseBindInfoById(shareId); - if (info != null) { - - setSharedMsg(info.getGuideInfo()); - - } + public void setXDescrption(Widget widget){ + if (widget != null) { + setXDescrption(widget.getDescription()); } } diff --git a/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java b/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java index 36158f821b..3c58e2f192 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java @@ -157,7 +157,7 @@ public class XCreatorUtils { FRContext.getLogger().error("Error to create xcreator!"); creator = new NullCreator(widget, d); } - creator.setShareMsgByWidget(widget);//设置共享信息 + creator.setXDescrption(widget);//设置描述信息 return creator; } diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 0e0d35637b..a056779a16 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -285,7 +285,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme } @Override - public void setSharedMsg(String msg) { + public void setXDescrption(String msg) { coverPanel.setHelpMsg(msg); } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index ef18f07135..679fcf9820 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -36,6 +36,8 @@ import com.fr.file.FILE; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; import com.fr.form.main.Form; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; @@ -51,6 +53,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; +import java.util.ArrayList; import java.util.HashMap; public class JForm extends JTemplate implements BaseJForm { @@ -622,7 +625,13 @@ public class JForm extends JTemplate implements BaseJForm { } else { JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); - pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); + //pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); + ArrayList elCaseBindInfos = new ArrayList<>(); + for (ElCaseBindInfo info : + ShareLoader.getLoader().getAllBindInfos().values()) { + elCaseBindInfos.add(info); + } + pane.add(new ShareWidgetPane(elCaseBindInfos.toArray(new ElCaseBindInfo[elCaseBindInfos.size()])), BorderLayout.CENTER); EastRegionContainerPane.getInstance().replaceDownPane(pane); } } diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index 531c52fee6..955e54822a 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -6,9 +6,7 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.share.ShareLoader; -import com.fr.form.ui.AbstractFormSharableEditor; import com.fr.form.ui.ElCaseBindInfo; -import com.fr.form.ui.FormSharableEditor; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; @@ -120,7 +118,6 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot Object source = e.getSource(); Widget creatorSource = null; String shareId = StringUtils.EMPTY; - String helpMsg = StringUtils.EMPTY; if (source instanceof ShareWidgetButton) { ShareWidgetButton no = (ShareWidgetButton) e.getSource(); if (no == null) { @@ -128,15 +125,10 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot } shareId = no.getBindInfo().getId(); creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId); - ElCaseBindInfo info = ShareLoader.getLoader().getElCaseBindInfoById(shareId); - if (info != null) { - helpMsg = info.getGuideInfo(); - } } if (creatorSource != null) { XCreator xCreator = XCreatorUtils.createXCreator(creatorSource); xCreator.setShareId(shareId); - xCreator.setSharedMsg(helpMsg); WidgetToolBarPane.getTarget().startDraggingBean(xCreator); lastPressEvent = null; this.setBorder(null); @@ -160,9 +152,6 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot ShareWidgetButton shareWidgetButton = (ShareWidgetButton) dge.getComponent(); if (shareWidgetButton != null) { Widget widget = ShareLoader.getLoader().getElCaseEditorById(shareWidgetButton.getBindInfo().getId()); - if (widget instanceof FormSharableEditor) { - ((AbstractFormSharableEditor) widget).setShareId(shareWidgetButton.getBindInfo().getId()); - } DragAndDropTransferable dragAndDropTransferable = new DragAndDropTransferable(widget); dge.startDrag(DragSource.DefaultCopyDrop, dragAndDropTransferable, this); } From 2346a959984da004ab9219e6e0d4897d5ed58ace Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Oct 2016 16:01:33 +0800 Subject: [PATCH 049/244] =?UTF-8?q?=E8=BF=98=E5=8E=9Fjform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_form/src/com/fr/design/mainframe/JForm.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 679fcf9820..ef18f07135 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -36,8 +36,6 @@ import com.fr.file.FILE; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; import com.fr.form.main.Form; -import com.fr.form.share.ShareLoader; -import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; @@ -53,7 +51,6 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; -import java.util.ArrayList; import java.util.HashMap; public class JForm extends JTemplate implements BaseJForm { @@ -625,13 +622,7 @@ public class JForm extends JTemplate implements BaseJForm { } else { JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); - //pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); - ArrayList elCaseBindInfos = new ArrayList<>(); - for (ElCaseBindInfo info : - ShareLoader.getLoader().getAllBindInfos().values()) { - elCaseBindInfos.add(info); - } - pane.add(new ShareWidgetPane(elCaseBindInfos.toArray(new ElCaseBindInfo[elCaseBindInfos.size()])), BorderLayout.CENTER); + pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); EastRegionContainerPane.getInstance().replaceDownPane(pane); } } From bf8b5b1958037904dabdc4384f7b4a0fdeb8cef8 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 20 Oct 2016 17:09:48 +0800 Subject: [PATCH 050/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 103 +++++++++++++++--- .../chart/gui/ChartTypeButtonPane.java | 15 ++- 2 files changed, 93 insertions(+), 25 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index 5c65bc276e..a0f05b0bd4 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -4,12 +4,18 @@ package com.fr.design.mainframe.chart.gui; * Created by hufan on 2016/10/20. */ +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.change.ChangeConfigAttr; +import com.fr.chart.chartattr.change.ChangeType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.function.MAX; +import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.third.org.hsqldb.lib.Collection; @@ -23,7 +29,10 @@ import java.awt.event.ActionListener; /** * 图表切换设置面板 */ -public class ChangeConfigPane extends BasicBeanPane { +public class ChangeConfigPane extends BasicBeanPane { + private static final int WIDTH = 100; + private static final int MIN_TIME = 0; + private static final int MAX_TIME = Integer.MAX_VALUE; private JPanel contentPane; //配置方式按钮 private UIButtonGroup configStyleButton; @@ -31,15 +40,19 @@ public class ChangeConfigPane extends BasicBeanPane { private JPanel configPane; //按钮切换方式配置界面 private JPanel buttonConfigPane; - private ChartTextAttrPane textAttrPane; - private ColorSelectBoxWithOutTransparent colorSelectBox; + private ChartTextAttrPane styleAttrPane; + private ColorSelectBoxWithOutTransparent colorSelectBox4button; + //轮播切换方式配置接界面 private JPanel carouselConfigPane; + protected UISpinner timeInterval; + private ColorSelectBoxWithOutTransparent colorSelectBox4carousel; public ChangeConfigPane(){ initButtonGroup(); - contentPane = createContentPane(); configPane = createConfigPane(); + contentPane = createContentPane(); + contentPane.setBorder(BorderFactory.createEmptyBorder(10, 30, 10, 30)); this.add(contentPane, BorderLayout.CENTER); } @@ -47,9 +60,10 @@ public class ChangeConfigPane extends BasicBeanPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {p, f}; - double[] rowSize = {p,p,p}; + double[] rowSize = {p,p,p,p}; Component[][] components = new Component[][]{ new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style") + ":"),configStyleButton}, + new Component[]{null, null}, new Component[]{new JSeparator(), null}, new Component[]{configPane, null}, }; @@ -65,7 +79,7 @@ public class ChangeConfigPane extends BasicBeanPane { @Override public Dimension getPreferredSize() { if(configStyleButton.getSelectedIndex() == 0){ - return new Dimension(buttonConfigPane.getWidth(), 0); + return buttonConfigPane.getPreferredSize(); } else{ return carouselConfigPane.getPreferredSize(); } @@ -79,18 +93,39 @@ public class ChangeConfigPane extends BasicBeanPane { } private JPanel createCarouseConfigPane() { - return new JPanel(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p,p,p}; + Component[][] components = new Component[][]{ + new Component[]{createTimeIntervalPane(),null}, + new Component[]{new JSeparator(),null}, + new Component[]{createCarouseBackgroundColorPane(),null}, + }; + + return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + } + + private Component createTimeIntervalPane() { + timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Time_Interval") + ":", timeInterval); + } + + private JPanel createCarouseBackgroundColorPane() { + colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4carousel); } private JPanel createTitleStylePane(){ - textAttrPane = new ChartTextAttrPane(); - return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); + styleAttrPane = new ChartTextAttrPane(); + styleAttrPane.setPreferredSize(new Dimension(WIDTH, (int) styleAttrPane.getPreferredSize().getHeight())); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style")+":", styleAttrPane); } - private JPanel createBackgroundColorPane(){ - colorSelectBox = new ColorSelectBoxWithOutTransparent(100); - return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); + private JPanel createButtonBackgroundColorPane(){ + colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4button); } private JPanel createButtonConfigPane() { @@ -101,7 +136,7 @@ public class ChangeConfigPane extends BasicBeanPane { Component[][] components = new Component[][]{ new Component[]{createTitleStylePane(),null}, new Component[]{new JSeparator(),null}, - new Component[]{createBackgroundColorPane(),null}, + new Component[]{createButtonBackgroundColorPane(),null}, }; return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); @@ -110,7 +145,7 @@ public class ChangeConfigPane extends BasicBeanPane { private void initButtonGroup() { configStyleButton = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Button_Style"), Inter.getLocText("Plugin-ChartF_Carousel_Style")}); - configStyleButton.setSelectedIndex(0); + configStyleButton.setPreferredSize(new Dimension(WIDTH * 2, (int) configStyleButton.getPreferredSize().getHeight())); configStyleButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -129,17 +164,51 @@ public class ChangeConfigPane extends BasicBeanPane { } @Override - public void populateBean(Collection ob) { + public void populateBean(ChartCollection ob) { + if (ob == null){ + return; + } + ChangeConfigAttr changeConfigAttr = ob.getChangeConfigAttr(); + if (changeConfigAttr == null){ + return; + } + configStyleButton.setSelectedIndex(changeConfigAttr.getChangeType() == ChangeType.BUTTON ? 0 : 1); + + //按钮切换界面 + styleAttrPane.populate(changeConfigAttr.getStyleAttr()); + colorSelectBox4button.setSelectObject(changeConfigAttr.getButtonColor()); + + //轮播切换界面 + timeInterval.setValue(changeConfigAttr.getTimeInterval()); + colorSelectBox4carousel.setSelectObject(changeConfigAttr.getCarouselColor()); + + checkCardPane(); } @Override - public Collection updateBean() { + public ChartCollection updateBean() { return null; } + public void updateBean(ChartCollection ob) { + if (ob == null){ + return; + } + ChangeConfigAttr changeConfigAttr = ob.getChangeConfigAttr(); + if (changeConfigAttr == null){ + return; + } + + changeConfigAttr.setChangeType(configStyleButton.getSelectedIndex() == 0 ? ChangeType.BUTTON : ChangeType.CAROUSEL); + changeConfigAttr.setStyleAttr(styleAttrPane.update()); + changeConfigAttr.setButtonColor(colorSelectBox4button.getSelectObject()); + changeConfigAttr.setTimeInterval(timeInterval.getValue()); + changeConfigAttr.setCarouselColor(colorSelectBox4carousel.getSelectObject()); + } + @Override protected String title4PopupWindow() { - return null; + return Inter.getLocText("Chart-Change_Config_Attributes"); } } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index a98e00260b..6c8c9ef462 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,7 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; -import com.fr.chart.chartglyph.ChangeConfigAttr; +import com.fr.chart.chartattr.change.ChangeConfigAttr; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; @@ -21,8 +21,6 @@ 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.awt.event.*; import java.awt.geom.Rectangle2D; @@ -39,6 +37,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private static final int B_W = 52; private static final int B_H = 20; private static final int COL_COUNT = 3; + private static final int P_W = 300; + private static final int P_H = 400; private UIButton addButton; private UIButton configButton; @@ -165,21 +165,20 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen @Override public void actionPerformed(ActionEvent e) { UIMenuNameableCreator ui = configCreator.clone(); - final Object obj = ui.getObj(); final BasicBeanPane pane = ui.getPane(); - - + pane.populateBean(editingCollection); UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() { @Override public void doOk() { - + pane.updateBean(editingCollection); } @Override public void doCancel() { + } }); - dialog.setSize(500, 500); + dialog.setSize(P_W, P_H); dialog.setVisible(true); } }; From ccc9c645af7b7f5d8a437e4ff0af8fa2e3712927 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Thu, 20 Oct 2016 19:43:58 +0800 Subject: [PATCH 051/244] =?UTF-8?q?REPORT-364=20=E5=92=8C=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E7=94=A8=E7=9A=84=E5=90=8C=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ava => FormElementCaseEditorProvider.java} | 70 +++++++------- ...bstractFormElementCaseEditorProvider.java} | 93 ++++++++++--------- .../design/designer/creator/XElementCase.java | 34 +++---- 3 files changed, 101 insertions(+), 96 deletions(-) rename designer_base/src/com/fr/design/fun/{FormElementCaseEditorProcessor.java => FormElementCaseEditorProvider.java} (67%) rename designer_base/src/com/fr/design/fun/impl/{AbstractFormElementCaseEditorProcessor.java => AbstractFormElementCaseEditorProvider.java} (61%) diff --git a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java similarity index 67% rename from designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java rename to designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java index e887d389b6..5b7bd6fa2f 100644 --- a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java +++ b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java @@ -1,34 +1,38 @@ -package com.fr.design.fun; - -import com.fr.stable.fun.ReportFitAttrProvider; -import com.fr.stable.fun.mark.Immutable; - -import java.beans.PropertyDescriptor; - -/** - * Created by zhouping on 2015/9/10. - */ -public interface FormElementCaseEditorProcessor extends Immutable { - - String MARK_STRING = "PropertyEditor"; - - int CURRENT_LEVEL = 1; - - - /** - * 生成属性表 - * @param temp 传入当前操作的class - * @param reportFitAttr 传入的自适应属性 - * @return 返回属性表 - */ - PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr); - - /** - * 返回pc自适应属性值 - * @param fitAttrProvider 传入的自适应属性 - * @return 返回pc自适应属性值 - */ - int getFitStateInPC(ReportFitAttrProvider fitAttrProvider); - - +package com.fr.design.fun; + +import com.fr.form.ui.ElementCaseEditor; +import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.form.main.Form; +import com.fr.stable.fun.mark.Mutable; + +import java.beans.PropertyDescriptor; + +/** + * Created by zhouping on 2015/9/10. + */ +public interface FormElementCaseEditorProvider extends Mutable { + + String MARK_STRING = "PropertyEditor"; + + int CURRENT_LEVEL = 1; + + + //加个provider返回tab的接口 + //design_base依赖了form + PropertyDescriptor[] createPropertyDescriptor (Class temp, Form reportAttr, ElementCaseEditor editor); + + /** + * 生成属性表 + * @param temp 传入当前操作的class + * @param reportFitAttr 传入的自适应属性 + * @return 返回属性表 + */ + PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr); + + /** + * 返回pc自适应属性值 + * @param fitAttrProvider 传入的自适应属性 + * @return 返回pc自适应属性值 + */ + int getFitStateInPC(ReportFitAttrProvider fitAttrProvider); } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java similarity index 61% rename from designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java rename to designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java index caafda0b84..f65107e2eb 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java @@ -1,44 +1,51 @@ -package com.fr.design.fun.impl; - -import com.fr.design.fun.FormElementCaseEditorProcessor; -import com.fr.stable.fun.ReportFitAttrProvider; -import com.fr.stable.fun.mark.API; - -import java.beans.PropertyDescriptor; - -/** - * Created by zhouping on 2015/9/10. - */ -@API(level = FormElementCaseEditorProcessor.CURRENT_LEVEL) -public abstract class AbstractFormElementCaseEditorProcessor implements FormElementCaseEditorProcessor { - - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - public int layerIndex() { - return DEFAULT_LAYER_INDEX; - } - - - /** - * 生成属性表 - * @param temp 传入当前操作的class - * @param reportFitAttr 传入的自适应属性 - * @return 返回属性表 - */ - @Override - public PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr) { - return new PropertyDescriptor[0]; - } - - /** - * 返回pc自适应属性值 - * @param fitAttrProvider 传入的自适应属性 - * @return 返回pc自适应属性值 - */ - @Override - public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { - return 0; - } +package com.fr.design.fun.impl; + +import com.fr.design.fun.FormElementCaseEditorProvider; +import com.fr.form.main.Form; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.stable.fun.mark.API; + +import java.beans.PropertyDescriptor; + +/** + * Created by zhouping on 2015/9/10. + */ +@API(level = FormElementCaseEditorProvider.CURRENT_LEVEL) +public abstract class AbstractFormElementCaseEditorProvider implements FormElementCaseEditorProvider { + + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return this.getClass().getName(); + } + + @Override + public PropertyDescriptor[] createPropertyDescriptor(Class temp, Form reportAttr, ElementCaseEditor editor) { + return new PropertyDescriptor[0]; + } + + /** + * 生成属性表 + * @param temp 传入当前操作的class + * @param reportFitAttr 传入的自适应属性 + * @return 返回属性表 + */ + @Override + public PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr) { + return new PropertyDescriptor[0]; + } + + /** + * 返回pc自适应属性值 + * @param fitAttrProvider 传入的自适应属性 + * @return 返回pc自适应属性值 + */ + @Override + public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { + return 0; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 252ec35c78..f2f369595e 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -4,8 +4,9 @@ import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.form.util.XCreatorConstants; -import com.fr.design.fun.FormElementCaseEditorProcessor; +import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.WidgetPropertyUIProvider; +import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; @@ -23,8 +24,7 @@ import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.stable.fun.FitProvider; -import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.form.main.Form; import javax.swing.*; import java.awt.*; @@ -32,6 +32,7 @@ import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; +import java.util.Set; public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ private UILabel imageLable; @@ -100,25 +101,18 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme }; - FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING); - if (processor == null) { - return propertyTableEditor; - } - this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - FitProvider wbTpl = (FitProvider) designer.getTarget(); - ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); - ElementCaseEditor editor = this.toData(); - //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) - if (editor.getFitStateInPC() == 0) { - editor.setReportFitAttr(null); - } - ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : editor.getReportFitAttr(); - PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); + Set set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING); + for (FormElementCaseEditorProvider processor : set) { + if (processor == null) { + return propertyTableEditor; + } + this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + Form attr = designer.getTarget(); - if (editor.getReportFitAttr() == null) { - editor.setReportFitInPc(processor.getFitStateInPC(fitAttr)); + PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), attr, this.toData()); + propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } - return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); + return propertyTableEditor; } @Override From 3e68fea0476b8ccd6e5e12bee756477d489dd605 Mon Sep 17 00:00:00 2001 From: zhouping Date: Fri, 21 Oct 2016 10:36:25 +0800 Subject: [PATCH 052/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20relea?= =?UTF-8?q?se=E7=9A=84=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5=E4=B8=80?= =?UTF-8?q?=E4=BB=BD=E5=88=B0dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itable/AbstractPropertyTable.java | 6 +++ ...bsoluteBodyLayoutPropertiesGroupModel.java | 44 ++++++++++++++++--- .../FRFitLayoutPropertiesGroupModel.java | 26 ++++++++++- .../mainframe/FormHierarchyTreePane.java | 14 ++++-- .../src/com/fr/design/mainframe/JForm.java | 20 +++++++-- 5 files changed, 94 insertions(+), 16 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/itable/AbstractPropertyTable.java b/designer_base/src/com/fr/design/gui/itable/AbstractPropertyTable.java index f16be99639..02a6f547b8 100644 --- a/designer_base/src/com/fr/design/gui/itable/AbstractPropertyTable.java +++ b/designer_base/src/com/fr/design/gui/itable/AbstractPropertyTable.java @@ -66,6 +66,9 @@ public abstract class AbstractPropertyTable extends JTable { public TableCellRenderer getCellRenderer(int row, int column) { if (groups != null) { Point pIndex = getGroupIndex(row); + if (pIndex == null){ + return super.getCellRenderer(row, column); + } PropertyGroup group = groups.get(pIndex.x); if (pIndex.y == 0) { if (column == 0) { @@ -192,6 +195,9 @@ public abstract class AbstractPropertyTable extends JTable { @Override public Object getValueAt(int row, int column) { Point pIndex = getGroupIndex(row); + if (pIndex == null){ + return null; + } PropertyGroup group = groups.get(pIndex.x); if (pIndex.y == 0) { if (column == 0) { diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index 1a7ab03d3f..fff14f03d0 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -1,7 +1,7 @@ package com.fr.design.designer.properties; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.mainframe.WidgetPropertyPane; @@ -93,6 +93,8 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr if (row == 0) { if (state == WBodyLayoutType.FIT.getTypeValue()) { XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent(); + //备份一下组件间隔 + int compInterval = xfl.toData().getCompInterval(); Component[] components = xwAbsoluteLayout.getComponents(); Arrays.sort(components, new ComparatorComponentLocation()); @@ -102,15 +104,35 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr xfl.toData().setLayoutType(WBodyLayoutType.FIT); for (Component comp : components) { - xfl.add(comp); + XCreator xCreator = (XCreator)comp; + if (xCreator.shouldScaleCreator()){ + XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight()); + xfl.add(parentPanel, xCreator.toData().getWidgetName()); + continue; + } + xfl.add(xCreator); } - moveComponents2FitLayout(xfl, components); + //这边计算的时候会先把组件间隔去掉 + moveComponents2FitLayout(xfl); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()})); + formDesigner.getSelectionModel().setSelectedCreator(xfl); xfl.convert(); LayoutUtils.layoutContainer(xfl); xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0); + + for (int i = 0; i < components.length; i++) { + Component comp = xfl.getComponent(i); + XCreator creator = (XCreator) comp; + creator.setBackupBound(components[i].getBounds()); + } + + //把组件间隔加上 + if (xfl.toData().getCompInterval() != compInterval) { + xfl.moveContainerMargin(); + xfl.moveCompInterval(xfl.getAcualInterval()); + xfl.toData().setCompInterval(compInterval); + xfl.addCompInterval(xfl.getAcualInterval()); + } return true; } } @@ -147,8 +169,9 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr } //把绝对布局中的元素按规则移动到自适应布局中 - private void moveComponents2FitLayout(XWFitLayout xwFitLayout, Component[] components) { + private void moveComponents2FitLayout(XWFitLayout xwFitLayout) { int eachRowCount = 4; + Component[] components = xwFitLayout.getComponents(); if (components.length <= 1){ return; } @@ -156,6 +179,7 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr int layoutHeight = xwFitLayout.getHeight() - xwFitLayout.toData().getMargin().getTop() - xwFitLayout.toData().getMargin().getBottom(); int leftMargin = xwFitLayout.toData().getMargin().getLeft(); int topMargin = xwFitLayout.toData().getMargin().getTop(); + xwFitLayout.toData().setCompInterval(0); int row = (components.length / eachRowCount) + (components.length % eachRowCount == 0 ? 0 : 1); //最后一行的列数不定 int column = components.length % eachRowCount == 0 ? eachRowCount : components.length % eachRowCount; @@ -182,6 +206,12 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr lastRowHeight ); } + for (int i = 0;i < components.length;i++){ + if (components[i] instanceof XWCardMainBorderLayout){ + ((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth()); + ((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight()); + } + } xwFitLayout.updateBoundsWidget(); } diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java index f6b8ccaf22..c9654e26d0 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java @@ -4,8 +4,7 @@ package com.fr.design.designer.properties; import com.fr.design.beans.GroupModel; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.*; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.mainframe.WidgetPropertyPane; @@ -91,8 +90,23 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { } } + private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) { + XLayoutContainer rootLayout = formDesigner.getRootComponent(); + if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)){ + rootLayout = (XWAbsoluteBodyLayout)rootLayout.getXCreator(0); + } + return rootLayout; + } + @Override public Object getValue(int row, int column) { + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + XLayoutContainer rootLayout = selectedBodyLayout(formDesigner); + if (rootLayout != formDesigner.getRootComponent() + && formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) { + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xfl, new Widget[]{selectedBodyLayout(formDesigner).toData()})); + } if (column == 0) { switch (row) { case 0: @@ -140,6 +154,14 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0,0)); xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) { + XCreator xCreator = (XCreator)component; + //部分控件被ScaleLayout包裹着,绝对布局里面要放出来 + if (xCreator.acceptType(XWScaleLayout.class)){ + if (xCreator.getComponentCount() > 0 && ((XCreator)xCreator.getComponent(0)).shouldScaleCreator()) { + component = xCreator.getComponent(0); + component.setBounds(xCreator.getBounds()); + } + } xwAbsoluteBodyLayout.add(component); } FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); diff --git a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java index 410519cafb..2f424a7b7c 100644 --- a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -5,7 +5,8 @@ import java.awt.event.ActionEvent; import javax.swing.BorderFactory; import javax.swing.Icon; - +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.actions.community.NeedAction; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.mainframe.widget.UITreeComboBox; @@ -171,10 +172,17 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree */ private void adjustPosition(ComponentTreeModel treeModel,FormDesigner formDesigner){ XCreator root = (XCreator)treeModel.getRoot(); - if(treeModel.getChild(root,PARA) instanceof XWParameterLayout){ + XCreator firstChild = (XCreator)treeModel.getChild(root,PARA); + if(firstChild.acceptType(XWParameterLayout.class)){ return; } - root.add((Component)(treeModel.getChild(root,PARA)),BODY); + // 绝对布局作为body的时候 + // 获取第一个子节点的方法中屏蔽了fit + // 这边另外处理一下 + else if (firstChild.acceptType(XWAbsoluteBodyLayout.class) && firstChild.getBackupParent() != null) { + firstChild = firstChild.getBackupParent(); + } + root.add(firstChild,BODY); treeModel.setRoot(root); componentTree = new ComponentTree(formDesigner,treeModel); } diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index ef18f07135..661ba0ab96 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -9,9 +9,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.actions.FormDeleteAction; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.XComponent; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -436,6 +434,18 @@ public class JForm extends JTemplate implements BaseJForm { return !inECUndoForm && this.getUndoManager().canUndo(); } + // 返回当前的body, + // 假如当前body是自适应的话就沿用, + // 假如当前body是绝对布局的话就返回绝对布局body + private XLayoutContainer selectedBodyLayout() { + XLayoutContainer rootLayout = formDesign.getRootComponent(); + for (int i = 0; i < rootLayout.getComponentCount(); i++){ + if (rootLayout.getXCreator(i).acceptType(XWAbsoluteBodyLayout.class)){ + rootLayout = (XWAbsoluteBodyLayout)rootLayout.getXCreator(i); + } + } + return rootLayout; + } @Override /** * 应用undoState的表单数据 @@ -447,7 +457,9 @@ public class JForm extends JTemplate implements BaseJForm { if (this.index == FORM_TAB) { JForm.this.refreshRoot(); this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue()); - this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(), u.getSelectWidgets())); + //撤销的时候要重新选择的body布局 + this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(), + formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()})); } else { String widgetName = this.formDesign.getElementCaseContainerName(); //这儿太坑了,u.getForm() 与 getTarget内容不一样 From a87cb4544dd754ed0575d24b128b89e61771731f Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Fri, 21 Oct 2016 10:38:36 +0800 Subject: [PATCH 053/244] =?UTF-8?q?REPORT-364=20=E6=9C=80=E5=88=9D?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=20=E5=BF=98=E4=BA=86=E5=88=A0?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...FormElementRefreshCaseEditorProcessor.java | 18 ------------ ...FormElementRefreshCaseEditorProcessor.java | 28 ------------------- 2 files changed, 46 deletions(-) delete mode 100644 designer_base/src/com/fr/design/fun/FormElementRefreshCaseEditorProcessor.java delete mode 100644 designer_base/src/com/fr/design/fun/impl/AbstractFormElementRefreshCaseEditorProcessor.java diff --git a/designer_base/src/com/fr/design/fun/FormElementRefreshCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/FormElementRefreshCaseEditorProcessor.java deleted file mode 100644 index ceb1881a29..0000000000 --- a/designer_base/src/com/fr/design/fun/FormElementRefreshCaseEditorProcessor.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.design.fun; - -import com.fr.stable.fun.ReportRefreshAttrProvider; -import com.fr.stable.fun.mark.Immutable; - -import java.beans.PropertyDescriptor; - -/** - * Created by Slpire on 16/10/12. - */ -public interface FormElementRefreshCaseEditorProcessor extends Immutable { - - String MARK_STRING = "PropertyEditor"; - - int CURRENT_LEVEL = 1; - - PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportRefreshAttrProvider reportefreshAttr); -} diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementRefreshCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementRefreshCaseEditorProcessor.java deleted file mode 100644 index 5bbf34bc71..0000000000 --- a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementRefreshCaseEditorProcessor.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.design.fun.impl; - -import com.fr.design.fun.FormElementRefreshCaseEditorProcessor; -import com.fr.stable.fun.RefreshProvider; -import com.fr.stable.fun.ReportRefreshAttrProvider; -import com.fr.stable.fun.mark.API; - -import java.beans.PropertyDescriptor; - -/** - * Created by Slpire on 16/10/12. - */ -@API(level = FormElementRefreshCaseEditorProcessor.CURRENT_LEVEL) -public abstract class AbstractFormElementRefreshCaseEditorProcessor implements FormElementRefreshCaseEditorProcessor { - - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - public int layerIndex() { - return DEFAULT_LAYER_INDEX; - } - - @Override - public PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportRefreshAttrProvider refreshAttrProvider) { - return new PropertyDescriptor[0]; - } -} From a1fab4d88e3432c0a55abebc3f2efa46a1c04889 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 21 Oct 2016 10:48:31 +0800 Subject: [PATCH 054/244] update --- .../fr/design/ChartTypeInterfaceManager.java | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 866d039667..1909c947cf 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -284,7 +284,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getChartDataPane(chartID, plotID, listener); + if (plotInChart(plotID, chartID)) { + return getChartDataPane(chartID, plotID, listener); + } } return getChartDataPane(DEFAULT_CHART_ID, plotID, listener); } @@ -310,7 +312,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getAttrPaneArray(chartID, plotID, listener); + if (plotInChart(plotID, chartID)) { + return getAttrPaneArray(chartID, plotID, listener); + } } return getAttrPaneArray(DEFAULT_CHART_ID, plotID, listener); } @@ -324,7 +328,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getTableDataSourcePane(chartID, plot, parent); + if (plotInChart(plot.getPlotID(), chartID)) { + return getTableDataSourcePane(chartID, plot, parent); + } } return getTableDataSourcePane(DEFAULT_CHART_ID, plot, parent); } @@ -339,11 +345,20 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getReportDataSourcePane(chartID, plot, parent); + String plotID = plot.getPlotID(); + if (plotInChart(plotID, chartID)) { + return getReportDataSourcePane(chartID, plot, parent); + } } return getReportDataSourcePane(DEFAULT_CHART_ID, plot, parent); } + private boolean plotInChart(String plotID, String chartID) { + return chartTypeInterfaces != null + && chartTypeInterfaces.containsKey(chartID) + && chartTypeInterfaces.get(chartID).containsKey(plotID); + } + private AbstractReportDataContentPane getReportDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getReportDataSourcePane(plot, parent); } @@ -354,7 +369,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getPlotConditionPane(chartID, plot); + if (plotInChart(plot.getPlotID(), chartID)) { + return getPlotConditionPane(chartID, plot); + } } return getPlotConditionPane(DEFAULT_CHART_ID, plot); } @@ -369,7 +386,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getPlotSeriesPane(chartID, parent, plot); + if (plotInChart(plot.getPlotID(), chartID)) { + return getPlotSeriesPane(chartID, parent, plot); + } } return getPlotSeriesPane(DEFAULT_CHART_ID, parent, plot); } From 48eff3e882badbb9233d36f808437363660c06dc Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 21 Oct 2016 14:13:34 +0800 Subject: [PATCH 055/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=85=B1=E4=BA=ABfireTargetChange=E4=BC=9A?= =?UTF-8?q?=E5=A4=9A=E8=AE=B0=E4=BD=8F=E4=B8=80=E6=AC=A1=E7=8A=B6=E6=80=81?= =?UTF-8?q?ctrl+z=E7=9A=84=E6=97=B6=E5=80=99=E5=BE=97=E5=A4=9A=E6=8C=89?= =?UTF-8?q?=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/data/datapane/TableDataTreePane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java index 618c2edec2..2e605cafcf 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java @@ -292,7 +292,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { } tds.putTableData(tdName, td); } - tc.fireTargetModified(); tc.parameterChanged(); dataTree.refresh(); } From 14403f3459f56671ab9111981dc898fdbd4edf03 Mon Sep 17 00:00:00 2001 From: zhouping Date: Fri, 21 Oct 2016 14:15:58 +0800 Subject: [PATCH 056/244] =?UTF-8?q?REPORT-533=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=B8=83=E5=B1=80=E6=96=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index fff14f03d0..bdaad048aa 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -173,6 +173,7 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr int eachRowCount = 4; Component[] components = xwFitLayout.getComponents(); if (components.length <= 1){ + xwFitLayout.updateBoundsWidget(); return; } int layoutWidth = xwFitLayout.getWidth() - xwFitLayout.toData().getMargin().getLeft() - xwFitLayout.toData().getMargin().getRight(); From 81e0e84ee0eab32794d1b34d5a5669ecb23a003d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 21 Oct 2016 15:30:41 +0800 Subject: [PATCH 057/244] update --- .../fr/design/mainframe/chart/gui/ChangeConfigPane.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index a0f05b0bd4..89e5e57197 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -6,7 +6,7 @@ package com.fr.design.mainframe.chart.gui; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.change.ChangeConfigAttr; -import com.fr.chart.chartattr.change.ChangeType; +import com.fr.chart.chartglyph.ChangeType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; @@ -14,14 +14,9 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; -import com.fr.function.MAX; -import com.fr.general.ComparatorUtils; import com.fr.general.Inter; -import com.fr.third.org.hsqldb.lib.Collection; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; From 2c4780d0828569adbaed0e85b67d268a7886f1fd Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 21 Oct 2016 15:48:22 +0800 Subject: [PATCH 058/244] =?UTF-8?q?REPORT-565=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=97=A5=E6=96=87=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8B=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=AF=B9=E8=AF=9D=E6=A1=86=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E6=96=87=E5=AD=97=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/hyperlink/AbstractHyperlinkPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java index 8a2773f58a..36297d1656 100644 --- a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java +++ b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java @@ -63,12 +63,12 @@ public abstract class AbstractHyperlinkPane extends BasicBe newWindowConfPane.add(new UILabel(Inter.getLocText("FR-Designer_Height") + ": ")); heightTextFiled = new UINumberField(); heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE)); - heightTextFiled.setPreferredSize(new Dimension(60, 20)); + heightTextFiled.setPreferredSize(new Dimension(40, 20)); newWindowConfPane.add(heightTextFiled); newWindowConfPane.add(new UILabel(" " + Inter.getLocText("FR-Designer_Width") + ": ")); widthTextFiled = new UINumberField(); widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE)); - widthTextFiled.setPreferredSize(new Dimension(60, 20)); + widthTextFiled.setPreferredSize(new Dimension(40, 20)); newWindowConfPane.add(widthTextFiled); JPanel centerPanel = new JPanel(new BorderLayout()); From d92bc1810816e2cbe25ae6885d66f94026801c09 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 21 Oct 2016 15:53:16 +0800 Subject: [PATCH 059/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20NPE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/CoverReportPane.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java index 42dc62040c..63ec66f5a5 100644 --- a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java +++ b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java @@ -62,15 +62,17 @@ public class CoverReportPane extends JPanel { editButton.setBackground(new Color(176, 196, 222)); add(editButton); add(controlButton); - WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { - @Override - public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == (DesignerEvent.CREATOR_DELETED) - || evt.getCreatorEventID() == (DesignerEvent.CREATOR_RESIZED)) { - destroyHelpDialog(); + if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { + WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { + @Override + public void fireCreatorModified(DesignerEvent evt) { + if (evt.getCreatorEventID() == (DesignerEvent.CREATOR_DELETED) + || evt.getCreatorEventID() == (DesignerEvent.CREATOR_RESIZED)) { + destroyHelpDialog(); + } } - } - }); + }); + } } public String getHelpMsg() { From 3e6056314b061109b70508374dbdfe2f5ae9ebb2 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 21 Oct 2016 15:54:51 +0800 Subject: [PATCH 060/244] =?UTF-8?q?REPORT-565=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=97=A5=E6=96=87=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8B=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=AF=B9=E8=AF=9D=E6=A1=86=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E6=96=87=E5=AD=97=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/hyperlink/AbstractHyperlinkPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java index 36297d1656..8a2773f58a 100644 --- a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java +++ b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java @@ -63,12 +63,12 @@ public abstract class AbstractHyperlinkPane extends BasicBe newWindowConfPane.add(new UILabel(Inter.getLocText("FR-Designer_Height") + ": ")); heightTextFiled = new UINumberField(); heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE)); - heightTextFiled.setPreferredSize(new Dimension(40, 20)); + heightTextFiled.setPreferredSize(new Dimension(60, 20)); newWindowConfPane.add(heightTextFiled); newWindowConfPane.add(new UILabel(" " + Inter.getLocText("FR-Designer_Width") + ": ")); widthTextFiled = new UINumberField(); widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE)); - widthTextFiled.setPreferredSize(new Dimension(40, 20)); + widthTextFiled.setPreferredSize(new Dimension(60, 20)); newWindowConfPane.add(widthTextFiled); JPanel centerPanel = new JPanel(new BorderLayout()); From 0a8aeb8c6188825ab614d25b777da60d9a2338ec Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 21 Oct 2016 16:29:08 +0800 Subject: [PATCH 061/244] =?UTF-8?q?REPORT-560=20&&=20REPORT-565=20=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AEformat=E5=90=8E=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=92=8C=E6=97=A5=E6=96=87=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8B?= =?UTF-8?q?=E8=B6=85=E9=93=BE=E6=8E=A5=E5=AF=B9=E8=AF=9D=E6=A1=86=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=90=8E=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/DateEditorDefinePane.java | 93 ++++++++----------- .../hyperlink/AbstractHyperlinkPane.java | 4 +- 2 files changed, 40 insertions(+), 57 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java index 2cd4dfaddc..b85a18a52d 100644 --- a/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java @@ -31,7 +31,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane 0) { try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(text); - String sample = simpleDateFormat.format(new Date()); - Color c = Color.black; - if (!ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), text)) { - sample += " " + Inter.getLocText("DateFormat-Custom_Warning"); - c = Color.red; - } + String sample = simpleDateFormat.format(new Date()); + Color c = Color.black; + if (!ArrayUtils.contains(FormatField.getInstance().getDateFormatArray(), text)) { + sample += " " + Inter.getLocText("DateFormat-Custom_Warning"); + c = Color.red; + } this.sampleLabel.setText(sample); - this.sampleLabel.setForeground(c); + this.sampleLabel.setForeground(c); } catch (Exception exp) { this.sampleLabel.setForeground(Color.red); this.sampleLabel.setText(exp.getMessage()); @@ -143,12 +126,12 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane 0) { try { - simpleDateFormat = new SimpleDateFormat(patternTextField.getText()); + simpleDateFormat = new SimpleDateFormat(text); this.sampleLabel.setText(simpleDateFormat.format(new Date())); } catch (Exception exp) { simpleDateFormat = new SimpleDateFormat(""); diff --git a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java index 8a2773f58a..36297d1656 100644 --- a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java +++ b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java @@ -63,12 +63,12 @@ public abstract class AbstractHyperlinkPane extends BasicBe newWindowConfPane.add(new UILabel(Inter.getLocText("FR-Designer_Height") + ": ")); heightTextFiled = new UINumberField(); heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE)); - heightTextFiled.setPreferredSize(new Dimension(60, 20)); + heightTextFiled.setPreferredSize(new Dimension(40, 20)); newWindowConfPane.add(heightTextFiled); newWindowConfPane.add(new UILabel(" " + Inter.getLocText("FR-Designer_Width") + ": ")); widthTextFiled = new UINumberField(); widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE)); - widthTextFiled.setPreferredSize(new Dimension(60, 20)); + widthTextFiled.setPreferredSize(new Dimension(40, 20)); newWindowConfPane.add(widthTextFiled); JPanel centerPanel = new JPanel(new BorderLayout()); From c84934b2351b81dce97198340f6eeb5d1bba6095 Mon Sep 17 00:00:00 2001 From: zhouping Date: Fri, 21 Oct 2016 17:21:28 +0800 Subject: [PATCH 062/244] =?UTF-8?q?REPORT-533=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=B8=83=E5=B1=80=E6=96=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20bugfix=20=E5=88=87=E6=8D=A2=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E7=AD=89=E5=88=86=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/designer/creator/XWFitLayout.java | 8 ++++++-- .../FRAbsoluteBodyLayoutPropertiesGroupModel.java | 7 +++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java index 20b12d8881..50fa38db93 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java @@ -21,6 +21,7 @@ import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; +import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WLayout; import com.fr.general.FRScreen; @@ -685,7 +686,10 @@ public class XWFitLayout extends XLayoutContainer { if (isRefreshing) { return; } - LayoutUtils.layoutContainer(this); + //当前的body布局为绝对布局的时候不要doLayout + if (toData().getBodyLayoutType() != WBodyLayoutType.ABSOLUTE){ + LayoutUtils.layoutContainer(this); + } WFitLayout layout = this.toData(); //自适应布局新增控件后,其他控件位置也会变 XWidgetCreator creator = (XWidgetCreator) e.getChild(); @@ -834,7 +838,7 @@ public class XWFitLayout extends XLayoutContainer { * 处理自适应布局的directions * @param xcreator 组件 */ - private void dealDirections(XCreator xcreator, boolean isInit) { + public void dealDirections(XCreator xcreator, boolean isInit) { if (xcreator == null) { return; } diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index bdaad048aa..6b29a172e5 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -101,13 +101,13 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr xfl.getLayoutAdapter().removeBean(xwAbsoluteLayout, xwAbsoluteLayout.getWidth(), xwAbsoluteLayout.getHeight()); xfl.remove(xwAbsoluteLayout); - xfl.toData().setLayoutType(WBodyLayoutType.FIT); for (Component comp : components) { XCreator xCreator = (XCreator)comp; if (xCreator.shouldScaleCreator()){ XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight()); xfl.add(parentPanel, xCreator.toData().getWidgetName()); + parentPanel.updateChildBound(xfl.getActualMinHeight()); continue; } xfl.add(xCreator); @@ -116,9 +116,6 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr moveComponents2FitLayout(xfl); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); formDesigner.getSelectionModel().setSelectedCreator(xfl); - xfl.convert(); - LayoutUtils.layoutContainer(xfl); - xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0); for (int i = 0; i < components.length; i++) { Component comp = xfl.getComponent(i); @@ -133,6 +130,7 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr xfl.toData().setCompInterval(compInterval); xfl.addCompInterval(xfl.getAcualInterval()); } + xfl.toData().setLayoutType(WBodyLayoutType.FIT); return true; } } @@ -212,6 +210,7 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr ((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth()); ((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight()); } + xwFitLayout.dealDirections((XCreator)components[i], false); } xwFitLayout.updateBoundsWidget(); } From d0274db42bf56339956f20499b32b0459d4f2e3c Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 21 Oct 2016 17:39:09 +0800 Subject: [PATCH 063/244] update --- .../chart/gui/ChartTypeButtonPane.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 6c8c9ef462..fceb0500fd 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -150,17 +150,20 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } catch (CloneNotSupportedException e1) { FRLogger.getLogger().error("Error in Clone"); } - //获取图表收集器的状态 - SwitchState state = editingCollection.calculateMultiChartMode(); - if (state.isDynamicState() && parent != null){ - parent.reactorChartTypePane(editingCollection); - } - + checkoutChange(); } layoutPane(buttonPane); } }; + //获取图表收集器的状态 + private void checkoutChange(){ + SwitchState state = editingCollection.calculateMultiChartMode(); + if (state.isDynamicState() && parent != null){ + parent.reactorChartTypePane(editingCollection); + } + } + ActionListener configListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -316,6 +319,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen layoutPane(buttonPane); checkConfigButtonVisible(); + //更新切换面板 + checkoutChange(); } private void checkConfigButtonVisible() { @@ -444,10 +449,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } //获取图表收集器的状态 - SwitchState state = editingCollection.calculateMultiChartMode(); - if (state.isDynamicState() && parent != null){ - parent.reactorChartTypePane(editingCollection); - } + checkoutChange(); relayoutPane(); } From 7f83e94d4c66084f742f6559598682c0dc419e17 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 24 Oct 2016 10:31:47 +0800 Subject: [PATCH 064/244] update --- .../mainframe/chart/gui/ChangeConfigPane.java | 13 +++++++------ .../mainframe/chart/gui/ChartTypeButtonPane.java | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index 89e5e57197..c4cd32a223 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -5,8 +5,8 @@ package com.fr.design.mainframe.chart.gui; */ import com.fr.chart.chartattr.ChartCollection; -import com.fr.chart.chartattr.change.ChangeConfigAttr; -import com.fr.chart.chartglyph.ChangeType; +import com.fr.chart.base.AttrChangeConfig; +import com.fr.chart.base.AttrChangeType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; @@ -163,11 +163,11 @@ public class ChangeConfigPane extends BasicBeanPane { if (ob == null){ return; } - ChangeConfigAttr changeConfigAttr = ob.getChangeConfigAttr(); + AttrChangeConfig changeConfigAttr = ob.getChangeConfigAttr(); if (changeConfigAttr == null){ return; } - configStyleButton.setSelectedIndex(changeConfigAttr.getChangeType() == ChangeType.BUTTON ? 0 : 1); + configStyleButton.setSelectedIndex(changeConfigAttr.getChangeType() == AttrChangeType.BUTTON ? 0 : 1); //按钮切换界面 styleAttrPane.populate(changeConfigAttr.getStyleAttr()); @@ -190,12 +190,13 @@ public class ChangeConfigPane extends BasicBeanPane { if (ob == null){ return; } - ChangeConfigAttr changeConfigAttr = ob.getChangeConfigAttr(); + AttrChangeConfig changeConfigAttr = ob.getChangeConfigAttr(); if (changeConfigAttr == null){ return; } - changeConfigAttr.setChangeType(configStyleButton.getSelectedIndex() == 0 ? ChangeType.BUTTON : ChangeType.CAROUSEL); + changeConfigAttr.setEnable(ob.changeEnable()); + changeConfigAttr.setChangeType(configStyleButton.getSelectedIndex() == 0 ? AttrChangeType.BUTTON : AttrChangeType.CAROUSEL); changeConfigAttr.setStyleAttr(styleAttrPane.update()); changeConfigAttr.setButtonColor(colorSelectBox4button.getSelectObject()); changeConfigAttr.setTimeInterval(timeInterval.getValue()); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index fceb0500fd..0a563723c7 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,7 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; -import com.fr.chart.chartattr.change.ChangeConfigAttr; +import com.fr.chart.base.AttrChangeConfig; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; @@ -115,7 +115,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initConfigCreator() { - configCreator = new UIMenuNameableCreator(Inter.getLocText("Chart-Change_Config_Attributes"), new ChangeConfigAttr(), ChangeConfigPane.class); + configCreator = new UIMenuNameableCreator(Inter.getLocText("Chart-Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class); } private void initAddButton() { From f6414ca067eb718ca04aa5ee1eb873fbe3090aab Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 24 Oct 2016 11:31:32 +0800 Subject: [PATCH 065/244] update --- .../src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index c4cd32a223..f9b2827cd8 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -194,8 +194,6 @@ public class ChangeConfigPane extends BasicBeanPane { if (changeConfigAttr == null){ return; } - - changeConfigAttr.setEnable(ob.changeEnable()); changeConfigAttr.setChangeType(configStyleButton.getSelectedIndex() == 0 ? AttrChangeType.BUTTON : AttrChangeType.CAROUSEL); changeConfigAttr.setStyleAttr(styleAttrPane.update()); changeConfigAttr.setButtonColor(colorSelectBox4button.getSelectObject()); From c1be9b8dffaaddaf6ce0d52d770091b4e4e3df73 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 24 Oct 2016 14:54:08 +0800 Subject: [PATCH 066/244] =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index f9b2827cd8..3ee84ceb7c 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -197,7 +197,7 @@ public class ChangeConfigPane extends BasicBeanPane { changeConfigAttr.setChangeType(configStyleButton.getSelectedIndex() == 0 ? AttrChangeType.BUTTON : AttrChangeType.CAROUSEL); changeConfigAttr.setStyleAttr(styleAttrPane.update()); changeConfigAttr.setButtonColor(colorSelectBox4button.getSelectObject()); - changeConfigAttr.setTimeInterval(timeInterval.getValue()); + changeConfigAttr.setTimeInterval((int) timeInterval.getValue()); changeConfigAttr.setCarouselColor(colorSelectBox4carousel.getSelectObject()); } From e09047983f7fe9386a5d1c266ad29443f2bc1507 Mon Sep 17 00:00:00 2001 From: fr_shine Date: Mon, 24 Oct 2016 16:49:04 +0800 Subject: [PATCH 067/244] mapMapCustomPane refresh areaname list --- .../fr/design/chart/series/PlotSeries/MapCustomPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 0a922d34e1..0cdd4595eb 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 @@ -166,8 +166,13 @@ refreshAreaNameBox(); } List columnNameList = tableDataWrappe.calculateColumnNameList(); + Object oldSelected = areaString.getSelectedItem(); areaString.removeAllItems(); - areaString.setItemList(columnNameList); + + for(String item : columnNameList) { + areaString.addItem(item); + } + areaString.getModel().setSelectedItem(oldSelected); } /** From 46333ce75228c1a061ba05e5410906bccb6e5729 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 24 Oct 2016 17:23:16 +0800 Subject: [PATCH 068/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=AF=E5=90=A6=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 0a563723c7..0fef00f319 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -162,6 +162,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen if (state.isDynamicState() && parent != null){ parent.reactorChartTypePane(editingCollection); } + //检查是否可以配置切换 + configButton.setEnabled(editingCollection.changeEnable()); } ActionListener configListener = new ActionListener() { From e7c5c7a8c3b36ef4eaa8f7f8626729df85f6f93e Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 24 Oct 2016 19:19:06 +0800 Subject: [PATCH 069/244] =?UTF-8?q?REPORT-585=20&&=20REPORT-529=20?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E8=8E=B7=E5=8F=96=E8=A1=A8=E5=8D=95=E5=90=8D?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0formletName=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=9C=A8=E5=85=AC=E5=BC=8F=E6=B7=BB=E5=8A=A0=E5=92=8C=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=96=87=E4=BB=B6=E6=95=B0=E6=8D=AE=E9=9B=86=EF=BC=8C?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=8B=E6=96=B9=E7=9A=84=E6=8F=90=E7=A4=BA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledata/tabledatapane/FileTableDataPane.java | 10 +++++++++- .../com/fr/design/formula/VariableResolverAdapter.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index 0a05e1893c..c27373d59d 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -445,6 +445,14 @@ public class FileTableDataPane extends AbstractTableDataPane { return suffixList.toArray(new String[suffixList.size()]); } + private String getFileSuffixToString() { + String suffixToString = fileTypeComboBox.getSelectedItem().toString().toLowerCase(); + if (suffixToString.equalsIgnoreCase("excel")) { + suffixToString = "xls"; + } + return suffixToString; + } + private ActionListener getFileTypeListener(final JPanel setPanel, final int width, final int height) { ActionListener fileTypeListener = new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -458,7 +466,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } else { setPanel.add(textSetPanel(width,height), BorderLayout.NORTH); } - String tipContent = Inter.getLocText("FR-Designer-Type_Parameter") + "reportlets/excel/FineReport${abc}." + getFileSuffix() + "
" + String tipContent = Inter.getLocText("FR-Designer-Type_Parameter") + "reportlets/excel/FineReport${abc}." + getFileSuffixToString() + "
" + "http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp
" + "  "; tips.setText(tipContent); } diff --git a/designer_base/src/com/fr/design/formula/VariableResolverAdapter.java b/designer_base/src/com/fr/design/formula/VariableResolverAdapter.java index 2489c6ff4f..eb80600acc 100644 --- a/designer_base/src/com/fr/design/formula/VariableResolverAdapter.java +++ b/designer_base/src/com/fr/design/formula/VariableResolverAdapter.java @@ -29,7 +29,7 @@ public abstract class VariableResolverAdapter implements VariableResolver { // 空值参数 "NULL", "NOFILTER", // request变量 - CalculatorProvider.REPORT_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME, + CalculatorProvider.REPORT_NAME, CalculatorProvider.FORMLET_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME, CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID }; } From 10f4be45070fd5233c3c062431621b105bb4d147 Mon Sep 17 00:00:00 2001 From: fr_shine Date: Tue, 25 Oct 2016 09:31:19 +0800 Subject: [PATCH 070/244] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=A0=87=E7=AD=BE=20?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E5=90=8D=E5=92=8C=E5=8C=BA=E5=9F=9F=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeriesCondition/TooltipContentsPane.java | 29 +++++++++---------- .../SeriesCondition/dlp/DataLabelPane.java | 15 +++++----- .../SeriesCondition/dlp/MapDataLabelPane.java | 18 ++++++++++++ 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TooltipContentsPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TooltipContentsPane.java index 0be84de39b..c8f2fe3948 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TooltipContentsPane.java +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/TooltipContentsPane.java @@ -1,28 +1,23 @@ package com.fr.design.chart.series.SeriesCondition; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.text.Format; - -import javax.swing.JPanel; -import javax.swing.SwingUtilities; - import com.fr.chart.base.AttrContents; import com.fr.chart.base.ChartConstants; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.style.FormatPane; import com.fr.general.Inter; import com.fr.stable.StringUtils; -import com.fr.design.style.FormatPane; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.Format; /** * 数据点提示内容面板,包含系列值、系列百分比 @@ -58,7 +53,7 @@ public class TooltipContentsPane extends BasicPane{ protected JPanel createJPanel4Value() { if (showValueCB == null) { - showValueCB = new UICheckBox(Inter.getLocText("Value")); + showValueCB = new UICheckBox(getValueString()); } showValueCB.setSelected(true); @@ -75,7 +70,9 @@ public class TooltipContentsPane extends BasicPane{ return valuePane; } - + protected String getValueString() { + return Inter.getLocText("Value"); + } protected Component[] createComponents4PercentValue() { if (showPercent == null) { 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 33f2dccb79..7d8b6c8ce1 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 @@ -1,12 +1,5 @@ package com.fr.design.chart.series.SeriesCondition.dlp; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; - -import javax.swing.ButtonGroup; -import javax.swing.JPanel; - import com.fr.base.Utils; import com.fr.chart.base.AttrContents; import com.fr.chart.base.ChartConstants; @@ -21,6 +14,9 @@ import com.fr.general.Inter; import com.fr.stable.Constants; import com.fr.stable.StringUtils; +import javax.swing.*; +import java.awt.*; + /** * Created by IntelliJ IDEA. * Author : Richer @@ -80,11 +76,14 @@ public class DataLabelPane extends TooltipContentsPane { protected Component[] createComponents4ShowCategoryName() { if (showCategoryNameCB == null) { - showCategoryNameCB = new UICheckBox(Inter.getLocText(new String[]{"StyleFormat-Category", "WF-Name"})); + showCategoryNameCB = new UICheckBox(getCategoryString()); } return new Component[]{null, showCategoryNameCB}; } + protected String getCategoryString(){ + return Inter.getLocText(new String[]{"StyleFormat-Category", "WF-Name"}); + } protected Component[] createComponents4ShowGuidLine() { diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MapDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MapDataLabelPane.java index 355ec9eeec..451197e2a5 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MapDataLabelPane.java +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/MapDataLabelPane.java @@ -1,6 +1,9 @@ package com.fr.design.chart.series.SeriesCondition.dlp; +import com.fr.general.Inter; + import javax.swing.*; +import java.awt.*; /** @@ -13,6 +16,21 @@ import javax.swing.*; */ public class MapDataLabelPane extends DataLabelPane { + @Override + protected Component[] createComponents4ShowSeriesName() { + return new Component[0]; + } + + @Override + protected String getCategoryString() { + return Inter.getLocText("FR-Chart-Area_Name"); + } + + @Override + protected String getValueString() { + return Inter.getLocText("FR-Chart-Area_Value"); + } + protected JPanel createJPanel4Position() { return null; } From 3d6f0f3e90de7163095a2cfc48ea69a39e263348 Mon Sep 17 00:00:00 2001 From: fr_shine Date: Tue, 25 Oct 2016 15:08:32 +0800 Subject: [PATCH 071/244] =?UTF-8?q?=E4=B8=80=E7=BB=B4=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE=E9=85=8D=E7=BD=AE=E9=80=9A=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/report/MeterPlotReportDataContentPane.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java index b785373bc2..6bd4b3fbe0 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java @@ -46,8 +46,8 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan double[] rowSize = { p, p, p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(CATENAME), getSingCatePane()}, - new Component[]{new UILabel(NVALUE), singValuePane = new TinyFormulaPane()}, + new Component[]{new UILabel(getCateName()), getSingCatePane()}, + new Component[]{new UILabel(getNValue()), singValuePane = new TinyFormulaPane()}, new Component[]{null, null} }; @@ -66,6 +66,14 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan this.add(pane, BorderLayout.CENTER); } + + protected String getCateName() { + return CATENAME; + } + + protected String getNValue() { + return NVALUE; + } public void populateBean(ChartCollection collection) { TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); From 17d5e09692c64e7933666ab49f7ffc5b7dcfa3fa Mon Sep 17 00:00:00 2001 From: fr_shine Date: Tue, 25 Oct 2016 15:10:08 +0800 Subject: [PATCH 072/244] update --- .../gui/data/report/MeterPlotReportDataContentPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java index 6bd4b3fbe0..c23f64dc18 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java @@ -46,8 +46,8 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan double[] rowSize = { p, p, p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(getCateName()), getSingCatePane()}, - new Component[]{new UILabel(getNValue()), singValuePane = new TinyFormulaPane()}, + new Component[]{new UILabel(getCateNameString()), getSingCatePane()}, + new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()}, new Component[]{null, null} }; @@ -67,11 +67,11 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan this.add(pane, BorderLayout.CENTER); } - protected String getCateName() { + protected String getCateNameString() { return CATENAME; } - protected String getNValue() { + protected String getNValueString() { return NVALUE; } From a98dd7f2ca15fc3e46a9af2129933c1c1dc94f9d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 25 Oct 2016 15:35:07 +0800 Subject: [PATCH 073/244] =?UTF-8?q?=E5=88=87=E6=8D=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/ChartTypeInterfaceManager.java | 15 +++++++++++++++ .../mainframe/chart/gui/ChartTypeButtonPane.java | 4 ++-- .../design/mainframe/chart/gui/ChartTypePane.java | 13 ++++++++++--- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 1909c947cf..6b280b3982 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -249,6 +249,21 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return new String[0]; } + /** + * 获取指定图表的标题 + * @param chartID + * @return + */ + public String getTitle4PopupWindow(String chartID, String plotID){ + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)){ + HashMap chartUIList = chartTypeInterfaces.get(chartID); + IndependentChartUIProvider provider = chartTypeInterfaces.get(chartID).get(plotID); + return provider.getPlotTypePane().title4PopupWindow(); + + } + return new String(); + } + private String[] getTitle4PopupWindow(){ int size = 0; if (chartTypeInterfaces != null){ diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 0fef00f319..f9c6e572c6 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -158,8 +158,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //获取图表收集器的状态 private void checkoutChange(){ - SwitchState state = editingCollection.calculateMultiChartMode(); - if (state.isDynamicState() && parent != null){ + editingCollection.calculateMultiChartMode(); + if (parent != null){ parent.reactorChartTypePane(editingCollection); } //检查是否可以配置切换 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 84cfbd52ba..01d47d4b7d 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 @@ -8,6 +8,7 @@ import com.fr.chart.chartattr.SwitchState; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.chart.fun.IndependentChartUIProvider; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.icombobox.UIComboBox; @@ -37,6 +38,8 @@ public class ChartTypePane extends AbstractChartAttrPane{ private ChartTypeButtonPane buttonPane; private ChartEditPane editPane; private ChartCollection editingCollection; + //记录面板所处状态 + private SwitchState paneState = SwitchState.DEFAULT; @Override protected JPanel createContentPane() { @@ -161,11 +164,10 @@ public class ChartTypePane extends AbstractChartAttrPane{ } public void reactor(ChartCollection collection){ - //重构前存储所选择的下拉选项 - Object item = jcb.getSelectedItem(); //重构需要重构下拉框选项和cardNames Chart chart = collection.getSelectedChart(); String chartID = chart.getChartID(); + String plotID = chart.getPlot().getPlotID(); if (collection.getState() == SwitchState.DEFAULT){ chartID = StringUtils.EMPTY; } @@ -179,6 +181,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ fcb.addItem(cardNames[i]); } //重新选择选中的下拉项 + Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); jcb.setSelectedItem(item); fcb.setItemEvenType(ItemEventType.DEFAULT); } @@ -220,7 +223,11 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void reactorChartTypePane(ChartCollection collection){ - chartTypePane.reactor(collection); + if (paneState != collection.getState()) { + chartTypePane.reactor(collection); + //设置面板切换状态 + paneState = collection.getState(); + } } /** From 05b2e143d0b121b9b1283286b8fec69a9905f8cf Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 25 Oct 2016 16:05:29 +0800 Subject: [PATCH 074/244] update --- .../src/com/fr/design/mainframe/chart/gui/ChartTypePane.java | 3 ++- 1 file changed, 2 insertions(+), 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 01d47d4b7d..85ca02832a 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 @@ -167,7 +167,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ //重构需要重构下拉框选项和cardNames Chart chart = collection.getSelectedChart(); String chartID = chart.getChartID(); - String plotID = chart.getPlot().getPlotID(); if (collection.getState() == SwitchState.DEFAULT){ chartID = StringUtils.EMPTY; } @@ -181,6 +180,8 @@ public class ChartTypePane extends AbstractChartAttrPane{ fcb.addItem(cardNames[i]); } //重新选择选中的下拉项 + chartID = chart.getChartID(); + String plotID = chart.getPlot().getPlotID(); Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); jcb.setSelectedItem(item); fcb.setItemEvenType(ItemEventType.DEFAULT); From b21956c279a2bbbcd8c854c442e2584f715e38ed Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 25 Oct 2016 16:28:51 +0800 Subject: [PATCH 075/244] update --- .../mainframe/chart/gui/ChartTypePane.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 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 85ca02832a..694a704762 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 @@ -173,17 +173,21 @@ public class ChartTypePane extends AbstractChartAttrPane{ //第一步就是重构cardNames cardNames = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID); //重构下拉框选项 + reactorComboBox(); + //重新选择选中的下拉项 + chartID = chart.getChartID(); + String plotID = chart.getPlot().getPlotID(); + Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); + jcb.setSelectedItem(item); + } + + private void reactorComboBox() { FlexibleComboBox fcb = (FlexibleComboBox)jcb; fcb.setItemEvenType(ItemEventType.REACTOR); fcb.removeAllItems(); for (int i = 0; i < this.cardNames.length; i++) { fcb.addItem(cardNames[i]); } - //重新选择选中的下拉项 - chartID = chart.getChartID(); - String plotID = chart.getPlot().getPlotID(); - Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); - jcb.setSelectedItem(item); fcb.setItemEvenType(ItemEventType.DEFAULT); } @@ -236,9 +240,8 @@ public class ChartTypePane extends AbstractChartAttrPane{ */ public void populate(ChartCollection collection) { Chart chart = collection.getSelectedChart(); - chartTypePane.populateBean(chart); - buttonPane.populateBean(collection); + chartTypePane.populateBean(chart); } /** From 04a2611500ee126d8a739d0b85a6a5b0c408f39b Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 16:59:24 +0800 Subject: [PATCH 076/244] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/ShareWidgetButton.java | 40 ++++--------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index 955e54822a..ffb688578e 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -4,7 +4,6 @@ import com.fr.base.BaseUtils; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.Widget; @@ -20,7 +19,6 @@ import java.awt.dnd.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; -import java.awt.image.BufferedImage; import java.io.IOException; import java.io.Serializable; @@ -36,42 +34,20 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot public ShareWidgetButton(ElCaseBindInfo bindInfo) { this.bindInfo = bindInfo; initUI(); - this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); this.addMouseListener(this); this.addMouseMotionListener(this); new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); } - private void initUI() { - this.setBackground(Color.WHITE); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - setPreferredSize(new Dimension(108, 72)); - setLayout(FRGUIPaneFactory.createBorderLayout()); - ImagePanel imagePanel = new ImagePanel((BufferedImage) bindInfo.getCover()); - imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - - this.add(imagePanel, BorderLayout.NORTH); - UILabel label = new UILabel(bindInfo.getName(), SwingConstants.HORIZONTAL); - label.setOpaque(true); - label.setBackground(new Color(184, 220, 242)); - this.add(label, BorderLayout.SOUTH); - } - - private class ImagePanel extends JPanel { - - private BufferedImage image; - - public ImagePanel(BufferedImage image) { - this.image = image; - this.setPreferredSize(new Dimension(108, 52)); - } - - @Override - public void paintComponent(Graphics g) { - g.drawImage(image, 0, 0, null); - } - + JPanel reportPane = new JPanel(new BorderLayout()); + reportPane.add(new UILabel(new ImageIcon(bindInfo.getCover())), BorderLayout.CENTER); + JPanel labelPane = new JPanel(new BorderLayout()); + UILabel label = new UILabel(bindInfo.getName(), UILabel.CENTER); + labelPane.setBackground(new Color(184, 220, 242)); + labelPane.add(label, BorderLayout.CENTER); + reportPane.add(labelPane, BorderLayout.SOUTH); + add(reportPane); } public ElCaseBindInfo getBindInfo() { From 989358cf8b463d17e8644df93c8eff35c0354c37 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:02:03 +0800 Subject: [PATCH 077/244] rt --- .../mainframe/FormWidgetDetailPane.java | 42 ++++++++++--------- .../fr/design/mainframe/ShareWidgetPane.java | 13 +++--- .../mainframe/widget/UITreeComboBox.java | 1 + 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 372377077e..f4af3d79d2 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -47,7 +47,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UITabbedPane tabbedPane; private UIScrollPane downPanel; - private JPanel reuWidgetPanel; + private JPanel esp; private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; private UIButton downloadButton; @@ -95,21 +95,14 @@ public class FormWidgetDetailPane extends FormDockView{ clearDockingView(); return; } - - JPanel esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); + esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); esp.setBorder(null); if (elCaseBindInfoList == null) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } initReuWidgetPanel(); - esp.add(reuWidgetPanel, BorderLayout.CENTER); createDownloadButton(); - JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 3)); - widgetPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), - SwingConstants.HORIZONTAL), BorderLayout.WEST); - widgetPane.add(downloadButton, BorderLayout.EAST); - esp.add(widgetPane,BorderLayout.NORTH); + initMenuPanel(); tabbedPane = new UITabbedPane(); tabbedPane.setOpaque(true); tabbedPane.setBorder(null); @@ -124,16 +117,25 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化组件共享和复用面板 */ private void initReuWidgetPanel() { - int rowCount = (elCaseBindInfoList.length + 1)/2; downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - downPanel.setPreferredSize(new Dimension(236, rowCount * 82)); - reuWidgetPanel = new JPanel(); + esp.add(downPanel); + } + + /** + * 初始化菜单栏面板 + */ + private void initMenuPanel() { + JPanel menutPane = new JPanel(); + menutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + menutPane.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 3)); + menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), + SwingConstants.HORIZONTAL), BorderLayout.WEST); + menutPane.add(downloadButton, BorderLayout.EAST); comboBox = new UIComboBox(getFormCategories()); - comboBox.setPreferredSize(new Dimension(236, 30)); + comboBox.setPreferredSize(new Dimension(240, 30)); initComboBoxSelectedListener(); - reuWidgetPanel.add(comboBox, BorderLayout.NORTH); - reuWidgetPanel.add(downPanel, BorderLayout.CENTER); - reuWidgetPanel.setBorder(new LineBorder(Color.gray)); + menutPane.add(comboBox, BorderLayout.SOUTH); + esp.add(menutPane,BorderLayout.NORTH); } private void initComboBoxSelectedListener() { @@ -144,7 +146,7 @@ public class FormWidgetDetailPane extends FormDockView{ if (filterIndex == 0) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } else { - String filterName = (String) e.getItem(); + String filterName = comboBox.getSelectedItem().toString(); elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); } refreshDownPanel(); @@ -191,10 +193,10 @@ public class FormWidgetDetailPane extends FormDockView{ public void refreshDownPanel() { - reuWidgetPanel.remove(downPanel); + esp.remove(downPanel); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); //todo:这个地方有问题 - reuWidgetPanel.add(downPanel); + esp.add(downPanel); repaintContainer(); } diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index f5e8e0126f..47fb692759 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; +import com.fr.design.form.layout.FRGridLayout; import com.fr.form.ui.ElCaseBindInfo; @@ -16,17 +17,15 @@ import java.util.List; public class ShareWidgetPane extends JPanel { public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) { - this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离 - int rowCount = (elCaseBindInfoList.length + 1)/2; - this.setLayout(new GridLayout(rowCount, 2, 10, 10)); + this.setBorder(BorderFactory.createEmptyBorder(5, 2, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 + int rowCount = (elCaseBindInfoList.length + 1) / 2; + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); this.add(widgetButton); } - if (elCaseBindInfoList.length == 1) { - this.add(new JPanel()); - } + this.setPreferredSize(new Dimension(240, rowCount * 80)); } -} +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index ef01c7b711..cbcf8f1975 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -15,6 +15,7 @@ import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.ComponentTree; import com.sun.java.swing.plaf.motif.*; import com.sun.java.swing.plaf.windows.*; From a519db2b8b22611e1eedb7f70bca03092b977a63 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 25 Oct 2016 17:02:33 +0800 Subject: [PATCH 078/244] update --- .../mainframe/chart/gui/ChartTypePane.java | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 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 694a704762..78f3f62712 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 @@ -38,9 +38,31 @@ public class ChartTypePane extends AbstractChartAttrPane{ private ChartTypeButtonPane buttonPane; private ChartEditPane editPane; private ChartCollection editingCollection; - //记录面板所处状态 - private SwitchState paneState = SwitchState.DEFAULT; - + private PaneState paneState = new PaneState(); + + private class PaneState{ + //记录面板所处状态 + private SwitchState paneState = SwitchState.DEFAULT; + //记录当前面板是谁在使用切换状态 + private String chartID = StringUtils.EMPTY; + + public SwitchState getPaneState() { + return paneState; + } + + public void setPaneState(SwitchState paneState) { + this.paneState = paneState; + } + + public String getChartID() { + return chartID; + } + + public void setChartID(String chartID) { + this.chartID = chartID; + } + } + @Override protected JPanel createContentPane() { JPanel content = new JPanel(new BorderLayout()); @@ -179,6 +201,13 @@ public class ChartTypePane extends AbstractChartAttrPane{ String plotID = chart.getPlot().getPlotID(); Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); jcb.setSelectedItem(item); + //重新选中 + checkPlotPane(); + } + + private void checkPlotPane() { + CardLayout cl = (CardLayout)cardPane.getLayout(); + cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); } private void reactorComboBox() { @@ -228,13 +257,22 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void reactorChartTypePane(ChartCollection collection){ - if (paneState != collection.getState()) { + if (needReactor(collection)) { chartTypePane.reactor(collection); //设置面板切换状态 - paneState = collection.getState(); + updatePaneState(collection); } } + private void updatePaneState(ChartCollection collection) { + paneState.setChartID(collection.getRepresentChartID()); + paneState.setPaneState(collection.getState()); + } + + private boolean needReactor(ChartCollection collection) { + return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState(); + } + /** * 更新界面属性 用于展示 */ From a9f89dc2680cd65cafc1edd4552ab36f02fcc5c9 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:02:43 +0800 Subject: [PATCH 079/244] rt --- .../src/com/fr/design/mainframe/widget/UITreeComboBox.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index cbcf8f1975..ef01c7b711 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -15,7 +15,6 @@ import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.ComponentTree; import com.sun.java.swing.plaf.motif.*; import com.sun.java.swing.plaf.windows.*; From 45edc1997f0bb1f3aeb9c017466c835940714cba Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:05:31 +0800 Subject: [PATCH 080/244] rt --- .../src/com/fr/design/mainframe/ShareWidgetPane.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index 47fb692759..d9228f7fba 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,14 +1,10 @@ package com.fr.design.mainframe; -import com.fr.design.form.layout.FRGridLayout; -import com.fr.form.ui.ElCaseBindInfo; - +import com.fr.form.ui.ElCaseBindInfo; import javax.swing.*; import java.awt.*; -import java.util.*; -import java.util.List; /** From 660024a8e1a14da473dda095b14ca898de5553ac Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:08:34 +0800 Subject: [PATCH 081/244] rt --- designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index d9228f7fba..8d52eb4c82 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -13,7 +13,7 @@ import java.awt.*; public class ShareWidgetPane extends JPanel { public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) { - this.setBorder(BorderFactory.createEmptyBorder(5, 2, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 + this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 int rowCount = (elCaseBindInfoList.length + 1) / 2; this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { From 583458bede4b79a59645859116e47d4c049ef754 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:10:41 +0800 Subject: [PATCH 082/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index f4af3d79d2..3eef45c40c 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -127,7 +127,7 @@ public class FormWidgetDetailPane extends FormDockView{ private void initMenuPanel() { JPanel menutPane = new JPanel(); menutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - menutPane.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 3)); + menutPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 3, 3)); menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), SwingConstants.HORIZONTAL), BorderLayout.WEST); menutPane.add(downloadButton, BorderLayout.EAST); From 3ad0e4764a6a00114423ebfe14ee459d4c208168 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:18:37 +0800 Subject: [PATCH 083/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 3eef45c40c..e311878269 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -195,7 +195,6 @@ public class FormWidgetDetailPane extends FormDockView{ public void refreshDownPanel() { esp.remove(downPanel); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - //todo:这个地方有问题 esp.add(downPanel); repaintContainer(); From f8ffda50923974e7f62daa1d76acf78a075f9f4c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 20:19:29 +0800 Subject: [PATCH 084/244] rt --- .../design/mainframe/FormWidgetDetailPane.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index e311878269..ef3a1e708e 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -47,7 +47,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UITabbedPane tabbedPane; private UIScrollPane downPanel; - private JPanel esp; + private JPanel reuWidgetPanel; private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; private UIButton downloadButton; @@ -95,8 +95,8 @@ public class FormWidgetDetailPane extends FormDockView{ clearDockingView(); return; } - esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); - esp.setBorder(null); + reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + reuWidgetPanel.setBorder(null); if (elCaseBindInfoList == null) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } @@ -107,7 +107,7 @@ public class FormWidgetDetailPane extends FormDockView{ tabbedPane.setOpaque(true); tabbedPane.setBorder(null); tabbedPane.setTabPlacement(SwingConstants.BOTTOM); - tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), esp); + tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), reuWidgetPanel); tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel()); add(tabbedPane, BorderLayout.CENTER); @@ -118,7 +118,7 @@ public class FormWidgetDetailPane extends FormDockView{ */ private void initReuWidgetPanel() { downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - esp.add(downPanel); + reuWidgetPanel.add(downPanel); } /** @@ -135,7 +135,7 @@ public class FormWidgetDetailPane extends FormDockView{ comboBox.setPreferredSize(new Dimension(240, 30)); initComboBoxSelectedListener(); menutPane.add(comboBox, BorderLayout.SOUTH); - esp.add(menutPane,BorderLayout.NORTH); + reuWidgetPanel.add(menutPane,BorderLayout.NORTH); } private void initComboBoxSelectedListener() { @@ -193,9 +193,9 @@ public class FormWidgetDetailPane extends FormDockView{ public void refreshDownPanel() { - esp.remove(downPanel); + reuWidgetPanel.remove(downPanel); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - esp.add(downPanel); + reuWidgetPanel.add(downPanel); repaintContainer(); } From b3e1b3d24041cde2a253a88a193621186a0ceea1 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 26 Oct 2016 17:39:06 +0800 Subject: [PATCH 085/244] =?UTF-8?q?REPORT-585=20=E6=B7=BB=E5=8A=A0formletN?= =?UTF-8?q?ame=E5=8F=98=E9=87=8F=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/insert/formula/variable/cn/formletName.txt | 3 +++ .../com/fr/design/insert/formula/variable/en/formletName.txt | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 designer_base/src/com/fr/design/insert/formula/variable/cn/formletName.txt create mode 100644 designer_base/src/com/fr/design/insert/formula/variable/en/formletName.txt diff --git a/designer_base/src/com/fr/design/insert/formula/variable/cn/formletName.txt b/designer_base/src/com/fr/design/insert/formula/variable/cn/formletName.txt new file mode 100644 index 0000000000..95c5feec3a --- /dev/null +++ b/designer_base/src/com/fr/design/insert/formula/variable/cn/formletName.txt @@ -0,0 +1,3 @@ + +ʣhttp://localhost:8080/WebReport/ReportServer?formlet=Form1.frm +formNameForm1.frm \ No newline at end of file diff --git a/designer_base/src/com/fr/design/insert/formula/variable/en/formletName.txt b/designer_base/src/com/fr/design/insert/formula/variable/en/formletName.txt new file mode 100644 index 0000000000..320a270d6f --- /dev/null +++ b/designer_base/src/com/fr/design/insert/formula/variable/en/formletName.txt @@ -0,0 +1,3 @@ +form name +http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm +formName is Form1.frm \ No newline at end of file From 2fc18dc59f04b13f2529e06aa79685efc6402ea2 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 26 Oct 2016 23:52:03 +0800 Subject: [PATCH 086/244] rt --- .../mainframe/FormWidgetDetailPane.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index ef3a1e708e..7fa96cb4b2 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -5,11 +5,13 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.io.File; import java.util.*; import java.util.List; import javax.swing.*; import javax.swing.border.LineBorder; +import javax.swing.filechooser.FileNameExtensionFilter; import com.fr.base.BaseUtils; import com.fr.design.actions.file.WebPreviewUtils; @@ -167,7 +169,13 @@ public class FormWidgetDetailPane extends FormDockView{ public void actionPerformed(ActionEvent e) { UIPopupMenu menu = new UIPopupMenu(); UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + menu.add(downloadItem); + menu.add(installItem); + menu.add(deleteItem); + downloadItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -177,12 +185,36 @@ public class FormWidgetDetailPane extends FormDockView{ dlg.setVisible(true); } }); + installItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter("zip", "zip")); + int returnValue = fileChooser.showDialog(new JLabel(), "选择"); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + + } + } + }); + + deleteItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + } + }); GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, tabbedPane.getY() + OFFSET_Y); } }); } + private void installFromDiskZipFile(File chosenFile) { + } + /** * 获取报表块组件分类 */ From 771a427f052b4526b35b1f6b92baeff6830275a9 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 27 Oct 2016 00:15:01 +0800 Subject: [PATCH 087/244] rt --- .../com/fr/design/mainframe/FormWidgetDetailPane.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 7fa96cb4b2..2ed98e0945 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -169,8 +169,8 @@ public class FormWidgetDetailPane extends FormDockView{ public void actionPerformed(ActionEvent e) { UIPopupMenu menu = new UIPopupMenu(); UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); - UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); - UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); menu.add(downloadItem); menu.add(installItem); @@ -203,7 +203,7 @@ public class FormWidgetDetailPane extends FormDockView{ deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - + deleteFromDiskZipFile(); } }); GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, tabbedPane.getY() + OFFSET_Y); @@ -212,7 +212,12 @@ public class FormWidgetDetailPane extends FormDockView{ }); } + private void deleteFromDiskZipFile() { + + } + private void installFromDiskZipFile(File chosenFile) { + } /** From ad5d27457af1d83dc016cf14ad1d1a30739f07b2 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Thu, 27 Oct 2016 17:23:34 +0800 Subject: [PATCH 088/244] =?UTF-8?q?REPORT-364=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/designer/creator/XElementCase.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index f2f369595e..cef415fa20 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -98,18 +98,17 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) .setI18NName(Inter.getLocText("Form-EC_toolbar")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), - }; + //这边有个插件兼容问题,之后还是要改回process才行 Set set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING); - for (FormElementCaseEditorProvider processor : set) { - if (processor == null) { + for (FormElementCaseEditorProvider provider : set) { + if (provider == null) { return propertyTableEditor; } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); Form attr = designer.getTarget(); - - PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), attr, this.toData()); + PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), attr, this.toData()); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } return propertyTableEditor; From 1d91186058ba60d539da53ed3b17929a0b9a1bf5 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Fri, 28 Oct 2016 15:22:30 +0800 Subject: [PATCH 089/244] =?UTF-8?q?REPORT-364=20=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=9A=84process=E5=8A=A0=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/FormElementCaseEditorProcessor.java | 31 +++++++++++++++++++ .../design/designer/creator/XElementCase.java | 6 ++-- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java diff --git a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java new file mode 100644 index 0000000000..21866a2c32 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java @@ -0,0 +1,31 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.stable.fun.mark.Immutable; + +import java.beans.PropertyDescriptor; + +/** + * Created by Slpire on 2016/10/28. + */ +public interface FormElementCaseEditorProcessor extends Immutable { + String MARK_STRING = "PropertyEditor"; + + int CURRENT_LEVEL = 1; + + + /** + * 生成属性表 + * @param temp 传入当前操作的class + * @param reportFitAttr 传入的自适应属性 + * @return 返回属性表 + */ + PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr); + + /** + * 返回pc自适应属性值 + * @param fitAttrProvider 传入的自适应属性 + * @return 返回pc自适应属性值 + */ + int getFitStateInPC(ReportFitAttrProvider fitAttrProvider); +} diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index cef415fa20..f5412107a1 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -104,11 +104,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme Set set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING); for (FormElementCaseEditorProvider provider : set) { if (provider == null) { - return propertyTableEditor; + continue; } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - Form attr = designer.getTarget(); - PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), attr, this.toData()); + Form formAttr = designer.getTarget(); + PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formAttr, this.toData()); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } return propertyTableEditor; From fe730b1fa0c27ad93b6c5b86ecdd2d6b3030869d Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 28 Oct 2016 16:15:12 +0800 Subject: [PATCH 090/244] =?UTF-8?q?REPORT-415=20=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8F=90=E4=BE=9B=E5=A4=9Asheet=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/webattr/EditToolBar.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/webattr/EditToolBar.java b/designer/src/com/fr/design/webattr/EditToolBar.java index da5ebe2b05..58f4558704 100644 --- a/designer/src/com/fr/design/webattr/EditToolBar.java +++ b/designer/src/com/fr/design/webattr/EditToolBar.java @@ -319,7 +319,7 @@ public class EditToolBar extends BasicPane { private CardLayout card; private JPanel centerPane; private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word, - flashPrint, pdfPrint, appletPrint, serverPrint, isPopup, isVerify, failSubmit; + flashPrint, pdfPrint, appletPrint, serverPrint, isPopup, isVerify, failSubmit, isCurSheet; private UIBasicSpinner count; private Widget widget; private UITextField nameField; @@ -469,10 +469,12 @@ public class EditToolBar extends BasicPane { private JPanel getSubmitPane() { isVerify = new UICheckBox(Inter.getLocText("Verify-Data_Verify")); failSubmit = new UICheckBox(Inter.getLocText(new String[]{"Verify_Fail", "Still", "Submit"})); + isCurSheet = new UICheckBox(Inter.getLocText("FR-Designer-Basic_Only_Submit_Current_Sheet")); JPanel submitPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); submitPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Form-Button", "Property", "Set"}), null)); submitPane.add(isVerify); submitPane.add(failSubmit); + submitPane.add(isCurSheet); isVerify.addChangeListener(changeListener); return submitPane; } @@ -562,6 +564,7 @@ public class EditToolBar extends BasicPane { Submit submit = ((Submit) widget); this.isVerify.setSelected(submit.isVerify()); this.failSubmit.setSelected(submit.isFailVerifySubmit()); + this.isCurSheet.setSelected(submit.isOnlySubmitSelect()); } private void populatePDFPrint(){ @@ -624,6 +627,7 @@ public class EditToolBar extends BasicPane { Submit submit = ((Submit) widget); submit.setVerify(this.isVerify.isSelected()); submit.setFailVerifySubmit(this.failSubmit.isSelected()); + submit.setOnlySubmitSelect(this.isCurSheet.isSelected()); } private void updatePrint(){ From f21e01b9a1fed73b4f254c6be96369aab3292801 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 28 Oct 2016 20:16:16 +0800 Subject: [PATCH 091/244] =?UTF-8?q?=E5=BC=82=E6=AD=A5=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 6b280b3982..743cc54504 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -87,6 +87,20 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + + //异步加载 + new Thread(new Runnable() { + @Override + public void run() { + getWidgetOption(typeName, child); + } + }).start(); + + + return child; + } + + private static void getWidgetOption(ChartInternationalNameContentBean[] typeName, ChartWidgetOption[] child){ for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); @@ -94,14 +108,15 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh continue; } - //初始化图表模型图片 + //加载初始化图表模型图片 initChartsDemoImage(rowChart); String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } - return child; + + DesignModuleFactory.registerExtraWidgetOptions(child); } private static void initChartsDemoImage(Chart[] rowChart) { From d4eda7c3feef0fa512507d2c29509bd5ccc54388 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sat, 29 Oct 2016 20:28:17 +0800 Subject: [PATCH 092/244] rt --- .../design/mainframe/ShareWidgetButton.java | 71 ++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index ffb688578e..c35ee64d5b 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -1,13 +1,17 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.icon.IconPathConstants; +import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.stable.StringUtils; import javax.swing.*; @@ -30,26 +34,83 @@ import java.io.Serializable; public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable { private ElCaseBindInfo bindInfo; private MouseEvent lastPressEvent; + private JPanel reportPane; + private boolean isEdit; + private Icon controlMode = IOUtils.readIcon("/com/fr/design/form/images/mark.png"); + private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); + private JComponent controlButton = new JComponent() { + protected void paintComponent(Graphics g) { + controlMode.paintIcon(this, g, 0, 0); + } + }; public ShareWidgetButton(ElCaseBindInfo bindInfo) { this.bindInfo = bindInfo; + this.setPreferredSize(new Dimension(108, 68)); initUI(); + this.setLayout(getCoverLayout()); this.addMouseListener(this); this.addMouseMotionListener(this); new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); } + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(composite); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.setComposite(oldComposite); + super.paint(g); + } + private void initUI() { - JPanel reportPane = new JPanel(new BorderLayout()); + + reportPane = new JPanel(new BorderLayout()); reportPane.add(new UILabel(new ImageIcon(bindInfo.getCover())), BorderLayout.CENTER); JPanel labelPane = new JPanel(new BorderLayout()); UILabel label = new UILabel(bindInfo.getName(), UILabel.CENTER); labelPane.setBackground(new Color(184, 220, 242)); labelPane.add(label, BorderLayout.CENTER); reportPane.add(labelPane, BorderLayout.SOUTH); + //add(controlButton); add(reportPane); } + protected LayoutManager getCoverLayout() { + return new LayoutManager() { + + @Override + public void removeLayoutComponent(Component comp) { + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + return parent.getPreferredSize(); + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return null; + } + + @Override + public void layoutContainer(Container parent) { + int width = parent.getWidth(); + int height = parent.getHeight(); + controlButton.setBounds((width - 25), 0, 25, 25); + reportPane.setBounds(0, 0, width, height); + + + + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + }; + } + public ElCaseBindInfo getBindInfo() { return bindInfo; } @@ -60,7 +121,15 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot @Override public void mouseClicked(MouseEvent e) { + if (isEdit) { + remove(controlButton); + isEdit = false; + } else { + add(controlButton,0); + isEdit = true; + } + repaint(); } @Override From 77272c368780b5a985d589d5b3eb6107f88391c0 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Sat, 29 Oct 2016 21:12:55 +0800 Subject: [PATCH 093/244] =?UTF-8?q?REPORT-364=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/FormElementCaseEditorProvider.java | 2 +- ...bstractFormElementCaseEditorProcessor.java | 44 +++++++++++++++++++ .../design/designer/creator/XElementCase.java | 25 +++++++++-- 3 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java diff --git a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java index 5b7bd6fa2f..191f7fa998 100644 --- a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java @@ -19,7 +19,7 @@ public interface FormElementCaseEditorProvider extends Mutable { //加个provider返回tab的接口 //design_base依赖了form - PropertyDescriptor[] createPropertyDescriptor (Class temp, Form reportAttr, ElementCaseEditor editor); + PropertyDescriptor[] createPropertyDescriptor (Class temp, Form form, ElementCaseEditor editor); /** * 生成属性表 diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java new file mode 100644 index 0000000000..08a5a1606f --- /dev/null +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java @@ -0,0 +1,44 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.FormElementCaseEditorProcessor; +import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.stable.fun.mark.API; + +import java.beans.PropertyDescriptor; + +/** + * Created by zhouping on 2015/9/10. + */ +@API(level = FormElementCaseEditorProcessor.CURRENT_LEVEL) +public abstract class AbstractFormElementCaseEditorProcessor implements FormElementCaseEditorProcessor { + + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + + + /** + * 生成属性表 + * @param temp 传入当前操作的class + * @param reportFitAttr 传入的自适应属性 + * @return 返回属性表 + */ + @Override + public PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr) { + return new PropertyDescriptor[0]; + } + + /** + * 返回pc自适应属性值 + * @param fitAttrProvider 传入的自适应属性 + * @return 返回pc自适应属性值 + */ + @Override + public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { + return 0; + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index f5412107a1..f60ffaa0df 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.FormElementCaseEditorProcessor; import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; @@ -25,6 +26,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; import com.fr.form.main.Form; +import com.fr.stable.fun.FitProvider; +import com.fr.stable.fun.ReportFitAttrProvider; import javax.swing.*; import java.awt.*; @@ -107,11 +110,27 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme continue; } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - Form formAttr = designer.getTarget(); - PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formAttr, this.toData()); + Form form = designer.getTarget(); + PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), form, this.toData()); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } - return propertyTableEditor; + + FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING); + if (processor == null) { + return propertyTableEditor; + } + this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + FitProvider wbTpl = (FitProvider) designer.getTarget(); + ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); + ElementCaseEditor editor = this.toData(); + //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) + if (editor.getFitStateInPC() == 0) { + editor.setReportFitAttr(null); + } + ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : editor.getReportFitAttr(); + PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); + + return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } @Override From 74ce95640a9781b1c20cbb2b4c0ceb049a77ff07 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Sat, 29 Oct 2016 21:21:28 +0800 Subject: [PATCH 094/244] 1 1 --- .../src/com/fr/design/designer/creator/XElementCase.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index f60ffaa0df..9f05e49fa2 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -129,6 +129,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme } ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : editor.getReportFitAttr(); PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); + if (editor.getReportFitAttr() == null) { + editor.setReportFitInPc(processor.getFitStateInPC(fitAttr)); + } return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } From 81aabe9e191446680edfcbbb965d4ea9de5c1e8f Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Sun, 30 Oct 2016 23:33:02 +0800 Subject: [PATCH 095/244] =?UTF-8?q?REPORT-364=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=88=B7=E6=96=B0=E5=92=8C=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E9=87=8D=E5=A4=8Dbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/impl/AbstractFormElementCaseEditorProvider.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java index f65107e2eb..bcd39d8f52 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java @@ -48,4 +48,12 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { return 0; } + + @Override + public boolean equals(Object obj) { + if(obj == null) { + return false; + } + return true; + } } \ No newline at end of file From fb5237b5448d687c4a8e34e3afdce327c517a528 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 31 Oct 2016 11:14:34 +0800 Subject: [PATCH 096/244] update --- designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 743cc54504..b3b04f948a 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -96,7 +96,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } }).start(); - return child; } From 425824c905486888032e742f1ad384150a56b885 Mon Sep 17 00:00:00 2001 From: sunmondong Date: Mon, 31 Oct 2016 14:39:42 +0800 Subject: [PATCH 097/244] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BE=9D=E8=B5=96jar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_form/build.dev.gradle | 12 +++- designer_form/build.dev.gradle.bak | 90 ++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 designer_form/build.dev.gradle.bak diff --git a/designer_form/build.dev.gradle b/designer_form/build.dev.gradle index 57ebd74c2c..24ee9430a9 100644 --- a/designer_form/build.dev.gradle +++ b/designer_form/build.dev.gradle @@ -30,11 +30,17 @@ FileTree files =fileTree(dir:'./',include:'build.*.gradle') def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//显示依赖jar包 +FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") +f.each{File file-> + println "----${f.path}" +} + //声明外部依赖 dependencies{ -compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') -compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") - + compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') + compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") testCompile 'junit:junit:4.12' } diff --git a/designer_form/build.dev.gradle.bak b/designer_form/build.dev.gradle.bak new file mode 100644 index 0000000000..c6dec88f9f --- /dev/null +++ b/designer_form/build.dev.gradle.bak @@ -0,0 +1,90 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.8 +//指定生成的jar包版本 +version='8.0' + +def srcDir="." + + +//指明生成jar包的名字 +jar{ + baseName='fr-designer-report' +} +//源码所在位置 +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src", +"${srcDir}/../designer/src"] + } + } +} + +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//显示依赖jar包 +FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") +f.each{File file-> + println "----${f.path}" + +} + +//声明外部依赖 +dependencies{ + compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') + compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + testCompile 'junit:junit:4.12' +} + +//指明无法编译文件所在路径 +def dataContent ={def dir -> + copySpec{ + from ("${dir}"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + } +} + +//将非.java文件复制到classes文件夹下 参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + with dataContent.call("${srcDir}/src") + with dataContent.call("${srcDir}/../designer/src") + into ('build/classes/main') + } + +} + + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + + } + fileset (dir:"${srcDir}/../designer/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + From f5c51b1e85c9034c2d0bfbbf45f50751f79f03e7 Mon Sep 17 00:00:00 2001 From: sunmondong Date: Mon, 31 Oct 2016 14:47:33 +0800 Subject: [PATCH 098/244] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_form/build.dev.gradle | 2 +- designer_form/build.dev.gradle.bak | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/designer_form/build.dev.gradle b/designer_form/build.dev.gradle index 24ee9430a9..2b727caac9 100644 --- a/designer_form/build.dev.gradle +++ b/designer_form/build.dev.gradle @@ -34,7 +34,7 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) //显示依赖jar包 FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") f.each{File file-> - println "----${f.path}" + println "----${file.path}" } //声明外部依赖 diff --git a/designer_form/build.dev.gradle.bak b/designer_form/build.dev.gradle.bak index c6dec88f9f..24ee9430a9 100644 --- a/designer_form/build.dev.gradle.bak +++ b/designer_form/build.dev.gradle.bak @@ -35,7 +35,6 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") f.each{File file-> println "----${f.path}" - } //声明外部依赖 From 1b9543d17779067c54944c4a49085f81c4f3ff2f Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 16:34:02 +0800 Subject: [PATCH 099/244] rt --- .../mainframe/FormWidgetDetailPane.java | 92 ++++++++++++++++--- 1 file changed, 78 insertions(+), 14 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 2ed98e0945..aee06781d2 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -6,6 +6,7 @@ import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.File; +import java.io.IOException; import java.util.*; import java.util.List; @@ -33,10 +34,12 @@ import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; +import com.fr.general.IOUtils; import com.fr.general.Inter; /** @@ -53,6 +56,8 @@ public class FormWidgetDetailPane extends FormDockView{ private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; private UIButton downloadButton; + private UIButton refreshButton; + private UIButton deleteButton; private static final int OFFSET_X = 140; private static final int OFFSET_Y = 26; @@ -103,6 +108,7 @@ public class FormWidgetDetailPane extends FormDockView{ elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } initReuWidgetPanel(); + createRefreshButton(); createDownloadButton(); initMenuPanel(); tabbedPane = new UITabbedPane(); @@ -119,7 +125,7 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化组件共享和复用面板 */ private void initReuWidgetPanel() { - downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); + downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); reuWidgetPanel.add(downPanel); } @@ -129,15 +135,22 @@ public class FormWidgetDetailPane extends FormDockView{ private void initMenuPanel() { JPanel menutPane = new JPanel(); menutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - menutPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 3, 3)); + menutPane.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3)); + menutPane.setPreferredSize(new Dimension(240, 48)); menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), SwingConstants.HORIZONTAL), BorderLayout.WEST); - menutPane.add(downloadButton, BorderLayout.EAST); + JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + buttonPanel.add(refreshButton, BorderLayout.WEST); + buttonPanel.add(downloadButton, BorderLayout.EAST); + menutPane.add(buttonPanel, BorderLayout.EAST); + menutPane.add(new JPanel(), BorderLayout.CENTER); comboBox = new UIComboBox(getFormCategories()); comboBox.setPreferredSize(new Dimension(240, 30)); initComboBoxSelectedListener(); menutPane.add(comboBox, BorderLayout.SOUTH); - reuWidgetPanel.add(menutPane,BorderLayout.NORTH); + reuWidgetPanel.add(menutPane, BorderLayout.NORTH); + } private void initComboBoxSelectedListener() { @@ -151,10 +164,25 @@ public class FormWidgetDetailPane extends FormDockView{ String filterName = comboBox.getSelectedItem().toString(); elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); } - refreshDownPanel(); + refreshDownPanel(false); + + } + }); + } + private void createRefreshButton() { + refreshButton = new UIButton(); + refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/refresh.png")); + refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Refresh")); + refreshButton.set4ToolbarButton(); + refreshButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + refreshShareMoudule(); + refreshDownPanel(false); } }); + } /** @@ -164,13 +192,14 @@ public class FormWidgetDetailPane extends FormDockView{ downloadButton = new UIButton(); downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png")); downloadButton.set4ToolbarButton(); + downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template")); downloadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UIPopupMenu menu = new UIPopupMenu(); - UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); - UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); - UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); + UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png")); + UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png")); menu.add(downloadItem); menu.add(installItem); @@ -185,13 +214,14 @@ public class FormWidgetDetailPane extends FormDockView{ dlg.setVisible(true); } }); + installItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter("zip", "zip")); - int returnValue = fileChooser.showDialog(new JLabel(), "选择"); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new JLabel(), Inter.getLocText("FR-Designer_Select")); if (returnValue == JFileChooser.APPROVE_OPTION) { final File chosenFile = fileChooser.getSelectedFile(); installFromDiskZipFile(chosenFile); @@ -206,18 +236,52 @@ public class FormWidgetDetailPane extends FormDockView{ deleteFromDiskZipFile(); } }); - GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, tabbedPane.getY() + OFFSET_Y); + + GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y); } }); } private void deleteFromDiskZipFile() { - + deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove")); + deleteButton.setOpaque(true); + deleteButton.setBackground(Color.red); + deleteButton.setPreferredSize(new Dimension(240, 40)); + reuWidgetPanel.add(deleteButton, BorderLayout.SOUTH); + deleteButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + ShareLoader.getLoader().removeElementFromMap(); + refreshShareMoudule(); + reuWidgetPanel.remove(deleteButton); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + } + }); + refreshDownPanel(true); } private void installFromDiskZipFile(File chosenFile) { + try { + IOUtils.copy(chosenFile, new File(ShareLoader.MODULE_PATH)); + refreshShareMoudule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); + } catch (IOException e) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); + e.printStackTrace(); + } + } + + private void refreshShareMoudule() { + try { + ShareLoader.getLoader().readFromEnv(); + } catch (Exception e) { + e.printStackTrace(); + } } /** @@ -229,9 +293,9 @@ public class FormWidgetDetailPane extends FormDockView{ - public void refreshDownPanel() { + public void refreshDownPanel(boolean isEdit) { reuWidgetPanel.remove(downPanel); - downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); + downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); reuWidgetPanel.add(downPanel); repaintContainer(); From 3163cccc9808b90292bff22a86cbd2b74afd1fc4 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 16:41:21 +0800 Subject: [PATCH 100/244] rt --- .../mainframe/FormHierarchyTreePane.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java index 2f424a7b7c..381f97a70b 100644 --- a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -49,7 +49,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree private ComponentTree componentTree; private UITreeComboBox treeComboBox; - private JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); // richer:搜寻树节点的的文本框 // private UITextField searchTextField; // private SearchResultPane searchResult; @@ -116,16 +115,15 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree if(childCount == NODE_LENGTH){ adjustPosition(treeModel, formDesigner); } - widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 2, 3, 0)); + JPanel widgetPane = new JPanel(); + widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); + widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout()); add(widgetPane, BorderLayout.NORTH); - - if(treeComboBox == null) { - widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ", - SwingConstants.HORIZONTAL), BorderLayout.WEST); - treeComboBox = new UITreeComboBox(componentTree); - widgetPane.add(treeComboBox, BorderLayout.CENTER); - add(widgetPane, BorderLayout.CENTER); - } + widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ", + SwingConstants.HORIZONTAL), BorderLayout.WEST); + treeComboBox = new UITreeComboBox(componentTree); + widgetPane.add(treeComboBox, BorderLayout.CENTER); + add(widgetPane, BorderLayout.CENTER); // UIScrollPane scrollPane = new UIScrollPane(componentTree); From 88520e8249e76e8f04e2e205d3aad169e35f30b1 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 18:18:13 +0800 Subject: [PATCH 101/244] rt --- .../mainframe/FormWidgetDetailPane.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index aee06781d2..e967bdb2eb 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -252,28 +252,24 @@ public class FormWidgetDetailPane extends FormDockView{ deleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - ShareLoader.getLoader().removeElementFromMap(); + ShareLoader.getLoader().removeModulesFromMap(); refreshShareMoudule(); reuWidgetPanel.remove(deleteButton); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); refreshDownPanel(false); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); } }); refreshDownPanel(true); + } private void installFromDiskZipFile(File chosenFile) { - try { - - IOUtils.copy(chosenFile, new File(ShareLoader.MODULE_PATH)); - refreshShareMoudule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); - } catch (IOException e) { - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); - e.printStackTrace(); - } + ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile); + refreshShareMoudule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); } private void refreshShareMoudule() { From 0fd90c222bf909bfb55a19ebd3c9c7424ffd5df1 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 18:19:18 +0800 Subject: [PATCH 102/244] rt --- .../design/mainframe/ShareWidgetButton.java | 48 ++++++++++++++----- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index c35ee64d5b..49a77e3696 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -1,6 +1,6 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; +import com.fr.base.*; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; @@ -15,6 +15,7 @@ import com.fr.general.IOUtils; import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.Icon; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; @@ -36,11 +37,18 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot private MouseEvent lastPressEvent; private JPanel reportPane; private boolean isEdit; - private Icon controlMode = IOUtils.readIcon("/com/fr/design/form/images/mark.png"); + private boolean isMarked; + private Icon markedMode = IOUtils.readIcon("/com/fr/design/form/images/mark.png"); + private Icon unMarkedMode = IOUtils.readIcon("/com/fr/design/form/images/unmark.png"); private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); - private JComponent controlButton = new JComponent() { + private JComponent markedButton = new JComponent() { protected void paintComponent(Graphics g) { - controlMode.paintIcon(this, g, 0, 0); + markedMode.paintIcon(this, g, 0, 0); + } + }; + private JComponent unMarkedButton = new JComponent() { + protected void paintComponent(Graphics g) { + unMarkedMode.paintIcon(this, g, 0, 0); } }; @@ -64,6 +72,16 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot super.paint(g); } + public void setElementCaseEdit(boolean isEdit) { + this.isEdit = isEdit; + if (isEdit) { + this.add(unMarkedButton, 0); + repaint(); + } + + + } + private void initUI() { reportPane = new JPanel(new BorderLayout()); @@ -73,7 +91,6 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot labelPane.setBackground(new Color(184, 220, 242)); labelPane.add(label, BorderLayout.CENTER); reportPane.add(labelPane, BorderLayout.SOUTH); - //add(controlButton); add(reportPane); } @@ -98,7 +115,8 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot public void layoutContainer(Container parent) { int width = parent.getWidth(); int height = parent.getHeight(); - controlButton.setBounds((width - 25), 0, 25, 25); + markedButton.setBounds((width - 25), 0, 25, 25); + unMarkedButton.setBounds((width - 25), 0, 25, 25); reportPane.setBounds(0, 0, width, height); @@ -119,14 +137,22 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot this.bindInfo = bindInfo; } + public String getFileName() { + return bindInfo.getName() +"." + bindInfo.getId() + ShareConstants.SUFFIX_MODULE; + } + @Override public void mouseClicked(MouseEvent e) { if (isEdit) { - remove(controlButton); - isEdit = false; - } else { - add(controlButton,0); - isEdit = true; + if (isMarked) { + remove(markedButton); + ShareLoader.getLoader().removeModuleForList(getFileName()); + isMarked = false; + } else { + add(markedButton,0); + ShareLoader.getLoader().addModuleToList(getFileName()); + isMarked = true; + } } repaint(); From c4e57b559bbaf47668e9d6bd8b9498baa190c577 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 18:21:50 +0800 Subject: [PATCH 103/244] rt --- .../src/com/fr/design/mainframe/ShareWidgetPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index 8d52eb4c82..cd04300bf1 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -12,12 +12,13 @@ import java.awt.*; */ public class ShareWidgetPane extends JPanel { - public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) { + public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList, boolean isEdit) { this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 int rowCount = (elCaseBindInfoList.length + 1) / 2; - this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); + widgetButton.setElementCaseEdit(isEdit); this.add(widgetButton); } this.setPreferredSize(new Dimension(240, rowCount * 80)); From acbc7f1ae6e720cae90fa9e8b6a6dc55115112c6 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 18:26:49 +0800 Subject: [PATCH 104/244] rt --- .../src/com/fr/design/mainframe/WidgetPropertyPane.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index 67524bfbbe..324ff62bb3 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -40,7 +40,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper private FormDesigner designer; private ComponentTree componentTree; private JPanel wsp; - private ParameterPropertyPane parameterPropertyPane; private MobileWidgetTable mobileWidgetTable; private MobileBodyWidgetTable mobileBodyWidgetTable; private UIScrollPane downPanel; @@ -51,6 +50,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper public static final int NODE_LENGTH = 2; public boolean isrefresh = true; + public static WidgetPropertyPane getInstance() { if (HOLDER.singleton == null) { HOLDER.singleton = new WidgetPropertyPane(); @@ -64,7 +64,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper return HOLDER.singleton; } - private static class HOLDER { private static WidgetPropertyPane singleton = new WidgetPropertyPane(); } @@ -190,10 +189,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper } } - - parameterPropertyPane = ParameterPropertyPane.getInstance(designer); - parameterPropertyPane.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 4)); - add(parameterPropertyPane, BorderLayout.NORTH); add(tabbedPane, BorderLayout.CENTER); propertyTable.initPropertyGroups(null); eventTable.refresh(); From c3c2cf1280fac72b78e73a0cf0bfb5dd5bf13b3a Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 19:55:09 +0800 Subject: [PATCH 105/244] rt --- .../com/fr/design/form/images/delete icon.png | Bin 0 -> 232 bytes .../com/fr/design/form/images/download icon.png | Bin 0 -> 706 bytes .../com/fr/design/form/images/install icon.png | Bin 0 -> 705 bytes .../src/com/fr/design/form/images/marked.png | Bin 0 -> 15541 bytes .../src/com/fr/design/form/images/refresh.png | Bin 0 -> 474 bytes .../src/com/fr/design/form/images/unmarked.png | Bin 0 -> 15957 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 designer_form/src/com/fr/design/form/images/delete icon.png create mode 100644 designer_form/src/com/fr/design/form/images/download icon.png create mode 100644 designer_form/src/com/fr/design/form/images/install icon.png create mode 100644 designer_form/src/com/fr/design/form/images/marked.png create mode 100644 designer_form/src/com/fr/design/form/images/refresh.png create mode 100644 designer_form/src/com/fr/design/form/images/unmarked.png diff --git a/designer_form/src/com/fr/design/form/images/delete icon.png b/designer_form/src/com/fr/design/form/images/delete icon.png new file mode 100644 index 0000000000000000000000000000000000000000..398c5db5c5ca1ab9896faaf3163fdd416b8ed7b1 GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1IgMV>B>Ar^vf zC!ghQP~d58v@KEi%A;%{J*QN$ls`vUu_2&SUFfM(y eMSsJ$U;TPx%d`Uz>R5%f1V4yN!BxGK5bF=2ZfB)2g>WqQ-EGsMP&8n)Z8@Tl0G;rq3nOyJR zzn==!7$PAd@mE$>mhFMd;kPT%*=D^q|PoA7DARzEJBqRjIFpxYG z6B9#0K>@S2w)S_R52nNPz-SBuL16}z49U&SWriujMh682aRSAIf$CL};%h!w3x1waBhSF|e_*(Gh6i z{}(S_{6sgTa_wsd5Jm<*K0Zu=fq@{QYb`A;79a)-hyW%LR$u_H=H%qGmy?rYb9Qzn z%7q}ky1Kdy+}zwOt5&UAJ%9duRj`4tU%$Shs;a6G8XC$*DC|InpaUf(B?e((VXh}n zp13f9yvfGKCQGhiFvF#!q_}{grNjhukvhr!SdO&XG*}l%ZzTQsyI8twP(K=zW)3NHb9(@g(238pMe?bx679=Gpt*; z4&+^<%F4=@;9L(%HlUaWMGh!D1qB7+$;RH^p5fK!zYJ6Ny$2hZ?Ig$`#>>pGdGqG) z&!0d40ZeWmfQj1+R-_?{5ukEVj00V$4#eVM-9VzYwzd((u3Gyh0YtY2i!1=qO-)TX oKy~+OYHD@>X^8Vd5`!K90EipkNuYIzbpQYW07*qoM6N<$f|`0kdjJ3c literal 0 HcmV?d00001 diff --git a/designer_form/src/com/fr/design/form/images/install icon.png b/designer_form/src/com/fr/design/form/images/install icon.png new file mode 100644 index 0000000000000000000000000000000000000000..37877a62c3e90719bd70714eb6c569e06d317dd1 GIT binary patch literal 705 zcmV;y0zUnTP)Px%dr3q=R5%gklTBz7Q4q&xc9UAP2suPa8j|*4p``~armbSJ7YW*nP|}MCIa$Pu z1uvzkM3S_KqTo@~AgLe?loqU~qCKgYh~Pm)MDn4DLWKya#3Z}pyvSQN+t9P%JLJuq z|I9D*=FI~9>kG{V`lH#Kd_E6|k0<85GZ94HtdGUBt}5XTA_#Eeqx8J*vRN0lA|1zL zMIQl96TlAys;tLy$>1`nQXfxHC&M;~=o}(d>}bC&HS=x&yZc-vKzNS|CK-AL0CU-o z`G*mrW=y46ILojBk&KEh@FMKa341u2?HzwkHerip08>*~v)Sz-&|#85NdeMnAjq%B z^Y;Z5K|l021whxe5n=lm3MX~IcfVd1j!CVhhr&5}z1XkS>PbReVMvhoRaJo}T7!}- z_lp=r)OcIrUQX~I+q*hD+?!Y2TTM;;SeJyN0x1ObwNBa{zV4tkPMi^xXnNjzRcbpb zl!Aa#qwdiOZdqYm;b-piCqzi5=X^^tN9;y3%}!z4HQcHaEL&kLtqwW8Q+KDaZp{(r zwiS*ol$=$)_G||Xajk3L{?O)(qudTAe8wxwfZbrA+OBPH|NP*Oe>p7Ut$Pb_H`o!U zH<+32e#n4*BD`3(_xk<55_|;aKhsSNN2jCwQRC z=E}@T!X8~L^)wo_B_8a-F2`Qa=A{D_;WsMe*&oNkhprnl7Lf_MRR8 z$Q$QXq_)~WuO<8Ld7tQ zZqX+N%k*RW4(N4~r%c~scG0d-mDnlO^oGTz-nwR?ca>oC=*u0s_9zDg0;0<6q5*$U z;i6^wm@Ws-wP8xHi%n5imFX+Bgt}H&gRV*ri#l^DOA0h=(OGPz2D8OtvaHZCw82c# zM#@N&jFB_ZoQcs*e)Nu9aApsCyj-L6!O3*MD${qWYKWt#?(Xi=Zeyt&_E83#%|_7- z#V{n8K`K2#m5-7^r6?|v&~b{25SBu!BnNexF7K8jYMEZIB}#rK?<){WCJHK(>;Oe7 z%7-XJDNSVx@(9V8P$cY+U7AOrM86migQ^1J3>o7>ow6z`o$?GRlkOQ4gEeuvlDRWp zZy=B{wW3yc0R)psGe#=SJt2{56csrV7R2f&LS0o=tg3X&Tcn^z?p8|d6daOT@06P8X9W4pct*q1~X?eaE$o@+RD*%nn-*mq~Vf1lD8+52FsZ(=^AM>VGYnf9$w{VrIJ23 zO~)f}UO61#RfiPdeIgYK`s`F{Fl}bCs<vGN+e1Xo0h0PEP;KG_ovO# z?!^O=xmgpq6J8*VwAVyh3??sW^%#sKFL+tTXkb~l+m=X?L1tR28c6}w+LKnrpq67h zTa&nY>S)5@mts3qhz~2G)_-OCL<1(bwB(MZ#l-rU;{|PRa|l{{h#osNWi)kJ$;int zY5H=`4nbT$Eqvx2-JN0()n0L_*sPgF6xpkG^I@^l2P$MXogY`78V1YTDeb?&FMR_G zq3~T_Z5d|QRbO!#(s!u;-!i1CSm@+~KGEZ#5(S(XnBB_7*K=xTCAxKbC)%|?Ck}Km zs3<wW-@?$~Lm9N+$I%L(ckKnz&@;K`w5eXfgKqGSI!ie=9mnOFIC!O zS*!=+qu`+rJa1CT2hM5jncT&`&Xd#~eVwY17ES^IL7NyCnh)f~xF8^C6XQbjfxH+O z1O#njTxdR!7vq9}piPVm%?I*gTo4eniE*L%KwgXs0)jR%E;Jv=i*Z3f&?d%(<^y># zE(i$P#JJFWATP!R0YRG>7n%>`#ke3KXcOZ?^MSk=7X$=tVq9oGkQd{EfS^r`3(W`e zVq6dqw25({`9NNb3j%^RF)lP8$cu47K+q<}h2{f!F)j!Q+Qhifd>}8z1pz^u7#Erk zzdT3~w^Y?SE1RQdcE3W@FNuHaHb z!4F%1x%~G0_g?#8e&O(mZG(LSdp}>#jBnWcZo!!ifws2Dz*yj{Jn_`ovF}`c(thFW zFRn!Ff5_T?-_qxc2fn!R?-vc%-AhjsEAq1P=j?BL_#eAnJ##1W@4B@DobPgdn7#F3 zbD;GeGH1?&x8x+hIZWK$zWm%dw$i7palJ7(w~!bki_iF*9K=({7rotmHUEjOM|#&U z>lrUJKd?0K_q+S8zRk@1=PrHg^yAgT+{TVb;KTM&ZVAc5_~XIRlA-_9|5xbTdTQimal_d4%1swW1}awU z+wYL;GsJQ;0kFLIU!)ly+`I$=n!F&IH`;hI`AN;Cq`@(sPZfn`a zS1-KzvFWoiVXHTH^TIx&Kg;+1a_eW&z0B`)?s@C`&t2Ja-?-A%_in{sm)JfY`u1hT zUeG>F-*u{G%jw3!6YRFz7Tof$JFMQ4)qi3yesZni(&Cn(rJ=u#_pwJ#Mfgf$u;TU6 z?1GmLyqA-;aYOH>(dgD4DuQ%?m-R~t%G@joRI9AxfJy&-lO0*fX_HBFra8dt| ziT0PQ{(!ys(ebN;RlBwak6`uu3)`5l2{_jcIdtlRa()1U0z|K%#;;Ka$I=BIbB)m|*Ft*&zpeYa!H{{Y$L BH$(sc literal 0 HcmV?d00001 diff --git a/designer_form/src/com/fr/design/form/images/refresh.png b/designer_form/src/com/fr/design/form/images/refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..d0efaf0482b4535a49e7b422c0d9fcf2308b0bc9 GIT binary patch literal 474 zcmV<00VV#4P)Px$lu1NER45gFQ9VloK@gp}Lp_kb0ma3a4Cg0{MQWo>qmR;|iwi078t(??S-dSIWxi7u4+3d!0bO zo(Atel}njesN=EWk!~hg@6mx2$s^;WHebI&3NvYX+_U| zbh4a832~RZVhxTB#YWnXIC)1;^!6+wecO)($-u(BCnma=Af@-zYU@bpji?}p>;_^5hnJNw7{1*;9CPv9PI Q0000007*qoM6N<$g7>b`)Bpeg literal 0 HcmV?d00001 diff --git a/designer_form/src/com/fr/design/form/images/unmarked.png b/designer_form/src/com/fr/design/form/images/unmarked.png new file mode 100644 index 0000000000000000000000000000000000000000..259d1dd7c6615a57fcaf8babfaf8b74ae36ce1d4 GIT binary patch literal 15957 zcmeI3e{2)i9l(zkD5QfwN*ZWV5!YE%5S;JMzkP8W(l{)kb(SSg6V|lJ`R>^{uzim2 zLL9FhB~#ZTZQTTmK!|l9rR_R8n$Z-(x@igltwNecC@V19b$~Pm>$G-*vI!V_XU9MC z;yj_Q)3oVXvhTj{`@Y}rz0ddizIXoPwl+6?X;D#W5k*mp8XLSV@c4lKT`(X19=-gW z2oDQm4eM2kx_62GokQ)~y^Nx&UXlGBT8Hm3UQ{9`K~e(1l!(OOY>IN%Bw~WN5om@0 z2+7fE<6qwXh0!2O)y8(4kM+gsK#$yzjDyx>lV4136kU?B##7`@@X$d7Xo4XT2}e~v zQEg25<>9$L%oq)+DcZ(rW33+0(BW$~)G2Xbu$k<%$l4tShs(s-91g2vwZY7CHioq@ z7M3TaeQ^=gZ-PsyD71P_4(5_G&6BQ~_1Zx~p2bYpq|H*L zkj{`Bu9dHg13^>benkm;(pA=+L1?I}OI4L&MY|l8lzw%kn?X%-`ObL*UO@vMSdVs^ zgT?6db2i?}@n+j9*2%MMo|E)U#D`Cj@ctp@VazqFLCKe63ncQIB%xqQhbxK%?!^;95i<>DloM)A)G`=yaYC=>5 zjb0BNFv+sSTY=r`Fb5s9=-@=!CRm-c%VM_BHgmw~as?a#Ht0-2^!f75XSnt%VxPWS zpzCyFkrWZS&s|oK4M=v$3EcxbOLH8s(@vWN=pZL?R@Np2fKAK<%5yd&(3j&f?0Z5u zZ;rke2?h(mrC3-&q%CaFN;^1fkakL(g%-r1-E86P_CUau2~oh!j8F}-3afP>uZm$U zr#f3J=$$^AQH14Ghl&Yt73lk~+L+mZ*_M{=Sh`JWAM=8!_co8HZx0~3nQ5cB%gS0# znaMNLd1naH{`1UdkI~-)qPXpqc9ohnyAxFjYW+eS)P`V%+{w;Qd!25Ex_2}By&x?A z2NIzQoBq8tu)rpUd8$2=7c8P2oPpMBCd z=2rNa4m@_7&0=#i=rC&0EGIy?!z;r(sH)!y%o!V0QP6PxY=(J?DZ_NC@*b#D-7`H3 zAJ^eO1t$AfVMb%k-hV#NliZ3vPp^nC5(EK)7YQyrA4E%VAwcjV!G-68XbCO^2wo(( z@O%(0!G!?9iv$;*527Ww5FmJw;KK7kv;-Fd1TPX?cs_`h;6i}lMS=^@2hkE-2oStT zaN+qNT7nA!f)@!cJRd|$a3MhOBEf~{gJ=mZ1PERvxbS=sEy0BV!HWbJo)4lWxDX(C zk>JAfL9_%H0t7D-TzEc+mf%8w;6;K9&j-;GTnG@nNO0l#AX4T z@FKy5=YwboE(8c(B)IT=5G}!l0Ktn`Tt&H;Z$T8kaoexITI(x$6TX&f5F1*26qT%` zsAs=HQUACNkC!Q`kEN(9-4w;|q^PCJwytAqDeA73jow;+;jqT%puC~@m_4&5sJ2wum+ap(=kxeVlw{^8&nmAnN+j;imOO3D7wGV!H zsO0)fC7*n><-F_2g6Aq;`t$W`o0La`uaEDRKkEI#=D+ohmiLVR;hUxJ?;Jhx(~0kF zU0N@-PQLu=zQ>+gHGZV?WZCue$*SkQPcKtyZh6m{YL@$cby3*x!EV_u2-(zxwp#f$!e;$7MUNcHVno@Z`D?!w&1- zdA+sU*Nsp+iue6}>3;h&KmVW%=4Dl=^wq~lw{P1Y9O_;=_Qi``50}3CU^&xyqnf&_ X Date: Mon, 31 Oct 2016 19:56:58 +0800 Subject: [PATCH 106/244] rt --- .../src/com/fr/design/mainframe/ShareWidgetButton.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index 49a77e3696..ec663176e9 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -38,8 +38,8 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot private JPanel reportPane; private boolean isEdit; private boolean isMarked; - private Icon markedMode = IOUtils.readIcon("/com/fr/design/form/images/mark.png"); - private Icon unMarkedMode = IOUtils.readIcon("/com/fr/design/form/images/unmark.png"); + private Icon markedMode = IOUtils.readIcon("/com/fr/design/form/images/marked.png"); + private Icon unMarkedMode = IOUtils.readIcon("/com/fr/design/form/images/unmarked.png"); private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); private JComponent markedButton = new JComponent() { protected void paintComponent(Graphics g) { From af38c88c952f315598e87a00be6350a6665ba660 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 19:57:40 +0800 Subject: [PATCH 107/244] rt --- .../mainframe/FormWidgetDetailPane.java | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index e967bdb2eb..709b8aacfe 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -252,12 +252,17 @@ public class FormWidgetDetailPane extends FormDockView{ deleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - ShareLoader.getLoader().removeModulesFromMap(); - refreshShareMoudule(); - reuWidgetPanel.remove(deleteButton); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); + if(ShareLoader.getLoader().removeModulesFromMap()) { + ShareLoader.getLoader().removeModulesFromMap(); + refreshShareMoudule(); + reuWidgetPanel.remove(deleteButton); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); + refreshDownPanel(false); + } else { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); + } + } }); refreshDownPanel(true); @@ -265,11 +270,17 @@ public class FormWidgetDetailPane extends FormDockView{ } private void installFromDiskZipFile(File chosenFile) { - ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile); - refreshShareMoudule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); + try { + ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile); + refreshShareMoudule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); + } catch (IOException e) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); + e.printStackTrace(); + } + } private void refreshShareMoudule() { From 099e4e496bb82827a10b2d41c1b32a7a0ba15c32 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 31 Oct 2016 20:06:27 +0800 Subject: [PATCH 108/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 709b8aacfe..78673b22d6 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -252,15 +252,16 @@ public class FormWidgetDetailPane extends FormDockView{ deleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if(ShareLoader.getLoader().removeModulesFromMap()) { - ShareLoader.getLoader().removeModulesFromMap(); + if(ShareLoader.getLoader().removeModulesFromList()) { refreshShareMoudule(); reuWidgetPanel.remove(deleteButton); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); refreshDownPanel(false); } else { + reuWidgetPanel.remove(deleteButton); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); + refreshDownPanel(false); } } From 4c993c74eea0fcbb4103023e4e0e90a4946cced2 Mon Sep 17 00:00:00 2001 From: zack Date: Tue, 1 Nov 2016 10:55:49 +0800 Subject: [PATCH 109/244] =?UTF-8?q?REPORT-414=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0dev=E4=B8=8A=E6=BC=94=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/constants/KeyWords.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer_base/src/com/fr/design/constants/KeyWords.java b/designer_base/src/com/fr/design/constants/KeyWords.java index e4af629709..546195e62d 100644 --- a/designer_base/src/com/fr/design/constants/KeyWords.java +++ b/designer_base/src/com/fr/design/constants/KeyWords.java @@ -117,6 +117,8 @@ public class KeyWords { "verifyReport()", "writeReportIgnoreVerify(true)", "writeReport(index)", + "loadSheetByIndex(index)", + "loadSheetByName(sheetName)", // curLGP "currentTDCell", From 3b96b135af47123ce9e3559c27beb112fbe9da87 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 13:48:32 +0800 Subject: [PATCH 110/244] rt --- .../gui/icontainer/UIResizableContainer.java | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index 22d1bb521b..9fa791b776 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -3,6 +3,7 @@ package com.fr.design.gui.icontainer; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUICoreUtils; @@ -21,6 +22,7 @@ public class UIResizableContainer extends JPanel { private JComponent upPane; private JComponent downPane; + private JComponent parameterPane = new JPanel(); private HorizotalToolPane horizontToolPane; private VerticalToolPane verticalToolPane; @@ -37,6 +39,7 @@ public class UIResizableContainer extends JPanel { private boolean isLeftRightDragEnabled = true; private boolean isDownPaneVisible = true ; + private int paraHeight; public UIResizableContainer(int direction) { this(new JPanel(), new JPanel(), direction); @@ -85,7 +88,10 @@ public class UIResizableContainer extends JPanel { add(horizontToolPane); add(downPane); add(verticalToolPane); + parameterPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + add(parameterPane); } + public UIResizableContainer(JComponent upPane, int direction) { setBackground(UIConstants.NORMAL_BACKGROUND); @@ -96,6 +102,7 @@ public class UIResizableContainer extends JPanel { setLayout(containerLayout); add(upPane); add(horizontToolPane); + add(parameterPane); } @@ -119,6 +126,20 @@ public class UIResizableContainer extends JPanel { } } + public int getParameterPaneHeight() { + if(parameterPane.getHeight() == 0) { + return 30; + } + return paraHeight; + + } + + public void setParameterHeight(int height) { + paraHeight = height; + refreshContainer(); + + } + /** * 得到上下子面板的高度 * @@ -183,20 +204,21 @@ public class UIResizableContainer extends JPanel { if(isDownPaneVisible){ upPane.setBounds(0, 0, containerWidth - toolPaneHeight, toolPaneY); horizontToolPane.setBounds(0, toolPaneY, containerWidth - toolPaneHeight, toolPaneHeight); - downPane.setBounds(0, toolPaneY + toolPaneHeight, containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight); + downPane.setBounds(0, toolPaneY + toolPaneHeight, containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight-30); verticalToolPane.setBounds(containerWidth - toolPaneHeight, 0, toolPaneHeight, getHeight()); }else{ upPane.setBounds(0, 0, containerWidth - toolPaneHeight, getHeight()); verticalToolPane.setBounds(containerWidth - toolPaneHeight, 0, toolPaneHeight, getHeight()); } - } else if (direction == Constants.LEFT) { + } else if (direction == Constants.LEFT && parent instanceof EastRegionContainerPane) { if(isDownPaneVisible){ if (toolPaneY > getHeight() - toolPaneHeight) { toolPaneY = getHeight() - toolPaneHeight; } - upPane.setBounds(toolPaneHeight, 0, containerWidth - toolPaneHeight, toolPaneY); - horizontToolPane.setBounds(toolPaneHeight, toolPaneY, containerWidth - toolPaneHeight, toolPaneHeight); - downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight, containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight); + parameterPane.setBounds(20,0,230,getParameterPaneHeight()); + upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY); + horizontToolPane.setBounds(toolPaneHeight, toolPaneY + getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneHeight); + downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight + getParameterPaneHeight(), containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); }else{ upPane.setBounds(toolPaneHeight, 0, containerWidth - toolPaneHeight, getHeight()); @@ -244,6 +266,16 @@ public class UIResizableContainer extends JPanel { refreshContainer(); } + public void addParameterPane(JComponent pane) { + add(this.parameterPane = pane); + refreshContainer(); + } + + public void removeParameterPane() { + remove(this.parameterPane); + refreshContainer(); + } + /** * 得到上子面板 * @@ -483,7 +515,7 @@ public class UIResizableContainer extends JPanel { jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel content = (JPanel) jf.getContentPane(); content.setLayout(new BorderLayout()); - UIResizableContainer bb = new UIResizableContainer(Constants.LEFT); + UIResizableContainer bb = new UIResizableContainer(Constants.RIGHT); JPanel cc = new JPanel(); cc.setBackground(Color.blue); content.add(bb, BorderLayout.EAST); From 06f825b893b07fa62ff8054a69ffaa96ac431845 Mon Sep 17 00:00:00 2001 From: fr_shine Date: Tue, 1 Nov 2016 14:06:23 +0800 Subject: [PATCH 111/244] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=8F=B3=E5=AF=B9?= =?UTF-8?q?=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/data/report/MeterPlotReportDataContentPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java index c23f64dc18..b447c7d098 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java @@ -46,8 +46,8 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan double[] rowSize = { p, p, p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(getCateNameString()), getSingCatePane()}, - new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()}, + new Component[]{new UILabel(getCateNameString(), SwingConstants.RIGHT), getSingCatePane()}, + new Component[]{new UILabel(getNValueString(), SwingConstants.RIGHT), singValuePane = new TinyFormulaPane()}, new Component[]{null, null} }; From 6c540eb1ed93ea6962067997e128753175b0a8a4 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:07:22 +0800 Subject: [PATCH 112/244] rt --- .../src/com/fr/design/mainframe/ElementCasePaneDelegate.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index d6c167a011..79c60d2dc2 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.design.fun.MenuHandler; import com.fr.design.menu.KeySetUtils; +import com.fr.design.parameter.ParameterPropertyPane; import com.fr.general.Inter; import com.fr.page.ReportSettingsProvider; import com.fr.design.file.HistoryTemplateListPane; @@ -58,6 +59,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { if (editingTemplate != null && !editingTemplate.isUpMode()) { EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance()); + EastRegionContainerPane.getInstance().removeParameterPane(); } } }); From 9f3eaac8a346409e5afd68364976d805c85e6f46 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:07:44 +0800 Subject: [PATCH 113/244] rt --- designer_form/src/com/fr/design/mainframe/JForm.java | 7 ++++++- 1 file changed, 6 insertions(+), 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 661ba0ab96..19ed6a1b1f 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -28,6 +28,7 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; +import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.LayoutUtils; import com.fr.file.FILE; @@ -247,6 +248,7 @@ public class JForm extends JTemplate implements BaseJForm { ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane()); } else { EastRegionContainerPane.getInstance().replaceUpPane(editingComponent); + } } @@ -615,8 +617,10 @@ public class JForm extends JTemplate implements BaseJForm { } } - EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign)); + EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign)); + //sharetest + EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign)); if (EastRegionContainerPane.getInstance().getDownPane() == null) { new Thread() { public void run() { @@ -636,6 +640,7 @@ public class JForm extends JTemplate implements BaseJForm { pane.setLayout(new BorderLayout()); pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER); EastRegionContainerPane.getInstance().replaceDownPane(pane); + } } From c3cb42a58ad1eb5879e4f7a76c661538f86d3dd3 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:08:07 +0800 Subject: [PATCH 114/244] rt --- .../com/fr/design/gui/icontainer/UIResizableContainer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index 9fa791b776..bb9686aa83 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -127,9 +127,7 @@ public class UIResizableContainer extends JPanel { } public int getParameterPaneHeight() { - if(parameterPane.getHeight() == 0) { - return 30; - } + return paraHeight; } @@ -217,6 +215,7 @@ public class UIResizableContainer extends JPanel { } parameterPane.setBounds(20,0,230,getParameterPaneHeight()); upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY); + System.out.print(getParameterPaneHeight() + "fsdfsdfsd"); horizontToolPane.setBounds(toolPaneHeight, toolPaneY + getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneHeight); downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight + getParameterPaneHeight(), containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); @@ -273,6 +272,7 @@ public class UIResizableContainer extends JPanel { public void removeParameterPane() { remove(this.parameterPane); + setParameterHeight(0); refreshContainer(); } From d8df4f920eab73a35753dd3361dde00fe311d5f8 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:08:50 +0800 Subject: [PATCH 115/244] rt --- .../src/com/fr/design/mainframe/FormDesigner.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 544d89ec7d..ec823827a5 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -198,6 +198,12 @@ public class FormDesigner extends TargetComponent
implements TreeSelection ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( getParameterArray() == null ? new Parameter[0] : getParameterArray()); ParameterPropertyPane.getInstance().repaintContainer(); + if (getParameterArray().length == 0) { + EastRegionContainerPane.getInstance().setParameterHeight(30); + } else { + EastRegionContainerPane.getInstance().setParameterHeight((getParameterArray().length + 5) / 6 * 30 + 80); + } + } private void removeSame(Parameter[] parameters, List namelist){ @@ -463,6 +469,8 @@ public class FormDesigner extends TargetComponent implements TreeSelection paraComponent = null; formLayoutContainer.setSize(rootComponent.getWidth(), rootComponent.getHeight()); EastRegionContainerPane.getInstance().replaceDownPane(this.getEastDownPane()); + //atat + //EastRegionContainerPane.getInstance().addTitlePane(ParameterPropertyPane.getInstance(FormDesigner.this)); //删除后重绘下 invalidateLayout(); } From ab3c192d76164d813863837eb7943d9a796a7c3e Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:14:04 +0800 Subject: [PATCH 116/244] rt --- .../src/com/fr/design/gui/icontainer/UIResizableContainer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index bb9686aa83..e27f105958 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -215,7 +215,6 @@ public class UIResizableContainer extends JPanel { } parameterPane.setBounds(20,0,230,getParameterPaneHeight()); upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY); - System.out.print(getParameterPaneHeight() + "fsdfsdfsd"); horizontToolPane.setBounds(toolPaneHeight, toolPaneY + getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneHeight); downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight + getParameterPaneHeight(), containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); From 8fddeec6857407771b22fdcb6e0bdcbe731dfb45 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:18:55 +0800 Subject: [PATCH 117/244] rt --- designer_form/src/com/fr/design/mainframe/JForm.java | 1 - 1 file changed, 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 19ed6a1b1f..c88ebe012b 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -619,7 +619,6 @@ public class JForm extends JTemplate implements BaseJForm { EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign)); - //sharetest EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign)); if (EastRegionContainerPane.getInstance().getDownPane() == null) { new Thread() { From a15aabfb62763f53ef700c561e329779cb6b197d Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:36:23 +0800 Subject: [PATCH 118/244] rt --- .../fr/design/gui/icontainer/UIResizableContainer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index e27f105958..ec8380eedd 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -208,18 +208,19 @@ public class UIResizableContainer extends JPanel { upPane.setBounds(0, 0, containerWidth - toolPaneHeight, getHeight()); verticalToolPane.setBounds(containerWidth - toolPaneHeight, 0, toolPaneHeight, getHeight()); } - } else if (direction == Constants.LEFT && parent instanceof EastRegionContainerPane) { + } else if (direction == Constants.LEFT) { if(isDownPaneVisible){ if (toolPaneY > getHeight() - toolPaneHeight) { toolPaneY = getHeight() - toolPaneHeight; } - parameterPane.setBounds(20,0,230,getParameterPaneHeight()); + parameterPane.setBounds(20, 0, 230, getParameterPaneHeight()); upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY); horizontToolPane.setBounds(toolPaneHeight, toolPaneY + getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneHeight); downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight + getParameterPaneHeight(), containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); - }else{ - upPane.setBounds(toolPaneHeight, 0, containerWidth - toolPaneHeight, getHeight()); + }else { + parameterPane.setBounds(20, 0, 230, getParameterPaneHeight()); + upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, getHeight() - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); } } From ac76c6839e456be595d3b4f03b07dcb11a1f1ab2 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:43:18 +0800 Subject: [PATCH 119/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 78673b22d6..6bcc9a2661 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -286,7 +286,7 @@ public class FormWidgetDetailPane extends FormDockView{ private void refreshShareMoudule() { try { - ShareLoader.getLoader().readFromEnv(); + ShareLoader.getLoader().refreshModule(); } catch (Exception e) { e.printStackTrace(); } From d8a2f250486d8020ecf0d8bb9354d243ae4bbecb Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:45:09 +0800 Subject: [PATCH 120/244] rt --- .../src/com/fr/design/gui/icontainer/UIResizableContainer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index ec8380eedd..a56ae64d71 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -88,7 +88,6 @@ public class UIResizableContainer extends JPanel { add(horizontToolPane); add(downPane); add(verticalToolPane); - parameterPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(parameterPane); } @@ -218,7 +217,7 @@ public class UIResizableContainer extends JPanel { horizontToolPane.setBounds(toolPaneHeight, toolPaneY + getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneHeight); downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight + getParameterPaneHeight(), containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); - }else { + } else { parameterPane.setBounds(20, 0, 230, getParameterPaneHeight()); upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, getHeight() - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); From 7e6603a996c82c761e5f52ee6a260942a6412841 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:47:38 +0800 Subject: [PATCH 121/244] rt --- .../fr/design/gui/icontainer/UIResizableContainer.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index a56ae64d71..201aee7594 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -22,6 +22,7 @@ public class UIResizableContainer extends JPanel { private JComponent upPane; private JComponent downPane; + //放参数面板 private JComponent parameterPane = new JPanel(); private HorizotalToolPane horizontToolPane; @@ -125,12 +126,20 @@ public class UIResizableContainer extends JPanel { } } + /** + * 获取参数面板高度 + */ public int getParameterPaneHeight() { return paraHeight; } + /** + * 设置参数面板高度 + * + * @param height + */ public void setParameterHeight(int height) { paraHeight = height; refreshContainer(); From 083bcb003c444a981fd77a79f7c6c9f101c6a0eb Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 14:58:38 +0800 Subject: [PATCH 122/244] rt --- designer_form/src/com/fr/design/mainframe/FormDesigner.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index ec823827a5..fffccd3fff 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -201,6 +201,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection if (getParameterArray().length == 0) { EastRegionContainerPane.getInstance().setParameterHeight(30); } else { + //参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度 EastRegionContainerPane.getInstance().setParameterHeight((getParameterArray().length + 5) / 6 * 30 + 80); } From 128d97ddf37786ecbc8924ecaa2fbd5693b756b1 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 15:16:10 +0800 Subject: [PATCH 123/244] rt --- .../src/com/fr/design/form/parameter/FormParaDesigner.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index f46334dd52..cfb3976ffd 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -114,6 +114,8 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP if (!BaseUtils.isAuthorityEditing()) { EastRegionContainerPane.getInstance().replaceUpPane( WidgetPropertyPane.getInstance(this)); + EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); + refreshParameter(); } else { showAuthorityEditPane(); } From 660e391aed9bbb13ae63e2974638d2c8e537d95e Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 1 Nov 2016 16:57:23 +0800 Subject: [PATCH 124/244] rt --- .../src/com/fr/design/parameter/ParameterPropertyPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java index 3ecfd53eda..f376bd6ab8 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java @@ -47,7 +47,7 @@ public class ParameterPropertyPane extends JPanel{ initParameterListener(); this.setLayout(new BorderLayout(0, 6)); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + this.setBorder(BorderFactory.createEmptyBorder(2, 5, 5, 5)); this.add(toolbarPane, BorderLayout.CENTER); } From 4b1e21f01322f358b8b8fd3291d825504d3f71d4 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 2 Nov 2016 09:44:13 +0800 Subject: [PATCH 125/244] rt --- .../src/com/fr/design/form/parameter/FormParaDesigner.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index cfb3976ffd..44580ab8cf 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -232,6 +232,9 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP } ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray()); + + //参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度 + EastRegionContainerPane.getInstance().setParameterHeight((p.getParameterArray().length + 5) / 6 * 30 + 80); ParameterPropertyPane.getInstance().repaintContainer(); } From b05333e82147f6d8e09c52b462c5dbc173b98eb4 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 2 Nov 2016 11:32:06 +0800 Subject: [PATCH 126/244] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index b3b04f948a..d40b43bd27 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -21,10 +21,7 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane import com.fr.design.module.DesignModuleFactory; import com.fr.file.XMLFileManager; import com.fr.form.ui.ChartEditor; -import com.fr.general.FRLogger; -import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; -import com.fr.general.Inter; +import com.fr.general.*; import com.fr.plugin.PluginCollector; import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginMessage; @@ -52,7 +49,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh private static ChartTypeInterfaceManager classManager = null; private static LinkedHashMap> chartTypeInterfaces = new LinkedHashMap>(); - private static final String DEFAULT_CHART_ID = "DefaultChart"; public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { @@ -150,7 +146,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - chartTypeInterfaces.put(DEFAULT_CHART_ID, chartUIList); + chartTypeInterfaces.put(ChartTypeManager.DEFAULT_CHART_ID, chartUIList); } public String getIconPath(String plotID) { @@ -291,15 +287,36 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh int index = 0; + //处理vanChart + { + Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); + while (vanChartUI.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) vanChartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); + } + } + //处理chart + { + Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); + while (chartUI.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); + } + } + //其它图表 Iterator i = chartTypeInterfaces.entrySet().iterator(); while (i.hasNext()){ Map.Entry entry = (Map.Entry) i.next(); String chartID = (String) entry.getKey(); - Iterator chartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); - while (chartUI.hasNext()){ - Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); - IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); + if (!(ComparatorUtils.equals(chartID, ChartTypeManager.chartID) || ComparatorUtils.equals(chartID, ChartTypeManager.vanChartID))) { + Iterator otherChartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); + while (otherChartUI.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) otherChartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); + } } } return names; @@ -317,7 +334,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getChartDataPane(chartID, plotID, listener); } } - return getChartDataPane(DEFAULT_CHART_ID, plotID, listener); + return getChartDataPane(ChartTypeManager.DEFAULT_CHART_ID, plotID, listener); } private ChartDataPane getChartDataPane(String chartID, String plotID, AttributeChangeListener listener) { @@ -345,7 +362,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getAttrPaneArray(chartID, plotID, listener); } } - return getAttrPaneArray(DEFAULT_CHART_ID, plotID, listener); + return getAttrPaneArray(ChartTypeManager.DEFAULT_CHART_ID, plotID, listener); } private AbstractChartAttrPane[] getAttrPaneArray(String chartID, String plotID, AttributeChangeListener listener) { @@ -361,7 +378,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getTableDataSourcePane(chartID, plot, parent); } } - return getTableDataSourcePane(DEFAULT_CHART_ID, plot, parent); + return getTableDataSourcePane(ChartTypeManager.DEFAULT_CHART_ID, plot, parent); } private AbstractTableDataContentPane getTableDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { @@ -379,7 +396,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getReportDataSourcePane(chartID, plot, parent); } } - return getReportDataSourcePane(DEFAULT_CHART_ID, plot, parent); + return getReportDataSourcePane(ChartTypeManager.DEFAULT_CHART_ID, plot, parent); } private boolean plotInChart(String plotID, String chartID) { @@ -402,7 +419,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getPlotConditionPane(chartID, plot); } } - return getPlotConditionPane(DEFAULT_CHART_ID, plot); + return getPlotConditionPane(ChartTypeManager.DEFAULT_CHART_ID, plot); } private ConditionAttributesPane getPlotConditionPane(String chartID, Plot plot) { @@ -419,7 +436,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getPlotSeriesPane(chartID, parent, plot); } } - return getPlotSeriesPane(DEFAULT_CHART_ID, parent, plot); + return getPlotSeriesPane(ChartTypeManager.DEFAULT_CHART_ID, parent, plot); } private BasicBeanPane getPlotSeriesPane(String chartID, ChartStylePane parent, Plot plot) { @@ -466,7 +483,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh extraChartDesignInterfaceList.add(tagName); } if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { - addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); + addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", ChartTypeManager.DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); } } } From 0f67a73d231126c295fc0eec24933bdc7f12038e Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 2 Nov 2016 11:48:59 +0800 Subject: [PATCH 127/244] update --- .../fr/design/ChartTypeInterfaceManager.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index d40b43bd27..eaa8625302 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -290,20 +290,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh //处理vanChart { Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); - while (vanChartUI.hasNext()) { - Map.Entry chartUIEntry = (Map.Entry) vanChartUI.next(); - IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); - } + fetchNames(vanChartUI, names, index++); } //处理chart { Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); - while (chartUI.hasNext()) { - Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); - IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); - } + fetchNames(chartUI, names, index++); } //其它图表 Iterator i = chartTypeInterfaces.entrySet().iterator(); @@ -312,11 +304,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); if (!(ComparatorUtils.equals(chartID, ChartTypeManager.chartID) || ComparatorUtils.equals(chartID, ChartTypeManager.vanChartID))) { Iterator otherChartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); - while (otherChartUI.hasNext()) { - Map.Entry chartUIEntry = (Map.Entry) otherChartUI.next(); - IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); - } + fetchNames(otherChartUI, names, index++); } } return names; @@ -325,6 +313,14 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return new String[0]; } + private void fetchNames(Iterator chartUI, String[] names, int index) { + while (chartUI.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index] = provider.getPlotTypePane().title4PopupWindow(); + } + } + public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ From fadf534930ba580e6f6467b1827d85252d610934 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 2 Nov 2016 11:54:40 +0800 Subject: [PATCH 128/244] update --- .../fr/design/ChartTypeInterfaceManager.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index eaa8625302..51d03ab3dc 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -288,15 +288,11 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh int index = 0; //处理vanChart - { - Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); - fetchNames(vanChartUI, names, index++); - } + Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); + index = fetchNames(vanChartUI, names, index); //处理chart - { - Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); - fetchNames(chartUI, names, index++); - } + Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); + index = fetchNames(chartUI, names, index); //其它图表 Iterator i = chartTypeInterfaces.entrySet().iterator(); while (i.hasNext()){ @@ -304,7 +300,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); if (!(ComparatorUtils.equals(chartID, ChartTypeManager.chartID) || ComparatorUtils.equals(chartID, ChartTypeManager.vanChartID))) { Iterator otherChartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); - fetchNames(otherChartUI, names, index++); + index = fetchNames(otherChartUI, names, index); } } return names; @@ -313,12 +309,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return new String[0]; } - private void fetchNames(Iterator chartUI, String[] names, int index) { + private int fetchNames(Iterator chartUI, String[] names, int index) { while (chartUI.hasNext()) { Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index] = provider.getPlotTypePane().title4PopupWindow(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); } + return index; } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { From dc464a7d677b1ebe29e4e51baab78cd7c3a7affd Mon Sep 17 00:00:00 2001 From: fr_shine Date: Wed, 2 Nov 2016 15:13:13 +0800 Subject: [PATCH 129/244] =?UTF-8?q?=E9=80=89=E4=B8=AD=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E6=8C=89id=E7=9C=8B=E6=98=AF=E5=90=A6=E7=9B=B8=E5=90=8C?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E6=8C=89index=E3=80=82=E5=9B=A0=E4=B8=BA?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2plotlist=E4=BC=9A=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icombobox/FRTreeComboBox.java | 12 +++++++++++- .../fr/design/mainframe/chart/gui/ChartTypePane.java | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java b/designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java index 3ddec17d25..a609422292 100644 --- a/designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java +++ b/designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java @@ -247,7 +247,17 @@ public class FRTreeComboBox extends UIComboBox { } @Override protected UIButton createArrowButton() { - arrowButton = new UIButton(UIConstants.ARROW_DOWN_ICON); + arrowButton = new UIButton(UIConstants.ARROW_DOWN_ICON){ + /** + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ + @Override + public boolean shouldResponseChangeListener() { + return false; + } + }; ((UIButton) arrowButton).setRoundBorder(true, Constants.LEFT); arrowButton.addMouseListener(this); comboBox.addMouseListener(this); 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 78f3f62712..c6d42386b0 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 @@ -129,7 +129,9 @@ public class ChartTypePane extends AbstractChartAttrPane{ } public void updateBean(Chart chart) { - int lastSelectIndex = editPane.getSelectedChartIndex(chart); + + Plot oldPlot = chart.getPlot(); + String lastPlotID = oldPlot == null ? StringUtils.EMPTY : oldPlot.getPlotID(); try{ Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone(); @@ -159,7 +161,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && lastSelectIndex != jcb.getSelectedIndex())){ + if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ editPane.reLayout(chart); } } From 08ba6060241ebb8ec41fbcee67d7ad7ee5005222 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 2 Nov 2016 17:27:59 +0800 Subject: [PATCH 130/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E4=BC=98=E5=85=88?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 183 +++++++++--------- .../mainframe/chart/gui/ChartTypePane.java | 4 +- 2 files changed, 91 insertions(+), 96 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 51d03ab3dc..873a967501 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -54,6 +54,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); + classManager.readDefault(); } return classManager; } @@ -70,9 +71,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh GeneralContext.addPluginReadListener(new PluginReadListener() { @Override public void success() { - if (chartTypeInterfaces.size() == 0) { - ChartTypeInterfaceManager.getInstance().readDefault(); - } //重新注册designModuleFactory DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); } @@ -127,6 +125,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private static void readDefault() { + if (chartTypeInterfaces.containsKey(ChartTypeManager.CHART_PRIORITY)){ + return; + } LinkedHashMap chartUIList = new LinkedHashMap(); chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); @@ -146,7 +147,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - chartTypeInterfaces.put(ChartTypeManager.DEFAULT_CHART_ID, chartUIList); + chartTypeInterfaces.put(ChartTypeManager.CHART_PRIORITY, chartUIList); } public String getIconPath(String plotID) { @@ -154,8 +155,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - String imagePath = getIconPath(chartID, plotID); + String priority = (String) entry.getKey(); + String imagePath = getIconPath(priority, plotID); if (!StringUtils.isEmpty(imagePath)) { return imagePath; } @@ -164,23 +165,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return StringUtils.EMPTY; } - private String getIconPath(String chartID, String plotID) { - if (chartTypeInterfaces.get(chartID) != null && chartTypeInterfaces.get(chartID).get(plotID) != null) { - return chartTypeInterfaces.get(chartID).get(plotID).getIconPath(); + private String getIconPath(String priority, String plotID) { + if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) { + return chartTypeInterfaces.get(priority).get(plotID).getIconPath(); }else { return StringUtils.EMPTY; } } - public static void addChartTypeInterface(IndependentChartUIProvider provider, String chartID, String plotID) { + public static void addChartTypeInterface(IndependentChartUIProvider provider, String priority, String plotID) { if (chartTypeInterfaces != null){ - if (!chartTypeInterfaces.containsKey(chartID)){ + if (!chartTypeInterfaces.containsKey(priority)){ //新建一个具体图表列表 LinkedHashMap chartUIList = new LinkedHashMap(); chartUIList.put(plotID, provider); - chartTypeInterfaces.put(chartID, chartUIList); + chartTypeInterfaces.put(priority, chartUIList); }else { - LinkedHashMap chartUIList = chartTypeInterfaces.get(chartID); + LinkedHashMap chartUIList = chartTypeInterfaces.get(priority); if (!chartUIList.containsKey(plotID)) { chartUIList.put(plotID, provider); } @@ -194,7 +195,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param className 类名 * @param plotID 标志ID */ - public void addChartInterface(String className, String chartID, String plotID, PluginSimplify simplify) { + public void addChartInterface(String className, String priority, String plotID, PluginSimplify simplify) { if (StringUtils.isNotBlank(className)) { try { Class clazz = Class.forName(className); @@ -206,7 +207,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) { PluginMessage.remindUpdate(className); } else { - ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, chartID, plotID); + ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, priority, plotID); } } catch (ClassNotFoundException e) { FRLogger.getLogger().error("class not found:" + e.getMessage()); @@ -230,8 +231,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - Iterator chartUIIterator = chartTypeInterfaces.get(chartID).entrySet().iterator(); + String priority = (String) entry.getKey(); + Iterator chartUIIterator = chartTypeInterfaces.get(priority).entrySet().iterator(); while (chartUIIterator.hasNext()) { Map.Entry chartUIEntry = (Map.Entry) chartUIIterator.next(); IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); @@ -240,13 +241,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } } - public String[] getTitle4PopupWindow(String chartID){ - if (chartID.isEmpty()){ + public String[] getTitle4PopupWindow(String priority){ + if (priority.isEmpty()){ return getTitle4PopupWindow(); } - String[] names = new String[getChartSize(chartID)]; - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){ - HashMap chartUIList = chartTypeInterfaces.get(chartID); + String[] names = new String[getChartSize(priority)]; + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)){ + HashMap chartUIList = chartTypeInterfaces.get(priority); Iterator iterator = chartUIList.entrySet().iterator(); int i = 0; while (iterator.hasNext()){ @@ -261,13 +262,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh /** * 获取指定图表的标题 - * @param chartID + * @param priority * @return */ - public String getTitle4PopupWindow(String chartID, String plotID){ - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)){ - HashMap chartUIList = chartTypeInterfaces.get(chartID); - IndependentChartUIProvider provider = chartTypeInterfaces.get(chartID).get(plotID); + public String getTitle4PopupWindow(String priority, String plotID){ + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){ + HashMap chartUIList = chartTypeInterfaces.get(priority); + IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID); return provider.getPlotTypePane().title4PopupWindow(); } @@ -275,34 +276,28 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private String[] getTitle4PopupWindow(){ + List priorityList = new ArrayList(); int size = 0; if (chartTypeInterfaces != null){ Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - size += getChartSize(chartID); + String priority = (String) entry.getKey(); + priorityList.add(Integer.valueOf(priority)); + size += getChartSize(priority); } String[] names = new String[size]; + priorityList = ChartTypeManager.orderInPriority(priorityList); + int index = 0; - //处理vanChart - Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); - index = fetchNames(vanChartUI, names, index); - //处理chart - Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); - index = fetchNames(chartUI, names, index); - //其它图表 - Iterator i = chartTypeInterfaces.entrySet().iterator(); - while (i.hasNext()){ - Map.Entry entry = (Map.Entry) i.next(); - String chartID = (String) entry.getKey(); - if (!(ComparatorUtils.equals(chartID, ChartTypeManager.chartID) || ComparatorUtils.equals(chartID, ChartTypeManager.vanChartID))) { - Iterator otherChartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); - index = fetchNames(otherChartUI, names, index); - } + for (int i = 0; i < priorityList.size(); i++){ + String priority = String.valueOf(priorityList.get(i)); + Iterator chartUI = chartTypeInterfaces.get(priority).entrySet().iterator(); + index = fetchNames(chartUI, names, index); } + return names; } @@ -322,26 +317,26 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plotID, chartID)) { - return getChartDataPane(chartID, plotID, listener); + String priority = (String) entry.getKey(); + if (plotInChart(plotID, priority)) { + return getChartDataPane(priority, plotID, listener); } } - return getChartDataPane(ChartTypeManager.DEFAULT_CHART_ID, plotID, listener); + return getChartDataPane(ChartTypeManager.CHART_PRIORITY, plotID, listener); } - private ChartDataPane getChartDataPane(String chartID, String plotID, AttributeChangeListener listener) { - return chartTypeInterfaces.get(chartID).get(plotID).getChartDataPane(listener); + private ChartDataPane getChartDataPane(String priority, String plotID, AttributeChangeListener listener) { + return chartTypeInterfaces.get(priority).get(plotID).getChartDataPane(listener); } /** * 获取对应ID的图表数量 - * @param chartID + * @param key * @return */ - private int getChartSize(String chartID){ - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){ - return chartTypeInterfaces.get(chartID).size(); + private int getChartSize(String key){ + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(key)){ + return chartTypeInterfaces.get(key).size(); } return 0; } @@ -350,32 +345,32 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plotID, chartID)) { - return getAttrPaneArray(chartID, plotID, listener); + String priority = (String) entry.getKey(); + if (plotInChart(plotID, priority)) { + return getAttrPaneArray(priority, plotID, listener); } } - return getAttrPaneArray(ChartTypeManager.DEFAULT_CHART_ID, plotID, listener); + return getAttrPaneArray(ChartTypeManager.CHART_PRIORITY, plotID, listener); } - private AbstractChartAttrPane[] getAttrPaneArray(String chartID, String plotID, AttributeChangeListener listener) { - return chartTypeInterfaces.get(chartID).get(plotID).getAttrPaneArray(listener); + private AbstractChartAttrPane[] getAttrPaneArray(String priority, String plotID, AttributeChangeListener listener) { + return chartTypeInterfaces.get(priority).get(plotID).getAttrPaneArray(listener); } public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plot.getPlotID(), chartID)) { - return getTableDataSourcePane(chartID, plot, parent); + String priority = (String) entry.getKey(); + if (plotInChart(plot.getPlotID(), priority)) { + return getTableDataSourcePane(priority, plot, parent); } } - return getTableDataSourcePane(ChartTypeManager.DEFAULT_CHART_ID, plot, parent); + return getTableDataSourcePane(ChartTypeManager.CHART_PRIORITY, plot, parent); } - private AbstractTableDataContentPane getTableDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { - return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getTableDataSourcePane(plot, parent); + private AbstractTableDataContentPane getTableDataSourcePane(String priority, Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getTableDataSourcePane(plot, parent); } @@ -383,23 +378,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); + String priority = (String) entry.getKey(); String plotID = plot.getPlotID(); - if (plotInChart(plotID, chartID)) { - return getReportDataSourcePane(chartID, plot, parent); + if (plotInChart(plotID, priority)) { + return getReportDataSourcePane(priority, plot, parent); } } - return getReportDataSourcePane(ChartTypeManager.DEFAULT_CHART_ID, plot, parent); + return getReportDataSourcePane(ChartTypeManager.CHART_PRIORITY, plot, parent); } - private boolean plotInChart(String plotID, String chartID) { + private boolean plotInChart(String plotID, String priority) { return chartTypeInterfaces != null - && chartTypeInterfaces.containsKey(chartID) - && chartTypeInterfaces.get(chartID).containsKey(plotID); + && chartTypeInterfaces.containsKey(priority) + && chartTypeInterfaces.get(priority).containsKey(plotID); } - private AbstractReportDataContentPane getReportDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { - return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getReportDataSourcePane(plot, parent); + private AbstractReportDataContentPane getReportDataSourcePane(String priority, Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getReportDataSourcePane(plot, parent); } @@ -407,16 +402,16 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plot.getPlotID(), chartID)) { - return getPlotConditionPane(chartID, plot); + String priority = (String) entry.getKey(); + if (plotInChart(plot.getPlotID(), priority)) { + return getPlotConditionPane(priority, plot); } } - return getPlotConditionPane(ChartTypeManager.DEFAULT_CHART_ID, plot); + return getPlotConditionPane(ChartTypeManager.CHART_PRIORITY, plot); } - private ConditionAttributesPane getPlotConditionPane(String chartID, Plot plot) { - return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotConditionPane(plot); + private ConditionAttributesPane getPlotConditionPane(String priority, Plot plot) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getPlotConditionPane(plot); } @@ -424,16 +419,16 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plot.getPlotID(), chartID)) { - return getPlotSeriesPane(chartID, parent, plot); + String priority = (String) entry.getKey(); + if (plotInChart(plot.getPlotID(), priority)) { + return getPlotSeriesPane(priority, parent, plot); } } - return getPlotSeriesPane(ChartTypeManager.DEFAULT_CHART_ID, parent, plot); + return getPlotSeriesPane(ChartTypeManager.CHART_PRIORITY, parent, plot); } - private BasicBeanPane getPlotSeriesPane(String chartID, ChartStylePane parent, Plot plot) { - return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotSeriesPane(parent, plot); + private BasicBeanPane getPlotSeriesPane(String priority, ChartStylePane parent, Plot plot) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getPlotSeriesPane(parent, plot); } /** @@ -446,19 +441,19 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (chartTypeInterfaces.get(chartID).containsKey(plotID)){ - return isUseDefaultPane(chartID, plotID); + String priority = (String) entry.getKey(); + if (chartTypeInterfaces.get(priority).containsKey(plotID)){ + return isUseDefaultPane(priority, plotID); } } return true; } - private boolean isUseDefaultPane(String chartID, String plotID){ + private boolean isUseDefaultPane(String priority, String plotID){ - if (chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)) { - return chartTypeInterfaces.get(chartID).get(plotID).isUseDefaultPane(); + if (chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) { + return chartTypeInterfaces.get(priority).get(plotID).isUseDefaultPane(); } return true; @@ -476,7 +471,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh extraChartDesignInterfaceList.add(tagName); } if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { - addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", ChartTypeManager.DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); + addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("priority", ChartTypeManager.CHART_PRIORITY),reader.getAttrAsString("plotID", ""), simplify); } } } 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 78f3f62712..229206f4dd 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 @@ -188,7 +188,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void reactor(ChartCollection collection){ //重构需要重构下拉框选项和cardNames Chart chart = collection.getSelectedChart(); - String chartID = chart.getChartID(); + String chartID = chart.getPriority(); if (collection.getState() == SwitchState.DEFAULT){ chartID = StringUtils.EMPTY; } @@ -197,7 +197,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ //重构下拉框选项 reactorComboBox(); //重新选择选中的下拉项 - chartID = chart.getChartID(); + chartID = chart.getPriority(); String plotID = chart.getPlot().getPlotID(); Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); jcb.setSelectedItem(item); From 0998bf995e4a1833df29504dbbfa8cf55a87ad53 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 2 Nov 2016 19:50:23 +0800 Subject: [PATCH 131/244] rt --- .../design/form/parameter/FormParaDesigner.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index 44580ab8cf..c52eb8ea47 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -79,6 +79,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP private static final int SECOND_H_LOCATION = 170; private static final int ADD_HEIGHT = 20; private static final int H_GAP = 105; + private static int paraCount; private static Image paraImage = BaseUtils.readImage("/com/fr/design/images/form/parameter.png"); @@ -114,8 +115,6 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP if (!BaseUtils.isAuthorityEditing()) { EastRegionContainerPane.getInstance().replaceUpPane( WidgetPropertyPane.getInstance(this)); - EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); - refreshParameter(); } else { showAuthorityEditPane(); } @@ -233,9 +232,16 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray()); - //参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度 - EastRegionContainerPane.getInstance().setParameterHeight((p.getParameterArray().length + 5) / 6 * 30 + 80); - ParameterPropertyPane.getInstance().repaintContainer(); + EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); + if (p.getParameterArray().length == 0) { + EastRegionContainerPane.getInstance().setParameterHeight(30); + } else { + //参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度 + EastRegionContainerPane.getInstance().setParameterHeight((p.getParameterArray().length + 5) / 6 * 30 + 80); + } + System.out.print("1"); + + //ParameterPropertyPane.getInstance().repaintContainer(); } /** From 865d923177dbaed541f5c21a3815798920e4a20d Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 2 Nov 2016 19:51:41 +0800 Subject: [PATCH 132/244] rt --- .../src/com/fr/design/form/parameter/FormParaDesigner.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index c52eb8ea47..c97e0b7235 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -79,7 +79,6 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP private static final int SECOND_H_LOCATION = 170; private static final int ADD_HEIGHT = 20; private static final int H_GAP = 105; - private static int paraCount; private static Image paraImage = BaseUtils.readImage("/com/fr/design/images/form/parameter.png"); @@ -239,9 +238,6 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP //参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度 EastRegionContainerPane.getInstance().setParameterHeight((p.getParameterArray().length + 5) / 6 * 30 + 80); } - System.out.print("1"); - - //ParameterPropertyPane.getInstance().repaintContainer(); } /** From 07ab7c7972fdb41cb3e4ceb8e4a83c47d48fec42 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 3 Nov 2016 13:56:55 +0800 Subject: [PATCH 133/244] rt --- .../src/com/fr/design/actions/AllowAuthorityEditAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java index 5d0ccf2d09..d4e15fc13e 100644 --- a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1 +1 @@ -package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file From 9af3093423d54454f167128a0646fb1033c0e6ef Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 3 Nov 2016 15:45:36 +0800 Subject: [PATCH 134/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=85=B1=E4=BA=AB=E7=9A=84=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=94=B9=E8=BF=9B=E5=92=8C=E9=AA=8C=E6=94=B6?= =?UTF-8?q?=E7=9A=84bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/HelpDialogHandler.java | 13 +++ .../design/mainframe/HelpDialogManager.java | 44 +++++++++ .../fr/design/mainframe/UndoStateEdit.java | 1 + .../design/designer/creator/XChartEditor.java | 7 +- .../design/designer/creator/XElementCase.java | 13 ++- .../com/fr/design/mainframe/CoverPane.java | 97 +++++++++++++++++++ .../fr/design/mainframe/CoverReportPane.java | 54 ++++------- .../mainframe/EditingMouseListener.java | 17 +++- 8 files changed, 195 insertions(+), 51 deletions(-) create mode 100644 designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java create mode 100644 designer_base/src/com/fr/design/mainframe/HelpDialogManager.java create mode 100644 designer_form/src/com/fr/design/mainframe/CoverPane.java diff --git a/designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java b/designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java new file mode 100644 index 0000000000..dec93e6588 --- /dev/null +++ b/designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe; + +/** + * Coder: zack + * Date: 2016/11/3 + * Time: 10:43 + */ +public interface HelpDialogHandler { + /** + * 销毁 + */ + void destroyHelpDialog(); +} diff --git a/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java b/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java new file mode 100644 index 0000000000..9cae023ea7 --- /dev/null +++ b/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java @@ -0,0 +1,44 @@ +package com.fr.design.mainframe; + +/** + * 帮助信息的面板由于需要滚动条所以采用了很挫的dialog做,dialog很多情况下不能主动关闭,这边控制一下 + * Coder: zack + * Date: 2016/11/2 + * Time: 16:34 + */ +public class HelpDialogManager { + private static HelpDialogManager THIS; + private HelpDialogHandler handler; + + private HelpDialogManager() { + + } + + public HelpDialogHandler getPane() { + return handler; + } + + public void setPane(HelpDialogHandler dialog) { + if (dialog == this.handler) { + return; + } + //只允许一个dialog存在 + if (this.handler != null) { + handler.destroyHelpDialog(); + } + this.handler = dialog; + } + + public static HelpDialogManager getInstance() { + if (THIS == null) { + THIS = new HelpDialogManager(); + } + return THIS; + } + + public void destroyDialog() { + if (handler != null) { + handler.destroyHelpDialog(); + } + } +} diff --git a/designer_base/src/com/fr/design/mainframe/UndoStateEdit.java b/designer_base/src/com/fr/design/mainframe/UndoStateEdit.java index 3fc8f0436f..f81e2bbd3a 100644 --- a/designer_base/src/com/fr/design/mainframe/UndoStateEdit.java +++ b/designer_base/src/com/fr/design/mainframe/UndoStateEdit.java @@ -50,6 +50,7 @@ public class UndoStateEdit extends AbstractUndoableEdit { } } if (this.old != null) { + HelpDialogManager.getInstance().destroyDialog(); this.old.applyState(); } if (BaseUtils.isAuthorityEditing()) { diff --git a/designer_form/src/com/fr/design/designer/creator/XChartEditor.java b/designer_form/src/com/fr/design/designer/creator/XChartEditor.java index 49d193199e..28926f6c82 100644 --- a/designer_form/src/com/fr/design/designer/creator/XChartEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XChartEditor.java @@ -2,26 +2,21 @@ package com.fr.design.designer.creator; import java.awt.*; import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; import java.beans.IntrospectionException; import javax.swing.*; -import com.fr.base.BaseUtils; -import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.*; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.module.DesignModuleFactory; import com.fr.design.designer.beans.events.DesignerEditor; -import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.ui.BaseChartEditor; import com.fr.form.ui.Widget; import com.fr.design.form.util.XCreatorConstants; @@ -237,7 +232,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator { editor.setLayout(null); editor.setOpaque(false); - coverPanel = new CoverReportPane(); + coverPanel = new CoverPane(); coverPanel.setPreferredSize(this.getPreferredSize()); coverPanel.setBounds(this.getBounds()); diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 39caec435c..6ff949dfd3 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -9,10 +9,7 @@ import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.CoverReportPane; -import com.fr.design.mainframe.EditingMouseListener; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.*; import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; @@ -201,6 +198,13 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme editor.repaint(); } + /** + * 销毁帮助提示框 + */ + public void destroyHelpDialog(){ + coverPanel.destroyHelpDialog(); + } + public JComponent getCoverPane(){ return coverPanel; } @@ -280,6 +284,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme if (this.isHelpBtnOnFocus()) { coverPanel.setMsgDisplay(e); }else { + coverPanel.destroyHelpDialog(); switchTab(e,editingMouseListener); } } diff --git a/designer_form/src/com/fr/design/mainframe/CoverPane.java b/designer_form/src/com/fr/design/mainframe/CoverPane.java new file mode 100644 index 0000000000..b6cdd472a2 --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/CoverPane.java @@ -0,0 +1,97 @@ +package com.fr.design.mainframe; + +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.icon.IconPathConstants; +import com.fr.general.IOUtils; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created with IntelliJ IDEA. + * User: zx + * Date: 14-7-24 + * Time: 上午9:09 + */ +public class CoverPane extends JPanel { + + private UIButton editButton; + private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); + + public CoverPane() { + setLayout(getCoverLayout()); + setBackground(null); + setOpaque(false); + + editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) { + @Override + public Dimension getPreferredSize() { + return new Dimension(60, 24); + } + }; + editButton.setBorderPainted(false); + editButton.setExtraPainted(false); + editButton.setBackground(new Color(176, 196, 222)); + add(editButton); + } + + public AlphaComposite getComposite() { + return composite; + } + + public void setComposite(AlphaComposite composite) { + this.composite = composite; + } + + public UIButton getEditButton() { + return editButton; + } + + public void setEditButton(UIButton editButton) { + this.editButton = editButton; + } + + protected LayoutManager getCoverLayout() { + return new LayoutManager() { + + @Override + public void removeLayoutComponent(Component comp) { + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + return parent.getPreferredSize(); + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return null; + } + + @Override + public void layoutContainer(Container parent) { + int width = parent.getParent().getWidth(); + int height = parent.getParent().getHeight(); + int preferWidth = editButton.getPreferredSize().width; + int preferHeight = editButton.getPreferredSize().height; + editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight); + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + }; + } + + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(composite); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.setComposite(oldComposite); + super.paint(g); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java index 63ec66f5a5..f996338562 100644 --- a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java +++ b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java @@ -8,7 +8,6 @@ import com.fr.design.icon.IconPathConstants; import com.fr.form.share.ShareConstants; import com.fr.general.FRScreen; import com.fr.general.IOUtils; -import com.fr.general.Inter; import com.fr.stable.StringUtils; import javax.swing.*; @@ -16,15 +15,13 @@ import java.awt.*; import java.awt.event.MouseEvent; /** - * Created with IntelliJ IDEA. - * User: zx - * Date: 14-7-24 - * Time: 上午9:09 + * 报表块的封面(如果后面所有的组件都有帮助信息的话就抽接口吧) + * Coder: zack + * Date: 2016/11/2 + * Time: 11:32 */ -public class CoverReportPane extends JPanel { - - private UIButton editButton; - private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); +public class CoverReportPane extends CoverPane implements HelpDialogHandler{ + private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); private JComponent controlButton = new JComponent() { protected void paintComponent(Graphics g) { g.setColor(UIConstants.NORMAL_BACKGROUND); @@ -39,28 +36,13 @@ public class CoverReportPane extends JPanel { private ElementCaseHelpDialog helpDialog = null; - private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); - public CoverReportPane() { this(StringUtils.EMPTY); } public CoverReportPane(String helpMsg) { + super(); this.helpMsg = helpMsg; - setLayout(getCoverLayout()); - setBackground(null); - setOpaque(false); - - editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) { - @Override - public Dimension getPreferredSize() { - return new Dimension(60, 24); - } - }; - editButton.setBorderPainted(false); - editButton.setExtraPainted(false); - editButton.setBackground(new Color(176, 196, 222)); - add(editButton); add(controlButton); if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { @@ -98,6 +80,7 @@ public class CoverReportPane extends JPanel { int rY = 165 + e.getY();//165是设计器最上面几个面板的高度 helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); helpDialog.showWindow(); + HelpDialogManager.getInstance().setPane(this); } else { controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); controlButton.repaint(); @@ -125,6 +108,7 @@ public class CoverReportPane extends JPanel { @Override public void layoutContainer(Container parent) { + UIButton editButton = getEditButton(); int width = parent.getParent().getWidth(); int height = parent.getParent().getHeight(); int preferWidth = editButton.getPreferredSize().width; @@ -139,17 +123,6 @@ public class CoverReportPane extends JPanel { }; } - - public void paint(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - Composite oldComposite = g2d.getComposite(); - g2d.setComposite(composite); - g2d.setColor(Color.white); - g2d.fillRect(0, 0, getWidth(), getHeight()); - g2d.setComposite(oldComposite); - super.paint(g); - } - public void destroyHelpDialog() { if (helpDialog != null) { controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); @@ -159,4 +132,11 @@ public class CoverReportPane extends JPanel { } } -} \ No newline at end of file + @Override + public void setVisible(boolean aFlag) { + super.setVisible(aFlag); + if (aFlag) { + HelpDialogManager.getInstance().setPane(this); + } + } +} diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index 0aa77281d1..869ec2077f 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -256,7 +256,7 @@ public class EditingMouseListener extends MouseInputAdapter { public void mouseMoved(MouseEvent e) { XCreator component = designer.getComponentAt(e); - setCoverPaneNotDisplay(); + setCoverPaneNotDisplay(e, false); if(processTopLayoutMouseMove(component, e)){ return; @@ -320,8 +320,17 @@ public class EditingMouseListener extends MouseInputAdapter { designer.repaint(); } - private void setCoverPaneNotDisplay(){ - if (xElementCase != null){ + private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) { + if (xElementCase != null) { + int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue(); + int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue(); + Rectangle rect = new Rectangle(x, y, xElementCase.getWidth(), xElementCase.getHeight()); + if (rect.contains(e.getPoint())) { + return; + } + if(isLinkedHelpDialog){ + xElementCase.destroyHelpDialog(); + } xElementCase.displayCoverPane(false); } if (xChartEditor != null){ @@ -525,7 +534,7 @@ public class EditingMouseListener extends MouseInputAdapter { designer.setCursor(Cursor.getDefaultCursor()); } - setCoverPaneNotDisplay(); + setCoverPaneNotDisplay(e, true); cancelPromptWidgetForbidEnter(); } From 5eda02c95d5bd713cf99f6209f36f9df2b56d445 Mon Sep 17 00:00:00 2001 From: sunmondong Date: Thu, 3 Nov 2016 16:20:21 +0800 Subject: [PATCH 135/244] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20dev=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/build.dev.gradle | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 designer_base/build.dev.gradle diff --git a/designer_base/build.dev.gradle b/designer_base/build.dev.gradle new file mode 100644 index 0000000000..b02f751e7c --- /dev/null +++ b/designer_base/build.dev.gradle @@ -0,0 +1,70 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.7 +//指定生成jar包版本 +version='8.0' +//生成jar包重命名 +jar{ + baseName='fr-designer-core' +} + + +def srcDir="." + +//指定源码路径 +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src"] + } + } +} +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//声明外部依赖 +dependencies{ + +compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} +//复制非.java文件到classes文件夹下参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + from ("${srcDir}/src"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + into 'build/classes/main' + } + +} + + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + + + From a6ff48e2f4fc3e70f3ee4eabf4cadf5218ac1622 Mon Sep 17 00:00:00 2001 From: sunmondong Date: Thu, 3 Nov 2016 16:42:10 +0800 Subject: [PATCH 136/244] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_chart/build.dev.gradle | 66 ++++++++++++++++++++++++ designer_form/build.dev.gradle | 89 +++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 designer_chart/build.dev.gradle create mode 100644 designer_form/build.dev.gradle diff --git a/designer_chart/build.dev.gradle b/designer_chart/build.dev.gradle new file mode 100644 index 0000000000..ba6df992bd --- /dev/null +++ b/designer_chart/build.dev.gradle @@ -0,0 +1,66 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.7 +//指定生成jar包的版本 +version='8.0' + +def srcDir="." + +//对生成的jar包进行重命名 + +jar{ + baseName='fr-designer-chart' +} + +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src"] + } + } +} +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//指定外部依赖 +dependencies{ +compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} +//将非.java 文件复制到classes文件夹下参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + from ("${srcDir}/src"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + + } + into 'build/classes/main' + } + +} + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + diff --git a/designer_form/build.dev.gradle b/designer_form/build.dev.gradle new file mode 100644 index 0000000000..2b727caac9 --- /dev/null +++ b/designer_form/build.dev.gradle @@ -0,0 +1,89 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.8 +//指定生成的jar包版本 +version='8.0' + +def srcDir="." + + +//指明生成jar包的名字 +jar{ + baseName='fr-designer-report' +} +//源码所在位置 +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src", +"${srcDir}/../designer/src"] + } + } +} + +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//显示依赖jar包 +FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") +f.each{File file-> + println "----${file.path}" +} + +//声明外部依赖 +dependencies{ + compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') + compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + testCompile 'junit:junit:4.12' +} + +//指明无法编译文件所在路径 +def dataContent ={def dir -> + copySpec{ + from ("${dir}"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + } +} + +//将非.java文件复制到classes文件夹下 参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + with dataContent.call("${srcDir}/src") + with dataContent.call("${srcDir}/../designer/src") + into ('build/classes/main') + } + +} + + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + + } + fileset (dir:"${srcDir}/../designer/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + From 117eae5f489fe05f2773a1d5b1bd4ea459feb62f Mon Sep 17 00:00:00 2001 From: eason-skx Date: Thu, 3 Nov 2016 17:06:24 +0800 Subject: [PATCH 137/244] =?UTF-8?q?=E5=8A=A0final=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/ChartTypeInterfaceManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 873a967501..2af5af799b 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -79,8 +79,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh public static WidgetOption[] initWidgetOption(){ - ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); - ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + final ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); + final ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; //异步加载 new Thread(new Runnable() { From f340f302ac47b8cecc9f5f9abe2843e89d41a7d4 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Thu, 3 Nov 2016 18:07:53 +0800 Subject: [PATCH 138/244] =?UTF-8?q?REPORT-745=20designer=5Fbase=E5=92=8Cfo?= =?UTF-8?q?rm=E4=BE=9D=E8=B5=96=E5=85=B3=E7=B3=BB=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/FormElementCaseEditorProvider.java | 9 +++---- ...AbstractFormElementCaseEditorProvider.java | 14 +++-------- .../design/designer/creator/XElementCase.java | 24 +++++++++++++++---- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java index 191f7fa998..4ad5699fdd 100644 --- a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java @@ -1,11 +1,11 @@ package com.fr.design.fun; -import com.fr.form.ui.ElementCaseEditor; +import com.fr.stable.fun.IOFileAttrMark; import com.fr.stable.fun.ReportFitAttrProvider; -import com.fr.form.main.Form; import com.fr.stable.fun.mark.Mutable; import java.beans.PropertyDescriptor; +import java.util.Map; /** * Created by zhouping on 2015/9/10. @@ -16,10 +16,7 @@ public interface FormElementCaseEditorProvider extends Mutable { int CURRENT_LEVEL = 1; - - //加个provider返回tab的接口 - //design_base依赖了form - PropertyDescriptor[] createPropertyDescriptor (Class temp, Form form, ElementCaseEditor editor); + PropertyDescriptor[] createPropertyDescriptor (Class temp, Map attrMarkMap, ReportFitAttrProvider reportFitAttr); /** * 生成属性表 diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java index bcd39d8f52..e6d4621aff 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java @@ -1,12 +1,12 @@ package com.fr.design.fun.impl; import com.fr.design.fun.FormElementCaseEditorProvider; -import com.fr.form.main.Form; -import com.fr.form.ui.ElementCaseEditor; +import com.fr.stable.fun.IOFileAttrMark; import com.fr.stable.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.API; import java.beans.PropertyDescriptor; +import java.util.Map; /** * Created by zhouping on 2015/9/10. @@ -24,7 +24,7 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme } @Override - public PropertyDescriptor[] createPropertyDescriptor(Class temp, Form reportAttr, ElementCaseEditor editor) { + public PropertyDescriptor[] createPropertyDescriptor(Class temp, Map attrMarkMap, ReportFitAttrProvider reportFitAttr) { return new PropertyDescriptor[0]; } @@ -48,12 +48,4 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { return 0; } - - @Override - public boolean equals(Object obj) { - if(obj == null) { - return false; - } - return true; - } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 39caec435c..37919ead96 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -22,11 +22,13 @@ import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; import com.fr.form.ui.ElementCaseEditor; import com.fr.general.Inter; +import com.fr.plugin.ExtraClassManager; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.form.main.Form; +import com.fr.stable.fun.ExtraAttrMapProvider; import com.fr.stable.fun.FitProvider; +import com.fr.stable.fun.IOFileAttrMark; import com.fr.stable.fun.ReportFitAttrProvider; import javax.swing.*; @@ -100,7 +102,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) .setI18NName(Inter.getLocText("Form-EC_toolbar")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") }; //这边有个插件兼容问题,之后还是要改回process才行 @@ -110,8 +112,22 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme continue; } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - Form form = designer.getTarget(); - PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), form, this.toData()); + ElementCaseEditor editor = this.toData(); + Set setAttr = ExtraClassManager.getInstance().getArray(ExtraAttrMapProvider.XML_TAG); + for (ExtraAttrMapProvider attrProvider:setAttr) { + if (attrProvider == null) { + continue; + } + editor.addAttrMark((IOFileAttrMark) attrProvider); + } + FitProvider fitProvider = (FitProvider) designer.getTarget(); + ReportFitAttrProvider fitAttr = fitProvider.getFitAttr(); + //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) + if (editor.getFitStateInPC() == 0) { + editor.setReportFitAttr(null); + } + ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : editor.getReportFitAttr(); + PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), editor.getAttrMarkMap(), reportFitAttr); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } From dc01a3fe223fdf7fa4b813c743cad09338b882d9 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 3 Nov 2016 19:22:07 +0800 Subject: [PATCH 139/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=20?= =?UTF-8?q?=E4=B8=A5=E6=A0=BC=E9=99=90=E5=88=B6dialog=E7=9A=84=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E4=B9=8B=E5=90=8Ectrl=20z=E6=92=A4=E9=94=80=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E5=BF=85=E9=A1=BB=E5=85=88=E5=85=B3=E9=97=AD=E5=B8=AE?= =?UTF-8?q?=E5=8A=A9=E5=BC=B9=E6=A1=86=EF=BC=8C=E8=BF=99=E8=BE=B9=E5=B0=B1?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=88=A0=E6=8E=89=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/mainframe/UndoStateEdit.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_base/src/com/fr/design/mainframe/UndoStateEdit.java b/designer_base/src/com/fr/design/mainframe/UndoStateEdit.java index f81e2bbd3a..3fc8f0436f 100644 --- a/designer_base/src/com/fr/design/mainframe/UndoStateEdit.java +++ b/designer_base/src/com/fr/design/mainframe/UndoStateEdit.java @@ -50,7 +50,6 @@ public class UndoStateEdit extends AbstractUndoableEdit { } } if (this.old != null) { - HelpDialogManager.getInstance().destroyDialog(); this.old.applyState(); } if (BaseUtils.isAuthorityEditing()) { From 5ed311f92a8b4ad89d8ebb1dce4abae4db864b4b Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 3 Nov 2016 20:02:54 +0800 Subject: [PATCH 140/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=85=B1=E4=BA=AB=E5=BC=82=E6=AD=A5=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormWidgetDetailPane.java | 62 +++++++++++-------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 6bcc9a2661..a1fb5f1476 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,47 +1,35 @@ package com.fr.design.mainframe; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.io.File; -import java.io.IOException; -import java.util.*; -import java.util.List; - -import javax.swing.*; -import javax.swing.border.LineBorder; -import javax.swing.filechooser.FileNameExtensionFilter; - import com.fr.base.BaseUtils; -import com.fr.design.actions.file.WebPreviewUtils; -import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.PluginWebBridge; import com.fr.design.extra.ShopDialog; import com.fr.design.extra.WebManagerPaneFactory; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIPreviewButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; -import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; -import com.fr.general.IOUtils; import com.fr.general.Inter; +import javax.swing.*; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.IOException; + /** * Created with IntelliJ IDEA. * User: zx @@ -60,6 +48,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UIButton deleteButton; private static final int OFFSET_X = 140; private static final int OFFSET_Y = 26; + private SwingWorker sw; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -105,7 +94,19 @@ public class FormWidgetDetailPane extends FormDockView{ reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel.setBorder(null); if (elCaseBindInfoList == null) { - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + elCaseBindInfoList = new ElCaseBindInfo[0]; + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); } initReuWidgetPanel(); createRefreshButton(); @@ -178,8 +179,19 @@ public class FormWidgetDetailPane extends FormDockView{ refreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - refreshShareMoudule(); - refreshDownPanel(false); + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + ShareLoader.getLoader().refreshModule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); } }); From 544538e412ffbf350861e1db9c9ec13675f66de3 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Thu, 3 Nov 2016 20:26:34 +0800 Subject: [PATCH 141/244] 1 1 --- .../com/fr/design/designer/creator/XElementCase.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 37919ead96..b7ba2f65d9 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -22,13 +22,10 @@ import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; import com.fr.form.ui.ElementCaseEditor; import com.fr.general.Inter; -import com.fr.plugin.ExtraClassManager; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.stable.fun.ExtraAttrMapProvider; import com.fr.stable.fun.FitProvider; -import com.fr.stable.fun.IOFileAttrMark; import com.fr.stable.fun.ReportFitAttrProvider; import javax.swing.*; @@ -113,13 +110,6 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); ElementCaseEditor editor = this.toData(); - Set setAttr = ExtraClassManager.getInstance().getArray(ExtraAttrMapProvider.XML_TAG); - for (ExtraAttrMapProvider attrProvider:setAttr) { - if (attrProvider == null) { - continue; - } - editor.addAttrMark((IOFileAttrMark) attrProvider); - } FitProvider fitProvider = (FitProvider) designer.getTarget(); ReportFitAttrProvider fitAttr = fitProvider.getFitAttr(); //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) From c827c18443260351aeebfdbbe5ff10466a951e31 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 4 Nov 2016 11:40:50 +0800 Subject: [PATCH 142/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 6bcc9a2661..799be1b360 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -303,6 +303,7 @@ public class FormWidgetDetailPane extends FormDockView{ public void refreshDownPanel(boolean isEdit) { reuWidgetPanel.remove(downPanel); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); reuWidgetPanel.add(downPanel); repaintContainer(); From eb9f159c3f3fcd879384ecd0dcb7cc196e0c0bfa Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 4 Nov 2016 13:22:40 +0800 Subject: [PATCH 143/244] log --- 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 9e25a76c68..af8067ae53 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -248,7 +248,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { }); df.setVisible(true); } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); + FRLogger.getLogger().error(e.getMessage(), e); if (!isException) { showDesignerFrame(args, df, true); } else { From 6f5a6915b24575e0b70ba27f24e790cd564bacd4 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 4 Nov 2016 13:24:30 +0800 Subject: [PATCH 144/244] change --- ...umnEditor.java => CellDSColumnEditor.java} | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) rename designer/src/com/fr/quickeditor/cellquick/{CellDScolumnEditor.java => CellDSColumnEditor.java} (90%) diff --git a/designer/src/com/fr/quickeditor/cellquick/CellDScolumnEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java similarity index 90% rename from designer/src/com/fr/quickeditor/cellquick/CellDScolumnEditor.java rename to designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index f92b353943..11cea3e152 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellDScolumnEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -16,7 +16,7 @@ import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -public class CellDScolumnEditor extends CellQuickEditor { +public class CellDSColumnEditor extends CellQuickEditor { private JPanel dsColumnRegion; private JPanel centerPane; private SelectedDataColumnPane dataPane; @@ -55,16 +55,7 @@ public class CellDScolumnEditor extends CellQuickEditor { } }; - private static CellDScolumnEditor THIS; - - public static final CellDScolumnEditor getInstance() { - if (THIS == null) { - THIS = new CellDScolumnEditor(); - } - return THIS; - } - - private CellDScolumnEditor() { + private CellDSColumnEditor() { super(); } @@ -107,4 +98,14 @@ public class CellDScolumnEditor extends CellQuickEditor { this.validate(); } + + /** + * for 关闭时候释放 + */ + public void release () { + super.release(); + dsColumnRegion = null; + centerPane = null; + } + } \ No newline at end of file From 375bb008717ee5dd6dc5d86beeeab645920e7327 Mon Sep 17 00:00:00 2001 From: zhouping Date: Fri, 4 Nov 2016 13:50:11 +0800 Subject: [PATCH 145/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20dev?= =?UTF-8?q?=E8=A2=AB=E8=A6=86=E7=9B=96=E7=9A=84=E4=BB=A3=E7=A0=81=E8=BF=98?= =?UTF-8?q?=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java | 3 --- .../design/designer/properties/items/FRLayoutTypeItems.java | 4 ++-- .../src/com/fr/design/gui/core/FormWidgetOption.java | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index ab22986161..6b29a172e5 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -116,9 +116,6 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr moveComponents2FitLayout(xfl); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); formDesigner.getSelectionModel().setSelectedCreator(xfl); - xfl.convert(); - LayoutUtils.layoutContainer(xfl); - xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0); for (int i = 0; i < components.length; i++) { Component comp = xfl.getComponent(i); diff --git a/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java b/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java index cd9ddb439c..a19d975170 100644 --- a/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java +++ b/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java @@ -7,8 +7,8 @@ import com.fr.form.ui.container.WBodyLayoutType; */ public class FRLayoutTypeItems implements ItemProvider{ public static final Item[] ITEMS = new Item[] { - new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue())/*, - new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())*/}; + new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue()), + new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())}; public Item[] getItems() { return ITEMS; diff --git a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java index 545ffadf73..b3fa73a26d 100644 --- a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java +++ b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java @@ -1 +1 @@ -package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER/*, ABSOLUTELAYOUTCONTAINER*/}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Absolute"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Tab"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file +package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Absolute"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Tab"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file From b638168388be417717ef6d1514a9944141cd0374 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Fri, 4 Nov 2016 16:45:24 +0800 Subject: [PATCH 146/244] =?UTF-8?q?REPORT-745=20designer=5Fbase=E5=92=8Cfo?= =?UTF-8?q?rm=E4=BE=9D=E8=B5=96=E5=85=B3=E7=B3=BB=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/FormElementCaseEditorProvider.java | 6 +++--- .../AbstractFormElementCaseEditorProvider.java | 7 +++---- .../fr/design/designer/creator/XElementCase.java | 14 +++++--------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java index 4ad5699fdd..92a1a835f4 100644 --- a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java @@ -1,11 +1,11 @@ package com.fr.design.fun; -import com.fr.stable.fun.IOFileAttrMark; +import com.fr.form.FormProvider; +import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.stable.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.Mutable; import java.beans.PropertyDescriptor; -import java.util.Map; /** * Created by zhouping on 2015/9/10. @@ -16,7 +16,7 @@ public interface FormElementCaseEditorProvider extends Mutable { int CURRENT_LEVEL = 1; - PropertyDescriptor[] createPropertyDescriptor (Class temp, Map attrMarkMap, ReportFitAttrProvider reportFitAttr); + PropertyDescriptor[] createPropertyDescriptor(Class temp, FormProvider formProvider, ElementCaseEditorProvider editor); /** * 生成属性表 diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java index e6d4621aff..c3cdbaa422 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java @@ -1,12 +1,12 @@ package com.fr.design.fun.impl; import com.fr.design.fun.FormElementCaseEditorProvider; -import com.fr.stable.fun.IOFileAttrMark; +import com.fr.form.FormProvider; +import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.stable.fun.ReportFitAttrProvider; import com.fr.stable.fun.mark.API; import java.beans.PropertyDescriptor; -import java.util.Map; /** * Created by zhouping on 2015/9/10. @@ -23,8 +23,7 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme return this.getClass().getName(); } - @Override - public PropertyDescriptor[] createPropertyDescriptor(Class temp, Map attrMarkMap, ReportFitAttrProvider reportFitAttr) { + public PropertyDescriptor[] createPropertyDescriptor(Class temp, FormProvider reportAttr, ElementCaseEditorProvider editor) { return new PropertyDescriptor[0]; } diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index b7ba2f65d9..5d161969bf 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -20,7 +20,9 @@ import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer; import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseProvider; +import com.fr.form.FormProvider; import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; @@ -109,15 +111,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme continue; } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - ElementCaseEditor editor = this.toData(); - FitProvider fitProvider = (FitProvider) designer.getTarget(); - ReportFitAttrProvider fitAttr = fitProvider.getFitAttr(); - //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) - if (editor.getFitStateInPC() == 0) { - editor.setReportFitAttr(null); - } - ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : editor.getReportFitAttr(); - PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), editor.getAttrMarkMap(), reportFitAttr); + FormProvider formProvider = designer.getTarget(); + ElementCaseEditorProvider elementCaseEditorProvider = this.toData(); + PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formProvider, elementCaseEditorProvider); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } From 9bfce25c0aac31f39fb3a92de81645c420f42425 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Fri, 4 Nov 2016 16:47:02 +0800 Subject: [PATCH 147/244] 1 --- .../design/fun/impl/AbstractFormElementCaseEditorProvider.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java index c3cdbaa422..8764eaf898 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java @@ -23,6 +23,7 @@ public abstract class AbstractFormElementCaseEditorProvider implements FormEleme return this.getClass().getName(); } + @Override public PropertyDescriptor[] createPropertyDescriptor(Class temp, FormProvider reportAttr, ElementCaseEditorProvider editor) { return new PropertyDescriptor[0]; } From da81437dc1d6a472cf910a8fc138db69a0cdca6d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Sun, 6 Nov 2016 16:51:38 +0800 Subject: [PATCH 148/244] =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/ChartTypeButtonPane.java | 2 ++ .../mainframe/chart/gui/ChartTypePane.java | 32 ++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index f9c6e572c6..786b3d1bda 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -283,6 +283,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private void changeCollectionSelected(String name) { if (editingCollection != null) { + //图表切换事件生效 + editingCollection.setChangeEvent(true); int count = editingCollection.getChartCount(); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(name, editingCollection.getChartName(i))) { 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 bd63724e1b..5b55562152 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 @@ -8,7 +8,6 @@ import com.fr.chart.chartattr.SwitchState; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.chart.fun.IndependentChartUIProvider; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.icombobox.UIComboBox; @@ -45,6 +44,8 @@ public class ChartTypePane extends AbstractChartAttrPane{ private SwitchState paneState = SwitchState.DEFAULT; //记录当前面板是谁在使用切换状态 private String chartID = StringUtils.EMPTY; + //记录当前面板是否处在图表切换的事件状态 + private boolean isChangEvent = false; public SwitchState getPaneState() { return paneState; @@ -61,6 +62,17 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void setChartID(String chartID) { this.chartID = chartID; } + + //使用一次即失效 + public boolean useChangEvent() { + boolean event = isChangEvent; + isChangEvent = false; + return event; + } + + public void setChangEvent(boolean changEvent) { + isChangEvent = changEvent; + } } @Override @@ -127,7 +139,13 @@ public class ChartTypePane extends AbstractChartAttrPane{ protected String title4PopupWindow() { return null; } - + + /** + * 不同图表切换分同一个selected的不同图表切换和不同selected的不同图表切换 + * 如果是切换图表的某个图表发生变化,则collection的选择下标不会变 + * 如果是切换图表的不同图表之间切换,则collection的选择下标会改变 + * @param chart + */ public void updateBean(Chart chart) { Plot oldPlot = chart.getPlot(); @@ -161,9 +179,12 @@ public class ChartTypePane extends AbstractChartAttrPane{ boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ + if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID)) || paneState.useChangEvent()){ editPane.reLayout(chart); } + + //重置面板切换事件状态 + paneState.setChangEvent(false); } } @@ -291,7 +312,10 @@ public class ChartTypePane extends AbstractChartAttrPane{ editingCollection = collection; buttonPane.update(collection);// 内部操作时 已经做过处理. Chart chart = collection.getSelectedChart(); - + //判断是否是图表切换事件 + if (collection.useChangeEvent()){ + paneState.setChangEvent(true); + } chartTypePane.updateBean(chart); } From 7437f96267eec11191f5d5a77f65a8ae32667ee6 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 7 Nov 2016 09:56:50 +0800 Subject: [PATCH 149/244] =?UTF-8?q?=E5=86=8Ddev=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A0=91=E6=9E=81=E9=80=9F=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=EF=BC=88=E4=B9=8B=E5=89=8Dmaster=E5=9B=9E=E9=80=80=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=8F=88=E8=87=AA=E5=8A=A8=E6=8A=8Adev?= =?UTF-8?q?=E5=9B=9E=E9=80=80=E4=BA=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/frpane/TreeSettingPane.java | 79 ++++++++++++++----- 1 file changed, 59 insertions(+), 20 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java index f0a94f3050..65df6f0625 100644 --- a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java @@ -1,40 +1,48 @@ package com.fr.design.gui.frpane; -import java.awt.BorderLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -import com.fr.data.impl.TreeNodeWrapper; -import com.fr.design.data.DataCreatorUI; -import com.fr.design.gui.ilable.UILabel; - -import javax.swing.*; - -import com.fr.general.NameObject; import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TreeAttr; import com.fr.data.impl.TreeNodeAttr; +import com.fr.data.impl.TreeNodeWrapper; +import com.fr.design.data.DataCreatorUI; +import com.fr.design.dialog.BasicPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.frpane.tree.layer.config.LayerDataControlPane; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.TreeDataCardPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.dialog.BasicPane; import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeEditor; +import com.fr.form.ui.tree.LayerConfig; import com.fr.general.Inter; +import com.fr.general.NameObject; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; public class TreeSettingPane extends BasicPane implements DataCreatorUI { private JTreeControlPane controlPane; + private JTreeAutoBuildPane autoBuildPane; + + /** + * 新的分层构建方式 + */ + private LayerDataControlPane layerDataControlPane; + private UIComboBox buildBox; + /** * */ private static final long serialVersionUID = 1762889323082827111L; - private String[] buildWay = new String[] { Inter.getLocText("FR-Designer_Layer-Build"), - Inter.getLocText("FR-Designer_Auto-Build") }; + private String[] buildWay = new String[]{Inter.getLocText("FR-Designer_DataTable-Build"), + Inter.getLocText("FR-Designer_Auto-Build"), Inter.getLocText("FR-Designer_Layer-Build")}; public TreeSettingPane(boolean isEditor) { this.initComponents(isEditor); @@ -58,14 +66,30 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { controlPane = new JTreeControlPane(new NameableCreator[] { treeNode }, new TreeDataCardPane(), isEditor); autoBuildPane = new JTreeAutoBuildPane(); + layerDataControlPane = new LayerDataControlPane(); this.add(buildWayPanel, BorderLayout.NORTH); cardChanged(0); } private void cardChanged(int index) { + this.remove(controlPane); this.remove(autoBuildPane); - this.add(index == 0 ? controlPane : autoBuildPane, BorderLayout.CENTER); + this.remove(layerDataControlPane); + switch (index) { + case 0: + this.add(layerDataControlPane); + break; + case 1: + this.add(autoBuildPane); + break; + case 2: + this.add(controlPane); + + break; + default: + break; + } validate(); repaint(); revalidate(); @@ -101,8 +125,17 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { buildBox.setSelectedIndex(1); TableDataDictionary dictionary = treeEditor.getDictionary(); autoBuildPane.populate(dictionary); - } else { + } else if (treeEditor.isLayerBuild()) { buildBox.setSelectedIndex(0); + java.util.List layerConfigList = treeEditor.getLayerConfigs(); + LayerConfig[] layerConfigs = new LayerConfig[layerConfigList.size()]; + int i = 0; + for (LayerConfig layerConfig : layerConfigList) { + layerConfigs[i++] = layerConfig; + } + this.layerDataControlPane.populate(new NameObject("tree", layerConfigs)); + } else { + buildBox.setSelectedIndex(2); } } @@ -123,7 +156,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { te.setAutoBuild(true); te.setDictionary(dictionary); te.setNodeOrDict(dictionary); - } else { + } else if (buildBox.getSelectedIndex() == 2) { te.setAutoBuild(false); NameObject no = this.controlPane.update(); if (no != null) { @@ -150,11 +183,14 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { * @return */ public Object updateTreeNodeAttrs() { - if(buildBox.getSelectedIndex() == 0) { + + if (buildBox.getSelectedIndex() == 2) { NameObject no = controlPane.update(); if (no != null) { return no.getObject(); } + } else if (buildBox.getSelectedIndex() == 0) { + return layerDataControlPane.update(); } else { return autoBuildPane.update(); } @@ -172,7 +208,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { tcb.setAutoBuild(true); tcb.setDictionary(dictionary); tcb.setNodeOrDict(dictionary); - } else { + } else if (buildBox.getSelectedIndex() == 2) { tcb.setAutoBuild(false); NameObject no = this.controlPane.update(); if (no != null) { @@ -204,12 +240,15 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { */ public void populate(Object nodeOrDict) { if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) { - buildBox.setSelectedIndex(0); + buildBox.setSelectedIndex(2); NameObject no = new NameObject("name", nodeOrDict); controlPane.populate(no); } else if(nodeOrDict instanceof TableDataDictionary) { buildBox.setSelectedIndex(1); autoBuildPane.populate((TableDataDictionary)nodeOrDict); + } else if (nodeOrDict instanceof NameObject) { + buildBox.setSelectedIndex(0); + layerDataControlPane.populate((NameObject) nodeOrDict); } } } \ No newline at end of file From 1a6500d1a4a906f095ab43b95f5f4343089d988e Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 7 Nov 2016 14:15:51 +0800 Subject: [PATCH 150/244] =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/chart/gui/ChartComponent.java | 2 +- .../chart/gui/ChartTypeButtonPane.java | 6 ++-- .../mainframe/chart/gui/ChartTypePane.java | 32 +++++++------------ 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java index 8565135629..5ce350450b 100644 --- a/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java +++ b/designer_chart/src/com/fr/design/chart/gui/ChartComponent.java @@ -315,7 +315,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene //不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单 //其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边 //处理画图事件 - Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this); + Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this, null); g2d.drawImage(chartImage, 0, 0, null); } } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 786b3d1bda..49e64385e6 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -283,12 +283,14 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private void changeCollectionSelected(String name) { if (editingCollection != null) { - //图表切换事件生效 - editingCollection.setChangeEvent(true); int count = editingCollection.getChartCount(); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(name, editingCollection.getChartName(i))) { editingCollection.setSelectedIndex(i); + //重构面板 + if (parent != null){ + parent.relayOutEditPane(editingCollection.getSelectedChart()); + } break; } } 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 5b55562152..6d6635b1eb 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 @@ -44,8 +44,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ private SwitchState paneState = SwitchState.DEFAULT; //记录当前面板是谁在使用切换状态 private String chartID = StringUtils.EMPTY; - //记录当前面板是否处在图表切换的事件状态 - private boolean isChangEvent = false; public SwitchState getPaneState() { return paneState; @@ -62,17 +60,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void setChartID(String chartID) { this.chartID = chartID; } - - //使用一次即失效 - public boolean useChangEvent() { - boolean event = isChangEvent; - isChangEvent = false; - return event; - } - - public void setChangEvent(boolean changEvent) { - isChangEvent = changEvent; - } } @Override @@ -179,12 +166,9 @@ public class ChartTypePane extends AbstractChartAttrPane{ boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID)) || paneState.useChangEvent()){ + if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ editPane.reLayout(chart); } - - //重置面板切换事件状态 - paneState.setChangEvent(false); } } @@ -278,6 +262,16 @@ public class ChartTypePane extends AbstractChartAttrPane{ } + /** + * 重构面板 + * @param chart + */ + public void relayOutEditPane(Chart chart){ + if (editPane != null){ + editPane.reLayout(chart); + } + } + public void reactorChartTypePane(ChartCollection collection){ if (needReactor(collection)) { @@ -312,10 +306,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ editingCollection = collection; buttonPane.update(collection);// 内部操作时 已经做过处理. Chart chart = collection.getSelectedChart(); - //判断是否是图表切换事件 - if (collection.useChangeEvent()){ - paneState.setChangEvent(true); - } chartTypePane.updateBean(chart); } From c153cdc433b3817e43f9ae774e953072bc2659ea Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 7 Nov 2016 14:19:18 +0800 Subject: [PATCH 151/244] update --- .../com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 2 +- .../src/com/fr/design/mainframe/chart/gui/ChartTypePane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 49e64385e6..46722836af 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -289,7 +289,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen editingCollection.setSelectedIndex(i); //重构面板 if (parent != null){ - parent.relayOutEditPane(editingCollection.getSelectedChart()); + parent.reLayoutEditPane(editingCollection.getSelectedChart()); } break; } 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 6d6635b1eb..a286b39c8c 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 @@ -266,7 +266,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ * 重构面板 * @param chart */ - public void relayOutEditPane(Chart chart){ + public void reLayoutEditPane(Chart chart){ if (editPane != null){ editPane.reLayout(chart); } From 51e95ad3aa6e0aac9f846b6380136dedb9f669dd Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 7 Nov 2016 14:26:00 +0800 Subject: [PATCH 152/244] =?UTF-8?q?=E5=86=85=E5=AD=98=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/module/DesignerModule.java | 33 +- .../fr/poly/creator/ChartBlockCreator.java | 2 +- .../com/fr/quickeditor/CellQuickEditor.java | 2 +- .../com/fr/quickeditor/ChartQuickEditor.java | 18 +- .../fr/design/actions/core/ActionFactory.java | 36 +- .../design/actions/file/SwitchExistEnv.java | 16 +- .../design/data/DesignTableDataManager.java | 44 +- .../data/datapane/TableDataComboBox.java | 1 + .../design/event/TemplateTreeDragSource.java | 37 -- .../design/file/HistoryTemplateListPane.java | 8 + .../fr/design/file/MutilTempalteTabPane.java | 2 +- .../com/fr/design/fun/ElementUIProvider.java | 2 +- .../gui/chart/BaseChartPropertyPane.java | 6 +- .../gui/chart/ChartEditPaneProvider.java | 13 + .../fr/design/gui/frpane/UIComboBoxPane.java | 3 + .../gui/itree/filetree/EnvFileTree.java | 3 - .../design/mainframe/HelpDialogManager.java | 1 + .../fr/design/module/DesignModuleFactory.java | 2 +- .../com/fr/design/selection/QuickEditor.java | 8 + .../gui/active/DataSeriesActiveGlyph.java | 6 +- .../action/SetAnalysisLineStyleAction.java | 4 +- .../gui/active/action/SetAxisStyleAction.java | 6 +- .../active/action/SetChartStyleAciton.java | 4 +- .../action/SetDataLabelStyleAction.java | 4 +- .../action/SetDataSeriesAttrAction.java | 4 +- .../gui/active/action/SetDataSheetAction.java | 4 +- .../active/action/SetLegendStyleAction.java | 4 +- .../gui/active/action/SetPlotStyleAction.java | 4 +- .../active/action/SetTitleStyleAction.java | 4 +- .../impl/ChartHyperPoplinkPane.java | 6 +- .../mainframe/ChartAndWidgetPropertyPane.java | 143 ------ .../fr/design/mainframe/ChartDesigner.java | 34 -- .../mainframe/ChartDesignerPropertyPane.java | 134 ------ .../design/mainframe/ChartPropertyPane.java | 13 +- .../fr/design/mainframe/ChartUndoState.java | 47 -- .../src/com/fr/design/mainframe/JChart.java | 376 ---------------- .../mainframe/MiddleChartPropertyPane.java | 16 +- .../actions/AbstractExportAction4JChart.java | 132 ------ .../actions/ExcelExportAction4Chart.java | 68 --- .../mainframe/actions/JChartAction.java | 21 - .../mainframe/actions/NewChartAction.java | 61 --- .../actions/PDFExportAction4Chart.java | 65 --- .../actions/PNGExportAction4Chart.java | 66 --- .../chart/AbstractChartAttrPane.java | 1 + .../design/mainframe/chart/ChartEditPane.java | 16 +- .../mainframe/chart/gui/ChartDataPane.java | 1 + .../chart/gui/ChartTypeButtonPane.java | 32 +- .../chart/gui/data/DatabaseTableDataPane.java | 1 + .../chart/gui/data/NormalChartDataPane.java | 1 + .../chart/gui/data/ReportDataPane.java | 6 +- .../chart/gui/other/ChartSwitchPane.java | 4 +- .../exporter/ExcelExporter4Chart.java | 94 ---- .../mainframe/exporter/Exporter4Chart.java | 25 -- .../exporter/ImageExporter4Chart.java | 89 ---- .../mainframe/exporter/PdfExporter4Chart.java | 382 ---------------- .../fr/design/module/ChartDesignerModule.java | 2 +- .../fr/design/module/ChartStartModule.java | 95 ---- .../src/com/fr/start/ChartSplashPane.java | 18 - .../src/com/fr/start/Designer4Chart.java | 406 ------------------ .../fr/design/mainframe/CoverReportPane.java | 22 +- .../mainframe/FormHierarchyTreePane.java | 6 + 61 files changed, 232 insertions(+), 2432 deletions(-) delete mode 100644 designer_base/src/com/fr/design/event/TemplateTreeDragSource.java create mode 100644 designer_base/src/com/fr/design/gui/chart/ChartEditPaneProvider.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/ChartAndWidgetPropertyPane.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/ChartDesignerPropertyPane.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/ChartUndoState.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/JChart.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/actions/AbstractExportAction4JChart.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/actions/JChartAction.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/actions/NewChartAction.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/actions/PDFExportAction4Chart.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/actions/PNGExportAction4Chart.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/exporter/Exporter4Chart.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/exporter/ImageExporter4Chart.java delete mode 100644 designer_chart/src/com/fr/design/mainframe/exporter/PdfExporter4Chart.java delete mode 100644 designer_chart/src/com/fr/design/module/ChartStartModule.java delete mode 100644 designer_chart/src/com/fr/start/ChartSplashPane.java delete mode 100644 designer_chart/src/com/fr/start/Designer4Chart.java diff --git a/designer/src/com/fr/design/module/DesignerModule.java b/designer/src/com/fr/design/module/DesignerModule.java index 13dc722dc8..9e0837ac09 100644 --- a/designer/src/com/fr/design/module/DesignerModule.java +++ b/designer/src/com/fr/design/module/DesignerModule.java @@ -111,17 +111,17 @@ public class DesignerModule extends DesignModule { */ private void registerCellEditor() { - ActionFactory.registerCellEditor(String.class, CellStringQuickEditor.getInstance()); - ActionFactory.registerCellEditor(Number.class, CellStringQuickEditor.getInstance()); - ActionFactory.registerCellEditor(Formula.class, CellStringQuickEditor.getInstance()); - ActionFactory.registerCellEditor(SubReport.class, CellSubReportEditor.getInstance()); - ActionFactory.registerCellEditor(RichText.class, CellRichTextEditor.getInstance()); - ActionFactory.registerCellEditor(DSColumn.class, CellDScolumnEditor.getInstance()); - ActionFactory.registerCellEditor(Image.class, CellImageQuickEditor.getInstance()); - ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor()); - ActionFactory.registerCellEditor(BufferedImage.class, CellImageQuickEditor.getInstance()); - - ActionFactory.registerChartCellEditorInEditor(ChartQuickEditor.getInstance()); + ActionFactory.registerCellEditor(String.class, CellStringQuickEditor.class); + ActionFactory.registerCellEditor(Number.class, CellStringQuickEditor.class); + ActionFactory.registerCellEditor(Formula.class, CellStringQuickEditor.class); + ActionFactory.registerCellEditor(SubReport.class, CellSubReportEditor.class); + ActionFactory.registerCellEditor(RichText.class, CellRichTextEditor.class); + ActionFactory.registerCellEditor(DSColumn.class, CellDSColumnEditor.class); + ActionFactory.registerCellEditor(Image.class, CellImageQuickEditor.class); + ActionFactory.registerCellEditor(BiasTextPainter.class, CellBiasTextPainterEditor.class); + ActionFactory.registerCellEditor(BufferedImage.class, CellImageQuickEditor.class); + + ActionFactory.registerChartCellEditorInEditor(ChartQuickEditor.class); Set providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); for (ElementUIProvider provider : providers) { @@ -139,14 +139,13 @@ public class DesignerModule extends DesignModule { * kunnat: 注册悬浮选中Editor */ private void registerFloatEditor() { - FloatStringQuickEditor floatStringQuickEditor = new FloatStringQuickEditor(); - ActionFactory.registerFloatEditor(String.class, floatStringQuickEditor); - ActionFactory.registerFloatEditor(Formula.class, floatStringQuickEditor); + ActionFactory.registerFloatEditor(String.class, FloatStringQuickEditor.class); + ActionFactory.registerFloatEditor(Formula.class, FloatStringQuickEditor.class); FloatImageQuickEditor floatImageQuickEditor = new FloatImageQuickEditor(); - ActionFactory.registerFloatEditor(Image.class, floatImageQuickEditor); - ActionFactory.registerFloatEditor(BufferedImage.class, floatImageQuickEditor); - ActionFactory.registerChartFloatEditorInEditor(ChartQuickEditor.getInstance()); + ActionFactory.registerFloatEditor(Image.class, FloatImageQuickEditor.class); + ActionFactory.registerFloatEditor(BufferedImage.class, FloatImageQuickEditor.class); + ActionFactory.registerChartFloatEditorInEditor(ChartQuickEditor.class); } /** diff --git a/designer/src/com/fr/poly/creator/ChartBlockCreator.java b/designer/src/com/fr/poly/creator/ChartBlockCreator.java index ca939295be..ca8106ffae 100644 --- a/designer/src/com/fr/poly/creator/ChartBlockCreator.java +++ b/designer/src/com/fr/poly/creator/ChartBlockCreator.java @@ -142,7 +142,7 @@ public class ChartBlockCreator extends BlockCreator { @Override public QuickEditor getQuickEditor(TargetComponent tc) { - ChartQuickEditor quitEditor = ChartQuickEditor.getInstance(); + ChartQuickEditor quitEditor = new ChartQuickEditor(); quitEditor.populate(tc); return quitEditor; } diff --git a/designer/src/com/fr/quickeditor/CellQuickEditor.java b/designer/src/com/fr/quickeditor/CellQuickEditor.java index e1b11cedab..1190b433a6 100644 --- a/designer/src/com/fr/quickeditor/CellQuickEditor.java +++ b/designer/src/com/fr/quickeditor/CellQuickEditor.java @@ -30,7 +30,7 @@ import java.awt.event.MouseEvent; */ public abstract class CellQuickEditor extends QuickEditor { - protected UITextField columnRowTextField; + protected UITextField columnRowTextField; protected UIButton cellElementEditButton; protected TemplateCellElement cellElement; diff --git a/designer/src/com/fr/quickeditor/ChartQuickEditor.java b/designer/src/com/fr/quickeditor/ChartQuickEditor.java index c187f1a449..f0f68a9a73 100644 --- a/designer/src/com/fr/quickeditor/ChartQuickEditor.java +++ b/designer/src/com/fr/quickeditor/ChartQuickEditor.java @@ -16,29 +16,17 @@ import com.fr.design.selection.QuickEditor; import java.awt.*; public class ChartQuickEditor extends QuickEditor{ - private static ChartQuickEditor THIS; - // kunsnat: editingPropertyPane初始化 避开设计器启动, 在用到的时候再初始化. - private BaseChartPropertyPane editingPropertyPane = null; - - public static final ChartQuickEditor getInstance() { - if(THIS == null) { - THIS = new ChartQuickEditor(); - } - return THIS; - } + //private BaseChartPropertyPane editingPropertyPane = null; - private ChartQuickEditor() { + public ChartQuickEditor() { setLayout(new BorderLayout()); setBorder(null); } @Override protected void refresh() { - if(editingPropertyPane != null) { - remove(editingPropertyPane); - } - + BaseChartPropertyPane editingPropertyPane = null; BaseChartCollection collection = null; if(tc instanceof PolyDesigner) { ChartBlockEditor chartBlockEditor = (ChartBlockEditor)((PolyDesigner)tc).getSelection().getEditor(); diff --git a/designer_base/src/com/fr/design/actions/core/ActionFactory.java b/designer_base/src/com/fr/design/actions/core/ActionFactory.java index 4b3eecb3ca..55a72002f4 100644 --- a/designer_base/src/com/fr/design/actions/core/ActionFactory.java +++ b/designer_base/src/com/fr/design/actions/core/ActionFactory.java @@ -10,6 +10,7 @@ import com.fr.design.selection.QuickEditor; import javax.swing.*; import java.awt.event.KeyEvent; import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.util.*; /** @@ -22,11 +23,11 @@ public class ActionFactory { private ActionFactory() { } - private static Map floatEditor = new HashMap(); + private static Map> floatEditor = new HashMap>(); private static Class chartCollectionClass = null; - private static Map cellEditor = new HashMap(); + private static Map> cellEditor = new HashMap>(); private static UpdateAction chartPreStyleAction = null; @@ -36,17 +37,18 @@ public class ActionFactory { * @param clazz 待说明 * @param editor 待说明 */ - public static void registerCellEditor(Class clazz, QuickEditor editor) { + public static void registerCellEditor(Class clazz, Class editor) { cellEditor.put(clazz, editor); } + /** * 待说明 * * @param clazz 待说明 * @param editor 待说明 */ - public static void registerFloatEditor(Class clazz, QuickEditor editor) { + public static void registerFloatEditor(Class clazz, Class editor) { floatEditor.put(clazz, editor); } @@ -84,7 +86,7 @@ public class ActionFactory { * * @param editor 待说明 */ - public static void registerChartFloatEditorInEditor(QuickEditor editor) { + public static void registerChartFloatEditorInEditor(Class editor) { if (chartCollectionClass != null) { floatEditor.put(chartCollectionClass, editor); } @@ -95,7 +97,7 @@ public class ActionFactory { * * @param editor 待说明 */ - public static void registerChartCellEditorInEditor(QuickEditor editor) { + public static void registerChartCellEditorInEditor(Class editor) { if (chartCollectionClass != null) { cellEditor.put(chartCollectionClass, editor); } @@ -105,11 +107,29 @@ public class ActionFactory { * 返回 悬浮元素选中的Editor */ public static QuickEditor getFloatEditor(Class clazz) { - return floatEditor.get(clazz); + return createEditor(clazz, floatEditor); + } + + private static QuickEditor createEditor(Class clazz, Map> editorMap) { + Class c = editorMap.get(clazz); + try { + Constructor constructor = c.getDeclaredConstructor(); + constructor.setAccessible(true); + return constructor.newInstance(); + } catch (NoSuchMethodException e) { + FRContext.getLogger().error(e.getMessage(), e); + } catch (IllegalAccessException e) { + FRContext.getLogger().error(e.getMessage(), e); + } catch (InstantiationException e) { + FRContext.getLogger().error(e.getMessage(), e); + } catch (InvocationTargetException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + return null; } public static QuickEditor getCellEditor(Class clazz) { - return cellEditor.get(clazz); + return createEditor(clazz, cellEditor); } /** 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 8854e777b8..8545d85d06 100644 --- a/designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer_base/src/com/fr/design/actions/file/SwitchExistEnv.java @@ -10,6 +10,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.TemplatePane; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; @@ -41,12 +42,15 @@ public class SwitchExistEnv extends MenuDef { this.setName(getMenuKeySet().getMenuName()); this.setHasScrollSubMenu(true); initMenuDef(); - GeneralContext.addEnvWillChangedListener(new EnvChangedListener() { - public void envChanged() { - SwitchExistEnv.this.clearShortCuts(); - initMenuDef(); - } - }); + JTemplate t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if(t != null) { + GeneralContext.addEnvWillChangedListener(t.getFullPathName(), new EnvChangedListener() { + public void envChanged() { + SwitchExistEnv.this.clearShortCuts(); + initMenuDef(); + } + }); + } } private void initMenuDef() { diff --git a/designer_base/src/com/fr/design/data/DesignTableDataManager.java b/designer_base/src/com/fr/design/data/DesignTableDataManager.java index 5ec6dd1d57..e0569424dc 100644 --- a/designer_base/src/com/fr/design/data/DesignTableDataManager.java +++ b/designer_base/src/com/fr/design/data/DesignTableDataManager.java @@ -13,8 +13,10 @@ import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedureConstants; import com.fr.design.data.tabledata.wrapper.*; import com.fr.design.DesignModelAdapter; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; import com.fr.design.parameter.ParameterInputPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.file.DatasourceManager; @@ -34,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,7 +57,10 @@ public abstract class DesignTableDataManager { */ private static java.util.Map globalDsCache = new java.util.HashMap(); private static java.util.Map dsNameChangedMap = new HashMap(); - private static List dsListeners = new ArrayList(); +// private static List dsListeners = new ArrayList(); + + private static Map> dsListenersMap = new HashMap>(); + public static String NO_PARAMETER = "no_paramater_pane"; @@ -73,15 +79,31 @@ public abstract class DesignTableDataManager { * 响应数据集改变. */ private static void fireDsChanged() { - for (int i = 0; i < dsListeners.size(); i++) { - //增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener), - // 由于dsListeners是arraylist, 此时会ConcurrentModifyException + for(Entry> listenerEntry : dsListenersMap.entrySet()) { + List dsListeners = listenerEntry.getValue(); + for (int i = 0; i < dsListeners.size(); i++) { + //增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener), + // 由于dsListeners是arraylist, 此时会ConcurrentModifyException // for (ChangeListener l : dsListeners) { - ChangeEvent e = null; - dsListeners.get(i).stateChanged(e); + ChangeEvent e = null; + dsListeners.get(i).stateChanged(e); + } + } + } + + public static void closeTemplate(JTemplate template) { + if(template != null) { + dsListenersMap.remove(template.getFullPathName()); } } + public static void envChange() { + dsListenersMap.clear(); + dsNameChangedMap.clear(); + clearGlobalDs(); + } + + /** * 响应数据集改变 * @@ -127,6 +149,16 @@ public abstract class DesignTableDataManager { * @param l ChangeListener监听器 */ public static void addDsChangeListener(ChangeListener l) { + JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + String key = StringUtils.EMPTY; + if(template != null) { + key = template.getFullPathName(); + } + List dsListeners = dsListenersMap.get(key); + if (dsListeners == null) { + dsListeners = new ArrayList(); + dsListenersMap.put(key, dsListeners); + } dsListeners.add(l); } diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataComboBox.java b/designer_base/src/com/fr/design/data/datapane/TableDataComboBox.java index 711c2fc717..4286bbe4ba 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataComboBox.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataComboBox.java @@ -146,4 +146,5 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC } }); } + } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/event/TemplateTreeDragSource.java b/designer_base/src/com/fr/design/event/TemplateTreeDragSource.java deleted file mode 100644 index 7b387305c1..0000000000 --- a/designer_base/src/com/fr/design/event/TemplateTreeDragSource.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.event; - -import com.fr.design.gui.itree.filetree.TemplateFileTree; -import com.fr.design.mainframe.dnd.ArrayTransferable; -import com.fr.design.mainframe.dnd.SerializableTransferable; -import com.fr.general.web.ParameterConsts; -import com.fr.stable.StringUtils; - -import javax.swing.*; -import java.awt.*; -import java.awt.dnd.DragGestureEvent; -import java.awt.dnd.DragGestureListener; -import java.awt.dnd.DragSource; -import java.awt.dnd.DragSourceAdapter; - -/** - * Created with IntelliJ IDEA. - * User: richie - * Date: 13-11-4 - * Time: 下午2:17 - */ -public class TemplateTreeDragSource extends DragSourceAdapter implements DragGestureListener { - private DragSource source; - - public TemplateTreeDragSource(JTree tree, int actions) { - source = new DragSource(); - source.createDefaultDragGestureRecognizer(tree, actions, this); - - } - public void dragGestureRecognized(DragGestureEvent dge) { - Component comp = dge.getComponent(); - if (comp instanceof TemplateFileTree) { - String selectedPath = ((TemplateFileTree)comp).getSelectedTemplatePath(); - source.startDrag(dge, DragSource.DefaultLinkDrop, new SerializableTransferable(selectedPath), this); - } - } -} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java b/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java index 26aa72f146..50cdf00cf9 100644 --- a/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java @@ -9,8 +9,11 @@ import java.util.logging.Level; import javax.swing.*; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.actions.core.ActionFactory; import com.fr.design.constants.UIConstants; import com.fr.design.DesignerEnvManager; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.gui.ilable.UILabel; import javax.swing.event.ListSelectionEvent; @@ -24,9 +27,11 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilist.UIList; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.design.module.DesignModuleFactory; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; +import com.fr.general.GeneralContext; import com.fr.general.Inter; import com.fr.stable.Constants; import com.fr.stable.project.ProjectConstants; @@ -102,6 +107,9 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations { * @param selected 选择的 */ public void closeSelectedReport(JTemplate selected) { + DesignModuleFactory.clearChartPropertyPane(); + DesignTableDataManager.closeTemplate(selected); + GeneralContext.removeEnvWillChangedListener(selected.getFullPathName()); if (contains(selected) == -1) { return; } diff --git a/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java b/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java index 15c0f0bfbf..794c6a5e44 100644 --- a/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java @@ -1 +1 @@ -package com.fr.design.file; import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.Arc2D; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; import java.io.File; import java.util.logging.Level; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.ButtonModel; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.plaf.basic.BasicMenuItemUI; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.stable.Constants; import com.fr.stable.ProductConstants; import com.fr.stable.project.ProjectConstants; /** * Author : daisy * Date: 13-8-5 * Time: 下午6:12 */ public class MutilTempalteTabPane extends JComponent implements MouseListener, MouseMotionListener, Action { private static Icon LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_normal.png"); private static Icon MOUSE_OVER_LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_pressed.png"); private static Icon MOUSE_PRESS_LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_pressed.png"); private static Icon CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); private static Icon MOUSE_OVER_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/mouseoverclose icon.png"); private static Icon MOUSE_PRESS_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/pressclose icon.png"); private static final String ELLIPSIS = "..."; private static final int GAP_BEFORE_CLOSE = 10; private static final int GAP = 5; private static final int SMALLGAP = 3; private static final int LIST_BUTTON_WIDTH = 34; private static final int HEIGHT = 26; private static final int LIST_DOWN_HEIGHT = 25; private static final double FOR_CAL_BYTES = 0.5; private static final double CORNOR_RADIUS = 0.0; //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 private static final double SPECIAL_LOCATION_1 = 2.5; private static final double SPECIAL_LOCATION_2 = 4.330127; private static final int ICON_WIDTH = 22; //每个标签页的最大的长度和最小长度。这些长度均为均分 private static final int MAXWIDTH = 240; private static final int MINWIDTH = 100; private static MutilTempalteTabPane THIS; //用于存放工作簿 private java.util.List> openedTemplate; //选中的Tab项 private int selectedIndex = 0; // private int mouseOveredIndex = -1; //tab栏可以放下的每个tab的实际宽度 private int realWidth = MAXWIDTH; //当前标签页栏存放的所有标签页的index private int minPaintIndex = 0; private int maxPaintIndex = 0; /** * 鼠标按下时的坐标数组、鼠标放开时的坐标数组 */ private int[] xyPressedCoordinate = {0, 0}; //每个关闭图标的起始位置 private int[] startX; private boolean[] isNeedToolTips; private Graphics2D g2d; //记录关闭按钮的状态 private int closeIconIndex = -1; private boolean isCloseCurrent = false; private Icon clodeMode = CLOSE; private Icon listDownMode = LIST_DOWN; private boolean isShowList = false; //自动新建的模板B若没有进行任何编辑,切换到其他 // // 模板时,模板B会自动关闭 private JTemplate temTemplate = null; private AWTEventListener awt = new AWTEventListener() { public void eventDispatched(AWTEvent event) { if (event instanceof MouseEvent) { MouseEvent mv = (MouseEvent) event; if (mv.getClickCount() > 0 && !ComparatorUtils.equals(mv.getSource(), MutilTempalteTabPane.this)) { isShowList = false; } } } }; public static final MutilTempalteTabPane getInstance() { if (THIS == null) { THIS = new MutilTempalteTabPane(); } return THIS; } public JTemplate getSelectedFile() { return openedTemplate.get(selectedIndex); } /** * 关闭掉当前已打开文件列表中指定的文件 * * @param file 指定的文件 * */ public void closeFileTemplate(FILE file){ for (JTemplate temp : openedTemplate) { if(ComparatorUtils.equals(file, temp.getEditingFILE())){ closeSpecifiedTemplate(temp); break; } } } public Dimension getPreferredSize() { Dimension dimension = super.getPreferredSize(); dimension.height = HEIGHT; return dimension; } /** * 多工作簿面板 */ public MutilTempalteTabPane() { this.setLayout(new BorderLayout(0, 0)); this.addMouseListener(this); this.addMouseMotionListener(this); this.setBorder(null); this.setForeground(new Color(99, 99, 99)); this.setFont(new Font(Inter.getLocText("FR-Designer_Song_TypeFace"), 0, 12)); openedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); selectedIndex = openedTemplate.size() - 1; Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); } private UIMenuItem initCloseOther() { UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer_FS_Close_Other_Templates")); setListDownItemPreferredSize(closeOther); closeOther.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (openedTemplate.size() == 1) { return; } SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false); //点击关闭其他模板,并且点击确定保存 if (saveSomeTempaltePane.showSavePane()) { for (int i = 0; i < openedTemplate.size(); i++) { if (i != selectedIndex) { //判断关闭的模板是不是格式刷的被参照的模板 closeFormat(openedTemplate.get(i)); HistoryTemplateListPane.getInstance().closeSelectedReport(openedTemplate.get(i)); } } JTemplate currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); HistoryTemplateListPane.getInstance().removeAllHistory(); DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate); THIS.repaint(); } //如果取消保存了,则不关闭其他模板 } }); if (openedTemplate.size() == 1) { closeOther.setEnabled(false); } return closeOther; } private UIMenuItem[] createListDownTemplate() { UIMenuItem[] templates = new UIMenuItem[openedTemplate.size()]; for (int i = 0; i < openedTemplate.size(); i++) { final int index = i; final JTemplate tem = openedTemplate.get(i); templates[i] = new UIMenuItem(tempalteShowName(tem), tem.getIcon()); templates[i].setUI(new UIListDownItemUI()); setListDownItemPreferredSize(templates[i]); if (i == selectedIndex) { //画选中的高亮 templates[i].setBackground(UIConstants.SHADOW_CENTER); } templates[i].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectedIndex = index; DesignerContext.getDesignerFrame().addAndActivateJTemplate(tem); } }); } return templates; } private void setListDownItemPreferredSize(UIMenuItem item) { Dimension dimension = item.getPreferredSize(); dimension.height = LIST_DOWN_HEIGHT; item.setPreferredSize(dimension); } private String tempalteShowName(JTemplate template) { String name = template.getEditingFILE().getName(); if (!template.isSaved() && !name.endsWith(" *")) { name += " *"; } return name; } /** * 刷新打开模板 * @param history 模板 */ public void refreshOpenedTemplate(java.util.List> history) { openedTemplate = history; } public void setTemTemplate(JTemplate auotCreate) { temTemplate = auotCreate; } private void showListDown() { UIScrollPopUpMenu menu = new UIScrollPopUpMenu(); menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0)); menu.add(initCloseOther()); JSeparator separator = new JSeparator() { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.height = 1; return d; } }; menu.add(new JPanel() { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.height = 1; return d; } }); separator.setForeground(UIConstants.LINE_COLOR); menu.add(separator); menu.add(new JPanel() { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.height = 1; return d; } }); UIMenuItem[] items = createListDownTemplate(); for (int i = 0; i < items.length; i++) { menu.add(items[i]); } GUICoreUtils.showPopupMenu(menu, MutilTempalteTabPane.getInstance(), MutilTempalteTabPane.getInstance().getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight()); } public void setSelectedIndex(int index) { selectedIndex = index; } public void paintComponent(Graphics g) { super.paintComponent(g); double maxWidth = getWidth() - LIST_BUTTON_WIDTH; //最大宽度 g2d = (Graphics2D) g; paintBackgroundAndLine(g2d, maxWidth); } private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { paintDefaultBackground(g2d); //最多能画的个数 int maxTemplateNum = (int) (maxWidth) / MINWIDTH; //计算开始画的最小模板index和最大模板index calMinAndMaxIndex(maxTemplateNum); calculateRealAverageWidth(maxWidth, maxTemplateNum); int maxStringlength = calculateStringMaxLength(); if (selectedIndex >= openedTemplate.size()) { selectedIndex = openedTemplate.size() - 1; } if (selectedIndex < 0) { selectedIndex = 0; } double templateStartX = 0; startX = new int[maxPaintIndex - minPaintIndex + 1]; isNeedToolTips = new boolean[maxPaintIndex - minPaintIndex + 1]; //从可以开始展示在tab面板上的tab开始画 for (int i = minPaintIndex; i <= maxPaintIndex; i++) { JTemplate template = openedTemplate.get(i); Icon icon = template.getIcon(); String name = tempalteShowName(template); //如果tab名字的长度大于最大能显示的英文字符长度,则进行省略号处理 if (getStringWidth(name) > maxStringlength) { name = getEllipsisName(name, maxStringlength); isNeedToolTips[i - minPaintIndex] = true; } else { isNeedToolTips[i - minPaintIndex] = false; } Icon selectedIcon = null; if (i == closeIconIndex) { selectedIcon = clodeMode; } else { selectedIcon = CLOSE; } if (i == selectedIndex) { startX[i - minPaintIndex] = paintSelectedTab(g2d, icon, templateStartX, name, selectedIcon); } else { boolean isLeft = i < selectedIndex; startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, isLeft, mouseOveredIndex, i); } templateStartX += realWidth; } paintListDown(g2d, maxWidth); paintUnderLine(templateStartX, maxWidth, g2d); } private void paintUnderLine(double templateStartX, double maxWidth, Graphics2D g2d) { //画下面的那条线 if (templateStartX < maxWidth) { GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); generalPath.moveTo((float) templateStartX, getHeight() - 1); generalPath.lineTo((float) maxWidth, getHeight() - 1); g2d.fill(generalPath); g2d.setPaint(UIConstants.LINE_COLOR); g2d.draw(new Line2D.Double((float) templateStartX, getHeight() - 1, (float) maxWidth + LIST_BUTTON_WIDTH, getHeight() - 1)); } } private void paintDefaultBackground(Graphics2D g2d) { //画默认背景 g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1, UIConstants.SHADOW_GREY)); g2d.fillRect(getX(), getY(), getWidth(), getHeight()); } private void paintListDown(Graphics2D g2d, double maxWidth) { int x = (int) maxWidth + (LIST_BUTTON_WIDTH - listDownMode.getIconWidth()) / 2; int y = (getHeight() - listDownMode.getIconHeight()) / 2; listDownMode.paintIcon(this, g2d, x, y); } /** * 判断tab文字的长度大于能装下的最大文字长度,要用省略号 * * @param name * @param maxStringlength * @return */ private String getEllipsisName(String name, int maxStringlength) { //若是名字长度大于能显示的长度,那能显示的文字的最大长度还要减去省略号的最大长度 // int maxellipsislength = maxStringlength - ELLIPSIS.length(); int ellipsisWidth = getStringWidth(ELLIPSIS); int leftkeyPoint = 0; int rightKeyPoint = name.length() - 1; int leftStrWidth = 0; int rightStrWidth = 0; while (leftStrWidth + rightStrWidth + ellipsisWidth < maxStringlength) { if (leftStrWidth <= rightStrWidth) { leftkeyPoint++; } else { rightKeyPoint--; } leftStrWidth = getStringWidth(name.substring(0, leftkeyPoint)); rightStrWidth = getStringWidth(name.substring(rightKeyPoint)); if (leftStrWidth + rightStrWidth + ellipsisWidth > maxStringlength) { if (leftStrWidth <= rightStrWidth) { rightKeyPoint++; } break; } } return name.substring(0, leftkeyPoint) + ELLIPSIS + name.substring(rightKeyPoint); } private void calMinAndMaxIndex(int maxTemplateNum) { //如果个数大于最多能容纳的个数,则多余的进行处理 if (openedTemplate.size() > maxTemplateNum) { //所点击列表中的标签页处在标签页栏最后一个标签页之后,则标签页栏左移至所点击标签页出现 if (selectedIndex >= maxPaintIndex) { minPaintIndex = selectedIndex - maxTemplateNum + 1; maxPaintIndex = selectedIndex; if (minPaintIndex <= 0) { minPaintIndex = 0; maxPaintIndex = maxTemplateNum - 1; } } else if (selectedIndex <= minPaintIndex) { //所点击列表中的标签页处在标签页栏第一个标签页之前,则标签页栏右移至所点击标签页出现 minPaintIndex = selectedIndex; maxPaintIndex = minPaintIndex + maxTemplateNum - 1; if (maxPaintIndex > openedTemplate.size() - 1) { maxPaintIndex = openedTemplate.size() - 1; } } else { if (selectedIndex >= openedTemplate.size() - 1) { selectedIndex = openedTemplate.size() - 1; maxPaintIndex = selectedIndex; minPaintIndex = selectedIndex - maxTemplateNum + 1; } else { maxPaintIndex = minPaintIndex + maxTemplateNum - 1; if (maxPaintIndex > openedTemplate.size() - 1) { maxPaintIndex = openedTemplate.size() - 1; } } } } else { minPaintIndex = 0; maxPaintIndex = openedTemplate.size() - 1; } } //个数小于最多能容纳的个数的情况下,看看宽度每个要画多少 private void calculateRealAverageWidth(double maxwidth, int templateNum) { int num = openedTemplate.size() > templateNum ? templateNum : openedTemplate.size(); realWidth = (int) (maxwidth / (num)); if (realWidth > MAXWIDTH) { realWidth = MAXWIDTH; } else if (realWidth < MINWIDTH) { //平均下来每个的宽度小于最小宽度 realWidth = MINWIDTH; } } /** * 计算过长度之后的每个tab的能接受的文字的英文字符数 * * @return */ private int calculateStringMaxLength() { return realWidth - 3 * GAP - ICON_WIDTH - SMALLGAP - CLOSE.getIconWidth(); } private int getStringWidth(String str) { return GraphHelper.getFontMetrics(this.getFont()).stringWidth(str); } /** * 画选中的tab * * @param g2d * @param sheeticon * @param templateStartX * @param sheetName * @param closeIcon * @return */ private int paintSelectedTab(Graphics2D g2d, Icon sheeticon, double templateStartX, String sheetName, Icon closeIcon) { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight(), getHeight(), -1, -1}; RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7); g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 double specialLocation1 = 2.5; double specialLocation2 = 4.330127; GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), x[0], y[0] + CORNOR_RADIUS); for (int index = 1; index <= 2; index++) { generalPath.lineTo((float) x[index], (float) y[index]); } generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); generalPath.closePath(); g2d.fill(generalPath); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(UIConstants.LINE_COLOR); g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); int sheetIconY = (getHeight() - sheeticon.getIconHeight()) / 2; sheeticon.paintIcon(this, g2d, (int) templateStartX + GAP, sheetIconY); // 画字符 g2d.setPaint(getForeground()); g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; closeIcon.paintIcon(this, g2d, closePosition, closeY); return closePosition; } /** * 画没有选中的tab * * @param g2d * @param sheeticon * @param templateStartX * @param sheetName * @param closeIcon * @param isLeft * @return */ private int paintUnSelectedTab(Graphics2D g2d, Icon sheeticon, double templateStartX, String sheetName, Icon closeIcon, boolean isLeft, int mouseOveredIndex, int selfIndex) { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; if (selfIndex == mouseOveredIndex) { g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1, UIConstants.HOVER_BLUE)); } else { g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1, UIConstants.SHADOW_GREY)); } GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); unSelectedClosedPath(generalPath, isLeft, x, y); g2d.fill(generalPath); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(UIConstants.LINE_COLOR); if (isLeft) { g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); } else { g2d.draw(new Arc2D.Double(x[0] - CORNOR_RADIUS * 2, y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); } g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1] + 1)); g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); if (isLeft) { g2d.draw(new Arc2D.Double(x[3], y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); } else { g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); } g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); int sheetIconY = (getHeight() - sheeticon.getIconHeight()) / 2; sheeticon.paintIcon(this, g2d, (int) templateStartX + GAP, sheetIconY); // 画字符 g2d.setPaint(getForeground()); g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; closeIcon.paintIcon(this, g2d, closePosition, closeY); return closePosition; } private void unSelectedClosedPath(GeneralPath generalPath, boolean isLeft, double[] x, double[] y) { if (isLeft) { generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - SPECIAL_LOCATION_1), (y[0] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) x[0] + CORNOR_RADIUS - SPECIAL_LOCATION_2), (y[0] + CORNOR_RADIUS - SPECIAL_LOCATION_1), x[0], y[0] + CORNOR_RADIUS); } else { generalPath.moveTo((float) x[0] - CORNOR_RADIUS, (float) y[0]); generalPath.curveTo(((float) x[0] - CORNOR_RADIUS + SPECIAL_LOCATION_1), (y[0] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) x[0] - CORNOR_RADIUS + SPECIAL_LOCATION_2), (y[0] + CORNOR_RADIUS - SPECIAL_LOCATION_1), x[0], y[0] + CORNOR_RADIUS); } for (int index = 1; index <= 2; index++) { generalPath.lineTo((float) x[index], (float) y[index]); } generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); if (isLeft) { generalPath.curveTo(((float) x[3] + CORNOR_RADIUS - SPECIAL_LOCATION_1), ((float) y[3] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) x[3] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) y[3] - CORNOR_RADIUS + SPECIAL_LOCATION_1), (float) x[3] + CORNOR_RADIUS, (float) y[3]); generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); } else { generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + SPECIAL_LOCATION_1), ((float) y[3] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) x[3] - CORNOR_RADIUS + SPECIAL_LOCATION_2), ((float) y[3] + CORNOR_RADIUS - SPECIAL_LOCATION_1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); generalPath.lineTo((float) x[0] - CORNOR_RADIUS, (float) y[0]); } generalPath.closePath(); } /** * 点击 * @param e 鼠标事件 */ public void mouseClicked(MouseEvent e) { } /** * 按下 * @param e 鼠标事件 */ public void mousePressed(MouseEvent e) { int evtX = e.getX(); int evtY = e.getY(); this.setPressedXY(evtX, evtY); //是否点击关闭按钮 如果点击了关闭按钮,则将点击的模板关闭,不需要切换,如果没有点击关闭按钮,则切换到点击的模板处 boolean isOverCloseIcon = isOverCloseIcon(evtX); if (isOverListDown(evtX)) { listDownMode = isOverListDown(evtX) ? MOUSE_PRESS_LIST_DOWN : LIST_DOWN; if (!isShowList) { showListDown(); } isShowList = !isShowList; } else if (isOverCloseIcon) { //关闭按钮的图标变化 closeIconIndex = getTemplateIndex(evtX); clodeMode = MOUSE_PRESS_CLOSE; //关闭close图标所在的模板{ closeFormat(openedTemplate.get(closeIconIndex)); closeSpecifiedTemplate(openedTemplate.get(closeIconIndex)); DesignerContext.getDesignerFrame().getContentFrame().repaint(); isShowList = false; } else { //没有点击关闭和ListDown按钮,则切换到点击的模板处 closeIconIndex = -1; clodeMode = CLOSE; int tempSelectedIndex = selectedIndex; if (selectedIndex != getTemplateIndex(evtX) && getTemplateIndex(evtX) != -1) { openedTemplate.get(selectedIndex).stopEditing(); selectedIndex = getTemplateIndex(evtX); //如果在权限编辑情况下,不允许切换到表单类型的工作簿 if(BaseUtils.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()){ DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); JOptionPane.showMessageDialog(this, Inter.getLocText("FR-Designer_Form-AuthorityEdited_Cannot_be_Supported") + "!", Inter.getLocText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); this.repaint(); return; } DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(getTemplateIndex(evtX))); } isShowList = false; } this.repaint(); } public void setIsCloseCurrent(boolean isCloseCurrent) { this.isCloseCurrent = isCloseCurrent; } /** * 关闭模板 * @param specifiedTemplate 模板 */ public void closeSpecifiedTemplate(JTemplate specifiedTemplate) { if (specifiedTemplate == null) { return; } //当前激活的模板 String filename = openedTemplate.get(selectedIndex).getEditingFILE().getPath(); if (filename.startsWith(ProjectConstants.REPORTLETS_NAME)) { filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename; } filename = filename.replaceAll("/", "\\\\"); if (!specifiedTemplate.isALLSaved()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Would_you_like_to_save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { specifiedTemplate.saveTemplate(); FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."})); HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); activeTemplate(filename); } else if (returnVal == JOptionPane.NO_OPTION) { //不保存 HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); activeTemplate(filename); } //若是点击取消关闭,则什么都不做 } else { //若是已经保存过了,则关闭即可 HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); activeTemplate(filename); } } /** * 关闭模板 * @param closedTemplate 模板 */ public void closeFormat(JTemplate closedTemplate) { //表单不需要处理 if (!closedTemplate.isJWorkBook()) { return; } if (DesignerContext.getFormatState() == DesignerContext.FORMAT_STATE_NULL) { return; } //是被参照的模板被关闭,则重置格式刷 closedTemplate.doConditionCancelFormat(); } /** * 关闭掉一个模板之后该激活的Tab * * @param fileName */ private void activeTemplate(String fileName) { if (openedTemplate.isEmpty()) { //新建并激活模板 DesignerContext.getDesignerFrame().addAndActivateJTemplate(); selectedIndex = 0; //此时刚自动新建的模板在HistoryTemplateListPane的editingTemplate temTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); } else { //如果关闭的模板是当前选中的模板,则重新激活 if (closeIconIndex == selectedIndex) { if (closeIconIndex == maxPaintIndex) { selectedIndex -= 1; } } else if (isCloseCurrent) { //不是通过关闭按钮,而是通过文件关闭菜单关闭的当前模板的,也重新激活 if (selectedIndex > openedTemplate.size() - 1) { selectedIndex -= 1; if (selectedIndex < 0) { selectedIndex = 0; } isCloseCurrent = false; } } else { //如果关闭的模板不是当前选中的模板,则激活的模板不变 selectedIndex = HistoryTemplateListPane.getInstance().contains(fileName); } DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(selectedIndex)); } } /** * 鼠标释放 * @param e 鼠标事件 */ public void mouseReleased(MouseEvent e) { } /** * 鼠标进入 * @param e 鼠标事件 */ public void mouseEntered(MouseEvent e) { } private boolean isOverCloseIcon(int evtX) { boolean isOverCloseIcon = false; for (int i = 0; i < startX.length; i++) { if (evtX >= startX[i] && evtX <= startX[i] + CLOSE.getIconWidth()) { isOverCloseIcon = true; break; } } return isOverCloseIcon; } private boolean isOverListDown(int evtX) { int maxWidth = getWidth() - LIST_BUTTON_WIDTH; return evtX >= (maxWidth + SMALLGAP) && evtX <= (getWidth() - SMALLGAP); } private int getTemplateIndex(int evtX) { int textX = 0; for (int i = minPaintIndex; i <= maxPaintIndex; i++) { int textWidth = realWidth; if (evtX >= textX && evtX < textX + textWidth) { return i; } textX += textWidth; } return -1; } /** * 鼠标离开 * @param e 鼠标事件 */ public void mouseExited(MouseEvent e) { listDownMode = LIST_DOWN; closeIconIndex = -1; mouseOveredIndex = -1; this.repaint(); } /** * 鼠标拖拽 * @param e 鼠标事件 */ public void mouseDragged(MouseEvent e) { } /** * 鼠标移动 * @param e 鼠标事件 */ public void mouseMoved(MouseEvent e) { int evtX = e.getX(); mouseOveredIndex = getTemplateIndex(evtX); //看是否需要显示toolTip if (mouseOveredIndex != -1 && isNeedToolTips[mouseOveredIndex - minPaintIndex]) { setToolTipText(openedTemplate.get(mouseOveredIndex).getEditingFILE().getName()); } else { setToolTipText(null); } listDownMode = isOverListDown(evtX) ? MOUSE_OVER_LIST_DOWN : LIST_DOWN; boolean isOverCloseIcon = isOverCloseIcon(evtX); clodeMode = isOverCloseIcon ? MOUSE_OVER_CLOSE : CLOSE; closeIconIndex = isOverCloseIcon ? mouseOveredIndex : -1; this.repaint(); } private void setPressedXY(int x, int y) { this.xyPressedCoordinate[0] = x; this.xyPressedCoordinate[1] = y; } public Object getValue(String key) { return null; } /** * 加入值 * @param key 键 * @param value 值 */ public void putValue(String key, Object value) { } /** * 动作 * @param e 事件 */ public void actionPerformed(ActionEvent e) { } /** * 处理自动新建的模板 在切换时的处理 */ public void doWithtemTemplate() { //temtemplate保存的一定是手动新建的没有编辑或是编辑了没有保存的模板 //没有保存,说明有编辑;已经保存在磁盘里的文件,说明有过处理,并且已经保存,此时切换都不将其自动关闭 if (temTemplate == null || temTemplate == HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()) { return; } if (!temTemplate.isSaved() || !temTemplate.getEditingFILE().isMemFile()) { temTemplate = null; } //自动新建的模板B若没有进行任何编辑(新建模板没有进行任何编辑时saved都是true):还没有存盘 if (temTemplate != null && temTemplate.getEditingFILE().isMemFile() && temTemplate.isSaved()) { HistoryTemplateListPane.getInstance().closeSelectedReport(temTemplate); temTemplate = null; setSelectedIndex(HistoryTemplateListPane.getInstance().contains(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())); } } private class UIListDownItemUI extends BasicMenuItemUI { @Override protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { if (menuItem.getIcon() == null) { super.paintBackground(g, menuItem, bgColor); return; } ButtonModel model = menuItem.getModel(); Color oldColor = g.getColor(); int menuWidth = menuItem.getWidth(); int menuHeight = menuItem.getHeight(); g.setColor(UIConstants.NORMAL_BACKGROUND); g.fillRect(0, 0, menuWidth, menuHeight); boolean itemIsSelected = menuItem instanceof JMenu && model.isSelected(); if (menuItem.isOpaque()) { if (model.isArmed() || itemIsSelected) { GUIPaintUtils.fillPaint((Graphics2D) g, GAP, 0, menuWidth - GAP, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, UIConstants.ARC); } else { GUIPaintUtils.fillPaint((Graphics2D) g, GAP, 0, menuWidth - GAP, menuHeight, true, Constants.NULL, menuItem.getBackground(), UIConstants.ARC); } g.setColor(oldColor); } else if (model.isArmed() || itemIsSelected) { GUIPaintUtils.fillPaint((Graphics2D) g, GAP, 0, menuWidth - GAP, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, UIConstants.ARC); g.setColor(oldColor); } } } } \ No newline at end of file +package com.fr.design.file; import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.Arc2D; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; import java.io.File; import java.util.logging.Level; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.ButtonModel; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.plaf.basic.BasicMenuItemUI; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.stable.Constants; import com.fr.stable.ProductConstants; import com.fr.stable.project.ProjectConstants; /** * Author : daisy * Date: 13-8-5 * Time: 下午6:12 */ public class MutilTempalteTabPane extends JComponent implements MouseListener, MouseMotionListener, Action { private static Icon LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_normal.png"); private static Icon MOUSE_OVER_LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_pressed.png"); private static Icon MOUSE_PRESS_LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_pressed.png"); private static Icon CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); private static Icon MOUSE_OVER_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/mouseoverclose icon.png"); private static Icon MOUSE_PRESS_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/pressclose icon.png"); private static final String ELLIPSIS = "..."; private static final int GAP_BEFORE_CLOSE = 10; private static final int GAP = 5; private static final int SMALLGAP = 3; private static final int LIST_BUTTON_WIDTH = 34; private static final int HEIGHT = 26; private static final int LIST_DOWN_HEIGHT = 25; private static final double FOR_CAL_BYTES = 0.5; private static final double CORNOR_RADIUS = 0.0; //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 private static final double SPECIAL_LOCATION_1 = 2.5; private static final double SPECIAL_LOCATION_2 = 4.330127; private static final int ICON_WIDTH = 22; //每个标签页的最大的长度和最小长度。这些长度均为均分 private static final int MAXWIDTH = 240; private static final int MINWIDTH = 100; private static MutilTempalteTabPane THIS; //用于存放工作簿 private java.util.List> openedTemplate; //选中的Tab项 private int selectedIndex = 0; // private int mouseOveredIndex = -1; //tab栏可以放下的每个tab的实际宽度 private int realWidth = MAXWIDTH; //当前标签页栏存放的所有标签页的index private int minPaintIndex = 0; private int maxPaintIndex = 0; /** * 鼠标按下时的坐标数组、鼠标放开时的坐标数组 */ private int[] xyPressedCoordinate = {0, 0}; //每个关闭图标的起始位置 private int[] startX; private boolean[] isNeedToolTips; private Graphics2D g2d; //记录关闭按钮的状态 private int closeIconIndex = -1; private boolean isCloseCurrent = false; private Icon clodeMode = CLOSE; private Icon listDownMode = LIST_DOWN; private boolean isShowList = false; //自动新建的模板B若没有进行任何编辑,切换到其他 // // 模板时,模板B会自动关闭 private JTemplate temTemplate = null; private AWTEventListener awt = new AWTEventListener() { public void eventDispatched(AWTEvent event) { if (event instanceof MouseEvent) { MouseEvent mv = (MouseEvent) event; if (mv.getClickCount() > 0 && !ComparatorUtils.equals(mv.getSource(), MutilTempalteTabPane.this)) { isShowList = false; } } } }; public static final MutilTempalteTabPane getInstance() { if (THIS == null) { THIS = new MutilTempalteTabPane(); } return THIS; } public JTemplate getSelectedFile() { return openedTemplate.get(selectedIndex); } /** * 关闭掉当前已打开文件列表中指定的文件 * * @param file 指定的文件 * */ public void closeFileTemplate(FILE file){ for (JTemplate temp : openedTemplate) { if(ComparatorUtils.equals(file, temp.getEditingFILE())){ closeSpecifiedTemplate(temp); break; } } } public Dimension getPreferredSize() { Dimension dimension = super.getPreferredSize(); dimension.height = HEIGHT; return dimension; } /** * 多工作簿面板 */ public MutilTempalteTabPane() { this.setLayout(new BorderLayout(0, 0)); this.addMouseListener(this); this.addMouseMotionListener(this); this.setBorder(null); this.setForeground(new Color(99, 99, 99)); this.setFont(new Font(Inter.getLocText("FR-Designer_Song_TypeFace"), 0, 12)); openedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); selectedIndex = openedTemplate.size() - 1; Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); } private UIMenuItem initCloseOther() { UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer_FS_Close_Other_Templates")); setListDownItemPreferredSize(closeOther); closeOther.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (openedTemplate.size() == 1) { return; } SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false); //点击关闭其他模板,并且点击确定保存 if (saveSomeTempaltePane.showSavePane()) { JTemplate[] panes = new JTemplate[openedTemplate.size()]; for(int i = 0; i < openedTemplate.size(); i++) { panes[i] = openedTemplate.get(i); } for (int i = 0; i < panes.length; i++) { if (i != selectedIndex) { //判断关闭的模板是不是格式刷的被参照的模板 openedTemplate.remove(panes[i]); closeFormat(panes[i]); HistoryTemplateListPane.getInstance().closeSelectedReport(panes[i]); } } JTemplate currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); HistoryTemplateListPane.getInstance().removeAllHistory(); DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate); THIS.repaint(); } //如果取消保存了,则不关闭其他模板 } }); if (openedTemplate.size() == 1) { closeOther.setEnabled(false); } return closeOther; } private UIMenuItem[] createListDownTemplate() { UIMenuItem[] templates = new UIMenuItem[openedTemplate.size()]; for (int i = 0; i < openedTemplate.size(); i++) { final int index = i; final JTemplate tem = openedTemplate.get(i); templates[i] = new UIMenuItem(tempalteShowName(tem), tem.getIcon()); templates[i].setUI(new UIListDownItemUI()); setListDownItemPreferredSize(templates[i]); if (i == selectedIndex) { //画选中的高亮 templates[i].setBackground(UIConstants.SHADOW_CENTER); } templates[i].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectedIndex = index; DesignerContext.getDesignerFrame().addAndActivateJTemplate(tem); } }); } return templates; } private void setListDownItemPreferredSize(UIMenuItem item) { Dimension dimension = item.getPreferredSize(); dimension.height = LIST_DOWN_HEIGHT; item.setPreferredSize(dimension); } private String tempalteShowName(JTemplate template) { String name = template.getEditingFILE().getName(); if (!template.isSaved() && !name.endsWith(" *")) { name += " *"; } return name; } /** * 刷新打开模板 * @param history 模板 */ public void refreshOpenedTemplate(java.util.List> history) { openedTemplate = history; } public void setTemTemplate(JTemplate auotCreate) { temTemplate = auotCreate; } private void showListDown() { UIScrollPopUpMenu menu = new UIScrollPopUpMenu(); menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0)); menu.add(initCloseOther()); JSeparator separator = new JSeparator() { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.height = 1; return d; } }; menu.add(new JPanel() { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.height = 1; return d; } }); separator.setForeground(UIConstants.LINE_COLOR); menu.add(separator); menu.add(new JPanel() { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.height = 1; return d; } }); UIMenuItem[] items = createListDownTemplate(); for (int i = 0; i < items.length; i++) { menu.add(items[i]); } GUICoreUtils.showPopupMenu(menu, MutilTempalteTabPane.getInstance(), MutilTempalteTabPane.getInstance().getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight()); } public void setSelectedIndex(int index) { selectedIndex = index; } public void paintComponent(Graphics g) { super.paintComponent(g); double maxWidth = getWidth() - LIST_BUTTON_WIDTH; //最大宽度 g2d = (Graphics2D) g; paintBackgroundAndLine(g2d, maxWidth); } private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { paintDefaultBackground(g2d); //最多能画的个数 int maxTemplateNum = (int) (maxWidth) / MINWIDTH; //计算开始画的最小模板index和最大模板index calMinAndMaxIndex(maxTemplateNum); calculateRealAverageWidth(maxWidth, maxTemplateNum); int maxStringlength = calculateStringMaxLength(); if (selectedIndex >= openedTemplate.size()) { selectedIndex = openedTemplate.size() - 1; } if (selectedIndex < 0) { selectedIndex = 0; } double templateStartX = 0; startX = new int[maxPaintIndex - minPaintIndex + 1]; isNeedToolTips = new boolean[maxPaintIndex - minPaintIndex + 1]; //从可以开始展示在tab面板上的tab开始画 for (int i = minPaintIndex; i <= maxPaintIndex; i++) { JTemplate template = openedTemplate.get(i); Icon icon = template.getIcon(); String name = tempalteShowName(template); //如果tab名字的长度大于最大能显示的英文字符长度,则进行省略号处理 if (getStringWidth(name) > maxStringlength) { name = getEllipsisName(name, maxStringlength); isNeedToolTips[i - minPaintIndex] = true; } else { isNeedToolTips[i - minPaintIndex] = false; } Icon selectedIcon = null; if (i == closeIconIndex) { selectedIcon = clodeMode; } else { selectedIcon = CLOSE; } if (i == selectedIndex) { startX[i - minPaintIndex] = paintSelectedTab(g2d, icon, templateStartX, name, selectedIcon); } else { boolean isLeft = i < selectedIndex; startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, isLeft, mouseOveredIndex, i); } templateStartX += realWidth; } paintListDown(g2d, maxWidth); paintUnderLine(templateStartX, maxWidth, g2d); } private void paintUnderLine(double templateStartX, double maxWidth, Graphics2D g2d) { //画下面的那条线 if (templateStartX < maxWidth) { GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); generalPath.moveTo((float) templateStartX, getHeight() - 1); generalPath.lineTo((float) maxWidth, getHeight() - 1); g2d.fill(generalPath); g2d.setPaint(UIConstants.LINE_COLOR); g2d.draw(new Line2D.Double((float) templateStartX, getHeight() - 1, (float) maxWidth + LIST_BUTTON_WIDTH, getHeight() - 1)); } } private void paintDefaultBackground(Graphics2D g2d) { //画默认背景 g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1, UIConstants.SHADOW_GREY)); g2d.fillRect(getX(), getY(), getWidth(), getHeight()); } private void paintListDown(Graphics2D g2d, double maxWidth) { int x = (int) maxWidth + (LIST_BUTTON_WIDTH - listDownMode.getIconWidth()) / 2; int y = (getHeight() - listDownMode.getIconHeight()) / 2; listDownMode.paintIcon(this, g2d, x, y); } /** * 判断tab文字的长度大于能装下的最大文字长度,要用省略号 * * @param name * @param maxStringlength * @return */ private String getEllipsisName(String name, int maxStringlength) { //若是名字长度大于能显示的长度,那能显示的文字的最大长度还要减去省略号的最大长度 // int maxellipsislength = maxStringlength - ELLIPSIS.length(); int ellipsisWidth = getStringWidth(ELLIPSIS); int leftkeyPoint = 0; int rightKeyPoint = name.length() - 1; int leftStrWidth = 0; int rightStrWidth = 0; while (leftStrWidth + rightStrWidth + ellipsisWidth < maxStringlength) { if (leftStrWidth <= rightStrWidth) { leftkeyPoint++; } else { rightKeyPoint--; } leftStrWidth = getStringWidth(name.substring(0, leftkeyPoint)); rightStrWidth = getStringWidth(name.substring(rightKeyPoint)); if (leftStrWidth + rightStrWidth + ellipsisWidth > maxStringlength) { if (leftStrWidth <= rightStrWidth) { rightKeyPoint++; } break; } } return name.substring(0, leftkeyPoint) + ELLIPSIS + name.substring(rightKeyPoint); } private void calMinAndMaxIndex(int maxTemplateNum) { //如果个数大于最多能容纳的个数,则多余的进行处理 if (openedTemplate.size() > maxTemplateNum) { //所点击列表中的标签页处在标签页栏最后一个标签页之后,则标签页栏左移至所点击标签页出现 if (selectedIndex >= maxPaintIndex) { minPaintIndex = selectedIndex - maxTemplateNum + 1; maxPaintIndex = selectedIndex; if (minPaintIndex <= 0) { minPaintIndex = 0; maxPaintIndex = maxTemplateNum - 1; } } else if (selectedIndex <= minPaintIndex) { //所点击列表中的标签页处在标签页栏第一个标签页之前,则标签页栏右移至所点击标签页出现 minPaintIndex = selectedIndex; maxPaintIndex = minPaintIndex + maxTemplateNum - 1; if (maxPaintIndex > openedTemplate.size() - 1) { maxPaintIndex = openedTemplate.size() - 1; } } else { if (selectedIndex >= openedTemplate.size() - 1) { selectedIndex = openedTemplate.size() - 1; maxPaintIndex = selectedIndex; minPaintIndex = selectedIndex - maxTemplateNum + 1; } else { maxPaintIndex = minPaintIndex + maxTemplateNum - 1; if (maxPaintIndex > openedTemplate.size() - 1) { maxPaintIndex = openedTemplate.size() - 1; } } } } else { minPaintIndex = 0; maxPaintIndex = openedTemplate.size() - 1; } } //个数小于最多能容纳的个数的情况下,看看宽度每个要画多少 private void calculateRealAverageWidth(double maxwidth, int templateNum) { int num = openedTemplate.size() > templateNum ? templateNum : openedTemplate.size(); realWidth = (int) (maxwidth / (num)); if (realWidth > MAXWIDTH) { realWidth = MAXWIDTH; } else if (realWidth < MINWIDTH) { //平均下来每个的宽度小于最小宽度 realWidth = MINWIDTH; } } /** * 计算过长度之后的每个tab的能接受的文字的英文字符数 * * @return */ private int calculateStringMaxLength() { return realWidth - 3 * GAP - ICON_WIDTH - SMALLGAP - CLOSE.getIconWidth(); } private int getStringWidth(String str) { return GraphHelper.getFontMetrics(this.getFont()).stringWidth(str); } /** * 画选中的tab * * @param g2d * @param sheeticon * @param templateStartX * @param sheetName * @param closeIcon * @return */ private int paintSelectedTab(Graphics2D g2d, Icon sheeticon, double templateStartX, String sheetName, Icon closeIcon) { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight(), getHeight(), -1, -1}; RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7); g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 double specialLocation1 = 2.5; double specialLocation2 = 4.330127; GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), x[0], y[0] + CORNOR_RADIUS); for (int index = 1; index <= 2; index++) { generalPath.lineTo((float) x[index], (float) y[index]); } generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); generalPath.closePath(); g2d.fill(generalPath); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(UIConstants.LINE_COLOR); g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); int sheetIconY = (getHeight() - sheeticon.getIconHeight()) / 2; sheeticon.paintIcon(this, g2d, (int) templateStartX + GAP, sheetIconY); // 画字符 g2d.setPaint(getForeground()); g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; closeIcon.paintIcon(this, g2d, closePosition, closeY); return closePosition; } /** * 画没有选中的tab * * @param g2d * @param sheeticon * @param templateStartX * @param sheetName * @param closeIcon * @param isLeft * @return */ private int paintUnSelectedTab(Graphics2D g2d, Icon sheeticon, double templateStartX, String sheetName, Icon closeIcon, boolean isLeft, int mouseOveredIndex, int selfIndex) { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; if (selfIndex == mouseOveredIndex) { g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1, UIConstants.HOVER_BLUE)); } else { g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1, UIConstants.SHADOW_GREY)); } GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); unSelectedClosedPath(generalPath, isLeft, x, y); g2d.fill(generalPath); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(UIConstants.LINE_COLOR); if (isLeft) { g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); } else { g2d.draw(new Arc2D.Double(x[0] - CORNOR_RADIUS * 2, y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); } g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1] + 1)); g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); if (isLeft) { g2d.draw(new Arc2D.Double(x[3], y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); } else { g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); } g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); int sheetIconY = (getHeight() - sheeticon.getIconHeight()) / 2; sheeticon.paintIcon(this, g2d, (int) templateStartX + GAP, sheetIconY); // 画字符 g2d.setPaint(getForeground()); g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; closeIcon.paintIcon(this, g2d, closePosition, closeY); return closePosition; } private void unSelectedClosedPath(GeneralPath generalPath, boolean isLeft, double[] x, double[] y) { if (isLeft) { generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - SPECIAL_LOCATION_1), (y[0] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) x[0] + CORNOR_RADIUS - SPECIAL_LOCATION_2), (y[0] + CORNOR_RADIUS - SPECIAL_LOCATION_1), x[0], y[0] + CORNOR_RADIUS); } else { generalPath.moveTo((float) x[0] - CORNOR_RADIUS, (float) y[0]); generalPath.curveTo(((float) x[0] - CORNOR_RADIUS + SPECIAL_LOCATION_1), (y[0] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) x[0] - CORNOR_RADIUS + SPECIAL_LOCATION_2), (y[0] + CORNOR_RADIUS - SPECIAL_LOCATION_1), x[0], y[0] + CORNOR_RADIUS); } for (int index = 1; index <= 2; index++) { generalPath.lineTo((float) x[index], (float) y[index]); } generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); if (isLeft) { generalPath.curveTo(((float) x[3] + CORNOR_RADIUS - SPECIAL_LOCATION_1), ((float) y[3] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) x[3] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) y[3] - CORNOR_RADIUS + SPECIAL_LOCATION_1), (float) x[3] + CORNOR_RADIUS, (float) y[3]); generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); } else { generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + SPECIAL_LOCATION_1), ((float) y[3] + CORNOR_RADIUS - SPECIAL_LOCATION_2), ((float) x[3] - CORNOR_RADIUS + SPECIAL_LOCATION_2), ((float) y[3] + CORNOR_RADIUS - SPECIAL_LOCATION_1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); generalPath.lineTo((float) x[0] - CORNOR_RADIUS, (float) y[0]); } generalPath.closePath(); } /** * 点击 * @param e 鼠标事件 */ public void mouseClicked(MouseEvent e) { } /** * 按下 * @param e 鼠标事件 */ public void mousePressed(MouseEvent e) { int evtX = e.getX(); int evtY = e.getY(); this.setPressedXY(evtX, evtY); //是否点击关闭按钮 如果点击了关闭按钮,则将点击的模板关闭,不需要切换,如果没有点击关闭按钮,则切换到点击的模板处 boolean isOverCloseIcon = isOverCloseIcon(evtX); if (isOverListDown(evtX)) { listDownMode = isOverListDown(evtX) ? MOUSE_PRESS_LIST_DOWN : LIST_DOWN; if (!isShowList) { showListDown(); } isShowList = !isShowList; } else if (isOverCloseIcon) { //关闭按钮的图标变化 closeIconIndex = getTemplateIndex(evtX); clodeMode = MOUSE_PRESS_CLOSE; //关闭close图标所在的模板{ closeFormat(openedTemplate.get(closeIconIndex)); closeSpecifiedTemplate(openedTemplate.get(closeIconIndex)); DesignerContext.getDesignerFrame().getContentFrame().repaint(); isShowList = false; } else { //没有点击关闭和ListDown按钮,则切换到点击的模板处 closeIconIndex = -1; clodeMode = CLOSE; int tempSelectedIndex = selectedIndex; if (selectedIndex != getTemplateIndex(evtX) && getTemplateIndex(evtX) != -1) { openedTemplate.get(selectedIndex).stopEditing(); selectedIndex = getTemplateIndex(evtX); //如果在权限编辑情况下,不允许切换到表单类型的工作簿 if(BaseUtils.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()){ DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); JOptionPane.showMessageDialog(this, Inter.getLocText("FR-Designer_Form-AuthorityEdited_Cannot_be_Supported") + "!", Inter.getLocText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); this.repaint(); return; } DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(getTemplateIndex(evtX))); } isShowList = false; } this.repaint(); } public void setIsCloseCurrent(boolean isCloseCurrent) { this.isCloseCurrent = isCloseCurrent; } /** * 关闭模板 * @param specifiedTemplate 模板 */ public void closeSpecifiedTemplate(JTemplate specifiedTemplate) { if (specifiedTemplate == null) { return; } //当前激活的模板 String filename = openedTemplate.get(selectedIndex).getEditingFILE().getPath(); if (filename.startsWith(ProjectConstants.REPORTLETS_NAME)) { filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename; } filename = filename.replaceAll("/", "\\\\"); if (!specifiedTemplate.isALLSaved()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Would_you_like_to_save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { specifiedTemplate.saveTemplate(); FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."})); HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); activeTemplate(filename); } else if (returnVal == JOptionPane.NO_OPTION) { //不保存 HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); activeTemplate(filename); } //若是点击取消关闭,则什么都不做 } else { //若是已经保存过了,则关闭即可 HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); activeTemplate(filename); } } /** * 关闭模板 * @param closedTemplate 模板 */ public void closeFormat(JTemplate closedTemplate) { //表单不需要处理 if (!closedTemplate.isJWorkBook()) { return; } if (DesignerContext.getFormatState() == DesignerContext.FORMAT_STATE_NULL) { return; } //是被参照的模板被关闭,则重置格式刷 closedTemplate.doConditionCancelFormat(); } /** * 关闭掉一个模板之后该激活的Tab * * @param fileName */ private void activeTemplate(String fileName) { if (openedTemplate.isEmpty()) { //新建并激活模板 DesignerContext.getDesignerFrame().addAndActivateJTemplate(); selectedIndex = 0; //此时刚自动新建的模板在HistoryTemplateListPane的editingTemplate temTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); } else { //如果关闭的模板是当前选中的模板,则重新激活 if (closeIconIndex == selectedIndex) { if (closeIconIndex == maxPaintIndex) { selectedIndex --; } } else if (isCloseCurrent) { //不是通过关闭按钮,而是通过文件关闭菜单关闭的当前模板的,也重新激活 if (selectedIndex > openedTemplate.size() - 1) { selectedIndex -= 1; if (selectedIndex < 0) { selectedIndex = 0; } isCloseCurrent = false; } } else { //如果关闭的模板不是当前选中的模板,则激活的模板不变 selectedIndex = HistoryTemplateListPane.getInstance().contains(fileName); } DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(selectedIndex)); } } /** * 鼠标释放 * @param e 鼠标事件 */ public void mouseReleased(MouseEvent e) { } /** * 鼠标进入 * @param e 鼠标事件 */ public void mouseEntered(MouseEvent e) { } private boolean isOverCloseIcon(int evtX) { boolean isOverCloseIcon = false; for (int i = 0; i < startX.length; i++) { if (evtX >= startX[i] && evtX <= startX[i] + CLOSE.getIconWidth()) { isOverCloseIcon = true; break; } } return isOverCloseIcon; } private boolean isOverListDown(int evtX) { int maxWidth = getWidth() - LIST_BUTTON_WIDTH; return evtX >= (maxWidth + SMALLGAP) && evtX <= (getWidth() - SMALLGAP); } private int getTemplateIndex(int evtX) { int textX = 0; for (int i = minPaintIndex; i <= maxPaintIndex; i++) { int textWidth = realWidth; if (evtX >= textX && evtX < textX + textWidth) { return i; } textX += textWidth; } return -1; } /** * 鼠标离开 * @param e 鼠标事件 */ public void mouseExited(MouseEvent e) { listDownMode = LIST_DOWN; closeIconIndex = -1; mouseOveredIndex = -1; this.repaint(); } /** * 鼠标拖拽 * @param e 鼠标事件 */ public void mouseDragged(MouseEvent e) { } /** * 鼠标移动 * @param e 鼠标事件 */ public void mouseMoved(MouseEvent e) { int evtX = e.getX(); mouseOveredIndex = getTemplateIndex(evtX); //看是否需要显示toolTip if (mouseOveredIndex != -1 && isNeedToolTips[mouseOveredIndex - minPaintIndex]) { setToolTipText(openedTemplate.get(mouseOveredIndex).getEditingFILE().getName()); } else { setToolTipText(null); } listDownMode = isOverListDown(evtX) ? MOUSE_OVER_LIST_DOWN : LIST_DOWN; boolean isOverCloseIcon = isOverCloseIcon(evtX); clodeMode = isOverCloseIcon ? MOUSE_OVER_CLOSE : CLOSE; closeIconIndex = isOverCloseIcon ? mouseOveredIndex : -1; this.repaint(); } private void setPressedXY(int x, int y) { this.xyPressedCoordinate[0] = x; this.xyPressedCoordinate[1] = y; } public Object getValue(String key) { return null; } /** * 加入值 * @param key 键 * @param value 值 */ public void putValue(String key, Object value) { } /** * 动作 * @param e 事件 */ public void actionPerformed(ActionEvent e) { } /** * 处理自动新建的模板 在切换时的处理 */ public void doWithtemTemplate() { //temtemplate保存的一定是手动新建的没有编辑或是编辑了没有保存的模板 //没有保存,说明有编辑;已经保存在磁盘里的文件,说明有过处理,并且已经保存,此时切换都不将其自动关闭 if (temTemplate == null || temTemplate == HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()) { return; } if (!temTemplate.isSaved() || !temTemplate.getEditingFILE().isMemFile()) { temTemplate = null; } //自动新建的模板B若没有进行任何编辑(新建模板没有进行任何编辑时saved都是true):还没有存盘 if (temTemplate != null && temTemplate.getEditingFILE().isMemFile() && temTemplate.isSaved()) { HistoryTemplateListPane.getInstance().closeSelectedReport(temTemplate); temTemplate = null; setSelectedIndex(HistoryTemplateListPane.getInstance().contains(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())); } } private class UIListDownItemUI extends BasicMenuItemUI { @Override protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { if (menuItem.getIcon() == null) { super.paintBackground(g, menuItem, bgColor); return; } ButtonModel model = menuItem.getModel(); Color oldColor = g.getColor(); int menuWidth = menuItem.getWidth(); int menuHeight = menuItem.getHeight(); g.setColor(UIConstants.NORMAL_BACKGROUND); g.fillRect(0, 0, menuWidth, menuHeight); boolean itemIsSelected = menuItem instanceof JMenu && model.isSelected(); if (menuItem.isOpaque()) { if (model.isArmed() || itemIsSelected) { GUIPaintUtils.fillPaint((Graphics2D) g, GAP, 0, menuWidth - GAP, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, UIConstants.ARC); } else { GUIPaintUtils.fillPaint((Graphics2D) g, GAP, 0, menuWidth - GAP, menuHeight, true, Constants.NULL, menuItem.getBackground(), UIConstants.ARC); } g.setColor(oldColor); } else if (model.isArmed() || itemIsSelected) { GUIPaintUtils.fillPaint((Graphics2D) g, GAP, 0, menuWidth - GAP, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, UIConstants.ARC); g.setColor(oldColor); } } } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/fun/ElementUIProvider.java b/designer_base/src/com/fr/design/fun/ElementUIProvider.java index 9f93c21ed3..7cdd8eb721 100644 --- a/designer_base/src/com/fr/design/fun/ElementUIProvider.java +++ b/designer_base/src/com/fr/design/fun/ElementUIProvider.java @@ -31,7 +31,7 @@ public interface ElementUIProvider extends Mutable { * 右侧的快速编辑器 * @return 编辑器 */ - QuickEditor quickEditor(); + Class quickEditor(); /** * 插件单元格元素 diff --git a/designer_base/src/com/fr/design/gui/chart/BaseChartPropertyPane.java b/designer_base/src/com/fr/design/gui/chart/BaseChartPropertyPane.java index 2bedd08dbe..c5b58ae268 100644 --- a/designer_base/src/com/fr/design/gui/chart/BaseChartPropertyPane.java +++ b/designer_base/src/com/fr/design/gui/chart/BaseChartPropertyPane.java @@ -20,6 +20,8 @@ public abstract class BaseChartPropertyPane extends DockingView { public abstract void setSupportCellData(boolean supportCellData); public abstract void populateChartPropertyPane(BaseChartCollection collection, TargetComponent ePane); - - public abstract void setWidgetPropertyPane(BaseWidgetPropertyPane pane); + + public abstract ChartEditPaneProvider getChartEditPane(); + + //public abstract void clear(); } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/chart/ChartEditPaneProvider.java b/designer_base/src/com/fr/design/gui/chart/ChartEditPaneProvider.java new file mode 100644 index 0000000000..3d4119ab7f --- /dev/null +++ b/designer_base/src/com/fr/design/gui/chart/ChartEditPaneProvider.java @@ -0,0 +1,13 @@ +package com.fr.design.gui.chart; + +/** + * Created by daniel on 2016/11/2. + */ +public interface ChartEditPaneProvider { + + + void gotoPane(String... id); + + void fire(); + +} diff --git a/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java b/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java index e903aa95a0..99a126e127 100644 --- a/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/UIComboBoxPane.java @@ -153,4 +153,7 @@ public abstract class UIComboBoxPane extends BasicBeanPane { return this.cards; } + public void clear() { + reset(); + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer_base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java index 436ea911cf..c7d7676003 100644 --- a/designer_base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer_base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -2,13 +2,11 @@ package com.fr.design.gui.itree.filetree; import java.awt.Component; import java.awt.Dimension; -import java.awt.dnd.DnDConstants; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import com.fr.design.constants.UIConstants; -import com.fr.design.event.TemplateTreeDragSource; import com.fr.design.gui.ilable.UILabel; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; @@ -74,7 +72,6 @@ public class EnvFileTree extends RefreshableJTree { this.setRootVisible(false); this.setShowsRootHandles(true); this.setEditable(false); - new TemplateTreeDragSource(this, DnDConstants.ACTION_COPY); } // CellRenderer diff --git a/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java b/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java index 9cae023ea7..5de971b71c 100644 --- a/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java +++ b/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java @@ -40,5 +40,6 @@ public class HelpDialogManager { if (handler != null) { handler.destroyHelpDialog(); } + handler = null; } } diff --git a/designer_base/src/com/fr/design/module/DesignModuleFactory.java b/designer_base/src/com/fr/design/module/DesignModuleFactory.java index b21d206c99..77233e4dbb 100644 --- a/designer_base/src/com/fr/design/module/DesignModuleFactory.java +++ b/designer_base/src/com/fr/design/module/DesignModuleFactory.java @@ -1 +1 @@ -package com.fr.design.module; import com.fr.base.FRContext; import com.fr.base.chart.BaseChartCollection; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartDialog; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.frpane.BaseHyperlinkGroup; import com.fr.design.gui.frpane.HyperlinkGroupType; import com.fr.design.mainframe.BaseFormDesigner; import com.fr.design.mainframe.BaseWidgetPropertyPane; import com.fr.design.parameter.HierarchyTreePane; import com.fr.design.parameter.ParameterDesignerProvider; import com.fr.design.parameter.ParameterReader; import com.fr.form.ui.Widget; import com.fr.stable.StableUtils; import java.awt.*; import java.lang.reflect.Constructor; import java.util.ArrayList; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 下午1:57 */ public class DesignModuleFactory { private static DesignModuleFactory instance = new DesignModuleFactory(); private DesignModuleFactory() { } private HyperlinkGroupType hyperlinkGroupType = new BaseHyperlinkGroup(); private NameableCreator[] creators4Hyperlink; private WidgetOption[] extraOptions; private Class chartEditorClass; private Class chartComponentClass; private Class chartDialogClass; private Class chartPropertyPaneClass; private Class newFormAction; private Class formParaDesigner; private Class paraPropertyPane; private Class formHierarchyPaneCls; private Class chartWidgetPropertyPaneCls; private Class widgetPropertyPane; private Class buttonDetailPaneClass; private java.util.List parameterReaderList; public static void registerHyperlinkGroupType(HyperlinkGroupType hyperlinkGroupType) { instance.hyperlinkGroupType = hyperlinkGroupType; } public static HyperlinkGroupType getHyperlinkGroupType() { return instance.hyperlinkGroupType; } public static void registerCreators4Hyperlink(NameableCreator[] nameableCreators) { instance.creators4Hyperlink = nameableCreators; } public static NameableCreator[] getCreators4Hyperlink() { return instance.creators4Hyperlink; } public static void registerExtraWidgetOptions(WidgetOption[] options) { instance.extraOptions = options; } public static WidgetOption[] getExtraWidgetOptions() { if (instance.extraOptions == null) { instance.extraOptions = new WidgetOption[0]; } return instance.extraOptions; } public static void registerChartEditorClass(Class cls) { instance.chartEditorClass = cls; } public static Class getChartEditorClass() { return instance.chartEditorClass; } public static void registerChartComponentClass(Class bcc) { instance.chartComponentClass = bcc; } public static void registerChartDialogClass(Class cd) { instance.chartDialogClass = cd; } public static void registerChartAndWidgetPropertyPane(Class p) { instance.chartWidgetPropertyPaneCls = p; } public static void registerChartPropertyPaneClass(Class p) { instance.chartPropertyPaneClass = p; } public static BaseChartPropertyPane getChartWidgetPropertyPane(BaseFormDesigner fd) { BaseChartPropertyPane p = null; if (instance.chartWidgetPropertyPaneCls != null) { p = StableUtils.getInstance(instance.chartWidgetPropertyPaneCls); p.setWidgetPropertyPane(DesignModuleFactory.getWidgetPropertyPane(fd)); p.setSureProperty(); } return p; } public static void registerNewFormActionClass(Class f) { instance.newFormAction = f; } public static Class getNewFormAction() { return instance.newFormAction; } public static void registerParaPropertyPaneClass(Class p) { instance.paraPropertyPane = p; } /** * 获取参数属性界面 * * @return 参数属性界面. */ public static Object getParaPropertyPane() { if (instance.paraPropertyPane != null) { try { return instance.paraPropertyPane.newInstance(); } catch (Exception e) { FRContext.getLogger().error("Error in Para PropertyPane"); } } return null; } public static void registerFormParaDesignerClass(Class f) { instance.formParaDesigner = f; } public static ParameterDesignerProvider getFormParaDesigner() { if (instance.formParaDesigner != null) { try { return (ParameterDesignerProvider) instance.formParaDesigner.newInstance(); } catch (Exception e) { FRContext.getLogger().error("error in form para designer"); } } return null; } public static void registerFormHierarchyPaneClass(Class fClass) { instance.formHierarchyPaneCls = fClass; } public static HierarchyTreePane getFormHierarchyPane() { return StableUtils.getInstance(instance.formHierarchyPaneCls); } public static void registerWidgetPropertyPaneClass(Class wp) { instance.widgetPropertyPane = wp; } public static BaseWidgetPropertyPane getWidgetPropertyPane(BaseFormDesigner fd) { BaseWidgetPropertyPane wp = null; if (instance.widgetPropertyPane != null) { wp = StableUtils.getInstance(instance.widgetPropertyPane); wp.setEditingFormDesigner(fd); wp.refreshDockingView(); } return wp; } public static MiddleChartComponent getChartComponent(BaseChartCollection collection) { MiddleChartComponent bcc = null; if (instance.chartComponentClass != null) { try { bcc = instance.chartComponentClass.newInstance(); bcc.populate(collection); } catch (InstantiationException e) { FRContext.getLogger().error("Error in ChartComponent instant", e); } catch (IllegalAccessException e) { FRContext.getLogger().error("Error in Access", e); } } return bcc; } /** * kunsnat: 初始化图表向导对话框, 调用静态方法showWindow, 参数window. * * @return 返回调出的ChartDailog */ public static MiddleChartDialog getChartDialog(Window window) { try { Constructor c; if (window instanceof Frame) { c = instance.chartDialogClass.getConstructor(Frame.class); } else { c = instance.chartDialogClass.getConstructor(Dialog.class); } return c.newInstance(window); } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); } return null; } /** * kunsnat: 获取图表属性界面 * * @return 返回界面. */ public static BaseChartPropertyPane getChartPropertyPane() { BaseChartPropertyPane bp = null; if (instance.chartPropertyPaneClass != null) { bp = StableUtils.getInstance(instance.chartPropertyPaneClass); bp.setSureProperty(); } return bp; } public static void registerButtonDetailPaneClass(Class clazz) { instance.buttonDetailPaneClass = clazz; } public static Class getButtonDetailPaneClass() { return instance.buttonDetailPaneClass; } public static void registerParameterReader(ParameterReader reader) { if (instance.parameterReaderList == null) { instance.parameterReaderList = new ArrayList(); } instance.parameterReaderList.add(reader); } public static ParameterReader[] getParameterReaders() { if (instance.parameterReaderList == null) { return new ParameterReader[0]; } return instance.parameterReaderList.toArray(new ParameterReader[instance.parameterReaderList.size()]); } } \ No newline at end of file +package com.fr.design.module; import com.fr.base.FRContext; import com.fr.base.chart.BaseChartCollection; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartDialog; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.frpane.BaseHyperlinkGroup; import com.fr.design.gui.frpane.HyperlinkGroupType; import com.fr.design.mainframe.BaseFormDesigner; import com.fr.design.mainframe.BaseWidgetPropertyPane; import com.fr.design.parameter.HierarchyTreePane; import com.fr.design.parameter.ParameterDesignerProvider; import com.fr.design.parameter.ParameterReader; import com.fr.form.ui.Widget; import com.fr.stable.StableUtils; import java.awt.*; import java.lang.reflect.Constructor; import java.util.ArrayList; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 下午1:57 */ public class DesignModuleFactory { private static DesignModuleFactory instance = new DesignModuleFactory(); private DesignModuleFactory() { } private HyperlinkGroupType hyperlinkGroupType = new BaseHyperlinkGroup(); private NameableCreator[] creators4Hyperlink; private WidgetOption[] extraOptions; private Class chartEditorClass; private Class chartComponentClass; private Class chartDialogClass; private Class chartPropertyPaneClass; private Class newFormAction; private Class formParaDesigner; private Class paraPropertyPane; private Class formHierarchyPaneCls; private Class widgetPropertyPane; private Class buttonDetailPaneClass; private java.util.List parameterReaderList; public static void registerHyperlinkGroupType(HyperlinkGroupType hyperlinkGroupType) { instance.hyperlinkGroupType = hyperlinkGroupType; } public static HyperlinkGroupType getHyperlinkGroupType() { return instance.hyperlinkGroupType; } public static void registerCreators4Hyperlink(NameableCreator[] nameableCreators) { instance.creators4Hyperlink = nameableCreators; } public static NameableCreator[] getCreators4Hyperlink() { return instance.creators4Hyperlink; } public static void registerExtraWidgetOptions(WidgetOption[] options) { instance.extraOptions = options; } public static WidgetOption[] getExtraWidgetOptions() { if (instance.extraOptions == null) { instance.extraOptions = new WidgetOption[0]; } return instance.extraOptions; } public static void registerChartEditorClass(Class cls) { instance.chartEditorClass = cls; } public static Class getChartEditorClass() { return instance.chartEditorClass; } public static void registerChartComponentClass(Class bcc) { instance.chartComponentClass = bcc; } public static void registerChartDialogClass(Class cd) { instance.chartDialogClass = cd; } public static void registerChartPropertyPaneClass(Class p) { instance.chartPropertyPaneClass = p; } public static void registerNewFormActionClass(Class f) { instance.newFormAction = f; } public static Class getNewFormAction() { return instance.newFormAction; } public static void registerParaPropertyPaneClass(Class p) { instance.paraPropertyPane = p; } /** * 获取参数属性界面 * * @return 参数属性界面. */ public static Object getParaPropertyPane() { if (instance.paraPropertyPane != null) { try { return instance.paraPropertyPane.newInstance(); } catch (Exception e) { FRContext.getLogger().error("Error in Para PropertyPane"); } } return null; } public static void registerFormParaDesignerClass(Class f) { instance.formParaDesigner = f; } public static ParameterDesignerProvider getFormParaDesigner() { if (instance.formParaDesigner != null) { try { return (ParameterDesignerProvider) instance.formParaDesigner.newInstance(); } catch (Exception e) { FRContext.getLogger().error("error in form para designer"); } } return null; } public static void registerFormHierarchyPaneClass(Class fClass) { instance.formHierarchyPaneCls = fClass; } public static HierarchyTreePane getFormHierarchyPane() { return StableUtils.getInstance(instance.formHierarchyPaneCls); } public static void registerWidgetPropertyPaneClass(Class wp) { instance.widgetPropertyPane = wp; } public static BaseWidgetPropertyPane getWidgetPropertyPane(BaseFormDesigner fd) { BaseWidgetPropertyPane wp = null; if (instance.widgetPropertyPane != null) { wp = StableUtils.getInstance(instance.widgetPropertyPane); wp.setEditingFormDesigner(fd); wp.refreshDockingView(); } return wp; } public static MiddleChartComponent getChartComponent(BaseChartCollection collection) { MiddleChartComponent bcc = null; if (instance.chartComponentClass != null) { try { bcc = instance.chartComponentClass.newInstance(); bcc.populate(collection); } catch (InstantiationException e) { FRContext.getLogger().error("Error in ChartComponent instant", e); } catch (IllegalAccessException e) { FRContext.getLogger().error("Error in Access", e); } } return bcc; } /** * kunsnat: 初始化图表向导对话框, 调用静态方法showWindow, 参数window. * * @return 返回调出的ChartDailog */ public static MiddleChartDialog getChartDialog(Window window) { try { Constructor c; if (window instanceof Frame) { c = instance.chartDialogClass.getConstructor(Frame.class); } else { c = instance.chartDialogClass.getConstructor(Dialog.class); } return c.newInstance(window); } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); } return null; } /** * kunsnat: 获取图表属性界面 * * @return 返回界面. */ public static BaseChartPropertyPane getChartPropertyPane() { BaseChartPropertyPane bp = null; if (instance.chartPropertyPaneClass != null) { bp = StableUtils.getInstance(instance.chartPropertyPaneClass); } return bp; } public static void clearChartPropertyPane() { if (instance.chartPropertyPaneClass != null) { StableUtils.clearInstance(instance.chartPropertyPaneClass); } } public static void registerButtonDetailPaneClass(Class clazz) { instance.buttonDetailPaneClass = clazz; } public static Class getButtonDetailPaneClass() { return instance.buttonDetailPaneClass; } public static void registerParameterReader(ParameterReader reader) { if (instance.parameterReaderList == null) { instance.parameterReaderList = new ArrayList(); } instance.parameterReaderList.add(reader); } public static ParameterReader[] getParameterReaders() { if (instance.parameterReaderList == null) { return new ParameterReader[0]; } return instance.parameterReaderList.toArray(new ParameterReader[instance.parameterReaderList.size()]); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/selection/QuickEditor.java b/designer_base/src/com/fr/design/selection/QuickEditor.java index 9ca62f88db..1d46af9295 100644 --- a/designer_base/src/com/fr/design/selection/QuickEditor.java +++ b/designer_base/src/com/fr/design/selection/QuickEditor.java @@ -41,6 +41,14 @@ public abstract class QuickEditor extends JComponent protected abstract void refresh(); + + /** + * for 关闭时候释放 + */ + public void release () { + tc = null; + } + public static QuickEditor DEFAULT_EDITOR = new QuickEditor() { @Override diff --git a/designer_chart/src/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java b/designer_chart/src/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java index 0543764e31..ea3fab9772 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/DataSeriesActiveGlyph.java @@ -6,8 +6,8 @@ import com.fr.base.chart.Glyph; import com.fr.chart.chartglyph.DataSeries; import com.fr.chart.chartglyph.PlotGlyph; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; /** * Created by IntelliJ IDEA. @@ -35,8 +35,8 @@ public class DataSeriesActiveGlyph extends ActiveGlyph { if(chartComponent.getEditingChart() == null) { return; } - - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE); + + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE); } @Override diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java index b4ca9a1c8e..bac286c87e 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetAnalysisLineStyleAction.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; public class SetAnalysisLineStyleAction extends ChartComponentAction{ @@ -20,7 +20,7 @@ public class SetAnalysisLineStyleAction extends ChartComponentAction{ } public void showAnalysisLineStylePane(){ - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LINE_TITLE); + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LINE_TITLE); } diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java index 26484bfb5c..60893c6fc2 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetAxisStyleAction.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; import com.fr.stable.StringUtils; @@ -27,7 +27,7 @@ public class SetAxisStyleAction extends ChartComponentAction { public void showAxisStylePane() { String axisType = getActiveAxisGlyph() == null ? StringUtils.EMPTY : getActiveAxisGlyph().getAxisType(); - - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AXIS_TITLE, axisType); + + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AXIS_TITLE, axisType); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java index b3effe37aa..6d4ef617fd 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetChartStyleAciton.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; /** @@ -26,6 +26,6 @@ public class SetChartStyleAciton extends ChartComponentAction { } public void showChartStylePane() { - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE); + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java index e565d8e160..bce590ab25 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataLabelStyleAction.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; public class SetDataLabelStyleAction extends ChartComponentAction{ @@ -20,7 +20,7 @@ public class SetDataLabelStyleAction extends ChartComponentAction{ } public void showDataLabelStylePane() { - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LABEL_TITLE); + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LABEL_TITLE); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSeriesAttrAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSeriesAttrAction.java index 96480ebd8f..0ca8924d4e 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSeriesAttrAction.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSeriesAttrAction.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; /** @@ -21,6 +21,6 @@ public class SetDataSeriesAttrAction extends ChartComponentAction { } public void actionPerformed(ActionEvent e) { - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE); + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_SERIES_TITLE); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSheetAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSheetAction.java index 6aedd01b19..23258796db 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSheetAction.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetDataSheetAction.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; /** @@ -28,6 +28,6 @@ public class SetDataSheetAction extends ChartComponentAction { } public void showDataSheetStylePane() { - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_DATA_TITLE); + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_DATA_TITLE); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java index 0a203db889..bc33e90fe3 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetLegendStyleAction.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; /** @@ -27,6 +27,6 @@ public class SetLegendStyleAction extends ChartComponentAction { } public void showLegendStylePane() { - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LEGNED_TITLE); + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_LEGNED_TITLE); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java index b49fb6ac65..686d8238c0 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetPlotStyleAction.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; /** @@ -27,6 +27,6 @@ public class SetPlotStyleAction extends ChartComponentAction { } public void showPlotPane() { - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE); + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_AREA_TITLE, PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java b/designer_chart/src/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java index f86f302a52..dc9a60575d 100644 --- a/designer_chart/src/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java +++ b/designer_chart/src/com/fr/design/chart/gui/active/action/SetTitleStyleAction.java @@ -3,8 +3,8 @@ package com.fr.design.chart.gui.active.action; import java.awt.event.ActionEvent; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; /** @@ -27,6 +27,6 @@ public class SetTitleStyleAction extends ChartComponentAction { } public void showTitlePane() { - ChartEditPane.getInstance().GoToPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_TITLE_TITLE); + DesignModuleFactory.getChartPropertyPane().getChartEditPane().gotoPane(PaneTitleConstants.CHART_STYLE_TITLE, PaneTitleConstants.CHART_STYLE_TITLE_TITLE); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java index fdcda38b2d..94836c7a38 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java @@ -13,8 +13,8 @@ import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.ChartHyperEditPane; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -129,8 +129,8 @@ public class ChartHyperPoplinkPane extends BasicBeanPane { public void updateBean(ChartHyperPoplink chartHyperlink) { hyperEditPane.updateHyperLink(chartHyperlink); chartHyperlink.setChartCollection(chartComponent.update()); - - ChartEditPane.getInstance().fire();// 响应整个图表保存事件等. + + DesignModuleFactory.getChartPropertyPane().getChartEditPane().fire();// 响应整个图表保存事件等. if(itemNameTextField != null){ chartHyperlink.setItemName(this.itemNameTextField.getText()); } diff --git a/designer_chart/src/com/fr/design/mainframe/ChartAndWidgetPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartAndWidgetPropertyPane.java deleted file mode 100644 index f5547b7e62..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/ChartAndWidgetPropertyPane.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright(c) 2001-2011, FineReport Inc, All Rights Reserved. - */ -package com.fr.design.mainframe; - -import java.awt.BorderLayout; -import java.awt.Component; - -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.constants.UIConstants; -import com.fr.design.designer.TargetComponent; -import com.fr.design.gui.ibutton.UIToggleButton; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itabpane.TitleChangeListener; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.module.DesignModuleFactory; -import com.fr.general.Inter; - -public class ChartAndWidgetPropertyPane extends MiddleChartPropertyPane { - - public synchronized static ChartAndWidgetPropertyPane getInstance(BaseFormDesigner formEditor) { - if(singleton == null) { - singleton = new ChartAndWidgetPropertyPane(formEditor); - } - - singleton.setWidgetPropertyPane(DesignModuleFactory.getWidgetPropertyPane(formEditor)); - singleton.setSureProperty(); - return singleton; - } - - public static ChartAndWidgetPropertyPane getInstance() { - if(singleton == null) { - singleton = new ChartAndWidgetPropertyPane(); - } - return singleton; - } - - private static ChartAndWidgetPropertyPane singleton; - - private BaseWidgetPropertyPane widgetpane = null; - - private UIToggleButton hisButton; - - public ChartAndWidgetPropertyPane() { - - } - - public ChartAndWidgetPropertyPane(BaseFormDesigner formEditor) { - super(); - this.widgetpane = DesignModuleFactory.getWidgetPropertyPane(formEditor); - } - - public void setWidgetPropertyPane(BaseWidgetPropertyPane pane) { - this.widgetpane = pane; - } - - @Override - protected void createMainPane() { - this.add(chartEditPane, BorderLayout.CENTER); - } - - @Override - protected void createNameLabel() { - nameLabel = new UILabel(); - nameLabel.setHorizontalAlignment(SwingConstants.LEFT); - nameLabel.setBorder(BorderFactory.createEmptyBorder(-2, 6, 2, 0)); - } - - @Override - protected JComponent createNorthComponent() { - JPanel toolPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - JPanel hisPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - hisPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); - hisButton = new UIToggleButton(Inter.getLocText(new String[]{"Widget", "Attribute"}), UIConstants.HISTORY_ICON); - hisButton.setNormalPainted(false); - hisButton.setBorderPaintedOnlyWhenPressed(true); - hisPane.add(hisButton, BorderLayout.CENTER); - - hisButton.addChangeListener(new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - cardChange(); - } - }); - - toolPane.add(nameLabel, BorderLayout.CENTER); - toolPane.add(hisPane, BorderLayout.EAST); - - titleListener = new TitleChangeListener() { - - @Override - public void fireTitleChange(String addName) { - if(hisButton.isSelected()) { - nameLabel.setText(Inter.getLocText(new String[]{"Widget", "Form-Widget_Property_Table"})); - }else { - nameLabel.setText(Inter.getLocText("Chart-Property_Table") + '-' + addName); - } - } - }; - - return toolPane; - } - - /** - * 感觉ChartCollection加载图表属性界面. - * @param collection 收集图表 - * @param ePane 面板 - */ - public void populateChartPropertyPane(ChartCollection collection, TargetComponent ePane) { - super.populateChartPropertyPane(collection, ePane); - //表单中的图表切换界面上得更新 - resetChartEditPane(); - } - - protected void resetChartEditPane() { - cardChange(); - } - - private void cardChange() { - remove(chartEditPane); - remove((Component)widgetpane); - if(hisButton.isSelected()) { - nameLabel.setText(Inter.getLocText(new String[]{"Widget", "Form-Widget_Property_Table"})); - add((Component)widgetpane, BorderLayout.CENTER); - } else { - String tabname = chartEditPane.getSelectedTabName(); - nameLabel.setText(Inter.getLocText(new String[]{"Utils-The-Chart", "Form-Widget_Property_Table"}) + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); - add(chartEditPane, BorderLayout.CENTER); - } - validate(); - repaint(); - revalidate(); - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartDesigner.java b/designer_chart/src/com/fr/design/mainframe/ChartDesigner.java index 715c02a324..f16fe98ec2 100644 --- a/designer_chart/src/com/fr/design/mainframe/ChartDesigner.java +++ b/designer_chart/src/com/fr/design/mainframe/ChartDesigner.java @@ -29,40 +29,13 @@ public class ChartDesigner extends TargetComponent implements MouseL private ChartArea chartArea;//上层区域 private boolean hasCalGap = false; - private ChartDesignerUI designerUI; private ArrayList changeListeners = new ArrayList(); - private ChartToolBarPane chartToolBarPane; - public ChartDesigner(ChartBook chartBook) { super(chartBook); this.addMouseListener(this); - designerUI = new ChartDesignerUI(); - chartToolBarPane = new ChartToolBarPane(this){ - public Dimension getPreferredSize() { - Dimension size = super.getPreferredSize(); - return new Dimension(size.width, ChartToolBarPane.TOTAL_HEIGHT); - } - }; - this.addMouseMotionListener(new MouseMotionAdapter() { - @Override - public void mouseMoved(MouseEvent e) { - if(designerUI!=null){ - designerUI.mouseMoved(e); - ChartDesigner.this.repaint(); - } - } - }); updateUI();// 初始化界面设计工具的UI实例 } - /** - * 设置其UI类为DesignerUI,负责渲染 - */ - @Override - public void updateUI() { - setUI(designerUI); - } - /** * 设置上层区域 * @param chartArea 图表区域 @@ -203,8 +176,6 @@ public class ChartDesigner extends TargetComponent implements MouseL * @param e 事件 */ public void mouseClicked(MouseEvent e) { - designerUI.mouseClicked(e); - this.chartToolBarPane.populate(); } /** @@ -247,18 +218,13 @@ public class ChartDesigner extends TargetComponent implements MouseL this.changeListeners.add(changeListener); } - public ChartToolBarPane getChartToolBarPane(){ - return this.chartToolBarPane; - } public void populate(){ - this.chartToolBarPane.populate(); } /** * 清除工具栏上面全局风格按钮的选中 */ public void clearToolBarStyleChoose(){ - chartToolBarPane.clearStyleChoose(); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartDesignerPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartDesignerPropertyPane.java deleted file mode 100644 index efa1eea628..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/ChartDesignerPropertyPane.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe; - -import com.fr.base.chart.BaseChartCollection; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.designer.TargetComponent; -import com.fr.design.gui.chart.BaseChartPropertyPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itabpane.TitleChangeListener; -import com.fr.design.mainframe.chart.ChartDesignEditPane; -import com.fr.design.mainframe.chart.ChartEditPane; -import com.fr.general.Inter; - - -import javax.swing.*; -import java.awt.*; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-15 - * Time: 下午12:43 - */ -public class ChartDesignerPropertyPane extends BaseChartPropertyPane { - private static ChartDesignerPropertyPane instance; - private TargetComponentContainer container = new TargetComponentContainer(); - private ChartEditPane chartEditPane; - private UILabel nameLabel; - private TitleChangeListener titleListener = new TitleChangeListener() { - - @Override - public void fireTitleChange(String addName) { - nameLabel.setText(Inter.getLocText("Chart-Property_Table") + '-' + addName); - } - }; - - public synchronized static ChartDesignerPropertyPane getInstance() { - if (instance == null) { - instance = new ChartDesignerPropertyPane(); - } - instance.setSureProperty(); - return instance; - } - - public ChartDesignerPropertyPane() { - this.setLayout(new BorderLayout()); - this.setBorder(null); - - createNameLabel(); - this.add(nameLabel, BorderLayout.NORTH); - chartEditPane = ChartDesignEditPane.getInstance(); - this.add(chartEditPane, BorderLayout.CENTER); - } - - private void createNameLabel() { - nameLabel = new UILabel() { - @Override - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, 18); - } - }; - nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); - nameLabel.setHorizontalAlignment(SwingConstants.CENTER); - } - - @Override - public void setSureProperty() { - chartEditPane.setContainer(container); - chartEditPane.addTitleChangeListener(titleListener); - String tabname = chartEditPane.getSelectedTabName(); - nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); - resetChartEditPane(); - - } - - protected void resetChartEditPane() { - remove(chartEditPane); - add(chartEditPane, BorderLayout.CENTER); - validate(); - repaint(); - revalidate(); - } - - @Override - public void setSupportCellData(boolean supportCellData){ - - } - - /** - * 感觉ChartCollection加载图表属性界面. - * @param collection 收集图表 - * @param chartDesigner 图表设计 - */ - public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent chartDesigner) { - if (collection instanceof ChartCollection) { - this.container.setEPane(chartDesigner); - chartEditPane.populate((ChartCollection) collection); - } - } - - @Override - public void setWidgetPropertyPane(BaseWidgetPropertyPane pane) { - - } - - /** - * 刷新 - */ - public void refreshDockingView() { - - } - - @Override - public String getViewTitle() { - return null; - } - - @Override - public Icon getViewIcon() { - return null; - } - - /** - * 位置 - * @return 位置 - */ - public Location preferredLocation() { - return null; - } -} \ 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 d11279fed3..1c04543d68 100644 --- a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java @@ -17,15 +17,15 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ /** * 创建图表属性表实例. */ - public synchronized static ChartPropertyPane getInstance() { + private synchronized static ChartPropertyPane getInstance() { if(singleton == null) { singleton = new ChartPropertyPane(); } - + singleton.setSureProperty(); return singleton; } - + private static ChartPropertyPane singleton; @Override @@ -49,9 +49,8 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ protected JComponent createNorthComponent() { return nameLabel; } - - @Override - public void setWidgetPropertyPane(BaseWidgetPropertyPane pane) { - + + public synchronized static void clear() { + singleton = null; } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartUndoState.java b/designer_chart/src/com/fr/design/mainframe/ChartUndoState.java deleted file mode 100644 index 04809b0dec..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/ChartUndoState.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe; - -import com.fr.form.ui.ChartBook; - -import java.awt.*; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-13 - * Time: 下午2:32 - */ -public class ChartUndoState extends BaseUndoState { - private ChartBook chartBook; - private Dimension designerSize; - private double widthValue; - private double heightValue; - - public ChartUndoState(JChart t,ChartArea area) { - super(t); - try { - this.chartBook = (ChartBook) t.getTarget().clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeException(e); - } - this.widthValue =area.getCustomWidth(); - this.heightValue = area.getCustomHeight(); - } - - - public ChartBook getChartBook(){ - return this.chartBook; - } - - /** - * 应用状态 - */ - public void applyState() { - this.getApplyTarget().applyUndoState(this); - - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/JChart.java b/designer_chart/src/com/fr/design/mainframe/JChart.java deleted file mode 100644 index 147c4d1b31..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/JChart.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - * 图表类型文件 - */ - -package com.fr.design.mainframe; - -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; -import com.fr.file.FILEChooserPane; -import com.fr.file.FILEChooserPane4Chart; -import com.fr.form.ui.ChartBook; -import com.fr.design.DesignModelAdapter; -import com.fr.design.event.TargetModifiedEvent; -import com.fr.design.event.TargetModifiedListener; -import com.fr.design.gui.imenu.UIMenuItem; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.actions.ExcelExportAction4Chart; -import com.fr.design.mainframe.actions.PDFExportAction4Chart; -import com.fr.design.mainframe.actions.PNGExportAction4Chart; -import com.fr.design.mainframe.form.FormECCompositeProvider; -import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.menu.ShortCut; -import com.fr.design.menu.ToolBarDef; -import com.fr.file.FILE; -import com.fr.general.Inter; -import com.fr.json.JSONArray; -import com.fr.json.JSONException; -import com.fr.json.JSONObject; -import com.fr.stable.StringUtils; - -import javax.swing.*; -import java.awt.*; -import java.awt.datatransfer.StringSelection; - -/** - * 图表crt文件 - *

- * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-13 - * Time: 下午2:28 - */ -public class JChart extends JTemplate { - public static final String XML_TAG = "JChart"; - private static final String CHART_CARD = "FORM"; - private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; - - private static final String[] CARDNAME = new String[]{CHART_CARD, ELEMENTCASE_CARD}; - private static final int TOOLBARPANEDIMHEIGHT_FORM = 60; - //图表设计器 - ChartDesigner chartDesigner; - - //中间编辑区域, carllayout布局 - private JPanel tabCenterPane; - private CardLayout cardLayout; - //当前编辑的组件对象 - private JComponent editingComponent; - private FormECCompositeProvider reportComposite; - - public JChart() { - super(new ChartBook(), "Chart"); - } - - public JChart(ChartBook chartFile, FILE file) { - super(chartFile, file); - } - - @Override - protected JPanel createCenterPane() { - tabCenterPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, new Color(85, 85, 85))); - chartDesigner = new ChartDesigner(this.getTarget()); - ChartArea area = new ChartArea(chartDesigner); - centerPane.add(area, BorderLayout.CENTER); - tabCenterPane.add(centerPane, CHART_CARD, 0); - chartDesigner.addTargetModifiedListener(new TargetModifiedListener() { - public void targetModified(TargetModifiedEvent e) { - JChart.this.fireTargetModified();// 调用保存*, 调用刷新界面, 刷新工具栏按钮 - } - }); - - this.add(tabCenterPane, BorderLayout.CENTER); - return tabCenterPane; - } - - /** - * 移除选择 - */ - public void removeTemplateSelection() { - - } - - /** - * 刷新容器 - */ - public void refreshContainer() { - - } - - /** - * 移除参数面板选择 - */ - public void removeParameterPaneSelection() { - - } - - /** - * 创建设计模式 - * - * @return 返回模式 - */ - protected DesignModelAdapter createDesignModel() { - return null; - } - - /** - * 创建预览得菜单 - * - * @return 菜单 - */ - public UIMenuItem[] createMenuItem4Preview() { - return new UIMenuItem[0]; - } - - /** - * 创建撤销状态 - * - * @return 状态 - */ - protected ChartUndoState createUndoState() { - return new ChartUndoState(this,chartDesigner.getArea()); - } - - /** - * 应用撤销状态 - * - * @param chartUndoState 撤销状态 - */ - protected void applyUndoState(ChartUndoState chartUndoState) { - try { - this.setTarget((ChartBook)chartUndoState.getChartBook().clone()); - chartDesigner.setTarget(this.getTarget()); - chartDesigner.populate(); - }catch (CloneNotSupportedException e) { - throw new RuntimeException(e); - } - } - - /** - * 后缀 - * - * @return 后缀 - */ - public String suffix() { - return ".crt"; - } - - /** - * 复制 - */ - public void copy() { - - } - - /** - * 黏贴 - * - * @return 是否鸟贴成功 - */ - public boolean paste() { - return false; - } - - /** - * 是否剪切 - * - * @return 剪切成功 - */ - public boolean cut() { - return false; - } - - /** - * 创建权限编辑面板 - * - * @return 面板 - */ - public AuthorityEditPane createAuthorityEditPane() { - return null; - } - - /** - * 工具栏 - * - * @return 工具栏 - */ - public ToolBarMenuDockPlus getToolBarMenuDockPlus() { - return null; - } - - /** - * 东上面板 - * - * @return 面板 - */ - public JPanel getEastUpPane() { - return null; - } - - /** - * 东下面板 - * - * @return 面板 - */ - public JPanel getEastDownPane() { - return null; - } - - /** - * 工具栏菜单 - * - * @return 菜单 - */ - public ToolBarDef[] toolbars4Target() { - return new ToolBarDef[0]; - } - - /** - * 表单面板 - * - * @return 面板 - */ - public JPanel[] toolbarPanes4Form() { - return new JPanel[0]; - } - - /** - * 模版菜单 - * - * @return 模版菜单 - */ - public ShortCut[] shortcut4TemplateMenu() { - return new ShortCut[0]; - } - - /** - * 权限编辑菜单 - * - * @return 菜单 - */ - public ShortCut[] shortCuts4Authority() { - return new ShortCut[0]; - } - - /** - * 工具条表单 - * - * @return 表单 - */ - public JComponent[] toolBarButton4Form() { - return new JComponent[0]; - } - - /** - * 权限编辑工具栏,但是图表设计器里面用于正常工具栏不是全县编辑 - * - * @return 工具条 - */ - public JComponent toolBar4Authority() { - return chartDesigner.getChartToolBarPane(); - } - - /** - * 工具条高度 - * - * @return 工具条高度 - */ - public int getToolBarHeight() { - return 0; - } - - /** - * 是否是报表 - * - * @return 不是 - */ - public boolean isJWorkBook() { - return false; - } - - /** - * 是否是图表 - * - * @return 是则返回true - */ - public boolean isChartBook() { - return true; - } - - /** - * 设置权限编辑模式 - * - * @param isUpMode 没有权限编辑 - */ - public void setAuthorityMode(boolean isUpMode) { - - } - - /** - * 刷新工具区域 - */ - public void refreshToolArea() { - DesignerContext.getDesignerFrame().resetToolkitByPlus(JChart.this); - chartDesigner.populate(); - ChartDesignerPropertyPane.getInstance().populateChartPropertyPane(getTarget().getChartCollection(), chartDesigner); - EastRegionContainerPane.getInstance().replaceUpPane(ChartDesignerPropertyPane.getInstance()); - } - - /** - * 导出菜单的子菜单 ,目前用于图表设计器 - * - * @return 子菜单 - */ - public ShortCut[] shortcut4ExportMenu() { - return new ShortCut[]{new PNGExportAction4Chart(this), new ExcelExportAction4Chart(this), new PDFExportAction4Chart(this)}; - } - - public Icon getIcon() { - return BaseUtils.readIcon("/com/fr/design/images/chart.png"); - } - - public ChartDesigner getChartDesigner(){ - return chartDesigner; - } - - /** - * 复制JS代码 - */ - public void copyJS(){ - JSONObject jsonObject =this.getTarget().createExportConfig(); - String jsonString = StringUtils.EMPTY; - if(jsonObject != null){ - try{ - if(jsonObject.has("charts")){ - JSONArray charts = jsonObject.getJSONArray("charts"); - jsonString = charts.toString(2); - }else{ - jsonString = jsonObject.toString(2); - } - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Chart-CopyJS_Message"), Inter.getLocText("FR-Chart-Action_Copy")+"JS", JOptionPane.INFORMATION_MESSAGE); - }catch (JSONException ex){ - FRContext.getLogger().error(ex.getMessage()); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Chart-CopyJS_Failed")+"!", Inter.getLocText("Error"), JOptionPane.ERROR_MESSAGE); - } - }else{ - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Chart-CopyJS_Failed")+"!", Inter.getLocText("Error"), JOptionPane.ERROR_MESSAGE); - } - StringSelection stringSelection = new StringSelection(jsonString); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null); - }; - - /** - * 系列风格改动 - */ - public void styleChange(){ - chartDesigner.clearToolBarStyleChoose(); - } - - protected FILEChooserPane getFILEChooserPane(boolean isShowLoc){ - return new FILEChooserPane4Chart(true, isShowLoc); - } - -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java index 59cfb383e4..0b86c5a12f 100644 --- a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java @@ -13,11 +13,13 @@ import com.fr.base.chart.BaseChartCollection; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.designer.TargetComponent; import com.fr.design.gui.chart.BaseChartPropertyPane; +import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.UITitlePanel; 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; public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ @@ -37,7 +39,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ createNameLabel(); this.add(createNorthComponent(), BorderLayout.NORTH); - chartEditPane = ChartEditPane.getInstance(); + chartEditPane = StableUtils.construct(ChartEditPane.class); chartEditPane.setSupportCellData(true); this.createMainPane(); } @@ -48,6 +50,12 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ protected abstract void createMainPane(); + + @Override + public ChartEditPaneProvider getChartEditPane() { + return chartEditPane; + } + public void setSureProperty() { chartEditPane.setContainer(container); chartEditPane.addTitleChangeListener(titleListener); @@ -93,6 +101,12 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ } } +// public void clear() { +// this.container.setEPane(null); +// chartEditPane.clear(); +// getParent().remove(this); +// } + /** * 返回View的标题. */ diff --git a/designer_chart/src/com/fr/design/mainframe/actions/AbstractExportAction4JChart.java b/designer_chart/src/com/fr/design/mainframe/actions/AbstractExportAction4JChart.java deleted file mode 100644 index 0601bd4f48..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/actions/AbstractExportAction4JChart.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe.actions; - -import com.fr.base.FRContext; -import com.fr.design.gui.iprogressbar.FRProgressBar; -import com.fr.form.ui.ChartBook; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.mainframe.JChart; -import com.fr.design.mainframe.exporter.Exporter4Chart; -import com.fr.file.FILE; -import com.fr.file.FILEChooserPane; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.general.FRLogger; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.io.FileOutputStream; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-15 - * Time: 上午9:48 - */ -public abstract class AbstractExportAction4JChart extends JChartAction { - protected AbstractExportAction4JChart(JChart chart){ - super(chart); - } - - private FRProgressBar progressbar; - - protected ChartBook getChartBook(){ - return this.getEditingComponent().getTarget(); - } - - /** - * 执行方法 - * @param e 事件 - */ - public void actionPerformed(ActionEvent e) { - JChart chart = this.getEditingComponent(); - FILE editingFILE = chart.getEditingFILE(); - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - - // 弹出参数 - final java.util.Map parameterMap = new java.util.HashMap(); - final ChartBook chartBook = getChartBook(); - - // Choose a file name.... - FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); - fileChooserPane.setFILEFilter(this.getChooseFileFilter()); - - // 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc - String filenName = editingFILE.getName(); - if (filenName.indexOf('.') != -1) { - filenName = filenName.substring(0, editingFILE.getName().lastIndexOf('.')); - } - fileChooserPane.setFileNameTextField(filenName, "." + this.getDefaultExtension()); - int saveValue = fileChooserPane.showSaveDialog(designerFrame, "." + this.getDefaultExtension()); - if (saveValue == FILEChooserPane.CANCEL_OPTION || saveValue == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION) { - fileChooserPane = null; - return; - } else if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { - FILE file = fileChooserPane.getSelectedFILE(); - try { - file.mkfile(); - } catch (Exception e1) { - FRLogger.getLogger().error("Error In Make New File"); - } - fileChooserPane = null; - FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("Prepare_Export") + "!"); - - (progressbar = new FRProgressBar(createExportWork(file, chartBook), designerFrame, - Inter.getLocText("Exporting"), "", 0, 100)).start(); - } - - } - - private SwingWorker createExportWork(FILE file, final ChartBook chartBook) { - final String filePath = file.getPath(); - final String fileGetName = file.getName(); - - SwingWorker exportWorker = new SwingWorker() { - protected Void doInBackground() throws Exception { - Thread.sleep(100); //bug 10516 - try { - final FileOutputStream fileOutputStream = new FileOutputStream(filePath); - - this.setProgress(10); - dealExporter(fileOutputStream,chartBook); - this.setProgress(80); - fileOutputStream.close(); - this.setProgress(100); - - FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("Finish_Export") + "!"); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - Inter.getLocText("Exported_successfully") + "\n" + filePath); - } catch (Exception exp) { - this.setProgress(100); - FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Export_failed") + "\n" + filePath); - } - return null; - } - - public void done() { - progressbar.close(); - } - }; - return exportWorker; - } - - private void dealExporter(FileOutputStream fileOutputStream, final ChartBook chartBook) throws Exception { - final Exporter4Chart exporter = AbstractExportAction4JChart.this.getExporter(); - exporter.export(fileOutputStream,this.getEditingComponent()); - } - - - - protected abstract ChooseFileFilter getChooseFileFilter(); - - protected abstract String getDefaultExtension(); - - protected abstract Exporter4Chart getExporter(); - -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java b/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java deleted file mode 100644 index e1e64395a3..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/actions/ExcelExportAction4Chart.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe.actions; - -import com.fr.base.BaseUtils; -import com.fr.base.ExcelUtils; -import com.fr.design.mainframe.JChart; -import com.fr.design.mainframe.exporter.ExcelExporter4Chart; -import com.fr.design.mainframe.exporter.Exporter4Chart; -import com.fr.design.menu.MenuKeySet; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.event.KeyEvent; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-15 - * Time: 上午9:52 - */ -public class ExcelExportAction4Chart extends AbstractExportAction4JChart { - - private MenuKeySet excel= new MenuKeySet() { - @Override - public char getMnemonic() { - return 'E'; - } - - @Override - public String getMenuName() { - return Inter.getLocText("FR-Chart-Format_Excel"); - } - - @Override - public KeyStroke getKeyStroke() { - return KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK); - } - }; - - public ExcelExportAction4Chart(JChart chart) { - super(chart); - this.setMenuKeySet(excel); - this.setName(getMenuKeySet().getMenuKeySetName()); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); - } - - - @Override - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(new String[]{"xls", "xlsx"}, Inter.getLocText("Export-Excel")); - } - - @Override - protected String getDefaultExtension() { - return ExcelUtils.checkThirdJarSupportPOI() ? "xlsx" : "xls"; - } - - @Override - protected Exporter4Chart getExporter() { - return new ExcelExporter4Chart(); - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/JChartAction.java b/designer_chart/src/com/fr/design/mainframe/actions/JChartAction.java deleted file mode 100644 index ba46678759..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/actions/JChartAction.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe.actions; - -import com.fr.design.actions.JTemplateAction; -import com.fr.design.mainframe.JChart; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-15 - * Time: 上午9:47 - */ -public abstract class JChartAction extends JTemplateAction { - public JChartAction(JChart jChart) { - super(jChart); - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/NewChartAction.java b/designer_chart/src/com/fr/design/mainframe/actions/NewChartAction.java deleted file mode 100644 index bd62a689bd..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/actions/NewChartAction.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe.actions; - -import com.fr.base.BaseUtils; -import com.fr.design.actions.UpdateAction; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JChart; -import com.fr.design.menu.MenuKeySet; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-13 - * Time: 下午3:22 - */ -public class NewChartAction extends UpdateAction{ - - public NewChartAction(){ - this.setMenuKeySet(NEW_CHART); - this.setName(getMenuKeySet().getMenuKeySetName()); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/newchart_normal.png")); - this.setAccelerator(getMenuKeySet().getKeyStroke()); - } - - - /** - * 执行事件 - * @param e 事件 - */ - public void actionPerformed(ActionEvent e) { - DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JChart()); - } - - public static final MenuKeySet NEW_CHART = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'F'; - } - - @Override - public String getMenuName() { - return Inter.getLocText("M-New_ChartBook"); - } - - @Override - public KeyStroke getKeyStroke() { - return KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK); - } - }; -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/PDFExportAction4Chart.java b/designer_chart/src/com/fr/design/mainframe/actions/PDFExportAction4Chart.java deleted file mode 100644 index df2f95598a..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/actions/PDFExportAction4Chart.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe.actions; - -import com.fr.base.BaseUtils; -import com.fr.design.mainframe.JChart; -import com.fr.design.mainframe.exporter.Exporter4Chart; -import com.fr.design.mainframe.exporter.PdfExporter4Chart; -import com.fr.design.menu.MenuKeySet; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.general.Inter; - -import javax.swing.*; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-15 - * Time: 上午10:16 - */ -public class PDFExportAction4Chart extends AbstractExportAction4JChart { - - private MenuKeySet pdf = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'P'; - } - - @Override - public String getMenuName() { - return Inter.getLocText("FR-Chart-Format_PDF"); - } - - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; - - public PDFExportAction4Chart(JChart chart) { - super(chart); - this.setMenuKeySet(pdf); - this.setName(getMenuKeySet().getMenuKeySetName()); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/pdf.png")); - } - - @Override - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(new String[]{"pdf"}, Inter.getLocText("Export-PDF")); - } - - @Override - protected String getDefaultExtension() { - return "pdf"; - } - - @Override - protected Exporter4Chart getExporter() { - return new PdfExporter4Chart(); - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/actions/PNGExportAction4Chart.java b/designer_chart/src/com/fr/design/mainframe/actions/PNGExportAction4Chart.java deleted file mode 100644 index 2b04f80d4d..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/actions/PNGExportAction4Chart.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe.actions; - -import com.fr.base.BaseUtils; -import com.fr.design.mainframe.JChart; -import com.fr.design.mainframe.exporter.Exporter4Chart; -import com.fr.design.mainframe.exporter.ImageExporter4Chart; -import com.fr.design.menu.MenuKeySet; -import com.fr.file.filter.ChooseFileFilter; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.event.KeyEvent; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-15 - * Time: 上午10:18 - */ -public class PNGExportAction4Chart extends AbstractExportAction4JChart { - - private MenuKeySet menuSet = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'M'; - } - - @Override - public String getMenuName() { - return Inter.getLocText("FR-Chart-Format_Image"); - } - - @Override - public KeyStroke getKeyStroke() { - return KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK); - } - }; - - public PNGExportAction4Chart(JChart chart) { - super(chart); - this.setMenuKeySet(menuSet); - this.setName(getMenuKeySet().getMenuKeySetName()); - this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/exportimg.png")); - } - - @Override - protected ChooseFileFilter getChooseFileFilter() { - return new ChooseFileFilter(new String[]{"png"}, Inter.getLocText("Image")); - } - - @Override - protected String getDefaultExtension() { - return "png"; - } - - @Override - protected Exporter4Chart getExporter() { - return new ImageExporter4Chart(); - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java b/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java index 23f21463b3..8c4a21c814 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/AbstractChartAttrPane.java @@ -32,4 +32,5 @@ public abstract class AbstractChartAttrPane extends AbstractAttrNoScrollPane { public void refreshChartDataPane(ChartCollection collection){ } + } \ No newline at end of file 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 c3a2e1d502..f19c49d66f 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -9,6 +9,7 @@ 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; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.itabpane.TitleChangeListener; @@ -30,20 +31,13 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.List; -public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange { - public synchronized static ChartEditPane getInstance() { - if (singleton == null) { - singleton = new ChartEditPane(); - } - return singleton; - } +public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange, ChartEditPaneProvider { private final static int CHANGE_MIN_TIME = 80; protected ChartCollection collection; protected boolean isDefaultPane = true;//是否是默认的界面 - private static ChartEditPane singleton; protected List paneList; protected ChartTypePane typePane; @@ -79,10 +73,6 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 registerDSChangeListener(); } - public static ChartEditPane getSingleton() { - return singleton; - } - //构建主面板 protected void createTabsPane() { Icon[] iconArray = new Icon[paneList.size()]; @@ -295,7 +285,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 * * @param id 界面的标志.id */ - public void GoToPane(String... id) { + public void gotoPane(String... id) { this.setSelectedIndex(id); EastRegionContainerPane.getInstance().setWindow2PreferWidth(); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java index d1a4088cd5..7c8589fb25 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java @@ -105,4 +105,5 @@ public class ChartDataPane extends AbstractChartAttrPane { public void refreshChartDataPane(ChartCollection collection){ this.populate(collection); } + } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index f9c6e572c6..1c2bd85ed9 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -66,20 +66,20 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen return this.mouseOnChartTypeButtonPane; } - private AWTEventListener awt = new AWTEventListener() { - public void eventDispatched(AWTEvent event) { - //没有进行鼠标点击,则返回 - if (event instanceof MouseEvent && ((MouseEvent) event).getClickCount() > 0) { - if (currentEditingEditor != null && !ComparatorUtils.equals(event.getSource(), currentEditingEditor)) { - stopEditing(); - if (event.getSource() instanceof ChartChangeButton) { - ((ChartChangeButton) event.getSource()).mouseClick((MouseEvent) event); - } - populateBean(editingCollection); - } - } - } - }; +// private AWTEventListener awt = new AWTEventListener() { +// public void eventDispatched(AWTEvent event) { +// //没有进行鼠标点击,则返回 +// if (event instanceof MouseEvent && ((MouseEvent) event).getClickCount() > 0) { +// if (currentEditingEditor != null && !ComparatorUtils.equals(event.getSource(), currentEditingEditor)) { +// stopEditing(); +// if (event.getSource() instanceof ChartChangeButton) { +// ((ChartChangeButton) event.getSource()).mouseClick((MouseEvent) event); +// } +// populateBean(editingCollection); +// } +// } +// } +// }; public ChartTypeButtonPane(ChartTypePane chartTypePane){ this(); @@ -111,7 +111,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen initConfigButton(); initConfigCreator(); - Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + // Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); } private void initConfigCreator() { @@ -328,7 +328,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private void checkConfigButtonVisible() { addButton.setVisible(true); //新建一个collection - if(editingCollection.getState() == SwitchState.DEFAULT){ + if(editingCollection.getState() == SwitchState.DEFAULT && editingCollection.getSelectedChart() != null){ //Chart 不支持图表切换 configButton.setVisible(editingCollection.getSelectedChart().supportChange()); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java index 4cb51f8f49..6c74211b8a 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java @@ -102,4 +102,5 @@ public class DatabaseTableDataPane extends BasicPane{ } }); } + } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index bf64e4957a..d5aa2d93ec 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -133,4 +133,5 @@ public class NormalChartDataPane extends DataContentsPane { public void setSupportCellData(boolean supportCellData) { dataPane.justSupportOneSelect(supportCellData); } + } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java index cedc08a483..a3ede1b9f3 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/ReportDataPane.java @@ -52,7 +52,7 @@ public class ReportDataPane extends FurtherBasicBeanPane{ * 界面重置 */ public void reset() { - + clear(); } /** @@ -98,4 +98,8 @@ public class ReportDataPane extends FurtherBasicBeanPane{ public ChartCollection updateBean() { return null; } + + public void clear() { + this.removeAll(); + } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java index 6fdf74ce96..6b1b9d9985 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java @@ -49,8 +49,8 @@ public class ChartSwitchPane extends AbstractAttrNoScrollPane{ if(currentChartEditPane != null) { currentChartEditPane.populate(editingChartCollection);// 选中新Plot之后 刷新对应界面, 比如超级链接等, 然后才能update. - currentChartEditPane.GoToPane(PaneTitleConstants.CHART_TYPE_TITLE); - currentChartEditPane.GoToPane(PaneTitleConstants.CHART_OTHER_TITLE, PaneTitleConstants.CHART_OTHER_TITLE_CHANGE); + currentChartEditPane.gotoPane(PaneTitleConstants.CHART_TYPE_TITLE); + currentChartEditPane.gotoPane(PaneTitleConstants.CHART_OTHER_TITLE, PaneTitleConstants.CHART_OTHER_TITLE_CHANGE); currentChartEditPane.fire(); } } diff --git a/designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java b/designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java deleted file mode 100644 index 71e02d1735..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/exporter/ExcelExporter4Chart.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.fr.design.mainframe.exporter; - -import com.fr.base.ExcelUtils; -import com.fr.design.mainframe.ChartDesigner; -import com.fr.design.mainframe.JChart; -import com.fr.general.FRLogger; -import com.fr.general.IOUtils; -import com.fr.stable.CoreGraphHelper; -import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFClientAnchor; -import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFWorkbook; -import com.fr.third.v2.org.apache.poi.ss.usermodel.ClientAnchor; -import com.fr.third.v2.org.apache.poi.ss.usermodel.Drawing; -import com.fr.third.v2.org.apache.poi.ss.usermodel.Sheet; -import com.fr.third.v2.org.apache.poi.ss.usermodel.Workbook; -import com.fr.third.v2.org.apache.poi.xssf.usermodel.XSSFClientAnchor; -import com.fr.third.v2.org.apache.poi.xssf.usermodel.XSSFWorkbook; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-22 - * Time: 上午10:47 - */ -public class ExcelExporter4Chart extends ImageExporter4Chart { - private static final int PICTURE_TYPE_PNG = 6 ; - private static final int DEFAULT_COLUMN_SPAN = 12; - private static final int DEFAULT_ROW_SPAN = 26; - private Workbook workbook; - private ClientAnchor anchor; - - - - /** - * 导出 - * - * @param out 输出流 - * @param chart 图表文件 - * @throws Exception 异常 - */ - public void export(OutputStream out, JChart chart) throws Exception { - try { - ChartDesigner designer = chart.getChartDesigner(); - int imageWidth = designer.getArea().getCustomWidth(); - int imageHeight = designer.getArea().getCustomHeight(); - BufferedImage image = CoreGraphHelper.createBufferedImage(imageWidth, (int) imageHeight, BufferedImage.TYPE_INT_RGB); - Graphics2D g2d = image.createGraphics(); - paintGlyph(g2d,imageWidth,imageHeight,designer); - g2d.dispose(); - if (checkExcelExportVersion()) { - workbook = new XSSFWorkbook(); - }else{ - workbook = new HSSFWorkbook(); - } - Sheet sheet = workbook.createSheet(); - if(checkExcelExportVersion()){ - anchor = new XSSFClientAnchor(0,0,0,0,1,1,DEFAULT_COLUMN_SPAN,DEFAULT_ROW_SPAN); - }else{ - anchor = new HSSFClientAnchor(0,0,0,0,(short)1,1,(short)DEFAULT_COLUMN_SPAN,DEFAULT_ROW_SPAN); - } - Drawing patriarch = sheet.createDrawingPatriarch(); - patriarch.createPicture(anchor,loadPicture(image)); - workbook.write(out); - out.flush(); - }catch (Exception e){ - FRLogger.getLogger().error(e.getMessage()); - } - } - - private boolean checkExcelExportVersion() { - return ExcelUtils.checkThirdJarSupportPOI(); - } - // 加载图片. - private int loadPicture(BufferedImage bufferedImage)throws IOException { - ByteArrayOutputStream bos = null; - try { - bos = new ByteArrayOutputStream(); - IOUtils.writeImage(bufferedImage, "png", bos); - //引用这个参数是jdk1.5的版本 XSSFWorkbook.PICTURE_TYPE_PNG, 在1.4下无法编译, 所有手动去掉这个参数. - return workbook.addPicture(bos.toByteArray(), PICTURE_TYPE_PNG); - } finally { - if (bos != null) { - bos.flush(); - bos.close(); - } - bufferedImage.flush(); - } - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/exporter/Exporter4Chart.java b/designer_chart/src/com/fr/design/mainframe/exporter/Exporter4Chart.java deleted file mode 100644 index 3e4a36d127..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/exporter/Exporter4Chart.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.design.mainframe.exporter; -import com.fr.design.mainframe.JChart; - -import java.io.OutputStream; - -/** - * 图表设计器crt文件的导出成其他类型文件的接口 - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-21 - * Time: 下午7:14 - */ -public interface Exporter4Chart { - - /** - * 将结果crt导出成目标文件 - * - * @param out 输出流 - * @param chart chart文件 - * @throws Exception 导出失败则抛出此异常 - */ - public void export(OutputStream out, JChart chart) throws Exception; - -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/exporter/ImageExporter4Chart.java b/designer_chart/src/com/fr/design/mainframe/exporter/ImageExporter4Chart.java deleted file mode 100644 index 4f3651d1fa..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/exporter/ImageExporter4Chart.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.mainframe.exporter; - -import com.fr.base.chart.BaseChartGlyph; -import com.fr.base.chart.chartdata.BaseTableDefinition; -import com.fr.base.chart.chartdata.ChartData; -import com.fr.base.chart.chartdata.TopDefinitionProvider; -import com.fr.chart.chartattr.Chart; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.chart.chartglyph.ChartGlyph; -import com.fr.data.TableDataSource; -import com.fr.design.mainframe.ChartDesigner; -import com.fr.design.mainframe.JChart; -import com.fr.script.Calculator; -import com.fr.stable.Constants; -import com.fr.stable.CoreGraphHelper; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.OutputStream; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-15 - * Time: 上午10:04 - */ -public class ImageExporter4Chart implements Exporter4Chart{ - private int resolution = Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION; - protected Calculator calculator; - - - public ImageExporter4Chart() { - - } - - /** - * 导出 - * - * @param out 输出流 - * @param chart 图表文件 - * @throws Exception 异常 - */ - public void export(OutputStream out, JChart chart) throws Exception { - ChartDesigner designer = chart.getChartDesigner(); - int imageWidth = designer.getArea().getCustomWidth(); - int imageHeight = designer.getArea().getCustomHeight(); - BufferedImage image = CoreGraphHelper.createBufferedImage(imageWidth, (int) imageHeight, BufferedImage.TYPE_INT_RGB); - Graphics2D g2d = image.createGraphics(); - paintGlyph(g2d,imageWidth,imageHeight,designer); - ImageIO.write(image, "png", out); - } - - protected void paintGlyph(Graphics2D g2d,int imageWidth,int imageHeight,ChartDesigner designer){ - if (imageWidth == 0 || imageHeight == 0) { - return; - } - this.calculator = Calculator.createCalculator(); - this.calculator.setAttribute(TableDataSource.class, null); - g2d.setColor(Color.white); - g2d.fillRect(0, 0, imageWidth,imageHeight); - ChartCollection chartCollection = (ChartCollection) designer.getTarget().getChartCollection(); - Chart editingChart = chartCollection.getSelectedChart(); - - TopDefinitionProvider topDefinition = editingChart.getFilterDefinition(); - ChartData chartData4Glyph = null; - if (topDefinition instanceof BaseTableDefinition) { - chartData4Glyph = ((BaseTableDefinition) topDefinition).calcu4ChartData(calculator, editingChart.getDataProcessor()); - } - - if (chartData4Glyph == null) { - chartData4Glyph = editingChart.defaultChartData(); - } - - BaseChartGlyph chartGlyph = null; - if (editingChart != null && editingChart.getPlot() != null) { - chartGlyph = editingChart.createGlyph(chartData4Glyph); - } - if (chartGlyph instanceof ChartGlyph) { - Image glyphImage = ((ChartGlyph) chartGlyph).toImage(imageWidth, imageHeight, resolution); - g2d.drawImage(glyphImage, 0, 0, null); - } - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/exporter/PdfExporter4Chart.java b/designer_chart/src/com/fr/design/mainframe/exporter/PdfExporter4Chart.java deleted file mode 100644 index b7a33e4d10..0000000000 --- a/designer_chart/src/com/fr/design/mainframe/exporter/PdfExporter4Chart.java +++ /dev/null @@ -1,382 +0,0 @@ -package com.fr.design.mainframe.exporter; - -import com.fr.base.FRContext; -import com.fr.design.mainframe.ChartDesigner; -import com.fr.design.mainframe.JChart; -import com.fr.general.ComparatorUtils; -import com.fr.general.FRLogger; -import com.fr.stable.OperatingSystem; -import com.fr.stable.StableUtils; -import com.fr.third.com.lowagie.text.Document; -import com.fr.third.com.lowagie.text.ExceptionConverter; -import com.fr.third.com.lowagie.text.Rectangle; -import com.fr.third.com.lowagie.text.pdf.*; - -import java.awt.*; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Locale; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-22 - * Time: 上午10:20 - */ -public class PdfExporter4Chart extends ImageExporter4Chart { - protected static MyFontMapper fontMapper = null; - - - /** - * 将结果crt导出成目标文件 - * - * @param out 输出流 - * @param chart chart文件 - * @throws Exception 导出失败则抛出此异常 - */ - public void export(OutputStream out, JChart chart) throws Exception { - ChartDesigner designer = chart.getChartDesigner(); - int imageWidth = designer.getArea().getCustomWidth(); - int imageHeight = designer.getArea().getCustomHeight(); - Document document = null; - PdfWriter writer = null; - ByteArrayOutputStream bo = new ByteArrayOutputStream(); - - if (document == null) { - document = new Document(new Rectangle(imageWidth, imageHeight)); - writer = PdfWriter.getInstance(document, bo); - document.open(); - } - //将chart画到PDF上去 - PdfContentByte cb = writer.getDirectContent(); - Graphics2D g2d = cb.createGraphics(imageWidth, imageHeight, prepareFontMapper()); - paintGlyph(g2d, imageWidth, imageHeight, designer); - g2d.dispose(); - if (document != null) { - document.close(); - } - - try { - out.write(bo.toByteArray()); - out.flush(); - out.close(); - } catch (IOException e) { - FRLogger.getLogger().error(e.getMessage()); - } - - - } - - private static void insertDirectory4Linux() { - /* - * alex:在222这台Redhat的机器上测试,发现把从windows拷来的simsun.ttc只有放在usr/share/fonts/default/Type1里面才可以用起来 - * 如果是放在usr/share/fonts目录或是${env}/resources/fonts目录下面,虽然可以读到,但是awtToPdf之后返回出去却依旧无法起作用 - * 中文字依然挤在一起 - * - * 觉得实在很诡异,可能必须放在系统字体的文件夹下面才行吧 - * - * PS:这是在用Graphics drawString的时候遇到的问题 - */ - //Linux - InsertDirectory(fontMapper, new File("/usr/X11R6/lib/X11/fonts")); - InsertDirectory(fontMapper, new File("/usr/share/fonts")); - String path = StableUtils.pathJoin(new String[]{FRContext.getCurrentEnv().getPath(), "fonts"}); - //再去web-inf/fonts里面找一下, 省去客户四处找jdk安装路径的麻烦 - InsertDirectory(fontMapper, new File(path)); - - //Solaris - InsertDirectory(fontMapper, new File("/usr/X/lib/X11/fonts/TrueType")); - InsertDirectory(fontMapper, new File("/usr/openwin/lib/X11/fonts/TrueType")); - } - - private static void insertDirectory4Windows() { - String libraryPath = System.getProperty("java.library.path"); - String[] libraryPathArray = StableUtils.splitString(libraryPath, ";"); - for (int i = 0; i < libraryPathArray.length; i++) { - File libraryFile = new File(libraryPathArray[i]); - InsertDirectory(fontMapper, new File(libraryFile, "Fonts")); - } - - InsertDirectory(fontMapper, new File("C:\\WINNT\\Fonts")); - InsertDirectory(fontMapper, new File("C:\\WINDOWS\\Fonts")); - } - - //peter:循环所有的目录,遍历所有的FontMapper. - protected static void InsertDirectory(MyFontMapper fontMapper, File dir) { - if (dir == null || !dir.exists() || !dir.isDirectory()) { - return; - } - - fontMapper.insertDirectory(dir.getAbsolutePath()); - - File[] listFiles = dir.listFiles(); - for (int i = 0; i < listFiles.length; i++) { - InsertDirectory(fontMapper, listFiles[i]); - } - } - - - /** - * Prepares FontMapper. - */ - protected static MyFontMapper prepareFontMapper() { - if (fontMapper != null) { - return fontMapper; - } - - fontMapper = new MyFontMapper(); - try { - //然后加载系统Font字体. - if (OperatingSystem.isWindows()) { - insertDirectory4Windows(); - - } else { - insertDirectory4Linux(); - - } - - String javaHomeProp = System.getProperty("java.home"); - if (javaHomeProp != null) { - File javaFontFile = new File(StableUtils.pathJoin(new String[]{ - javaHomeProp, "lib", "fonts" - })); - if (javaFontFile.exists() && javaFontFile.isDirectory()) { - InsertDirectory(fontMapper, javaFontFile); - } - } - - if (FRContext.getLocale() == Locale.CHINA || FRContext.getLocale() == Locale.CHINESE) { - MyFontMapper.defaultFont = BaseFont.createFont(MyFontMapper.CHINESE_SIMPLIFIED_FONT, MyFontMapper.CHINESE_SIMPLIFIED_ENCODING_H, BaseFont.NOT_EMBEDDED); - } else if (FRContext.getLocale() == Locale.TAIWAN || FRContext.getLocale() == Locale.TRADITIONAL_CHINESE) { - MyFontMapper.defaultFont = BaseFont.createFont(MyFontMapper.CHINESE_TRADITIONAL_FONT_M_SUNG, MyFontMapper.CHINESE_TRADITIONAL_ENCODING_H, BaseFont.NOT_EMBEDDED); - } else if (FRContext.getLocale() == Locale.JAPAN || FRContext.getLocale() == Locale.JAPANESE) { - MyFontMapper.defaultFont = BaseFont.createFont(MyFontMapper.JAPANESE_FONT_GO, MyFontMapper.JAPANESE_ENCODING_H, BaseFont.NOT_EMBEDDED); - } else if (FRContext.getLocale() == Locale.KOREA || FRContext.getLocale() == Locale.KOREAN) { - MyFontMapper.defaultFont = BaseFont.createFont(MyFontMapper.KOREAN_FONT_GO_THIC, MyFontMapper.KOREAN_ENCODING_H, BaseFont.NOT_EMBEDDED); - } else { - //默认也设置一个吧45422 , 不设置默认字体, linux英文环境导不出来 - MyFontMapper.defaultFont = BaseFont.createFont(MyFontMapper.CHINESE_SIMPLIFIED_FONT, MyFontMapper.CHINESE_SIMPLIFIED_ENCODING_H, BaseFont.NOT_EMBEDDED); - } - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - - return fontMapper; - } - - public static class MyFontMapper implements FontMapper { - - public static final String CHINESE_SIMPLIFIED_FONT = "STSong-Light"; - public static final String CHINESE_SIMPLIFIED_ENCODING_H = "UniGB-UCS2-H"; - public static final String CHINESE_SIMPLIFIED_ENCODING_V = "UniGB-UCS2-V"; - - public static final String CHINESE_TRADITIONAL_FONT_M_HEI = "MHei-Medium"; - public static final String CHINESE_TRADITIONAL_FONT_M_SUNG = "MSung-Light"; - public static final String CHINESE_TRADITIONAL_ENCODING_H = "UniCNS-UCS2-H"; - public static final String CHINESE_TRADITIONAL_ENCODING_V = "UniCNS-UCS2-V"; - - public static final String JAPANESE_FONT_GO = "HeiseiKakuGo-W5"; - public static final String JAPANESE_FONT_MIN = "HeiseiMin-W3"; - public static final String JAPANESE_ENCODING_H = "UniJIS-UCS2-H"; - public static final String JAPANESE_ENCODING_V = "UniJIS-UCS2-V"; - public static final String JAPANESE_ENCODING_HW_H = "UniJIS-UCS2-HW-H"; - public static final String JAPANESE_ENCODING_HW_V = "UniJIS-UCS2-HW-V"; - - public static final String KOREAN_FONT_GO_THIC = "HYGoThic-Medium"; - public static final String KOREAN_FONT_S_MYEONG_JO = "HYSMyeongJo-Medium"; - public static final String KOREAN_ENCODING_H = "UniKS-UCS2-H"; - public static final String KOREAN_ENCODING_V = "UniKS-UCS2-V"; - - public static BaseFont defaultFont; - private HashMap mapper; - - public static class BaseFontParameters { - - public String fontName; - public String encoding; - public boolean embedded; - public boolean cached; - public byte ttfAfm[]; - public byte pfb[]; - - public BaseFontParameters(String fontName) { - this.fontName = fontName; - encoding = BaseFont.IDENTITY_H; - embedded = true; - cached = true; - } - - /** - * toString方法 - * - * @return 对象说明 - */ - public String toString() { - return "{fontName:" + fontName + ",encoding:" + encoding + ",embedded:" + embedded + ",cached:" + cached; - } - } - - public MyFontMapper() { - mapper = new HashMap(); - } - - /** - * 转化字体 - * - * @param font awt字体 - * @return pdf字体 - */ - public BaseFont awtToPdf(Font font) { - try { - BaseFontParameters p = getBaseFontParameters(font.getFontName()); - - /* - * alex:不明真相 - * 经测试,Arial粗体在getFontName返回的是Arial Bold,可以在上面的方法中得到对应的p - * 所以getFontName是有用的 - * 但是在linux上测试,宋体在getFontName返回的却是Dialog这种逻辑字体,只有getName才返回SimSun - * 所以还需要getBaseFontParameters一下 - */ - if (p == null) { - p = getBaseFontParameters(font.getName()); - } - - if (p != null) { - return BaseFont.createFont(p.fontName, p.encoding, p.embedded, p.cached, p.ttfAfm, p.pfb); - } else { - // FRContext.getLogger().info(Inter.getLocText("Utils-Font_Not_Found") + ":" + font.getFontName()); - - // alex:未找到合适的字体,如果有默认字体,用之,没有的话,根据Bold & Italic设置字体 - if (defaultFont != null) { - return defaultFont; - } else { - String fontKey = BaseFont.COURIER; - if (font.isBold() && font.isItalic()) { - fontKey = BaseFont.COURIER_BOLDOBLIQUE; - } else if (font.isBold()) { - fontKey = BaseFont.COURIER_BOLD; - } else if (font.isItalic()) { - fontKey = BaseFont.COURIER_OBLIQUE; - } - - return BaseFont.createFont(fontKey, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); - } - } - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - throw new ExceptionConverter(e); - } - } - - /** - * 转化字体 - * - * @param font pdf字体 - * @param size 大小 - * @return 转化后awt字体 - */ - public Font pdfToAwt(BaseFont font, int size) { - String[][] names = font.getFullFontName(); - if (names.length == 1) { - return new Font(names[0][3], 0, size); - } - String name10 = null; - String name3x = null; - for (int k = 0; k < names.length; ++k) { - String[] name = names[k]; - if (ComparatorUtils.equals(name[0], "1") && ComparatorUtils.equals(name[1], "0")) { - name10 = name[3]; - } else if (ComparatorUtils.equals(name[2], "1033")) { - name3x = name[3]; - break; - } - } - String finalName = name3x; - if (finalName == null) { - finalName = name10; - } - if (finalName == null) { - finalName = names[0][3]; - } - return new Font(finalName, 0, size); - } - - private BaseFontParameters getBaseFontParameters(String name) { - return (BaseFontParameters) mapper.get(name); - } - - protected void insertNames(String names[][], String path) { - String main = null; - int k = 0; - do { - if (k >= names.length) { - break; - } - String[] name = names[k]; - if (ComparatorUtils.equals(name[2], "1033")) { - main = name[3]; - break; - } - k++; - } while (true); - if (main == null) { - main = names[0][3]; - } - BaseFontParameters p = new BaseFontParameters(path); - - // alex:不一样的名字可能对应同样的BaseFontParameters,比如simsun和宋体都对应同样的p - mapper.put(main, p); - for (k = 0; k < names.length; k++) { - mapper.put(names[k][3], p); - } - } - - /** - * 插入目录里的字体 - * - * @param dir 目录 - * @return 插入数量 - */ - public int insertDirectory(String dir) { - File file = new File(dir); - if (!file.exists() || !file.isDirectory()) { - return 0; - } - - File[] files = file.listFiles(); - int count = 0; - for (int k = 0; k < files.length; k++) { - file = files[k]; - String name = file.getPath().toLowerCase(); - try { - if (matchPostfix(name)) { - String[][] names = BaseFont.getFullFontName(file.getPath(), BaseFont.CP1252, null); - insertNames(names, file.getPath()); - count++; - } else if (name.endsWith(".ttc")) { - String[] ttcs = BaseFont.enumerateTTCNames(file.getPath()); - for (int j = 0; j < ttcs.length; j++) { - String nt = String.valueOf(new StringBuffer(file.getPath()).append(',').append(j)); - String[][] names = BaseFont.getFullFontName(nt, BaseFont.CP1252, null); - insertNames(names, nt); - } - - count++; - } - } catch (Exception exception) { - FRContext.getLogger().error(exception.getMessage(), exception); - } - } - - return count; - } - - private boolean matchPostfix(String name) { - return name.endsWith(".ttf") || name.endsWith(".otf") || name.endsWith(".afm"); - } - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/module/ChartDesignerModule.java b/designer_chart/src/com/fr/design/module/ChartDesignerModule.java index d86c469ff0..38034efd04 100644 --- a/designer_chart/src/com/fr/design/module/ChartDesignerModule.java +++ b/designer_chart/src/com/fr/design/module/ChartDesignerModule.java @@ -1 +1 @@ -package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartAndWidgetPropertyPane; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartAndWidgetPropertyPane(ChartAndWidgetPropertyPane.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if(rowChart == null) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } } \ No newline at end of file +package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if(rowChart == null) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/module/ChartStartModule.java b/designer_chart/src/com/fr/design/module/ChartStartModule.java deleted file mode 100644 index 0dab6e9235..0000000000 --- a/designer_chart/src/com/fr/design/module/ChartStartModule.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.design.module; - -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; -import com.fr.base.io.XMLEncryptUtils; -import com.fr.chart.base.ChartInternationalNameContentBean; -import com.fr.chart.chartattr.Chart; -import com.fr.chart.charttypes.ChartTypeManager; -import com.fr.chart.module.ChartModule; -import com.fr.design.DesignerEnvManager; -import com.fr.design.chart.gui.ChartWidgetOption; -import com.fr.design.gui.core.WidgetOption; -import com.fr.design.mainframe.*; -import com.fr.file.FILE; -import com.fr.form.ui.ChartBook; -import com.fr.form.ui.ChartEditor; -import com.fr.general.Inter; -import com.fr.general.ModuleContext; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-13 - * Time: 下午2:56 - */ -public class ChartStartModule extends ChartDesignerModule { - - protected void dealBeforeRegister(){ - ModuleContext.startModule(ChartModule.class.getName()); - } - - protected void registerFloatEditor() { - - } - - protected WidgetOption[] options4Show() { - ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); - ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; - for (int i = 0; i < typeName.length; i++) { - Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(typeName[i].getPlotID()); - child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), BaseUtils - .readIcon("com/fr/design/images/form/toolbar/" + typeName[i].getName() + ".png"), - ChartEditor.class, rowChart[0]); - } - return child; - } - - /** - * 应用打开器 - * @return 应用 - */ - public App[] apps4TemplateOpener() { - return new App[]{new AbstractAppProvider() { - - @Override - public String[] defaultExtentions() { - return new String[]{"crt"}; - } - - @Override - public JTemplate openTemplate(FILE tplFile) { - return new JChart(asIOFile(tplFile), tplFile); - } - - @Override - public ChartBook asIOFile(FILE file) { - if (XMLEncryptUtils.isCptEncoded() && - !XMLEncryptUtils.checkVaild(DesignerEnvManager.getEnvManager().getEncryptionKey())) { - if (!new DecodeDialog(file).isPwdRight()) { - FRContext.getLogger().error(Inter.getLocText("FR-Chart-Password_Error")); - return new ChartBook(); - } - } - - - ChartBook tpl = new ChartBook(); - //打开通知 - FRContext.getLogger().info(Inter.getLocText(new String[]{"LOG-Is_Being_Openned", "LOG-Please_Wait"}, - new String[]{"\"" + file.getName() + "\"" + ",", "..."})); - try { - tpl.readStream(file.asInputStream()); - } catch (Exception exp) { - FRContext.getLogger().error("Failed to generate frm from " + file, exp); - return null; - } - return tpl; - } - }}; - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/start/ChartSplashPane.java b/designer_chart/src/com/fr/start/ChartSplashPane.java deleted file mode 100644 index d081d21642..0000000000 --- a/designer_chart/src/com/fr/start/ChartSplashPane.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.start; - -import java.awt.Image; - -import com.fr.base.BaseUtils; - -public class ChartSplashPane extends SplashPane{ - - /** - * 创建启动画面的背景图片 - * - * @return 背景图片 - * - */ - public Image createSplashBackground() { - return BaseUtils.readImage("/com/fr/design/images/splash4Chart.png"); - } -} \ No newline at end of file diff --git a/designer_chart/src/com/fr/start/Designer4Chart.java b/designer_chart/src/com/fr/start/Designer4Chart.java deleted file mode 100644 index 83de32da70..0000000000 --- a/designer_chart/src/com/fr/start/Designer4Chart.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. - */ - -package com.fr.start; - -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; -import com.fr.design.DesignerEnvManager; -import com.fr.design.actions.file.WebPreviewUtils; -import com.fr.design.actions.help.AboutAction; -import com.fr.design.constants.UIConstants; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.file.NewTemplatePane; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.itoolbar.UILargeToolbar; -import com.fr.design.mainframe.*; -import com.fr.design.mainframe.actions.*; -import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.menu.*; -import com.fr.design.module.ChartStartModule; -import com.fr.general.FRFont; -import com.fr.general.Inter; -import com.fr.general.web.ParameterConsts; -import com.fr.stable.Constants; - -import javax.swing.*; -import javax.swing.border.MatteBorder; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import java.util.ArrayList; - -/** - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-13 - * Time: 上午11:02 - */ -public class Designer4Chart extends BaseDesigner { - private static final int TOOLBAR_HEIGHT = 53; - private static final int TOOLBAR_WIDTH =60+34+7+1+7 ; - private static final int GAP = 7; - private static final int EAST_WIDTH = 292; - private static final int MESSAGEPORT = 51460; - private UIButton saveButton; - private UIButton undo; - private UIButton redo; - private UIButton run; - private UIButton copy; - - /** - * 主函数 - * - * @param args 入口参数 - */ - public static void main(String[] args) { - new Designer4Chart(args); - } - - public Designer4Chart(String[] args) { - super(args); - } - - @Override - protected String module2Start() { - EastRegionContainerPane.getInstance().setDownPaneVisible(false); - EastRegionContainerPane.getInstance().setContainerWidth(EAST_WIDTH); - return ChartStartModule.class.getName(); - } - - protected void initLanguage() { - //这两句的位置不能随便调换,因为会影响语言切换的问题 - FRContext.setLanguage(Constants.LANGUAGE_ENGLISH); - } - - protected void initDefaultFont(){ - FRContext.getDefaultValues().setFRFont(FRFont.getInstance("Meiryo", Font.PLAIN, 9)); - } - - /** - * build得路径 - * @return build得路径 - */ - public String buildPropertiesPath() { - return "/com/fr/chart/base/build.properties"; - } - - /** - * 创建文件菜单项 - * @return 菜单项 - */ - public ShortCut[] createNewFileShortCuts() { - ArrayList shortCuts = new ArrayList(); - shortCuts.add(new NewChartAction()); - return shortCuts.toArray(new ShortCut[shortCuts.size()]); - } - - /** - * 创建新模版 - * @return 模版 - */ - public JTemplate createNewTemplate() { - return new JChart(); - } - - protected void resetToolTips(){ - copy.setToolTipText(Inter.getLocText("FR-Chart-Action_Copy")+"JS"); - run.setToolTipText(PREVIEW.getMenuKeySetName()); - } - - /** - * 创建设计器上几个比较大的图标:新建cpt,保存,前进,后退,运行。 - * - * @return 返回大图标对应的工具栏 - */ - public UILargeToolbar createLargeToolbar() { - - UILargeToolbar largeToolbar = new UILargeToolbar(FlowLayout.LEFT){ - public Dimension getPreferredSize() { - return new Dimension(TOOLBAR_WIDTH ,TOOLBAR_HEIGHT); - } - }; - largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4)); - largeToolbar.add(new JPanel() { - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.width = 1; - return dim; - } - }); - createRunButton(); - largeToolbar.add(run); - largeToolbar.add(new JPanel() { - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.width = GAP; - return dim; - } - }); - largeToolbar.addSeparator(new Dimension(2, 42)); - largeToolbar.add(new JPanel() { - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.width = GAP; - return dim; - } - }); - createCopyButton(); - largeToolbar.add(copy); - largeToolbar.add(new JPanel() { - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.width = GAP; - return dim; - } - }); - largeToolbar.addSeparator(new Dimension(2, 42)); - - largeToolbar.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), UIConstants.LINE_COLOR)); - return largeToolbar; - } - - protected int getStartPort(){ - return MESSAGEPORT; - } - - protected DesignerFrame createDesignerFrame(){ - - return new DesignerFrame4Chart(this); - } - - /** - * 创建上面一排的工具栏按钮 - * - * @return 按钮 - */ - public UIButton[] createUp() { - return new UIButton[]{createSaveButton(), createUndoButton(), createRedoButton()}; - } - - private UIButton createRunButton() { - run = new UIButton(BaseUtils.readIcon("com/fr/design/images/buttonicon/pageb24.png")) { - public Dimension getPreferredSize() { - return new Dimension(34, 43); - } - }; - run.setToolTipText(PREVIEW.getMenuKeySetName()); - run.set4ChartLargeToolButton(); - run.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - onChartPreview(jt); - } - }); - return run; - } - - public static void onChartPreview(JTemplate jt) { - WebPreviewUtils.actionPerformed(jt, null, ParameterConsts.CHARTLET); - } - - public static final MenuKeySet PREVIEW = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'P'; - } - - @Override - public String getMenuName() { - return Inter.getLocText("FR-Chart-Template_Preview"); - } - - @Override - public KeyStroke getKeyStroke() { - return KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK); - } - }; - - - private UIButton createCopyButton(){ - copy = new UIButton(BaseUtils.readIcon("com/fr/design/images/copyjs.png")) { - public Dimension getPreferredSize() { - return new Dimension(34, 43); - } - }; - copy.setToolTipText(Inter.getLocText("FR-Chart-Action_Copy")+"JS"); - copy.set4ChartLargeToolButton(); - copy.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - DesignerContext.getDesignerFrame().refreshToolbar(); - - jt.stopEditing(); - if (!jt.isSaved() && !jt.saveTemplate2Env()) { - return; - } - //复制代码 - jt.copyJS(); - } - }); - return copy; - } - - private UIButton createSaveButton() { - saveButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/save.png")); - saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName()); - saveButton.set4ToolbarButton(); - saveButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - jt.stopEditing(); - jt.saveTemplate(); - jt.requestFocus(); - } - }); - return saveButton; - } - - private UIButton createUndoButton() { - undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png")); - undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); - undo.set4ToolbarButton(); - undo.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null) { - jt.undo(); - } - } - }); - return undo; - } - - private UIButton createRedoButton() { - redo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/redo.png")); - redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName()); - redo.set4ToolbarButton(); - redo.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt != null) { - jt.redo(); - } - } - }); - return redo; - } - - /** - * 重置工具条 - * @param toolbarComponent 工具栏 - * @param plus 对象 - * @return 工具条对象 - */ - public JComponent resetToolBar(JComponent toolbarComponent, ToolBarMenuDockPlus plus) { - return plus.toolBar4Authority(); - } - - public NewTemplatePane getNewTemplatePane(){ - return new NewTemplatePane() { - @Override - public Icon getNew() { - return BaseUtils.readIcon("/com/fr/design/images/newchart_normal.png"); - } - - @Override - public Icon getMouseOverNew() { - return BaseUtils.readIcon("/com/fr/design/images/newchart_over.png"); - } - - @Override - public Icon getMousePressNew() { - return BaseUtils.readIcon("/com/fr/design/images/newchart_press.png"); - } - }; - }; - - @Override - protected void refreshLargeToolbarState() { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jt == null) { - return; - } - saveButton.setEnabled(!jt.isSaved()); - MutilTempalteTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListPane.getInstance().getHistoryList()); - MutilTempalteTabPane.getInstance().repaint(); - if (DesignerEnvManager.getEnvManager().isSupportUndo()) { - undo.setEnabled(jt.canUndo()); - redo.setEnabled(jt.canRedo()); - } else { - undo.setEnabled(false); - redo.setEnabled(false); - } - } - - protected SplashPane createSplashPane() { - return new ChartSplashPane(); - } - - /** - *更新工具栏 - */ - public void updateToolBarDef() { - refreshLargeToolbarState(); - } - - protected void addCloseCurrentTemplateAction(MenuDef menuDef) { - - } - - protected void addPreferenceAction(MenuDef menuDef) { - - } - - protected void addSwitchExistEnvAction(MenuDef menuDef) { - - } - - @Override - public MenuDef[] createTemplateShortCuts(ToolBarMenuDockPlus plus) { - MenuDef menuDef = new MenuDef(KeySetUtils.EXPORT_CHART.getMenuKeySetName(), KeySetUtils.EXPORT_CHART.getMnemonic()); - menuDef.addShortCut(plus.shortcut4ExportMenu()); - return new MenuDef[] {menuDef}; - } - - /** - * 创建帮助菜单得菜单项 - * @return 菜单项 - */ - public ShortCut[] createHelpShortCuts() { - resetToolTips(); - return new ShortCut[]{ - new ChartWebAction(), - SeparatorDef.DEFAULT, - new ChartFeedBackAciton(), - SeparatorDef.DEFAULT, - new UpdateOnlineAction(), - new AboutAction() - }; - } - - protected ShortCut openTemplateAction(){ - return new OpenChartAction(); - } - - protected String[] startFileSuffix(){ - return new String[]{".crt"}; - } - -} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java index f996338562..ee1fb27bd1 100644 --- a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java +++ b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java @@ -44,17 +44,17 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{ super(); this.helpMsg = helpMsg; add(controlButton); - if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { - WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { - @Override - public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == (DesignerEvent.CREATOR_DELETED) - || evt.getCreatorEventID() == (DesignerEvent.CREATOR_RESIZED)) { - destroyHelpDialog(); - } - } - }); - } +// if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { +// WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { +// @Override +// public void fireCreatorModified(DesignerEvent evt) { +// if (evt.getCreatorEventID() == (DesignerEvent.CREATOR_DELETED) +// || evt.getCreatorEventID() == (DesignerEvent.CREATOR_RESIZED)) { +// destroyHelpDialog(); +// } +// } +// }); +// } } public String getHelpMsg() { diff --git a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java index 006918ba93..91f92cba69 100644 --- a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -89,6 +89,12 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree public void refreshDockingView() { FormDesigner formDesigner = this.getEditingFormDesigner(); removeAll(); + if(this.componentTree != null) { + this.componentTree.removeAll(); + } + if(this.treeComboBox != null) { + this.treeComboBox.removeAll(); + } if (formDesigner == null) { clearDockingView(); return; From d2e367ac2a0d3d07627ff35d6bfd54c9ea13be7a Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 7 Nov 2016 14:47:12 +0800 Subject: [PATCH 153/244] level ++ --- designer_base/src/com/fr/design/fun/ElementUIProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/fun/ElementUIProvider.java b/designer_base/src/com/fr/design/fun/ElementUIProvider.java index 7cdd8eb721..75c3c86e8a 100644 --- a/designer_base/src/com/fr/design/fun/ElementUIProvider.java +++ b/designer_base/src/com/fr/design/fun/ElementUIProvider.java @@ -13,7 +13,7 @@ public interface ElementUIProvider extends Mutable { String MARK_STRING = "ElementUIProvider"; - int CURRENT_LEVEL = 1; + int CURRENT_LEVEL = 2; /** * 单元格元素编辑器 From 985546787dc69e203aec4580d1bde9ad5aa6c2b8 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 7 Nov 2016 16:31:00 +0800 Subject: [PATCH 154/244] =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/ChartTypeButtonPane.java | 18 ++++++++++++++---- .../mainframe/chart/gui/ChartTypePane.java | 13 +++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 46722836af..0f23beb5d8 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -19,6 +19,7 @@ import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -51,6 +52,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private UITextField currentEditingEditor = null; private ChartTypePane parent = null; + private String lastPlotID = StringUtils.EMPTY; //记录鼠标当前是否在操作添加按钮 private boolean mouseOnChartTypeButtonPane = false; @@ -281,16 +283,18 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen return Inter.getLocText("FR-Chart-Types_Switch"); } + /** + * 返回是否还需要更新 + * @param name + * @return + */ private void changeCollectionSelected(String name) { if (editingCollection != null) { + lastPlotID = editingCollection.getSelectedChart().getPlot().getPlotID(); int count = editingCollection.getChartCount(); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(name, editingCollection.getChartName(i))) { editingCollection.setSelectedIndex(i); - //重构面板 - if (parent != null){ - parent.reLayoutEditPane(editingCollection.getSelectedChart()); - } break; } } @@ -509,6 +513,12 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen changeCollectionSelected(getButtonName()); setSelectedWithFireListener(true); fireSelectedChanged(); + + //需要先更新,最后重构面板 + //重构面板 + if (parent != null ){ + parent.reLayoutEditPane(lastPlotID, editingCollection); + } } } 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 a286b39c8c..eab0010eae 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 @@ -262,12 +262,17 @@ public class ChartTypePane extends AbstractChartAttrPane{ } + /** - * 重构面板 - * @param chart + * 面板重构 + * @param lastPlotID + * @param collection */ - public void reLayoutEditPane(Chart chart){ - if (editPane != null){ + public void reLayoutEditPane(String lastPlotID, ChartCollection collection){ + Chart chart = collection.getSelectedChart(); + String plotID = chart.getPlot().getPlotID(); + boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); + if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ editPane.reLayout(chart); } } From a5a817f6a722ed592c4dde38f417e66a732f426d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 7 Nov 2016 17:17:03 +0800 Subject: [PATCH 155/244] update --- .../fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index a9626e5f54..9de951f4be 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -52,7 +52,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private UITextField currentEditingEditor = null; private ChartTypePane parent = null; - private String lastPlotID = StringUtils.EMPTY; //记录鼠标当前是否在操作添加按钮 private boolean mouseOnChartTypeButtonPane = false; @@ -290,7 +289,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen */ private void changeCollectionSelected(String name) { if (editingCollection != null) { - lastPlotID = editingCollection.getSelectedChart().getPlot().getPlotID(); int count = editingCollection.getChartCount(); for (int i = 0; i < count; i++) { if (ComparatorUtils.equals(name, editingCollection.getChartName(i))) { @@ -510,6 +508,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen if (isEnabled()) { noSelected(); + //记录改变前的plotID + String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChart().getPlot().getPlotID(); changeCollectionSelected(getButtonName()); setSelectedWithFireListener(true); fireSelectedChanged(); From 3332fa12c40c3b8de78086cccb7bf4112fd8d66b Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 7 Nov 2016 17:17:59 +0800 Subject: [PATCH 156/244] update --- .../fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 9de951f4be..8ee4e4667f 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -282,11 +282,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen return Inter.getLocText("FR-Chart-Types_Switch"); } - /** - * 返回是否还需要更新 - * @param name - * @return - */ private void changeCollectionSelected(String name) { if (editingCollection != null) { int count = editingCollection.getChartCount(); From 0529d6924a7e819198ff8604d17de2270938fa74 Mon Sep 17 00:00:00 2001 From: lee <854954082@qq.com> Date: Mon, 7 Nov 2016 18:28:18 +0800 Subject: [PATCH 157/244] 1 1 --- .../com/fr/design/extra/LoginWebBridge.java | 25 +++++----- .../com/fr/design/extra/PluginWebBridge.java | 13 ++++- .../design/extra/exe/PluginLoginExecutor.java | 49 +++++++++++++++++++ 3 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 designer_base/src/com/fr/design/extra/exe/PluginLoginExecutor.java diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index b604ae8d8b..41ed99beb9 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java @@ -68,11 +68,11 @@ public class LoginWebBridge { public static com.fr.design.extra.LoginWebBridge getHelper() { if (helper != null) { - return helper; + return helper; } synchronized (com.fr.design.extra.LoginWebBridge.class) { if (helper == null) { - helper = new com.fr.design.extra.LoginWebBridge(); + helper = new com.fr.design.extra.LoginWebBridge(); } return helper; } @@ -118,14 +118,13 @@ public class LoginWebBridge { if(!StringUtils.isEmpty(this.userName)){ updateMessageCount(); } - DesignerEnvManager.getEnvManager().setBBSName(userName); this.userName = userName; } /** * 定时取后台论坛消息 */ - private void updateMessageCount(){ + public void updateMessageCount(){ //启动获取消息更新的线程 //登陆状态, 根据存起来的用户名密码, 每1分钟发起一次请求, 更新消息条数. Thread updateMessageThread = new Thread(new Runnable() { @@ -171,7 +170,7 @@ public class LoginWebBridge { } this.messageCount = count; StringBuilder sb = new StringBuilder(); - sb.append(StringUtils.BLANK).append(this.userName) + sb.append(StringUtils.BLANK).append(DesignerEnvManager.getEnvManager().getBBSName()) .append("(").append(this.messageCount) .append(")").append(StringUtils.BLANK); DesignerEnvManager.getEnvManager().setInShowBBsName(sb.toString()); @@ -244,7 +243,7 @@ public class LoginWebBridge { * @param uiLabel 两边的label显示 * @return 登录信息标志 */ - private String login(String username, String password, UILabel uiLabel) { + public String login(String username, String password, UILabel uiLabel) { if (!StringUtils.isNotBlank(username) && !StringUtils.isNotBlank(password)) { return LOGIN_INFO_EMPTY; } @@ -253,7 +252,7 @@ public class LoginWebBridge { } String loginResult = login(username, password); if (loginResult.equals(LOGININ)) { - updateUserInfo(username, password); + updateUserInfo(username); loginSuccess(username, uiLabel); setUserName(username, uiLabel); } @@ -275,10 +274,7 @@ public class LoginWebBridge { * @param username 用户名 * @param password 密码 */ - public void updateUserInfo(String username,String password) { - DesignerEnvManager.getEnvManager().setBBSName(username); - DesignerEnvManager.getEnvManager().setBBSPassword(password); - DesignerEnvManager.getEnvManager().setInShowBBsName(username); + public void updateUserInfo(String username) { this.userName = username; } @@ -309,7 +305,7 @@ public class LoginWebBridge { }); } - public String login(String username, String password) { + private String login(String username, String password) { try { Client uc = new Client(); String result = uc.uc_user_login(username, password); @@ -319,6 +315,9 @@ public class LoginWebBridge { int $uid = Integer.parseInt(list.get(0)); if ($uid > 0) { DesignerEnvManager.getEnvManager().setBbsUid($uid); + DesignerEnvManager.getEnvManager().setBBSName(username); + DesignerEnvManager.getEnvManager().setInShowBBsName(username); + DesignerEnvManager.getEnvManager().setBBSPassword(password); return LOGININ;//登录成功,0 } else if ($uid == -1) { return USERNAME_NOT_EXSIT;//用户名不存在,-1 @@ -335,4 +334,4 @@ public class LoginWebBridge { } return UNKNOWN_ERROR; } -} +} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 12c3e85c41..15bd72c09c 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -529,6 +529,17 @@ public class PluginWebBridge { return LoginWebBridge.getHelper().pluginManageLogin(username, password, uiLabel); } + /** + * 插件管理部分的登陆的回调处理 + * @param username + * @param password + * @param callback + */ + public void defaultLogin(String username, String password, final JSObject callback) { + Task task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password, uiLabel)); + new Thread(task).start(); + } + /** * 弹出QQ授权页面 */ @@ -545,4 +556,4 @@ public class PluginWebBridge { DesignerEnvManager.getEnvManager().setInShowBBsName(StringUtils.EMPTY); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); } -} +} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/exe/PluginLoginExecutor.java b/designer_base/src/com/fr/design/extra/exe/PluginLoginExecutor.java new file mode 100644 index 0000000000..c1101f8005 --- /dev/null +++ b/designer_base/src/com/fr/design/extra/exe/PluginLoginExecutor.java @@ -0,0 +1,49 @@ +package com.fr.design.extra.exe; + +import com.fr.design.extra.LoginWebBridge; +import com.fr.design.extra.Process; +import com.fr.design.gui.ilable.UILabel; + +/** + * Created by Slpire on 2016/11/7. + */ +public class PluginLoginExecutor implements Executor { + + private String result = "[]"; + + private String username; + private String password; + private UILabel uiLabel; + + public PluginLoginExecutor(String username, String password, UILabel uiLabel) { + this.username = username; + this.password = password; + this.uiLabel = uiLabel; + } + + @Override + public String getTaskFinishMessage() { + return result; + } + + @Override + public Command[] getCommands() { + return new Command[] { + new Command() { + @Override + public String getExecuteMessage() { + return null; + } + + @Override + public void run(Process process) { + String loginResult = LoginWebBridge.getHelper().login(username, password, uiLabel); + if (Integer.valueOf(loginResult) == 0) { + LoginWebBridge.getHelper().updateMessageCount(); + } + result = loginResult; + } + } + }; + } +} From 46199cf5a75e7386f87af53c75c5882a688b4457 Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 7 Nov 2016 18:54:08 +0800 Subject: [PATCH 158/244] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E5=9C=A8web=E7=AB=AF=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/LocalePane.java | 75 +++++++------------ 1 file changed, 28 insertions(+), 47 deletions(-) diff --git a/designer_base/src/com/fr/design/actions/file/LocalePane.java b/designer_base/src/com/fr/design/actions/file/LocalePane.java index 27dad46df9..3356fa70af 100644 --- a/designer_base/src/com/fr/design/actions/file/LocalePane.java +++ b/designer_base/src/com/fr/design/actions/file/LocalePane.java @@ -8,13 +8,7 @@ import java.awt.BorderLayout; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.Set; -import java.util.Vector; +import java.util.*; import javax.swing.JTable; import javax.swing.RowFilter; @@ -31,10 +25,7 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.dialog.BasicPane; import com.fr.file.filetree.FileNode; -import com.fr.general.FRLogger; -import com.fr.general.GeneralUtils; -import com.fr.general.IOUtils; -import com.fr.general.Inter; +import com.fr.general.*; import com.fr.stable.ArrayUtils; import com.fr.stable.project.ProjectConstants; @@ -43,12 +34,6 @@ import com.fr.stable.project.ProjectConstants; * @since : 8.0 */ public class LocalePane extends BasicPane { - private static final String FR = "fr.properties"; - private static final String US = "fr_en_US.properties"; - private static final String CN = "fr_zh_CN.properties"; - private static final String JP = "fr_ja_JP.properties"; - private static final String TW = "fr_zh_TW.properties"; - private static final String KR = "fr_ko_KR.properties"; private static final String PREFIX = "fr_"; private static final int LOCALE_NAME_LEN = 5; @@ -124,39 +109,35 @@ public class LocalePane extends BasicPane { } private void initPredefinedProperties() { - Properties fr = loadLocaleProperties(FR); - Properties us = loadLocaleProperties(US); - Properties cn = loadLocaleProperties(CN); - Properties jp = loadLocaleProperties(JP); - Properties tw = loadLocaleProperties(TW); - Properties kr = loadLocaleProperties(KR); - - Set keys = fr.stringPropertyNames(); - List sortKeys = new ArrayList(keys); + Map map = Inter.getPredefinedPackageMap(); + LocalePackage chinese = map.get(Locale.SIMPLIFIED_CHINESE); + + List sortKeys = new ArrayList(); + + + Set bundles = chinese.getKindsOfResourceBundle(); + for (ResourceBundle bundle : bundles) { + sortKeys.addAll(bundle.keySet()); + } Collections.sort(sortKeys); - Vector keyVector = new Vector(); - Vector valueVector = new Vector(); - Vector usVector = new Vector(); - Vector cnVector = new Vector(); - Vector jpVector = new Vector(); - Vector twVector = new Vector(); - Vector krVector = new Vector(); - for (String key : sortKeys) { - keyVector.add(key); - valueVector.add(fr.getProperty(key)); - usVector.add(us.getProperty(key)); - cnVector.add(cn.getProperty(key)); - jpVector.add(jp.getProperty(key)); - twVector.add(tw.getProperty(key)); - krVector.add(kr.getProperty(key)); + + Map> data = new HashMap>(); + for (Map.Entry entry : map.entrySet()) { + Vector column = new Vector(); + for (String key : sortKeys) { + column.add(entry.getValue().getLocText(key)); + } + data.put(entry.getKey(), column); } + + Vector keyVector = new Vector(); + keyVector.addAll(sortKeys); + + predefineTableModel.addColumn(Inter.getLocText("Key"), keyVector); - predefineTableModel.addColumn(Inter.getLocText("Value"), valueVector); - predefineTableModel.addColumn("en_US", usVector); - predefineTableModel.addColumn("zh_CN", cnVector); - predefineTableModel.addColumn("ja_JP", jpVector); - predefineTableModel.addColumn("zh_TW", twVector); - predefineTableModel.addColumn("ko_KR", krVector); + for (Map.Entry> entry : data.entrySet()) { + predefineTableModel.addColumn(entry.getKey().getDisplayName(), entry.getValue()); + } } private void initCustomProperties() throws Exception { From 402d9e98c808f2cc8362163ccf874514549de6e1 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Mon, 7 Nov 2016 19:29:04 +0800 Subject: [PATCH 159/244] 1 1 --- designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index 79ca8b44d5..ddce30d70f 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -18,6 +18,7 @@ import com.fr.general.Inter; import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; import com.fr.stable.EncodeConstants; +import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import javax.swing.*; @@ -99,7 +100,9 @@ public class UserInfoLabel extends UILabel{ } }); - //PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this); + if (StableUtils.getMajorJavaVersion() == 8) { + PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this); + } QQLoginWebBridge.getHelper().setUILabelInPlugin(UserInfoLabel.this); UserLoginContext.addLoginContextListener(new LoginContextListener() { From 1ac33db0c254d05ec7a3381a714c89d8677cdf11 Mon Sep 17 00:00:00 2001 From: zhouping Date: Mon, 7 Nov 2016 19:29:49 +0800 Subject: [PATCH 160/244] =?UTF-8?q?REPORT-750=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E5=86=85=E6=B5=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XWAbsoluteBodyLayout.java | 10 ++++++++++ .../src/com/fr/design/mainframe/FormArea.java | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java index b9fea0a0bf..e4008df6f1 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java @@ -42,4 +42,14 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { public void setEditable(boolean isEditable) { super.setEditable(true); } + + /** + * 该组件是否可以拖拽(表单中绝对布局不可以拖拽) + * + * @return 是则返回true + */ + @Override + public boolean isSupportDrag() { + return false; + } } diff --git a/designer_form/src/com/fr/design/mainframe/FormArea.java b/designer_form/src/com/fr/design/mainframe/FormArea.java index 26f3b04903..4f6c86feef 100644 --- a/designer_form/src/com/fr/design/mainframe/FormArea.java +++ b/designer_form/src/com/fr/design/mainframe/FormArea.java @@ -433,17 +433,17 @@ public class FormArea extends JComponent implements ScrollRulerComponent { if (rec.width <= dWidth&&rec.x < getHorizontalValue()) { //在边界内部且x位置小于水平滚动条的值 horScrollBar.setValue(rec.x); - } else if (rec.x+rec.width > dWidth) { + } else if (rec.x + rec.width > dWidth + horizontalValue) { //超出边界宽度 - horScrollBar.setValue(rec.x+rec.width-dWidth); + horScrollBar.setValue(rec.x + rec.width - dWidth); } int dHeight = getDesignerHeight(); if (rec.height < dHeight && rec.y < getVerticalValue()) { //在边界内部且y位置小于竖直滚动条的值 verScrollBar.setValue(rec.y); - } else if (rec.y+rec.height > dHeight) { + } else if (rec.y + rec.height > dHeight + verticalValue) { //超出边界高度 - verScrollBar.setValue(rec.y+rec.height-dHeight); + verScrollBar.setValue(rec.y + rec.height - dHeight); } } From 100bcc4216b76994ca991b89ca1608d1ebbc4ca6 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Tue, 8 Nov 2016 10:29:11 +0800 Subject: [PATCH 161/244] =?UTF-8?q?=E5=88=A0import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/file/HistoryTemplateListPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java b/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java index 50cdf00cf9..c61a39c431 100644 --- a/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java @@ -9,8 +9,6 @@ import java.util.logging.Level; import javax.swing.*; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.actions.core.ActionFactory; import com.fr.design.constants.UIConstants; import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; From d1ba1a7e4cc9ac3fc4f8a6448fbec9a495eaf8fa Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 8 Nov 2016 14:40:46 +0800 Subject: [PATCH 162/244] =?UTF-8?q?=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListPane.java | 3 +- .../fr/design/ChartTypeInterfaceManager.java | 54 +++++++++++-------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java b/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java index 50cdf00cf9..fff7f31224 100644 --- a/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer_base/src/com/fr/design/file/HistoryTemplateListPane.java @@ -9,8 +9,7 @@ import java.util.logging.Level; import javax.swing.*; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.actions.core.ActionFactory; + import com.fr.design.constants.UIConstants; import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 2af5af799b..aae009dc42 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -222,16 +222,16 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return ChartTypeManager.getInstance().containsPlot(plotID); } + /** * 把所有的pane加到list里 * * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList) { - Iterator iterator = chartTypeInterfaces.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = (Map.Entry) iterator.next(); - String priority = (String) entry.getKey(); + List priorityList = getPriorityInOrder(); + for (int i = 0; i < priorityList.size(); i++){ + String priority = String.valueOf(priorityList.get(i)); Iterator chartUIIterator = chartTypeInterfaces.get(priority).entrySet().iterator(); while (chartUIIterator.hasNext()) { Map.Entry chartUIEntry = (Map.Entry) chartUIIterator.next(); @@ -276,32 +276,40 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private String[] getTitle4PopupWindow(){ - List priorityList = new ArrayList(); + List priorityList = getPriorityInOrder(); + + if (priorityList.size() == 0){ + return new String[0]; + } + int size = 0; - if (chartTypeInterfaces != null){ + //获取总得图表格式 + for (int i = 0; i < priorityList.size(); i++) { + size += getChartSize(String.valueOf(priorityList.get(i))); + } + String[] names = new String[size]; + + int index = 0; + for (int i = 0; i < priorityList.size(); i++){ + String priority = String.valueOf(priorityList.get(i)); + Iterator chartUI = chartTypeInterfaces.get(priority).entrySet().iterator(); + index = fetchNames(chartUI, names, index); + } + + return names; + } + + private List getPriorityInOrder() { + List priorityList = new ArrayList(); + if (chartTypeInterfaces != null) { Iterator iterator = chartTypeInterfaces.entrySet().iterator(); - while (iterator.hasNext()){ + while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String priority = (String) entry.getKey(); priorityList.add(Integer.valueOf(priority)); - size += getChartSize(priority); } - String[] names = new String[size]; - - priorityList = ChartTypeManager.orderInPriority(priorityList); - - int index = 0; - - for (int i = 0; i < priorityList.size(); i++){ - String priority = String.valueOf(priorityList.get(i)); - Iterator chartUI = chartTypeInterfaces.get(priority).entrySet().iterator(); - index = fetchNames(chartUI, names, index); - } - - return names; } - - return new String[0]; + return ChartTypeManager.orderInPriority(priorityList); } private int fetchNames(Iterator chartUI, String[] names, int index) { From 92e1b01f5f0f03e74c54d8da7e25bedc0662b8bd Mon Sep 17 00:00:00 2001 From: zhouping Date: Tue, 8 Nov 2016 14:59:16 +0800 Subject: [PATCH 163/244] =?UTF-8?q?REPORT-750=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E5=86=85=E6=B5=8B=E9=97=AE=E9=A2=98=20bugfix?= =?UTF-8?q?3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/XWAbsoluteBodyLayout.java | 39 +++++++++++++++++++ .../src/com/fr/design/mainframe/JForm.java | 3 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java index e4008df6f1..e41ac8cba5 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java @@ -2,9 +2,19 @@ package com.fr.design.designer.creator; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteBodyLayoutAdapter; +import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; +import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; +import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; +import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer; +import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WAbsoluteBodyLayout; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; +import com.fr.stable.core.PropertyChangeAdapter; import java.awt.*; +import java.beans.IntrospectionException; /** * Created by zhouping on 2016/10/14. @@ -52,4 +62,33 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout { public boolean isSupportDrag() { return false; } + + /** + * 得到属性名 + * + * @return 属性名 + * @throws java.beans.IntrospectionException + */ + @Override + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + return new CRPropertyDescriptor[] { + new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter + .getLocText("FR-Designer_Form-Widget_Name")), + new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( + WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName( + Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + initStyle(); + } + }) + }; + } + + @Override + protected void initStyle() { + initBorderStyle(); + } } diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index c88ebe012b..bbc1706d9b 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -657,7 +657,8 @@ public class JForm extends JTemplate implements BaseJForm { * @return 是则返回true */ public boolean isSelectRootPane() { - return formDesign.getRootComponent() == formDesign.getSelectionModel().getSelection().getSelectedCreator(); + return (formDesign.getRootComponent() == formDesign.getSelectionModel().getSelection().getSelectedCreator()) + || (formDesign.getSelectionModel().getSelection().getSelectedCreator().acceptType(XWAbsoluteBodyLayout.class)); } From 2cf1139523cbd39449550da6df337606c84afee1 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 16:17:48 +0800 Subject: [PATCH 164/244] rt --- .../src/com/fr/design/actions/AllowAuthorityEditAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java index d4e15fc13e..a9ac7efc28 100644 --- a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1 +1 @@ -package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file From 68226c50bcd911a22f5bc6341feffa7dfb3b001d Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 16:19:48 +0800 Subject: [PATCH 165/244] rt --- .../src/com/fr/design/mainframe/FormDesigner.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index fffccd3fff..465b6588c5 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -198,13 +198,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( getParameterArray() == null ? new Parameter[0] : getParameterArray()); ParameterPropertyPane.getInstance().repaintContainer(); - if (getParameterArray().length == 0) { - EastRegionContainerPane.getInstance().setParameterHeight(30); - } else { - //参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度 - EastRegionContainerPane.getInstance().setParameterHeight((getParameterArray().length + 5) / 6 * 30 + 80); - } - + EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height); } private void removeSame(Parameter[] parameters, List namelist){ From a165e869ba25b6b242df1d783775e7fadfeea389 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 16:20:13 +0800 Subject: [PATCH 166/244] rt --- .../com/fr/design/form/parameter/FormParaDesigner.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index c97e0b7235..211d5e6c18 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -230,14 +230,9 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP } ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray()); - EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); - if (p.getParameterArray().length == 0) { - EastRegionContainerPane.getInstance().setParameterHeight(30); - } else { - //参数面板独立后只能这边触发调整高度,根据参数个数调整换行,计算高度 - EastRegionContainerPane.getInstance().setParameterHeight((p.getParameterArray().length + 5) / 6 * 30 + 80); - } + EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height); + } /** From 7f63787080fcc2152eee0eece6adec33f1041aca Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 16:20:41 +0800 Subject: [PATCH 167/244] rt --- .../src/com/fr/design/actions/AllowAuthorityEditAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java index a9ac7efc28..4a79a2d986 100644 --- a/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1 +1 @@ -package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file +package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file From 52883ba4d144a655619da68ebfcb353771b1efb1 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 16:48:07 +0800 Subject: [PATCH 168/244] rt --- .../src/com/fr/design/parameter/ParameterPropertyPane.java | 4 ++-- .../src/com/fr/design/parameter/ParameterToolBarPane.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java index f376bd6ab8..f093a14327 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java @@ -45,9 +45,9 @@ public class ParameterPropertyPane extends JPanel{ toolbarPane = new ParameterToolBarPane(); initParameterListener(); - + this.setLayout(new BorderLayout(0, 6)); - this.setBorder(BorderFactory.createEmptyBorder(2, 5, 5, 5)); + this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); this.add(toolbarPane, BorderLayout.CENTER); } diff --git a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java index d495e9c06a..4d6eb655f6 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java @@ -35,6 +35,7 @@ public class ParameterToolBarPane extends BasicBeanPane { private static final int GAP_BV = 4; private static final int L_H = 18; + private static int HEIGHT = 0; public ParameterToolBarPane() { this.setLayout(new FlowParameterPaneLayout()); From 379fb70e4315cf52c3e0cab859960ff66dc9788c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 16:51:01 +0800 Subject: [PATCH 169/244] rt --- .../src/com/fr/design/mainframe/FormHierarchyTreePane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java index 91f92cba69..5bfbfa6304 100644 --- a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -79,7 +79,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree this.componentTree = null; // this.searchTextField = null; // this.searchResult = null; - add(new JScrollPane(), BorderLayout.CENTER); +// add(new JScrollPane(), BorderLayout.CENTER); } @Override @@ -109,7 +109,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree adjustPosition(treeModel, formDesigner); } JPanel widgetPane = new JPanel(); - widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); + widgetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout()); add(widgetPane, BorderLayout.NORTH); widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ", From 2c9a6ee822da75529514042a8a176ceded6d6abf Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 16:51:30 +0800 Subject: [PATCH 170/244] rt --- .../src/com/fr/design/form/parameter/FormParaDesigner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index 211d5e6c18..f283904be3 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -231,7 +231,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray()); EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); - EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height); + EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); } From 9b8816f1e238ecf46292b7628c81d298aa34a84e Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 16:52:02 +0800 Subject: [PATCH 171/244] rt --- designer_form/src/com/fr/design/mainframe/FormDesigner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 465b6588c5..8422bfdb40 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -198,7 +198,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( getParameterArray() == null ? new Parameter[0] : getParameterArray()); ParameterPropertyPane.getInstance().repaintContainer(); - EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height); + EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); } private void removeSame(Parameter[] parameters, List namelist){ From b3bcd7085aac492d375f9c201cf695b02592b9e8 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 17:17:40 +0800 Subject: [PATCH 172/244] rt --- .../gui/icontainer/UIResizableContainer.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index 201aee7594..d69a54dce5 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -222,7 +222,11 @@ public class UIResizableContainer extends JPanel { toolPaneY = getHeight() - toolPaneHeight; } parameterPane.setBounds(20, 0, 230, getParameterPaneHeight()); + + + upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY); + horizontToolPane.setBounds(toolPaneHeight, toolPaneY + getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneHeight); downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight + getParameterPaneHeight(), containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); @@ -232,7 +236,6 @@ public class UIResizableContainer extends JPanel { verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); } } - } @Override @@ -302,6 +305,15 @@ public class UIResizableContainer extends JPanel { return this.downPane; } + /** + * 得到参数面板 + * + * @return + */ + public JComponent getParameterPane() { + return this.parameterPane; + } + /** * 刷新下面板 */ @@ -343,7 +355,7 @@ public class UIResizableContainer extends JPanel { public void mouseDragged(MouseEvent e) { toolPaneY = e.getYOnScreen() - UIResizableContainer.this.getLocationOnScreen().y; toolPaneY = toolPaneY < 0 ? 0 : toolPaneY; - toolPaneY = toolPaneY > UIResizableContainer.this.getHeight() - toolPaneHeight ? UIResizableContainer.this.getHeight() - toolPaneHeight : toolPaneY; + toolPaneY = toolPaneY > UIResizableContainer.this.getHeight() - toolPaneHeight ? UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight() : toolPaneY - getParameterPaneHeight(); refreshContainer(); } }); @@ -366,7 +378,7 @@ public class UIResizableContainer extends JPanel { if (e.getX() <= ARROW_RANGE) { toolPaneY = 0; } else if (e.getX() >= getWidth() - ARROW_RANGE) { - toolPaneY = UIResizableContainer.this.getHeight() - toolPaneHeight; + toolPaneY = UIResizableContainer.this.getHeight() - toolPaneHeight - getParameterPaneHeight(); } else { return; } From 60fd977db6ac82fc60881e3ad4fb2f97372317e1 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 17:29:58 +0800 Subject: [PATCH 173/244] rt --- .../src/com/fr/design/parameter/ParameterToolBarPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java index 4d6eb655f6..d495e9c06a 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java @@ -35,7 +35,6 @@ public class ParameterToolBarPane extends BasicBeanPane { private static final int GAP_BV = 4; private static final int L_H = 18; - private static int HEIGHT = 0; public ParameterToolBarPane() { this.setLayout(new FlowParameterPaneLayout()); From 1f3349d70826fd8264feb5cd4bc0dc538e385342 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 17:32:57 +0800 Subject: [PATCH 174/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 0de3b27386..a1fb5f1476 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -315,7 +315,6 @@ public class FormWidgetDetailPane extends FormDockView{ public void refreshDownPanel(boolean isEdit) { reuWidgetPanel.remove(downPanel); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); reuWidgetPanel.add(downPanel); repaintContainer(); From 40a36cac8f62c0f279442803475bf606b4949ef9 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 8 Nov 2016 17:38:35 +0800 Subject: [PATCH 175/244] rt --- .../com/fr/design/gui/icontainer/UIResizableContainer.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index d69a54dce5..86945674bf 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -222,11 +222,7 @@ public class UIResizableContainer extends JPanel { toolPaneY = getHeight() - toolPaneHeight; } parameterPane.setBounds(20, 0, 230, getParameterPaneHeight()); - - - upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY); - horizontToolPane.setBounds(toolPaneHeight, toolPaneY + getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneHeight); downPane.setBounds(toolPaneHeight, toolPaneY + toolPaneHeight + getParameterPaneHeight(), containerWidth - toolPaneHeight, parent.getHeight() - toolPaneY - toolPaneHeight - getParameterPaneHeight()); verticalToolPane.setBounds(0, 0, toolPaneHeight, getHeight()); From da78d44dab9d44835dfa013e28c9291135f9b1b4 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 9 Nov 2016 15:07:32 +0800 Subject: [PATCH 176/244] rt --- .../mainframe/FormWidgetDetailPane.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index a1fb5f1476..5beea605c8 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.FRContext; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.PluginWebBridge; @@ -19,6 +20,8 @@ import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.general.Inter; +import com.fr.general.SiteCenter; +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; @@ -29,6 +32,8 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.File; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; /** * Created with IntelliJ IDEA. @@ -220,10 +225,23 @@ public class FormWidgetDetailPane extends FormDockView{ downloadItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - BasicPane managerPane = new WebManagerPaneFactory().createReusePane(); - UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane); - PluginWebBridge.getHelper().setDialogHandle(dlg); - dlg.setVisible(true); + String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url"); + if (StringUtils.isEmpty(url)) { + FRContext.getLogger().info("The URL is empty!"); + return; + } + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException exp) { + JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + } catch (URISyntaxException exp) { + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + } catch (Exception exp) { + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + FRContext.getLogger().error("Can not open the browser for URL: " + url); + } + } }); From e537b799f3951a7dd55517c75ff9362ca345254f Mon Sep 17 00:00:00 2001 From: zhouping Date: Wed, 9 Nov 2016 15:11:03 +0800 Subject: [PATCH 177/244] =?UTF-8?q?REPORT-750=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E5=86=85=E6=B5=8B=E9=97=AE=E9=A2=98=20bugfix?= =?UTF-8?q?4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRAbsoluteLayoutAdapter.java | 10 +- ...bsoluteBodyLayoutPropertiesGroupModel.java | 94 +++++++++++-------- .../FRFitLayoutPropertiesGroupModel.java | 53 ++++++----- 3 files changed, 89 insertions(+), 68 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index c49ecf0f38..3ab61eb38b 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -308,19 +308,23 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { * @param y 坐标y */ public void fix(XCreator creator ,int x, int y) { + int height = creator.getHeight(); + int width = creator.getWidth(); if (x < 0) { + width += x; x = 0; } else if (x + creator.getWidth() > container.getWidth()) { - x = container.getWidth() - creator.getWidth(); + width = container.getWidth() - x; } if (y < 0) { + height += y; y = 0; } else if (y + creator.getHeight() > container.getHeight()) { - y = container.getHeight() - creator.getHeight(); + height = container.getHeight() - y; } - creator.setLocation(x, y); + creator.setBounds(x, y, width, height); } @Override diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index 6b29a172e5..b290bcccfb 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -9,6 +9,7 @@ import com.fr.design.mainframe.widget.editors.LayoutTypeEditor; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBodyLayoutType; +import com.fr.general.FRLogger; import com.fr.general.FRScreen; import com.fr.general.Inter; @@ -92,46 +93,7 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr } else { if (row == 0) { if (state == WBodyLayoutType.FIT.getTypeValue()) { - XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent(); - //备份一下组件间隔 - int compInterval = xfl.toData().getCompInterval(); - Component[] components = xwAbsoluteLayout.getComponents(); - - Arrays.sort(components, new ComparatorComponentLocation()); - - xfl.getLayoutAdapter().removeBean(xwAbsoluteLayout, xwAbsoluteLayout.getWidth(), xwAbsoluteLayout.getHeight()); - xfl.remove(xwAbsoluteLayout); - - for (Component comp : components) { - XCreator xCreator = (XCreator)comp; - if (xCreator.shouldScaleCreator()){ - XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight()); - xfl.add(parentPanel, xCreator.toData().getWidgetName()); - parentPanel.updateChildBound(xfl.getActualMinHeight()); - continue; - } - xfl.add(xCreator); - } - //这边计算的时候会先把组件间隔去掉 - moveComponents2FitLayout(xfl); - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - formDesigner.getSelectionModel().setSelectedCreator(xfl); - - for (int i = 0; i < components.length; i++) { - Component comp = xfl.getComponent(i); - XCreator creator = (XCreator) comp; - creator.setBackupBound(components[i].getBounds()); - } - - //把组件间隔加上 - if (xfl.toData().getCompInterval() != compInterval) { - xfl.moveContainerMargin(); - xfl.moveCompInterval(xfl.getAcualInterval()); - xfl.toData().setCompInterval(compInterval); - xfl.addCompInterval(xfl.getAcualInterval()); - } - xfl.toData().setLayoutType(WBodyLayoutType.FIT); - return true; + return switch2FitBodyLayout(); } } if (row == 1) { @@ -166,7 +128,57 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr return true; } - //把绝对布局中的元素按规则移动到自适应布局中 + private boolean switch2FitBodyLayout() { + try { + XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent(); + //备份一下组件间隔 + int compInterval = xfl.toData().getCompInterval(); + Component[] components = xwAbsoluteLayout.getComponents(); + + Arrays.sort(components, new ComparatorComponentLocation()); + + xfl.getLayoutAdapter().removeBean(xwAbsoluteLayout, xwAbsoluteLayout.getWidth(), xwAbsoluteLayout.getHeight()); + xfl.remove(xwAbsoluteLayout); + + for (Component comp : components) { + XCreator xCreator = (XCreator) comp; + if (xCreator.shouldScaleCreator()) { + XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight()); + xfl.add(parentPanel, xCreator.toData().getWidgetName()); + parentPanel.updateChildBound(xfl.getActualMinHeight()); + continue; + } + xfl.add(xCreator); + } + //这边计算的时候会先把组件间隔去掉 + moveComponents2FitLayout(xfl); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreator(xfl); + + for (int i = 0; i < components.length; i++) { + Component comp = xfl.getComponent(i); + XCreator creator = (XCreator) comp; + creator.setBackupBound(components[i].getBounds()); + } + + //把组件间隔加上 + if (xfl.toData().getCompInterval() != compInterval) { + xfl.moveContainerMargin(); + xfl.moveCompInterval(xfl.getAcualInterval()); + xfl.toData().setCompInterval(compInterval); + xfl.addCompInterval(xfl.getAcualInterval()); + } + xfl.toData().setLayoutType(WBodyLayoutType.FIT); + return true; + } + catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + return false; + } + } + + // 把绝对布局中的元素按规则移动到自适应布局中 + // 规则:各元素按顺序放置,其中每行最多4个元素,超出则换行,各元素均分body的高度和宽度 private void moveComponents2FitLayout(XWFitLayout xwFitLayout) { int eachRowCount = 4; Component[] components = xwFitLayout.getComponents(); diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java index c9654e26d0..9ffad45338 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java @@ -17,6 +17,7 @@ import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WFitLayout; +import com.fr.general.FRLogger; import com.fr.general.Inter; import javax.swing.table.DefaultTableCellRenderer; @@ -145,34 +146,38 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { layout.setCompState(state); return true; }else if (row == 0) { - layout.setLayoutType(WBodyLayoutType.parse(state)); - if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { - WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); - wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); - Component[] components = xfl.getComponents(); - xfl.removeAll(); - XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0,0)); - xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); - for (Component component : components) { - XCreator xCreator = (XCreator)component; - //部分控件被ScaleLayout包裹着,绝对布局里面要放出来 - if (xCreator.acceptType(XWScaleLayout.class)){ - if (xCreator.getComponentCount() > 0 && ((XCreator)xCreator.getComponent(0)).shouldScaleCreator()) { - component = xCreator.getComponent(0); - component.setBounds(xCreator.getBounds()); + try { + if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { + WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); + wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); + Component[] components = xfl.getComponents(); + xfl.removeAll(); + XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); + xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); + for (Component component : components) { + XCreator xCreator = (XCreator) component; + //部分控件被ScaleLayout包裹着,绝对布局里面要放出来 + if (xCreator.acceptType(XWScaleLayout.class)) { + if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) { + component = xCreator.getComponent(0); + component.setBounds(xCreator.getBounds()); + } } + xwAbsoluteBodyLayout.add(component); } - xwAbsoluteBodyLayout.add(component); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xfl, new Widget[]{wAbsoluteBodyLayout})); + } else { + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()})); } - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xfl, new Widget[]{wAbsoluteBodyLayout})); - } - else { - FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()})); + }catch (Exception e){ + FRLogger.getLogger().error(e.getMessage()); + return false; } + layout.setLayoutType(WBodyLayoutType.parse(state)); return true; } return false; From 804478d3180b268a943770e2ef9470713280c3d7 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 9 Nov 2016 15:16:52 +0800 Subject: [PATCH 178/244] rt --- .../fr/design/mainframe/widget/UITreeComboBox.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index ef01c7b711..38b62a99a1 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -107,7 +107,7 @@ public class UITreeComboBox extends JComboBox{ class UITreeComboBoxRenderer extends DefaultListCellRenderer { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ - if(tree != null ){ + if(tree != null && tree.getSelectedTreePath().length > 0){ TreePath path = tree.getSelectedTreePath()[0]; tree.setAndScrollSelectionPath(path); Object node = path.getLastPathComponent(); @@ -131,14 +131,12 @@ public class UITreeComboBox extends JComboBox{ public void fireCreatorModified(DesignerEvent evt) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { TreePath[] paths = tree.getSelectedTreePath(); - - if (paths.length == 1) { + if (tree != null && paths.length > 0) { tree.setAndScrollSelectionPath(paths[0]); - } else { - tree.setSelectionPaths(paths); + setSelectedItem(paths[0]); + MenuSelectionManager.defaultManager().clearSelectedPath(); } - setSelectedItem(paths[0]); - MenuSelectionManager.defaultManager().clearSelectedPath(); + } else { tree.refreshUI(); repaint(); @@ -205,7 +203,7 @@ class TreePopup extends JPopupMenu implements ComboPopup{ } } - public void show(){ + public void show() { updatePopup(); show(comboBox, 0, comboBox.getHeight()); comboBox.getTree().requestFocus(); From 6fb118eea1d3946fd8df50a39c464c27d5407243 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 9 Nov 2016 15:17:37 +0800 Subject: [PATCH 179/244] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/form/parameter/FormParaDesigner.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index f283904be3..a7936a8288 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -112,9 +112,12 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP EastRegionContainerPane.getInstance().replaceDownPane( FormWidgetDetailPane.getInstance(this)); if (!BaseUtils.isAuthorityEditing()) { + EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); + EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); EastRegionContainerPane.getInstance().replaceUpPane( WidgetPropertyPane.getInstance(this)); } else { + EastRegionContainerPane.getInstance().removeParameterPane(); showAuthorityEditPane(); } @@ -230,8 +233,6 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP } ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray()); - EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); - EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); } From fbbaab5055cad14d5c3a681d011d7a7b5bceb3e2 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 9 Nov 2016 15:32:20 +0800 Subject: [PATCH 180/244] =?UTF-8?q?REPORT-578=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F=E5=B1=9E=E6=80=A7=E5=B0=8F?= =?UTF-8?q?=E6=94=B9=E8=89=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRFitLayoutAdapter.java | 1825 +++++++++-------- .../design/designer/creator/XChartEditor.java | 2 +- .../designer/creator/XLayoutContainer.java | 4 +- .../creator/cardlayout/XWCardLayout.java | 2 +- .../creator/cardlayout/XWTabFitLayout.java | 2 +- .../properties/FRFitLayoutConstraints.java | 42 +- .../fr/design/gui/xpane/LayoutBorderPane.java | 2 +- 7 files changed, 983 insertions(+), 896 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index daf6e2dbc9..e02dbd8fc9 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -1,5 +1,5 @@ /** - * + * */ package com.fr.design.designer.beans.adapters.layout; @@ -24,6 +24,7 @@ import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.JForm; +import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WLayout; @@ -32,620 +33,666 @@ import com.fr.general.ComparatorUtils; /** * 自适应布局的容器适配器 - * + * * @author jim * @date 2014-6-24 */ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { - - public static final String WIDGETPANEICONPATH="/com/fr/web/images/form/resources/layout_absolute.png"; - private static final int DEPENDING_SCOPE = 3; - private HoverPainter painter; - - /** - * 构造函数 - * @param container XWFitLayout容器 - */ - public FRFitLayoutAdapter(XLayoutContainer container) { - super(container); - painter = new FRFitLayoutPainter(container); - initMinSize(); - } - - private void initMinSize() { - XWFitLayout layout = (XWFitLayout) container; - minWidth = layout.getActualMinWidth(); - minHeight = layout.getActualMinHeight(); - actualVal = layout.getAcualInterval(); - margin = layout.toData().getMargin(); - } - - @Override - public HoverPainter getPainter() { - return painter; - } - - /** - * 返回布局自身属性,方便一些特有设置在layout刷新时处理 - */ - @Override + + public static final String WIDGETPANEICONPATH = "/com/fr/web/images/form/resources/layout_absolute.png"; + private static final int DEPENDING_SCOPE = 3; + private HoverPainter painter; + + /** + * 构造函数 + * + * @param container XWFitLayout容器 + */ + public FRFitLayoutAdapter(XLayoutContainer container) { + super(container); + painter = new FRFitLayoutPainter(container); + initMinSize(); + } + + private void initMinSize() { + XWFitLayout layout = (XWFitLayout) container; + minWidth = layout.getActualMinWidth(); + minHeight = layout.getActualMinHeight(); + actualVal = layout.getAcualInterval(); + margin = layout.toData().getMargin(); + } + + @Override + public HoverPainter getPainter() { + return painter; + } + + /** + * 返回布局自身属性,方便一些特有设置在layout刷新时处理 + */ + @Override public GroupModel getLayoutProperties() { - XWFitLayout xfl = (XWFitLayout) container; + XWFitLayout xfl = (XWFitLayout) container; return new FRFitLayoutPropertiesGroupModel(xfl); } - - /** - * 添加组件 - * - * @param child 待添加的组件 - *@param x 坐标x - *@param y 坐标y - */ - @Override - public void addComp(XCreator child, int x, int y) { - fix(child, x, y); - if (child.shouldScaleCreator() || child.hasTitleStyle()) { - addParentCreator(child); - } else { - container.add(child, child.toData().getWidgetName()); - } - XWFitLayout layout = (XWFitLayout) container; - // 更新对应的BoundsWidget - layout.updateBoundsWidget(); - updateCreatorBackBound(); + + /** + * 添加组件 + * + * @param child 待添加的组件 + * @param x 坐标x + * @param y 坐标y + */ + @Override + public void addComp(XCreator child, int x, int y) { + fix(child, x, y); + if (child.shouldScaleCreator() || child.hasTitleStyle()) { + addParentCreator(child); + } else { + container.add(child, child.toData().getWidgetName()); + } + XWFitLayout layout = (XWFitLayout) container; + // 更新对应的BoundsWidget + layout.updateBoundsWidget(); + updateCreatorBackBound(); + } + + public void updateCreatorBackBound() { + for (int i = 0, size = container.getComponentCount(); i < size; i++) { + XCreator creator = (XCreator) container.getComponent(i); + creator.updateChildBound(minHeight); + creator.setBackupBound(creator.getBounds()); + } + } + + + private void addParentCreator(XCreator child) { + XLayoutContainer parentPanel = child.initCreatorWrapper(minHeight); + container.add(parentPanel, child.toData().getWidgetName()); } - - public void updateCreatorBackBound() { - for (int i=0,size=container.getComponentCount(); i= minWidth * 2 + actualVal; - boolean verticalValid = componentHeight >= minHeight * 2 + actualVal; - return y > upHeight && y < downHeight ? horizonValid : verticalValid; + // 计算是否能拖入鼠标区域时,会用到fix 的方法 + isFindRelatedComps = false; + //拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域 + Component comp = container.getComponentAt(x, y); + if (checkInterval(comp)) { + return false; + } + //如果当前处于边缘地带, 那么就把他贴到父容器上 + boolean isMatchEdge = matchEdge(x, y); + + int componentHeight = comp.getHeight(); + int componentWidth = comp.getWidth(); + //上半部分高度 + int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY(); + //下半部分高度 + int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY(); + + //布局控件要先判断是不是可编辑 + XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout(); + if (topLayout != null && !isMatchEdge && !topLayout.isEditable()) { + return false; + } + + if (isCrossPointArea(comp, x, y)) { + return canAcceptWhileCrossPoint(comp, x, y); + } + + if (isTrisectionArea(comp, x, y)) { + return canAcceptWhileTrisection(comp, x, y); + } + + boolean horizonValid = componentWidth >= minWidth * 2 + actualVal; + boolean verticalValid = componentHeight >= minHeight * 2 + actualVal; + return y > upHeight && y < downHeight ? horizonValid : verticalValid; } - + // 间隔区域 - private boolean checkInterval(Component comp){ - return container.getComponentCount()>0 && comp == container; + private boolean checkInterval(Component comp) { + return container.getComponentCount() > 0 && comp == container; } - + /** * 是否在组件边缘 + * * @param x 横坐标 * @param y 纵坐标 * @return 是否在组件边缘 */ - public boolean matchEdge(int x, int y){ - if(intersectsEdge(x, y,container)){ - //寻找最近的fit, 在边缘地段添加的控件, 将其送给该fit - XLayoutContainer parent = container.findNearestFit(); - container = parent != null ? parent : container; - return true; - } - return false; + public boolean matchEdge(int x, int y) { + if (intersectsEdge(x, y, container)) { + //寻找最近的fit, 在边缘地段添加的控件, 将其送给该fit + XLayoutContainer parent = container.findNearestFit(); + container = parent != null ? parent : container; + return true; + } + return false; } - - /** - * 是否在组件边缘 - * @param x 横坐标 - * @param y 纵坐标 - * @param container 参照组件 - * @return 是否在组件边缘 - */ + + /** + * 是否在组件边缘 + * + * @param x 横坐标 + * @param y 纵坐标 + * @param container 参照组件 + * @return 是否在组件边缘 + */ //是否包含于边缘地段, 按顺序上, 下, 左, 右检测 - public boolean intersectsEdge(int x, int y,XLayoutContainer container) { - int containerX = container.getX(); - int containerY = container.getY(); - int containerWidth = container.getWidth(); - int containerHeight = container.getHeight(); - - // 当前坐标点 - Rectangle currentXY = new Rectangle(x, y, 1, 1); - // 上边缘 - Rectangle upEdge = new Rectangle(containerX, containerY, containerWidth, BORDER_PROPORTION); - if(upEdge.intersects(currentXY)){ - return true; - } - - int bottomY = containerY + containerHeight - BORDER_PROPORTION; - // 下边缘 - Rectangle bottomEdge = new Rectangle(containerX, bottomY, containerWidth, BORDER_PROPORTION); - if(bottomEdge.intersects(currentXY)){ - return true; - } - - //左右边缘的高度 -10*2 是为了不和上下边缘重合 - int verticalHeight = containerHeight - BORDER_PROPORTION * 2; - int leftY = containerY + BORDER_PROPORTION; - // 左边缘 - Rectangle leftEdge = new Rectangle(containerX, leftY, BORDER_PROPORTION, verticalHeight); - if(leftEdge.intersects(currentXY)){ - return true; - } - - int rightY = containerY + BORDER_PROPORTION; - int rightX = containerX + containerWidth - BORDER_PROPORTION; - // 右边缘 - Rectangle rightEdge = new Rectangle(rightX, rightY, BORDER_PROPORTION, verticalHeight); - return rightEdge.intersects(currentXY); - } - + public boolean intersectsEdge(int x, int y, XLayoutContainer container) { + int containerX = container.getX(); + int containerY = container.getY(); + int containerWidth = container.getWidth(); + int containerHeight = container.getHeight(); + + // 当前坐标点 + Rectangle currentXY = new Rectangle(x, y, 1, 1); + // 上边缘 + Rectangle upEdge = new Rectangle(containerX, containerY, containerWidth, BORDER_PROPORTION); + if (upEdge.intersects(currentXY)) { + return true; + } + + int bottomY = containerY + containerHeight - BORDER_PROPORTION; + // 下边缘 + Rectangle bottomEdge = new Rectangle(containerX, bottomY, containerWidth, BORDER_PROPORTION); + if (bottomEdge.intersects(currentXY)) { + return true; + } + + //左右边缘的高度 -10*2 是为了不和上下边缘重合 + int verticalHeight = containerHeight - BORDER_PROPORTION * 2; + int leftY = containerY + BORDER_PROPORTION; + // 左边缘 + Rectangle leftEdge = new Rectangle(containerX, leftY, BORDER_PROPORTION, verticalHeight); + if (leftEdge.intersects(currentXY)) { + return true; + } + + int rightY = containerY + BORDER_PROPORTION; + int rightX = containerX + containerWidth - BORDER_PROPORTION; + // 右边缘 + Rectangle rightEdge = new Rectangle(rightX, rightY, BORDER_PROPORTION, verticalHeight); + return rightEdge.intersects(currentXY); + } + /** * 交叉点区域时,能否对应位置放入组件 */ protected boolean canAcceptWhileCrossPoint(Component comp, int x, int y) { - return super.canAcceptWhileCrossPoint(comp, x, y); + return super.canAcceptWhileCrossPoint(comp, x, y); } protected boolean canAcceptWhileTrisection(Component comp, int x, int y) { - return super.canAcceptWhileTrisection(comp, x, y); + return super.canAcceptWhileTrisection(comp, x, y); } - + /** * 判断是否鼠标在组件的三等分区域,如果组件在布局管理器中间,上下左右都可能会三等分 + * * @param parentComp 鼠标所在区域的组件 - * @param x 坐标x - * @param y 坐标y + * @param x 坐标x + * @param y 坐标y * @return 是则返回true */ public boolean isTrisectionArea(Component parentComp, int x, int y) { - return super.isTrisectionArea(parentComp, x, y); + return super.isTrisectionArea(parentComp, x, y); } - + /** * 是否为组件交叉点区域 或者是相邻三组建中间点 + * * @param currentComp 当前组件 - * @param x 坐标x - * @param y 坐标y + * @param x 坐标x + * @param y 坐标y * @return 是则返回true */ public boolean isCrossPointArea(Component currentComp, int x, int y) { - return super.isCrossPointArea(currentComp, x, y); + return super.isCrossPointArea(currentComp, x, y); } protected void initCompsList() { - super.initCompsList(); + super.initCompsList(); } protected void clearCompsList() { - super.clearCompsList(); + super.clearCompsList(); } - private Rectangle adjustBackupBound(Rectangle backupBound,XWCardMainBorderLayout mainLayout){ - // 参数界面高度对纵坐标产生的影响 - JForm jform = (JForm)(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); - if(jform.getFormDesign().getParaComponent()!= null){ - backupBound.y -= jform.getFormDesign().getParaHeight(); - } - - Rectangle rec = mainLayout.getBounds(); - // XWTabLayout里面的横纵坐标收到外层XWCardMainBorderLayout的横纵坐标影响 - // 减掉之后可以按照它原来的逻辑执行 - backupBound.x -= rec.x; - backupBound.y -= rec.y; - XWCardLayout cardLayout = mainLayout.getCardPart(); - LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); - // 当tab布局为标题样式时,才需要处理标题栏高度产生的影响 - if(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)){ - backupBound.y -= WCardMainBorderLayout.TAB_HEIGHT; - } - return backupBound; + + private Rectangle adjustBackupBound(Rectangle backupBound, XWCardMainBorderLayout mainLayout) { + // 参数界面高度对纵坐标产生的影响 + JForm jform = (JForm) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + if (jform.getFormDesign().getParaComponent() != null) { + backupBound.y -= jform.getFormDesign().getParaHeight(); + } + + Rectangle rec = mainLayout.getBounds(); + // XWTabLayout里面的横纵坐标收到外层XWCardMainBorderLayout的横纵坐标影响 + // 减掉之后可以按照它原来的逻辑执行 + backupBound.x -= rec.x; + backupBound.y -= rec.y; + XWCardLayout cardLayout = mainLayout.getCardPart(); + LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); + // 当tab布局为标题样式时,才需要处理标题栏高度产生的影响 + if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { + backupBound.y -= WCardMainBorderLayout.TAB_HEIGHT; + } + return backupBound; } - + /** * 拖拽控件边框后,根据控件的大小尺寸,进行相关组件的调整 + * * @param creator 组件 */ @Override public void fix(XCreator creator) { - //拖拽组件原大小、位置 - Rectangle backupBound = creator.getBackupBound(); - backupBound.x -= container.getX(); - backupBound.y -= container.getY(); - //当前拖拽组件的位置 - int x = creator.getX(); - int y = creator.getY(); - - // 获取容器所有内部组件横坐标 - int[] posXs = container.getHors(); - // 获取容器所有内部组件纵坐标 - int[] posYs = container.getVeris(); - - XLayoutContainer outerLayout = container.getOuterLayout(); - if(!ComparatorUtils.equals(outerLayout, container.getBackupParent())){ - XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout)outerLayout; - backupBound = adjustBackupBound(backupBound, mainLayout); - } - - //拖拽组件拖拽以后的大小 - int w = creator.getWidth(); - int h = creator.getHeight(); - initCompsList(); - creator.setBounds(backupBound); - int difference = 0; - if (x!=backupBound.x) { - dealLeft(backupBound, x, posXs, difference, creator); - } else if(w!=backupBound.width) { - dealRight(backupBound, x, w, posXs, difference, creator); - } else if (y!=backupBound.y) { - dealTop(backupBound, y, posYs, difference, creator); - } else if (h!=backupBound.height) { - dealButtom(backupBound, y, h, posYs, difference, creator); - } - clearCompsList(); - XWFitLayout layout = (XWFitLayout) container; - layout.updateBoundsWidget(); // 更新对应的BoundsWidget - updateCreatorBackBound(); + //拖拽组件原大小、位置 + Rectangle backupBound = creator.getBackupBound(); + backupBound.x -= container.getX(); + backupBound.y -= container.getY(); + //当前拖拽组件的位置 + int x = creator.getX(); + int y = creator.getY(); + + // 获取容器所有内部组件横坐标 + int[] posXs = container.getHors(); + // 获取容器所有内部组件纵坐标 + int[] posYs = container.getVeris(); + + XLayoutContainer outerLayout = container.getOuterLayout(); + if (!ComparatorUtils.equals(outerLayout, container.getBackupParent())) { + XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) outerLayout; + backupBound = adjustBackupBound(backupBound, mainLayout); + } + + //拖拽组件拖拽以后的大小 + int w = creator.getWidth(); + int h = creator.getHeight(); + initCompsList(); + creator.setBounds(backupBound); + int difference = 0; + if (x != backupBound.x) { + dealLeft(backupBound, x, posXs, difference, creator); + } else if (w != backupBound.width) { + dealRight(backupBound, x, w, posXs, difference, creator); + } else if (y != backupBound.y) { + dealTop(backupBound, y, posYs, difference, creator); + } else if (h != backupBound.height) { + dealButtom(backupBound, y, h, posYs, difference, creator); + } + clearCompsList(); + XWFitLayout layout = (XWFitLayout) container; + layout.updateBoundsWidget(); // 更新对应的BoundsWidget + updateCreatorBackBound(); } - - private void dealLeft(Rectangle backupBound,int x,int[] posXs,int difference,XCreator creator){ - if (backupBound.x == margin.getLeft()) { - return; - } - x = adjustCoordinateByDependingLine(x,posXs); - difference = x-backupBound.x; - dealDirectionAtLeft(backupBound, difference, creator); + + /** + * 拖拽控件边框后,根据控件的大小尺寸,进行相关组件的调整 + * + * @param backupBound 边界备份 + * @param bounds 组件边界 + * @param xCreator 组件 + * @param row 选中的行 + * @param difference 偏移量 + */ + public void calculateBounds(Rectangle backupBound, Rectangle bounds, XCreator xCreator, int row, int difference) { + Rectangle rc = new Rectangle(0,0,0,0); + XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); + if (parent != null) { + Rectangle rec = ComponentUtils.getRelativeBounds(parent); + rc.x = rec.x; + rc.y = rec.y; + } + int x = backupBound.x - rc.x, y = backupBound.y - rc.y; + //处理左右延伸 + switch (row) { + case 0: + if (backupBound.width + backupBound.x == container.getWidth() - margin.getRight() +rc.x) { + x += difference; + } + break; + case 1: + if(backupBound.y + backupBound.height == container.getHeight() - margin.getBottom() +rc.y){ + y += difference; + } + break; + } + bounds.setLocation(x,y); + xCreator.setBackupBound(backupBound); + xCreator.setBounds(bounds); + this.fix(xCreator); } - - private void dealRight(Rectangle backupBound,int x,int w,int[] posXs,int difference,XCreator creator){ - if (backupBound.width+backupBound.x== container.getWidth() - margin.getRight()) { - return; - } - w = adjustDiffByDependingLine(x, posXs, w); - difference = w-backupBound.width; //拖拽长度 - dealDirectionAtRight(backupBound, difference, creator); + + private void dealLeft(Rectangle backupBound, int x, int[] posXs, int difference, XCreator creator) { + if (backupBound.x == margin.getLeft()) { + return; + } + x = adjustCoordinateByDependingLine(x, posXs); + difference = x - backupBound.x; + dealDirectionAtLeft(backupBound, difference, creator); } - - private void dealTop(Rectangle backupBound,int y,int[] posYs,int difference,XCreator creator){ - if (backupBound.y== margin.getTop()) { - return; - } - y = adjustCoordinateByDependingLine(y, posYs); - difference = y-backupBound.y; - dealDirectionAtTop(backupBound, difference, creator); + + private void dealRight(Rectangle backupBound, int x, int w, int[] posXs, int difference, XCreator creator) { + if (backupBound.width + backupBound.x == container.getWidth() - margin.getRight()) { + return; + } + w = adjustDiffByDependingLine(x, posXs, w); + difference = w - backupBound.width; //拖拽长度 + dealDirectionAtRight(backupBound, difference, creator); } - - private void dealButtom(Rectangle backupBound,int y,int h,int[] posYs,int difference,XCreator creator){ - if (backupBound.y+backupBound.height==container.getHeight() - margin.getBottom()) { - return; - } - h = adjustDiffByDependingLine(y, posYs, h); - difference = h-backupBound.height; - dealDirectionABottom(backupBound, difference, creator); + + private void dealTop(Rectangle backupBound, int y, int[] posYs, int difference, XCreator creator) { + if (backupBound.y == margin.getTop()) { + return; + } + y = adjustCoordinateByDependingLine(y, posYs); + difference = y - backupBound.y; + dealDirectionAtTop(backupBound, difference, creator); + } + + private void dealButtom(Rectangle backupBound, int y, int h, int[] posYs, int difference, XCreator creator) { + if (backupBound.y + backupBound.height == container.getHeight() - margin.getBottom()) { + return; + } + h = adjustDiffByDependingLine(y, posYs, h); + difference = h - backupBound.height; + dealDirectionABottom(backupBound, difference, creator); } - + // 根据需要依附的位置调整拖拽的坐标值 - private int adjustCoordinateByDependingLine(int coordinate,int[] coordinates){ - for(int i=0; i coordinates[i]-DEPENDING_SCOPE && coordinate < coordinates[i] + DEPENDING_SCOPE){ - coordinate = coordinates[i]; - break; - } - } - return coordinate; + private int adjustCoordinateByDependingLine(int coordinate, int[] coordinates) { + for (int i = 0; i < coordinates.length; i++) { + if (coordinate == coordinates[i]) { + continue; + } + if (coordinate > coordinates[i] - DEPENDING_SCOPE && coordinate < coordinates[i] + DEPENDING_SCOPE) { + coordinate = coordinates[i]; + break; + } + } + return coordinate; } - + // 根据需要依附的位置调整拖拽的距离 - private int adjustDiffByDependingLine(int coordinate,int[] coordinates,int diff){ - for(int i=0; i coordinates[i]-DEPENDING_SCOPE && coordinate+diff < coordinates[i] + DEPENDING_SCOPE){ - diff = coordinates[i] - coordinate; - break; - } - } - return diff; + private int adjustDiffByDependingLine(int coordinate, int[] coordinates, int diff) { + for (int i = 0; i < coordinates.length; i++) { + if (coordinate + diff > coordinates[i] - DEPENDING_SCOPE && coordinate + diff < coordinates[i] + DEPENDING_SCOPE) { + diff = coordinates[i] - coordinate; + break; + } + } + return diff; } - + // 左侧边框拉伸,循环找出对齐的两侧控件 private void dealDirectionAtLeft(Rectangle backupBound, int difference, Component creator) { - rightComps.add(creator); - Component rightComp = null; - int leftx = backupBound.x-DEFAULT_AREA_LENGTH - actualVal; - // 取左侧边框右面的组件x值 - int rightx = backupBound.x+DEFAULT_AREA_LENGTH; - Component leftComp = container.getLeftComp(backupBound.x, backupBound.y); - leftComps.add(leftComp); - //先找上侧对齐时(y相等)的左右两边组件 - int ry = backupBound.y; - int ly = leftComp.getY(); - int min = margin.getTop(); - int max = container.getHeight() - margin.getBottom(); - while (ry>= min && ly>= min) { - if (ry == ly) { - break; - } else { - if (ry>ly) { - rightComp = container.getTopComp(rightx, ry); - ry = rightComp.getY(); - rightComps.add(rightComp); - } else { - leftComp = container.getTopComp(leftx, ly); - ly = leftComp.getY(); - leftComps.add(leftComp); - } - } - } - // 下侧对齐时(y+h相等)两边组件 - ry = backupBound.y + backupBound.height ; - ly = leftComps.get(0).getY() + leftComps.get(0).getHeight(); - while(ry<= max && ly<= max) { - if (ry==ly) { - break; - } else { - if (ry>ly) { - leftComp = container.getComponentAt(leftx, ly+DEFAULT_AREA_LENGTH+actualVal); - ly = leftComp.getY() + leftComp.getHeight(); - leftComps.add(leftComp); - } else { - rightComp = container.getComponentAt(rightx, ry+DEFAULT_AREA_LENGTH+actualVal); - ry = rightComp.getY() + rightComp.getHeight(); - rightComps.add(rightComp); - } - } - } - dealHorDirection(backupBound.x, difference); + rightComps.add(creator); + Component rightComp = null; + int leftx = backupBound.x - DEFAULT_AREA_LENGTH - actualVal; + // 取左侧边框右面的组件x值 + int rightx = backupBound.x + DEFAULT_AREA_LENGTH; + Component leftComp = container.getLeftComp(backupBound.x, backupBound.y); + leftComps.add(leftComp); + //先找上侧对齐时(y相等)的左右两边组件 + int ry = backupBound.y; + int ly = leftComp.getY(); + int min = margin.getTop(); + int max = container.getHeight() - margin.getBottom(); + while (ry >= min && ly >= min) { + if (ry == ly) { + break; + } else { + if (ry > ly) { + rightComp = container.getTopComp(rightx, ry); + ry = rightComp.getY(); + rightComps.add(rightComp); + } else { + leftComp = container.getTopComp(leftx, ly); + ly = leftComp.getY(); + leftComps.add(leftComp); + } + } + } + // 下侧对齐时(y+h相等)两边组件 + ry = backupBound.y + backupBound.height; + ly = leftComps.get(0).getY() + leftComps.get(0).getHeight(); + while (ry <= max && ly <= max) { + if (ry == ly) { + break; + } else { + if (ry > ly) { + leftComp = container.getComponentAt(leftx, ly + DEFAULT_AREA_LENGTH + actualVal); + ly = leftComp.getY() + leftComp.getHeight(); + leftComps.add(leftComp); + } else { + rightComp = container.getComponentAt(rightx, ry + DEFAULT_AREA_LENGTH + actualVal); + ry = rightComp.getY() + rightComp.getHeight(); + rightComps.add(rightComp); + } + } + } + dealHorDirection(backupBound.x, difference); } - + // 右侧边框拉伸,循环找出对齐的两侧控件 private void dealDirectionAtRight(Rectangle backupBound, int difference, Component creator) { - leftComps.add(creator); - Component leftComp = null; - int leftx = backupBound.x+backupBound.width-DEFAULT_AREA_LENGTH; - // 取右侧边框右面的组件x值 - int rightx = backupBound.x+backupBound.width+DEFAULT_AREA_LENGTH+actualVal; - Component rightComp = container.getRightComp(backupBound.x, backupBound.y, backupBound.width); - rightComps.add(rightComp); - int ly = backupBound.y, ry = rightComp.getY(); - int min = margin.getTop(); - int max = container.getHeight() - margin.getBottom(); - while (ry>= min && ly>= min) { - if (ry == ly) { - break; - } else { - if (ry>ly) { - rightComp = container.getTopComp(rightx, ry); - ry = rightComp.getY(); - rightComps.add(rightComp); - } else { - leftComp = container.getTopComp(leftx, ly); - ly = leftComp.getY(); - leftComps.add(leftComp); - } - } - } - ly = backupBound.y + backupBound.height; - ry = rightComps.get(0).getY() + rightComps.get(0).getHeight(); - while(ry<= max && ly<= max) { - if (ry==ly) { - break; - } else { - if (ry>ly) { - leftComp = container.getComponentAt(leftx, ly+DEFAULT_AREA_LENGTH+actualVal); - ly = leftComp.getY() + leftComp.getHeight(); - leftComps.add(leftComp); - } else { - rightComp = container.getComponentAt(rightx, ry+DEFAULT_AREA_LENGTH+actualVal); - ry = rightComp.getY() + rightComp.getHeight(); - rightComps.add(rightComp); - } - } - } - dealHorDirection(backupBound.x+backupBound.width+actualVal, difference); + leftComps.add(creator); + Component leftComp = null; + int leftx = backupBound.x + backupBound.width - DEFAULT_AREA_LENGTH; + // 取右侧边框右面的组件x值 + int rightx = backupBound.x + backupBound.width + DEFAULT_AREA_LENGTH + actualVal; + Component rightComp = container.getRightComp(backupBound.x, backupBound.y, backupBound.width); + rightComps.add(rightComp); + int ly = backupBound.y, ry = rightComp.getY(); + int min = margin.getTop(); + int max = container.getHeight() - margin.getBottom(); + while (ry >= min && ly >= min) { + if (ry == ly) { + break; + } else { + if (ry > ly) { + rightComp = container.getTopComp(rightx, ry); + ry = rightComp.getY(); + rightComps.add(rightComp); + } else { + leftComp = container.getTopComp(leftx, ly); + ly = leftComp.getY(); + leftComps.add(leftComp); + } + } + } + ly = backupBound.y + backupBound.height; + ry = rightComps.get(0).getY() + rightComps.get(0).getHeight(); + while (ry <= max && ly <= max) { + if (ry == ly) { + break; + } else { + if (ry > ly) { + leftComp = container.getComponentAt(leftx, ly + DEFAULT_AREA_LENGTH + actualVal); + ly = leftComp.getY() + leftComp.getHeight(); + leftComps.add(leftComp); + } else { + rightComp = container.getComponentAt(rightx, ry + DEFAULT_AREA_LENGTH + actualVal); + ry = rightComp.getY() + rightComp.getHeight(); + rightComps.add(rightComp); + } + } + } + dealHorDirection(backupBound.x + backupBound.width + actualVal, difference); } - + /** - * 水平方向上拉伸边框的处理 + * 水平方向上拉伸边框的处理 */ private void dealHorDirection(int objx, int difference) { - if (difference>0) { - difference = Math.min(getMinWidth(rightComps)-minWidth, difference); - } else { - difference = Math.max(difference, minWidth-getMinWidth(leftComps)); - } - //重新计算左右两侧组件size、point - if(CalculateLefttRelatComponent(difference)){ - CalculateRightRelatComponent(objx+difference, -difference); - } + if (difference > 0) { + difference = Math.min(getMinWidth(rightComps) - minWidth, difference); + } else { + difference = Math.max(difference, minWidth - getMinWidth(leftComps)); + } + //重新计算左右两侧组件size、point + if (CalculateLefttRelatComponent(difference)) { + CalculateRightRelatComponent(objx + difference, -difference); + } } - + // 上侧边框拉伸,循环找出对齐的两侧控件 private void dealDirectionAtTop(Rectangle backupBound, int difference, Component creator) { - downComps.add(creator); - // 取上侧边框上面的组件用的y值 - int topy = backupBound.y-DEFAULT_AREA_LENGTH - actualVal; - // 上侧边框下面的组件y值 - int bottomy = backupBound.y+DEFAULT_AREA_LENGTH; - Component topComp = container.getTopComp(backupBound.x, backupBound.y); - upComps.add(topComp); - Component bottomComp = null; - int min = margin.getLeft(); - int max = container.getWidth() - margin.getRight(); - //先找左侧侧对齐时(x相等)的上下两边组件 - int ux = topComp.getX(); - int dx = backupBound.x; - while(ux>= min && dx>=min) { - if (ux == dx) { - break; - } else { - if (ux= min && dx >= min) { + if (ux == dx) { + break; + } else { + if (ux < dx) { + bottomComp = container.getLeftComp(dx, bottomy); + dx = bottomComp.getX(); + downComps.add(bottomComp); + } else { + topComp = container.getLeftComp(ux, topy); + ux = topComp.getX(); + upComps.add(topComp); + } + } + } + // 右侧对齐时(x+w相等)两边组件 + ux = upComps.get(0).getX() + upComps.get(0).getWidth(); + dx = backupBound.x + backupBound.width; + while (ux <= max && dx <= max) { + if (ux == dx) { + break; + } else { + if (ux < dx) { + topComp = container.getComponentAt(ux + DEFAULT_AREA_LENGTH + actualVal, topy); + ux = topComp.getX() + topComp.getWidth(); + upComps.add(topComp); + } else { + bottomComp = container.getComponentAt(dx + DEFAULT_AREA_LENGTH + actualVal, bottomy); + dx = bottomComp.getX() + bottomComp.getWidth(); + downComps.add(bottomComp); + } + } + } + + dealVertiDirection(backupBound.y, difference); } - + // 下侧边框拉伸,循环找出对齐的两侧控件 private void dealDirectionABottom(Rectangle backupBound, int difference, Component creator) { - upComps.add(creator); - Component topComp = null; - Component bottomComp = container.getBottomComp(backupBound.x, backupBound.y, backupBound.height); - // 下侧边框下面的组件y坐标 - int bottomy = backupBound.y+backupBound.height+DEFAULT_AREA_LENGTH + actualVal; - // 取下侧边框上面的组件用的y值 - int topy = backupBound.y+backupBound.height-DEFAULT_AREA_LENGTH; - downComps.add(bottomComp); - int dx = bottomComp.getX(); - int ux = backupBound.x; - int min = margin.getLeft(); - int max = container.getWidth() - margin.getRight(); - while(ux>= min && dx>= min) { - if (ux == dx) { - break; - } else { - if (ux= min && dx >= min) { + if (ux == dx) { + break; + } else { + if (ux < dx) { + bottomComp = container.getLeftComp(dx, bottomy); + dx = bottomComp.getX(); + downComps.add(bottomComp); + } else { + topComp = container.getLeftComp(ux, topy); + ux = topComp.getX(); + upComps.add(topComp); + } + } + } + dx = downComps.get(0).getX() + downComps.get(0).getWidth(); + ux = backupBound.x + backupBound.width; + while (ux <= max && dx <= max) { + if (ux == dx) { + break; + } else { + if (ux < dx) { + topComp = container.getComponentAt(ux + DEFAULT_AREA_LENGTH + actualVal, topy); + ux = topComp.getX() + topComp.getWidth(); + upComps.add(topComp); + } else { + bottomComp = container.getComponentAt(dx + DEFAULT_AREA_LENGTH + actualVal, bottomy); + dx = bottomComp.getX() + bottomComp.getWidth(); + downComps.add(bottomComp); + } + } + } + dealVertiDirection(backupBound.y + backupBound.height + actualVal, difference); } - + /** - * 垂直方向上拉伸边框的处理 + * 垂直方向上拉伸边框的处理 */ private void dealVertiDirection(int objY, int difference) { - if (difference>0) { - difference = Math.min(getMinHeight(downComps) - minHeight, difference); - } else { - difference = Math.max(difference, minHeight - getMinHeight(upComps)); - } - //重新计算上下两侧组件size、point - if(CalculateUpRelatComponent(difference)){ - CalculateDownRelatComponent(objY+difference, -difference); - }; + if (difference > 0) { + difference = Math.min(getMinHeight(downComps) - minHeight, difference); + } else { + difference = Math.max(difference, minHeight - getMinHeight(upComps)); + } + //重新计算上下两侧组件size、point + if (CalculateUpRelatComponent(difference)) { + CalculateDownRelatComponent(objY + difference, -difference); + } + ; } - + /** - * 新拖入组件时,计算调整其他关联组件位置大小 - * @param child 新拖入的组件 - * @param x 鼠标所在x坐标 - * @param y 鼠标所在y坐标 + * 新拖入组件时,计算调整其他关联组件位置大小 + * + * @param child 新拖入的组件 + * @param x 鼠标所在x坐标 + * @param y 鼠标所在y坐标 */ public void fix(XCreator child, int x, int y) { - Component parentComp = container.getComponentAt(x, y); - if (container.getComponentCount()==0){ - child.setLocation(0, 0); - child.setSize(parentComp.getWidth(), parentComp.getHeight()); - } else if(isCrossPointArea(parentComp, x, y)){ - //交叉区域插入组件时,根据具体位置进行上下或者左右或者相邻三个组件的位置大小插入 - fixCrossPointArea(parentComp, child, x, y); - return; - } else if (isTrisectionArea(parentComp, x, y)) { - // 在边界三等分区域,就不再和组件二等分了 - fixTrisect(parentComp, child, x, y); - return; - } else{ - fixHalve(parentComp, child, x, y); - } + Component parentComp = container.getComponentAt(x, y); + if (container.getComponentCount() == 0) { + child.setLocation(0, 0); + child.setSize(parentComp.getWidth(), parentComp.getHeight()); + } else if (isCrossPointArea(parentComp, x, y)) { + //交叉区域插入组件时,根据具体位置进行上下或者左右或者相邻三个组件的位置大小插入 + fixCrossPointArea(parentComp, child, x, y); + return; + } else if (isTrisectionArea(parentComp, x, y)) { + // 在边界三等分区域,就不再和组件二等分了 + fixTrisect(parentComp, child, x, y); + return; + } else { + fixHalve(parentComp, child, x, y); + } } - + /** * 平分,正常情况拖入组件时,按照上1/4区域、下1/4区域为上下平分,中左侧1/2区域、中右侧1/2区域为左右平分 */ protected void fixHalve(Component currentComp, XCreator child, int x, int y) { - super.fixHalve(currentComp, child, x, y); + super.fixHalve(currentComp, child, x, y); } /** @@ -654,58 +701,60 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 右上角和左下角是水平方向插入组件,这样避免田字块时重复 */ protected void fixCrossPointArea(Component currentComp, XCreator child, int x, int y) { - super.fixCrossPointArea(currentComp, child, x, y); + super.fixCrossPointArea(currentComp, child, x, y); } /** * 三等分区域时,调整相关联的组件 - * @param currentComp 鼠标所在组件 - * @param child 待插入组件 + * + * @param currentComp 鼠标所在组件 + * @param child 待插入组件 */ protected void fixTrisect(Component currentComp, XCreator child, int x, int y) { - super.fixTrisect(currentComp, child, x, y); + super.fixTrisect(currentComp, child, x, y); } /** - * 删除组件或者重新拖动时,其它组件重新计算位置大小 - */ - protected void delete(XCreator creator, int creatorWidth, int creatorHeight) { - int x = creator.getX(); - int y = creator.getY(); - recalculateChildrenSize(x, y, creatorWidth, creatorHeight); + * 删除组件或者重新拖动时,其它组件重新计算位置大小 + */ + protected void delete(XCreator creator, int creatorWidth, int creatorHeight) { + int x = creator.getX(); + int y = creator.getY(); + recalculateChildrenSize(x, y, creatorWidth, creatorHeight); } - + /** * 重新计算内部组件大小 - * @param x 坐标x - * @param y 坐标y - * @param creatorWidth 删除的组件之前所在布局的宽度 + * + * @param x 坐标x + * @param y 坐标y + * @param creatorWidth 删除的组件之前所在布局的宽度 * @param creatorHeight 删除的组件之前所在布局的高度 */ public void recalculateChildrenSize(int x, int y, int creatorWidth, int creatorHeight) { - if (container.getComponentCount() == 0){ - return; - } else{ - initCompsList(); - int width = creatorWidth; - int height = creatorHeight; - calculateRelatedComponent(x, y, width, height); - if (!rightComps.isEmpty() && getAllHeight(rightComps)==height){ - CalculateRightRelatComponent(x, width+actualVal); - } else if (!leftComps.isEmpty() && getAllHeight(leftComps)==height) { - CalculateLefttRelatComponent(width+actualVal); - } else if (!downComps.isEmpty() && getAllWidth(downComps)==width) { - CalculateDownRelatComponent(y, height+actualVal); - } else if(!upComps.isEmpty() && getAllWidth(upComps)==width) { - CalculateUpRelatComponent(height+actualVal); - } else { - // 由于布局三等分的存在,可能会出现删除组件时,找不到关联的组件填充,此时特殊处理 - calculateNoRelatedComponent(x, y, width, height); - } - } - clearCompsList(); + if (container.getComponentCount() == 0) { + return; + } else { + initCompsList(); + int width = creatorWidth; + int height = creatorHeight; + calculateRelatedComponent(x, y, width, height); + if (!rightComps.isEmpty() && getAllHeight(rightComps) == height) { + CalculateRightRelatComponent(x, width + actualVal); + } else if (!leftComps.isEmpty() && getAllHeight(leftComps) == height) { + CalculateLefttRelatComponent(width + actualVal); + } else if (!downComps.isEmpty() && getAllWidth(downComps) == width) { + CalculateDownRelatComponent(y, height + actualVal); + } else if (!upComps.isEmpty() && getAllWidth(upComps) == width) { + CalculateUpRelatComponent(height + actualVal); + } else { + // 由于布局三等分的存在,可能会出现删除组件时,找不到关联的组件填充,此时特殊处理 + calculateNoRelatedComponent(x, y, width, height); + } + } + clearCompsList(); } - + /** * 四侧边框都没有对齐的,此时每侧有且只有一个方向不对齐 * 比如右侧不对齐,那么必然右上或右下没对齐,不会同时不对齐,否则不会出现此情况 @@ -713,416 +762,420 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 右侧不对齐时的组件先上下微调,再向左侧填充。 */ private void calculateNoRelatedComponent(int x, int y, int width, int height) { - // 只有最后一个组件了,直接删除 - if (container.getComponentCount() <= 1) { - return; - } - // 删除当前组件时,由于没有刚好边框对齐的其他组件,这时候需要调整的组件 - Component rightComp = container.getRightComp(x, y, width); - if(rightComp == null){ - return; - } - - int ry = rightComp.getY(); - clearCompsList(); - initCompsList(); - Rectangle rec = new Rectangle(x, y, width, height); - if (ry != y ) { - calculateNoRelatedWhileRightTop(rec, rightComp); - } else { - calculateNoRelatedWhileRightBott(rec, rightComp); - } - + // 只有最后一个组件了,直接删除 + if (container.getComponentCount() <= 1) { + return; + } + // 删除当前组件时,由于没有刚好边框对齐的其他组件,这时候需要调整的组件 + Component rightComp = container.getRightComp(x, y, width); + if (rightComp == null) { + return; + } + + int ry = rightComp.getY(); + clearCompsList(); + initCompsList(); + Rectangle rec = new Rectangle(x, y, width, height); + if (ry != y) { + calculateNoRelatedWhileRightTop(rec, rightComp); + } else { + calculateNoRelatedWhileRightBott(rec, rightComp); + } + } - + private void calculateNoRelatedWhileRightTop(Rectangle bound, Component rcomp) { - if(rcomp == null){ - return; - } - - int ry = rcomp.getY(); - int rh = rcomp.getHeight(); - int rw = rcomp.getWidth(); - int dh = bound.y - ry - actualVal; - // 没法缩小高度 - if (dh < minHeight) { - // 没法缩小时则拉伸rcomp的上边框 - dealDirectionAtTop(rcomp.getBounds(), dh + actualVal, rcomp); - //调整的时候可能有组件达到最小高度,判断下 - if (rcomp.getY() != bound.y) { - clearCompsList(); - initCompsList(); - dealDirectionAtTop(rcomp.getBounds(), bound.y - rcomp.getY()-minHeight - actualVal, rcomp); - ry = rcomp.getY(); - int rx = rcomp.getX(); - rcomp.setBounds(rx, ry, rw, minHeight); - recalculateChildrenSize(rx, bound.y, rw, rh-dh - actualVal); - recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); - return; - } - } else { - // 右侧控件底部对齐 - if (rh+ry == bound.y+bound.height) { - rcomp.setSize(rw, dh); - bound.width += rw; - bound.width += actualVal; - } else { - recalculateChildrenSize(bound.x, ry+rh + actualVal, bound.width, bound.height+bound.y-rh-ry - actualVal); - recalculateChildrenSize(bound.x, bound.y, bound.width, ry+rh-bound.y); - return; - } - } - recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); + if (rcomp == null) { + return; + } + + int ry = rcomp.getY(); + int rh = rcomp.getHeight(); + int rw = rcomp.getWidth(); + int dh = bound.y - ry - actualVal; + // 没法缩小高度 + if (dh < minHeight) { + // 没法缩小时则拉伸rcomp的上边框 + dealDirectionAtTop(rcomp.getBounds(), dh + actualVal, rcomp); + //调整的时候可能有组件达到最小高度,判断下 + if (rcomp.getY() != bound.y) { + clearCompsList(); + initCompsList(); + dealDirectionAtTop(rcomp.getBounds(), bound.y - rcomp.getY() - minHeight - actualVal, rcomp); + ry = rcomp.getY(); + int rx = rcomp.getX(); + rcomp.setBounds(rx, ry, rw, minHeight); + recalculateChildrenSize(rx, bound.y, rw, rh - dh - actualVal); + recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); + return; + } + } else { + // 右侧控件底部对齐 + if (rh + ry == bound.y + bound.height) { + rcomp.setSize(rw, dh); + bound.width += rw; + bound.width += actualVal; + } else { + recalculateChildrenSize(bound.x, ry + rh + actualVal, bound.width, bound.height + bound.y - rh - ry - actualVal); + recalculateChildrenSize(bound.x, bound.y, bound.width, ry + rh - bound.y); + return; + } + } + recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); } - + private void calculateNoRelatedWhileRightBott(Rectangle bound, Component rcomp) { - rcomp = container.getBottomRightComp(bound.x, bound.y, bound.height, bound.width); - int ry = rcomp.getY(); - int rh = rcomp.getHeight(); - int rw = rcomp.getWidth(); - int dh = ry + rh - bound.y - bound.height - actualVal; - if (dh < minHeight) { - dealDirectionABottom(rcomp.getBounds(), -dh - actualVal, rcomp); - //调整的时候可能有组件达到最小高度,判断下 - if (rcomp.getHeight()+ry != bound.y + bound.height) { - clearCompsList(); - initCompsList(); - dh = ry + rcomp.getHeight() - bound.y - bound.height - actualVal; - dealDirectionABottom(rcomp.getBounds(), minHeight-dh, rcomp); - rh = rcomp.getHeight(); - int rx = rcomp.getX(); - rcomp.setBounds(rx, bound.y+bound.height + actualVal, rw, minHeight); - recalculateChildrenSize(rx, ry, rw, rh-minHeight - actualVal); - recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); - return; - } - } else { - if (ry == bound.y) { - rcomp.setBounds(rcomp.getX(), bound.y+bound.height + actualVal, rw, dh); - bound.width += rw; - bound.width += actualVal; - } else { - recalculateChildrenSize(bound.x, bound.y, bound.width, ry-bound.y - actualVal); - recalculateChildrenSize(bound.x, ry, bound.width, bound.height-ry+bound.y); - return; - } - } - recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); + rcomp = container.getBottomRightComp(bound.x, bound.y, bound.height, bound.width); + int ry = rcomp.getY(); + int rh = rcomp.getHeight(); + int rw = rcomp.getWidth(); + int dh = ry + rh - bound.y - bound.height - actualVal; + if (dh < minHeight) { + dealDirectionABottom(rcomp.getBounds(), -dh - actualVal, rcomp); + //调整的时候可能有组件达到最小高度,判断下 + if (rcomp.getHeight() + ry != bound.y + bound.height) { + clearCompsList(); + initCompsList(); + dh = ry + rcomp.getHeight() - bound.y - bound.height - actualVal; + dealDirectionABottom(rcomp.getBounds(), minHeight - dh, rcomp); + rh = rcomp.getHeight(); + int rx = rcomp.getX(); + rcomp.setBounds(rx, bound.y + bound.height + actualVal, rw, minHeight); + recalculateChildrenSize(rx, ry, rw, rh - minHeight - actualVal); + recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); + return; + } + } else { + if (ry == bound.y) { + rcomp.setBounds(rcomp.getX(), bound.y + bound.height + actualVal, rw, dh); + bound.width += rw; + bound.width += actualVal; + } else { + recalculateChildrenSize(bound.x, bound.y, bound.width, ry - bound.y - actualVal); + recalculateChildrenSize(bound.x, ry, bound.width, bound.height - ry + bound.y); + return; + } + } + recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); } - + private int getMinWidth(List comps) { - if (comps.isEmpty()) { - return 0; - } - int minWidth =container.getWidth() - margin.getLeft() - margin.getRight(); - for (int i=0, size=comps.size(); icomps.get(i).getWidth() ? comps.get(i).getWidth() : minWidth; - } - return minWidth; + if (comps.isEmpty()) { + return 0; + } + int minWidth = container.getWidth() - margin.getLeft() - margin.getRight(); + for (int i = 0, size = comps.size(); i < size; i++) { + minWidth = minWidth > comps.get(i).getWidth() ? comps.get(i).getWidth() : minWidth; + } + return minWidth; } - + private int getMinHeight(List comps) { - if (comps.isEmpty()) { - return 0; - } - int minH =container.getHeight() - margin.getTop() - margin.getBottom(); - for (int i=0, size=comps.size(); icomps.get(i).getHeight() ? comps.get(i).getHeight() : minH; - } - return minH; + if (comps.isEmpty()) { + return 0; + } + int minH = container.getHeight() - margin.getTop() - margin.getBottom(); + for (int i = 0, size = comps.size(); i < size; i++) { + minH = minH > comps.get(i).getHeight() ? comps.get(i).getHeight() : minH; + } + return minH; } - + // 删除时计算待删除组件上下侧的组件是否何其对齐 private int getAllHeight(List comps) { - int allHeight = 0; - if (comps.isEmpty()) { - return allHeight; - } - int n=comps.size(); - for (int i=0; i comps) { - int allWidth = 0; - if (comps.isEmpty()) { - return allWidth; - } - int n=comps.size(); - for (int i=0; i=0 && objHeight>=(rheight+verti); - boolean isVerti = hori>=0 && objWidth>=(rwidth+hori); - if (isHori && (objX+objWidth+actualVal)==rx) { - rightComps.add(relatComp); - } else if(isHori && objX==(rx+rwidth+actualVal)) { - leftComps.add(relatComp); - } else if(isVerti && (objY+objHeight+actualVal)==ry) { - downComps.add(relatComp); - } else if(isVerti && objY==(ry+rheight+actualVal)) { - upComps.add(relatComp); - } - } + int count = container.getComponentCount(); + for (int i = 0; i < count; i++) { + Component relatComp = container.getComponent(i); + int rx = relatComp.getX(); + int ry = relatComp.getY(); + int rwidth = relatComp.getWidth(); + int rheight = relatComp.getHeight(); + int verti = ry - objY; + int hori = rx - objX; + boolean isHori = verti >= 0 && objHeight >= (rheight + verti); + boolean isVerti = hori >= 0 && objWidth >= (rwidth + hori); + if (isHori && (objX + objWidth + actualVal) == rx) { + rightComps.add(relatComp); + } else if (isHori && objX == (rx + rwidth + actualVal)) { + leftComps.add(relatComp); + } else if (isVerti && (objY + objHeight + actualVal) == ry) { + downComps.add(relatComp); + } else if (isVerti && objY == (ry + rheight + actualVal)) { + upComps.add(relatComp); + } + } } - + /** * 拖拽组件时遍历某一侧组件得到该侧组件能够缩放的最小宽度,tab布局最小宽度 = 内部组件数 * 单个组件最小宽度 + * * @param list 某一侧组件的集合 如:leftComps * @return int 最小宽度 - * */ - private int getCompsMinWidth(List list){ - return getMaxCompsNum(list, true) * WLayout.MIN_WIDTH; + private int getCompsMinWidth(List list) { + return getMaxCompsNum(list, true) * WLayout.MIN_WIDTH; } - + /** * 拖拽组件遍历某一侧得到该侧组件能够缩放的最小高度,tab布局最小高度 = 内部组件数 * 单个组件最小高度 + 标题高度 + * * @param list 某一侧组件集合 * @return int 最小高度 - * */ - private int getCompsMinHeight(List list){ - for(int i=0;i childrenList = creator.getTargetChildrenList(); - if(!childrenList.isEmpty()){ - return getMaxCompsNum(list,false) * WLayout.MIN_HEIGHT + WCardMainBorderLayout.TAB_HEIGHT; - } - } - return WLayout.MIN_HEIGHT; + private int getCompsMinHeight(List list) { + for (int i = 0; i < list.size(); i++) { + XCreator creator = (XCreator) list.get(i); + ArrayList childrenList = creator.getTargetChildrenList(); + if (!childrenList.isEmpty()) { + return getMaxCompsNum(list, false) * WLayout.MIN_HEIGHT + WCardMainBorderLayout.TAB_HEIGHT; + } + } + return WLayout.MIN_HEIGHT; } - + /** * 根据子组件的横(纵)坐标获取某一侧组件的最大内部组件数 - * @param list 某一侧组件集合 + * + * @param list 某一侧组件集合 * @param isHor 是否以横坐标为准 * @return int 最大内部组件数 - * */ - private int getMaxCompsNum(List list,boolean isHor){ - int maxCompNums = 1; - for(int i=0,size=list.size();i childrenList = creator.getTargetChildrenList(); - int count = childrenList.size(); - if(count > 0){ - for(int j=0;j list, boolean isHor) { + int maxCompNums = 1; + for (int i = 0, size = list.size(); i < size; i++) { + XCreator creator = (XCreator) list.get(i); + ArrayList childrenList = creator.getTargetChildrenList(); + int count = childrenList.size(); + if (count > 0) { + for (int j = 0; j < count; j++) { + XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j); + int[] positions = isHor ? tabLayout.getHors(true) : tabLayout.getVeris(true); + int compNums = positions.length - 1; + maxCompNums = Math.max(compNums, maxCompNums); + } + } + } + return maxCompNums; } - + /** * 根据偏移量缩放内部组件大小,(tab布局用到) + * * @param creator tab布局 - * @param offset 偏移量 - * @param isHor 是否为横向拖拽 + * @param offset 偏移量 + * @param isHor 是否为横向拖拽 */ - private void adjustCompsSize(XCreator creator,int offset,boolean isHor){ - ArrayList childrenList = creator.getTargetChildrenList(); - int size = childrenList.size(); - if(size > 0){ - for(int j=0;j childrenList = creator.getTargetChildrenList(); + int size = childrenList.size(); + if (size > 0) { + for (int j = 0; j < size; j++) { + XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j); + tabLayout.setBackupBound(tabLayout.getBounds()); + int refSize = isHor ? tabLayout.getWidth() : tabLayout.getHeight(); + double percent = (double) offset / refSize; + if (percent < 0 && !tabLayout.canReduce(percent)) { + return; + } + setAdjustedSize(tabLayout, offset, isHor); + for (int m = 0; m < tabLayout.getComponentCount(); m++) { + XCreator childCreator = tabLayout.getXCreator(m); + BoundsWidget wgt = tabLayout.toData().getBoundsWidget(childCreator.toData()); + wgt.setBounds(tabLayout.getComponent(m).getBounds()); + } + adjustCreatorsSize(percent, tabLayout, isHor); + } + + } } - + // 纵向拖拽,先将tab布局的高度设置为拖拽后的实际高度 - private void setAdjustedHeight(XWTabFitLayout tabLayout,int offset){ - tabLayout.setSize(tabLayout.getWidth(),tabLayout.getHeight() + offset); + private void setAdjustedHeight(XWTabFitLayout tabLayout, int offset) { + tabLayout.setSize(tabLayout.getWidth(), tabLayout.getHeight() + offset); } - + // 横向拖拽,先将tab布局的宽度设置为拖拽后的实际宽度 - private void setAdjustedSize(XWTabFitLayout tabLayout,int offset,boolean isHor){ - if(offset < 0){ - // 缩放时需要备份原tab布局宽高 - tabLayout.setReferDim(new Dimension(tabLayout.getWidth(),tabLayout.getHeight())); - } - if(isHor){ - tabLayout.setSize(tabLayout.getWidth() + offset, tabLayout.getHeight()); - return; - } - setAdjustedHeight(tabLayout,offset); + private void setAdjustedSize(XWTabFitLayout tabLayout, int offset, boolean isHor) { + if (offset < 0) { + // 缩放时需要备份原tab布局宽高 + tabLayout.setReferDim(new Dimension(tabLayout.getWidth(), tabLayout.getHeight())); + } + if (isHor) { + tabLayout.setSize(tabLayout.getWidth() + offset, tabLayout.getHeight()); + return; + } + setAdjustedHeight(tabLayout, offset); } - + // 按照拖拽偏移量,对tab布局进行缩放 - private void adjustCreatorsSize(double percent,XWTabFitLayout tabLayout,boolean isHor){ - if(isHor){ - tabLayout.adjustCreatorsWidth(percent); - return; - } - tabLayout.adjustCreatorsHeight(percent); + private void adjustCreatorsSize(double percent, XWTabFitLayout tabLayout, boolean isHor) { + if (isHor) { + tabLayout.adjustCreatorsWidth(percent); + return; + } + tabLayout.adjustCreatorsHeight(percent); } - - + + /** * 删除或拉伸控件右边框 调整右侧组件位置大小 - * @param objX 调整后的坐标x + * + * @param objX 调整后的坐标x * @param objWidth 调整后的宽度 */ - protected void CalculateRightRelatComponent(int objX, int objWidth){ - int count = rightComps.size(); - for(int i=0; i compsList){ - int compMinWidth = getCompsMinWidth(compsList); - for(int i=0;i (creator.getWidth() - compMinWidth)){ - return true; - } - } - return false; + private boolean isBeyondWidthScope(int offset, List compsList) { + int compMinWidth = getCompsMinWidth(compsList); + for (int i = 0; i < compsList.size(); i++) { + XCreator creator = (XCreator) compsList.get(i); + if (Math.abs(offset) > (creator.getWidth() - compMinWidth)) { + return true; + } + } + return false; } - + /** * 删除或拉伸控件左边框时 调整左侧的组件位置大小; */ - protected boolean CalculateLefttRelatComponent(int objWidth){ - if(isBeyondAdjustWidthScope(objWidth)){ - return false; - } - int count = leftComps.size(); - for(int i=0; i compsList){ - int minHeight = getCompsMinHeight(compsList); - for(int i=0;i (creator.getHeight() - minHeight)){ - return true; - } - } - return false; + private boolean isBeyondHeightScope(int offset, List compsList) { + int minHeight = getCompsMinHeight(compsList); + for (int i = 0; i < compsList.size(); i++) { + XCreator creator = (XCreator) compsList.get(i); + if (Math.abs(offset) > (creator.getHeight() - minHeight)) { + return true; + } + } + return false; } + /** * 删除或拉伸上边框 调整上方的组件位置大小 */ - protected boolean CalculateUpRelatComponent(int objHeight){ - if(isBeyondAdjustHeightScope(objHeight)){ - return false; - } - int count = upComps.size(); - for(int i=0; i Date: Wed, 9 Nov 2016 17:00:57 +0800 Subject: [PATCH 181/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2but?= =?UTF-8?q?ton=E9=87=8D=E5=91=BD=E5=90=8D=E7=BB=93=E6=9D=9F=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/ChartTypeButtonPane.java | 67 +++++++++++-------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 8ee4e4667f..8d9ed81530 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -1,10 +1,10 @@ package com.fr.design.mainframe.chart.gui; import com.fr.base.BaseUtils; +import com.fr.chart.base.AttrChangeConfig; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; -import com.fr.chart.base.AttrChangeConfig; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; @@ -53,19 +53,14 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private ChartTypePane parent = null; - //记录鼠标当前是否在操作添加按钮 - private boolean mouseOnChartTypeButtonPane = false; - //配置窗口属性 private UIMenuNameableCreator configCreator; - /** - * 鼠标事件是否在这个面板 - * @return 返回是否 - */ - public boolean isMouseOnChartTypeButtonPane() { - return this.mouseOnChartTypeButtonPane; - } + //处理 编辑一个button时,选中另一个button的问题. + //stopEditing不能直接relayout,否则click事件不响应了. + //所以:stopEditing--选中其他button则响应click之后relayout;普通失焦则直接relayout. + private boolean pressOtherButtonWhenEditing = false; + // private AWTEventListener awt = new AWTEventListener() { // public void eventDispatched(AWTEvent event) { @@ -122,7 +117,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private void initAddButton() { addButton.setPreferredSize(new Dimension(20, 20)); addButton.addActionListener(addListener); - addButton.addMouseListener(mouseListener); } private void initConfigButton() { @@ -133,7 +127,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen ActionListener addListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - mouseOnChartTypeButtonPane = true; String name = getNewChartName(); ChartChangeButton button = new ChartChangeButton(name);// some set selected @@ -188,15 +181,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen dialog.setVisible(true); } }; - - - MouseListener mouseListener = new MouseAdapter() { - @Override - public void mouseExited(MouseEvent e) { - super.mouseExited(e); - mouseOnChartTypeButtonPane = false; - } - }; private String getNewChartName() { int count = indexList.size() + 1; @@ -352,12 +336,19 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen if (currentEditingEditor != null) { String newName = currentEditingEditor.getText(); int selectedIndex = editingCollection.getSelectedIndex(); + ChartChangeButton button = indexList.get(selectedIndex); + button.isMoveOn = false; if (!ComparatorUtils.equals(editingCollection.getChartName(selectedIndex), newName)) { editingCollection.setChartName(selectedIndex, newName); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); + button.changeChartName(newName); } buttonPane.remove(currentEditingEditor); currentEditingEditor = null; + + if(!pressOtherButtonWhenEditing) { + layoutPane(buttonPane); + } } } @@ -375,11 +366,25 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen buttonName = name; this.setToolTipText(name); - nameField.addActionListener(new ActionListener() { + nameField.addActionListener(new ActionListener() {//enter @Override public void actionPerformed(ActionEvent e) { + pressOtherButtonWhenEditing = false; stopEditing(); - populateBean(editingCollection); + } + }); + + nameField.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + + } + + @Override + public void focusLost(FocusEvent e) {//编辑状态lost才走这边 + if (currentEditingEditor != null ) { + stopEditing(); + } } }); } @@ -388,6 +393,11 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen return buttonName; } + private void changeChartName(String name) { + this.setText(name); + buttonName = name; + } + public Dimension getPreferredSize() { return new Dimension(B_W, B_H); } @@ -467,17 +477,20 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen @Override public void mouseClicked(MouseEvent e) { mouseClick(e); - mouseOnChartTypeButtonPane = true; + if(pressOtherButtonWhenEditing){ + relayoutPane(); + pressOtherButtonWhenEditing = false; + } } public void mouseEntered(MouseEvent e) { checkMoveOn(true); - mouseOnChartTypeButtonPane = true; + pressOtherButtonWhenEditing = currentEditingEditor != null; } public void mouseExited(MouseEvent e) { checkMoveOn(false); - mouseOnChartTypeButtonPane = false; + pressOtherButtonWhenEditing = false; } }; } From 7a0e32b91709709b9646538472a473284603eb6a Mon Sep 17 00:00:00 2001 From: zack Date: Wed, 9 Nov 2016 17:04:23 +0800 Subject: [PATCH 182/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=85=B1=E4=BA=AB=E7=9A=84=E5=B8=AE=E5=8A=A9?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=94=B9=E5=8F=98=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/HelpDialogManager.java | 7 ---- .../design/designer/creator/XElementCase.java | 6 +-- .../fr/design/mainframe/CoverReportPane.java | 42 ++++++++----------- .../mainframe/ElementCaseHelpDialog.java | 10 +++-- 4 files changed, 27 insertions(+), 38 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java b/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java index 5de971b71c..febda0a851 100644 --- a/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java +++ b/designer_base/src/com/fr/design/mainframe/HelpDialogManager.java @@ -35,11 +35,4 @@ public class HelpDialogManager { } return THIS; } - - public void destroyDialog() { - if (handler != null) { - handler.destroyHelpDialog(); - } - handler = null; - } } diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 2ba11975f5..f2fa5cfa12 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -282,12 +282,12 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme * @param e 点击事件 */ public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ + HelpDialogManager.getInstance().setPane(coverPanel); super.respondClick(editingMouseListener, e); if (this.isHelpBtnOnFocus()) { coverPanel.setMsgDisplay(e); - }else { - coverPanel.destroyHelpDialog(); - switchTab(e,editingMouseListener); + } else { + switchTab(e, editingMouseListener); } } diff --git a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java index ee1fb27bd1..1d8277c461 100644 --- a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java +++ b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java @@ -1,8 +1,6 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; -import com.fr.design.designer.beans.events.DesignerEditListener; -import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; import com.fr.form.share.ShareConstants; @@ -13,6 +11,8 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; /** * 报表块的封面(如果后面所有的组件都有帮助信息的话就抽接口吧) @@ -43,18 +43,6 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{ public CoverReportPane(String helpMsg) { super(); this.helpMsg = helpMsg; - add(controlButton); -// if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { -// WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { -// @Override -// public void fireCreatorModified(DesignerEvent evt) { -// if (evt.getCreatorEventID() == (DesignerEvent.CREATOR_DELETED) -// || evt.getCreatorEventID() == (DesignerEvent.CREATOR_RESIZED)) { -// destroyHelpDialog(); -// } -// } -// }); -// } } public String getHelpMsg() { @@ -63,12 +51,16 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{ public void setHelpMsg(String helpMsg) { this.helpMsg = helpMsg; + //帮助信息为空就不显示帮助按钮 + if (StringUtils.isNotEmpty(helpMsg)) { + add(controlButton); + } } public void setMsgDisplay(MouseEvent e) { if (helpDialog == null) { - controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); - controlButton.repaint(); +// controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); + controlButton.setVisible(false); helpDialog = new ElementCaseHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); int offsetX = 0; @@ -80,12 +72,14 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{ int rY = 165 + e.getY();//165是设计器最上面几个面板的高度 helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); helpDialog.showWindow(); + helpDialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosed(WindowEvent e) { + helpDialog = null; + controlButton.setVisible(true); + } + }); HelpDialogManager.getInstance().setPane(this); - } else { - controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); - controlButton.repaint(); - helpDialog.dispose(); - helpDialog = null; } } @@ -135,8 +129,8 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{ @Override public void setVisible(boolean aFlag) { super.setVisible(aFlag); - if (aFlag) { - HelpDialogManager.getInstance().setPane(this); - } +// if (aFlag) { +// HelpDialogManager.getInstance().setPane(this); +// } } } diff --git a/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java b/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java index 60b699107c..0894bd0db5 100644 --- a/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java +++ b/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itextarea.UITextArea; +import com.fr.general.Inter; import javax.swing.*; import java.awt.*; @@ -15,7 +16,7 @@ import java.awt.*; public class ElementCaseHelpDialog extends UIDialog { private static final int OUTER_WIDTH = 190; - private static final int OUTER_HEIGHT = 120; + private static final int OUTER_HEIGHT = 280; private String helpMsg; @@ -25,7 +26,6 @@ public class ElementCaseHelpDialog extends UIDialog { public ElementCaseHelpDialog(Frame parent, String helpMsg) { super(parent); this.helpMsg = helpMsg; - setUndecorated(true); initHelpArea(); JPanel panel = (JPanel) getContentPane(); initComponents(panel); @@ -37,21 +37,23 @@ public class ElementCaseHelpDialog extends UIDialog { textArea.setEditable(false); textArea.setBorder(null); helpArea = new UIScrollPane(textArea); - helpArea.setBounds(0, 0, 190, 120); + helpArea.setBounds(0, 0, 190, 280); helpArea.setBorder(null); } private void initComponents(JPanel contentPane) { contentPane.setLayout(new BorderLayout()); add(helpArea, BorderLayout.CENTER); + this.applyClosingAction(); + this.setTitle(Inter.getLocText("FR-Designer_Help")); } /** * 打开帮助框 */ public void showWindow() { - setVisible(true); this.setResizable(false); + setVisible(true); } /** From 9d8b573195c040ad5638993e9f4240f0afaeee11 Mon Sep 17 00:00:00 2001 From: zack Date: Wed, 9 Nov 2016 17:06:07 +0800 Subject: [PATCH 183/244] d --- .../src/com/fr/design/mainframe/ElementCaseHelpDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java b/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java index 0894bd0db5..2f2c6e3b5d 100644 --- a/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java +++ b/designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java @@ -37,7 +37,7 @@ public class ElementCaseHelpDialog extends UIDialog { textArea.setEditable(false); textArea.setBorder(null); helpArea = new UIScrollPane(textArea); - helpArea.setBounds(0, 0, 190, 280); + helpArea.setBounds(0, 0, OUTER_WIDTH, OUTER_HEIGHT); helpArea.setBorder(null); } From 3fa3b0450a04c3d609d66966b5f9523e500f50a8 Mon Sep 17 00:00:00 2001 From: fr_shine Date: Wed, 9 Nov 2016 19:30:05 +0800 Subject: [PATCH 184/244] =?UTF-8?q?=E6=BC=8F=E6=96=97=E5=9B=BE=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=B1=9E=E6=80=A7=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chart/ChartPlotFactory.java | 2 +- .../dlp/FunnelDataLabelPane.java | 13 +++++++++ .../FunnelPlotDataSeriesConditionPane.java | 28 +++++++++++++++++++ .../FunnelIndependentChartInterface.java | 6 ++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/FunnelDataLabelPane.java create mode 100644 designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FunnelPlotDataSeriesConditionPane.java diff --git a/designer_chart/src/com/fr/design/chart/ChartPlotFactory.java b/designer_chart/src/com/fr/design/chart/ChartPlotFactory.java index 48e018a598..aeb780add1 100644 --- a/designer_chart/src/com/fr/design/chart/ChartPlotFactory.java +++ b/designer_chart/src/com/fr/design/chart/ChartPlotFactory.java @@ -72,7 +72,7 @@ public class ChartPlotFactory { .setAxisPaneCls(XYChartStyleAxisPane.class) .setDataLabelPaneClass(XYDataLabelPane.class)); map.put(FunnelPlot.class.getName(), new FactoryObject() - .setDataLabelPaneClass(PieDataLabelPane.class)); + .setDataLabelPaneClass(FunnelDataLabelPane.class)); } private ChartPlotFactory() { diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/FunnelDataLabelPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/FunnelDataLabelPane.java new file mode 100644 index 0000000000..14b0c18ad2 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/FunnelDataLabelPane.java @@ -0,0 +1,13 @@ +package com.fr.design.chart.series.SeriesCondition.dlp; + +import java.awt.*; + +/** + * Created by Mitisky on 16/11/9. + */ +public class FunnelDataLabelPane extends DataLabelPane { + @Override + protected Component[] createComponents4ShowCategoryName() { + return new Component[0]; + } +} diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FunnelPlotDataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FunnelPlotDataSeriesConditionPane.java new file mode 100644 index 0000000000..99469ff3cf --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FunnelPlotDataSeriesConditionPane.java @@ -0,0 +1,28 @@ +package com.fr.design.chart.series.SeriesCondition.impl; + +import com.fr.chart.chartattr.FunnelPlot; +import com.fr.chart.chartattr.Plot; +import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; +import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; +import com.fr.design.chart.series.SeriesCondition.PiePlotChartConditionPane; + +/** + * Created by Mitisky on 16/11/9. + */ +public class FunnelPlotDataSeriesConditionPane extends DataSeriesConditionPane { + + @Override + protected ChartConditionPane createListConditionPane() { + return new PiePlotChartConditionPane(); + } + + /** + * 返回class对象 + * @return class对象 + */ + @Override + public Class class4Correspond() { + return FunnelPlot.class; + } + +} diff --git a/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java index 43c71b46c2..00891e628c 100644 --- a/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java @@ -3,6 +3,8 @@ package com.fr.design.chartinterface; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; +import com.fr.design.chart.series.SeriesCondition.impl.FunnelPlotDataSeriesConditionPane; +import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; @@ -34,6 +36,10 @@ public class FunnelIndependentChartInterface extends AbstractIndependentChartUIW return new FunnelSeriesPane(parent, plot); } + public ConditionAttributesPane getPlotConditionPane(Plot plot){ + return new FunnelPlotDataSeriesConditionPane(); + } + /** *图标路径 * @return 图标路径 From 848a8f36ae02657c80c6cc77fddf5148c69f3a0e Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 10 Nov 2016 14:00:29 +0800 Subject: [PATCH 185/244] =?UTF-8?q?REPORT-773=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=A4=BE=E5=8C=BA=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 4e1d1decd1..8df23d70d9 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -138,8 +138,6 @@ public abstract class ToolBarMenuDock { // 添加帮助菜单 menuList.add(createHelpMenuDef()); - // 添加社区菜单 - menuList.add(createCommunityMenuDef()); return menuList.toArray(new MenuDef[menuList.size()]); } From a597b91fd527681663d3feb89945b835ab53526a Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 10 Nov 2016 15:43:41 +0800 Subject: [PATCH 186/244] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index aae009dc42..f9a75a1058 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -79,37 +79,42 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh public static WidgetOption[] initWidgetOption(){ - final ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); - final ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); + ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + final Chart[][] allChart = new Chart[typeName.length][]; + for (int i = 0; i < typeName.length; i++) { + String plotID = typeName[i].getPlotID(); + Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); + allChart[i] = rowChart; + if(rowChart == null) { + continue; + } + String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); + Icon icon = IOUtils.readIcon(iconPath); + child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); + } - //异步加载 + //异步加载图片 new Thread(new Runnable() { @Override public void run() { - getWidgetOption(typeName, child); + initAllChartsDemoImage(allChart); } }).start(); return child; } - private static void getWidgetOption(ChartInternationalNameContentBean[] typeName, ChartWidgetOption[] child){ - for (int i = 0; i < typeName.length; i++) { - String plotID = typeName[i].getPlotID(); - Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); + //加载所有图表图片 + private static void initAllChartsDemoImage(Chart[][] allCharts){ + for (int i = 0; i < allCharts.length; i++) { + Chart[] rowChart = allCharts[i]; if(rowChart == null) { continue; } - //加载初始化图表模型图片 initChartsDemoImage(rowChart); - - String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); - Icon icon = IOUtils.readIcon(iconPath); - child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } - - DesignModuleFactory.registerExtraWidgetOptions(child); } private static void initChartsDemoImage(Chart[] rowChart) { From b2551fcccdf1564339871e55c2fb63600b9b2138 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 10 Nov 2016 15:46:13 +0800 Subject: [PATCH 187/244] update --- .../src/com/fr/design/ChartTypeInterfaceManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index f9a75a1058..3515be8f24 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -81,24 +81,25 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; - final Chart[][] allChart = new Chart[typeName.length][]; + final Chart[][] allCharts = new Chart[typeName.length][]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); - allChart[i] = rowChart; if(rowChart == null) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); + + allCharts[i] = rowChart; } //异步加载图片 new Thread(new Runnable() { @Override public void run() { - initAllChartsDemoImage(allChart); + initAllChartsDemoImage(allCharts); } }).start(); From 7dbd536916367104f76b17e9bbe2cd8b56eafa9e Mon Sep 17 00:00:00 2001 From: zhouping Date: Thu, 10 Nov 2016 20:11:20 +0800 Subject: [PATCH 188/244] =?UTF-8?q?REPORT-750=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E5=86=85=E6=B5=8B=E9=97=AE=E9=A2=98=20dev?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=B0release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCreator.java | 16 ++++++++++ .../designer/creator/XWAbsoluteLayout.java | 32 +++++++++++++++++++ .../design/designer/creator/XWFitLayout.java | 2 ++ 3 files changed, 50 insertions(+) diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index d47009ff95..ed692cd428 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -601,4 +601,20 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } } + + /** + * 按照比例调整组件的宽度 + * @param percent 比例 + */ + public void adjustCompWidth(double percent){ + return; + } + + /** + * 按照比例调整组件的高度 + * @param percent 比例 + */ + public void adjustCompHeight(double percent) { + return; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 210343f8ed..df28759393 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -444,4 +444,36 @@ public class XWAbsoluteLayout extends XLayoutContainer { } } } + + /** + * body大小手动调整的时候 + * 按照比例调整组件的宽度 + * @param percent 比例 + */ + @Override + public void adjustCompWidth(double percent) { + for (int i = 0; i < getComponentCount(); i++) { + XCreator xCreator = (XCreator) getComponent(i); + Rectangle rectangle = xCreator.getBounds(); + xCreator.setBounds((int) (rectangle.x * percent), rectangle.y, (int) (rectangle.width * percent), rectangle.height); + BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); + widget.setBounds(xCreator.getBounds()); + } + } + + /** + * body大小手动调整的时候 + * 按照比例调整组件的高度 + * @param percent 比例 + */ + @Override + public void adjustCompHeight(double percent) { + for (int i = 0; i < getComponentCount(); i++) { + XCreator xCreator = (XCreator) getComponent(i); + Rectangle rectangle = xCreator.getBounds(); + xCreator.setBounds(rectangle.x, (int) (rectangle.y * percent), rectangle.width, (int) (rectangle.height * percent)); + BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); + widget.setBounds(xCreator.getBounds()); + } + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java index 50fa38db93..04904a7238 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java @@ -381,6 +381,7 @@ public class XWFitLayout extends XLayoutContainer { needAddWidth = Math.max(needAddWidth, MIN_WIDTH-width); } } + creator.adjustCompWidth((double) creator.getBounds().width / rec.width); toData().setBounds(creator.toData(), creator.getBounds()); } @@ -504,6 +505,7 @@ public class XWFitLayout extends XLayoutContainer { needAddHeight = Math.max(needAddHeight, MIN_HEIGHT-h); } } + creator.adjustCompHeight((double) creator.getBounds().height / rec.height); toData().setBounds(creator.toData(), creator.getBounds()); } From 14a88966488276fc3d6bf036a57d3bf7c71a52aa Mon Sep 17 00:00:00 2001 From: sunmondong Date: Fri, 11 Nov 2016 12:17:12 +0800 Subject: [PATCH 189/244] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.release.gradle | 85 +++++++++++++++++++++++++++++ designer_base/build.release.gradle | 70 ++++++++++++++++++++++++ designer_chart/build.release.gradle | 66 ++++++++++++++++++++++ designer_form/build.release.gradle | 83 ++++++++++++++++++++++++++++ 4 files changed, 304 insertions(+) create mode 100644 build.release.gradle create mode 100644 designer_base/build.release.gradle create mode 100644 designer_chart/build.release.gradle create mode 100644 designer_form/build.release.gradle diff --git a/build.release.gradle b/build.release.gradle new file mode 100644 index 0000000000..44aacadb4d --- /dev/null +++ b/build.release.gradle @@ -0,0 +1,85 @@ +apply plugin: "java" +tasks.withType(JavaCompile){ + options.encoding = "UTF-8" +} +def basicDir="../../" +def libDir="${basicDir}/finereport-lib-stable/master" +//获取什么分支名 +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:"${libDir}/tmp-${branchName}") + mkdir(dir:"build/classes/") + 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") + + } + unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") + jar(jarfile:"build/libs/fr-applet-8.0.jar"){ + fileset(dir:"build/classes"){ + exclude(name:"*.*") + exclude(name:"bin/*.*") + exclude(name:"classes/**") + exclude(name:"com/fr/schedule/**") + exclude(name:"com/fr/cell/**") + exclude(name:"com/fr/dialog/**") + exclude(name:"com/fr/view/**") + exclude(name:"com/fr/web/**") + exclude(name:"com/fr/fs/**") + exclude(name:"com/fr/design/**") + exclude(name:"com/fr/start/**") + exclude(name:"com/fr/process/**") + } + fileset(dir:"${libDir}/tmp-${branchName}"){ + include(name:"javax/mail/**") + include(name:"javax/servlet/**") + include(name:"org/freehep/**") + include(name:"com/fr/third/JAI/**") + include(name:"com/fr/third/antlr/**") + include(name:"com/fr/third/javax/**") + include(name:"com/sun/xml/**") + include(name:"javax/xml/**") + + } + fileset(dir:"build/classes"){ + include(name:"com/fr/web/*.class") + include(name:"com/fr/web/attr/*.class") + } + } + delete(dir:"${libDir}/tmp-${branchName}") + def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" + def keystore="frapplet.store" + def keycert="fr.cert" + def keypassword="123456" + def keyalias="fr" + + exec(executable:"${jdk6home}/bin/keytool"){ + arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") + } + exec(executable:"${jdk6home}/bin/keytool"){ + arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") + } + + exec(executable:"${jdk6home}/bin/jarsigner"){ + arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") + } + delete(file:"${keystore}") + delete(file:"${keycert}") + delete(dir:"build/classes") + + } + +} \ No newline at end of file diff --git a/designer_base/build.release.gradle b/designer_base/build.release.gradle new file mode 100644 index 0000000000..4ed4ba12b0 --- /dev/null +++ b/designer_base/build.release.gradle @@ -0,0 +1,70 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.8 +//指定生成jar包版本 +version='8.0' +//生成jar包重命名 +jar{ + baseName='fr-designer-core' +} + + +def srcDir="." + +//指定源码路径 +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src"] + } + } +} +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//声明外部依赖 +dependencies{ + +compile fileTree(dir:'../../../finereport-lib-stable/master',include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} +//复制非.java文件到classes文件夹下参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + from ("${srcDir}/src"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + into 'build/classes/main' + } + +} + + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + + + diff --git a/designer_chart/build.release.gradle b/designer_chart/build.release.gradle new file mode 100644 index 0000000000..e97176e24c --- /dev/null +++ b/designer_chart/build.release.gradle @@ -0,0 +1,66 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.8 +//指定生成jar包的版本 +version='8.0' + +def srcDir="." + +//对生成的jar包进行重命名 + +jar{ + baseName='fr-designer-chart' +} + +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src"] + } + } +} +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + +//指定外部依赖 +dependencies{ +compile fileTree(dir:'../../../finereport-lib-stable/master',include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} +//将非.java 文件复制到classes文件夹下参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + from ("${srcDir}/src"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + + } + into 'build/classes/main' + } + +} + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + diff --git a/designer_form/build.release.gradle b/designer_form/build.release.gradle new file mode 100644 index 0000000000..90abcb81ee --- /dev/null +++ b/designer_form/build.release.gradle @@ -0,0 +1,83 @@ + +apply plugin: 'java' +tasks.withType(JavaCompile){ + options.encoding = 'UTF-8' +} +//指定构建的jdk版本 +sourceCompatibility=1.8 +//指定生成的jar包版本 +version='8.0' + +def srcDir="." + + +//指明生成jar包的名字 +jar{ + baseName='fr-designer-report' +} +//源码所在位置 +sourceSets{ + main{ + java{ + srcDirs=["${srcDir}/src", +"${srcDir}/../designer/src"] + } + } +} + +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.*.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) +//声明外部依赖 +dependencies{ +compile fileTree(dir:'../../../finereport-lib-stable/master',include:'**/*.jar') +compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") + + testCompile 'junit:junit:4.12' +} + +//指明无法编译文件所在路径 +def dataContent ={def dir -> + copySpec{ + from ("${dir}"){ + exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' + } + } +} + +//将非.java文件复制到classes文件夹下 参与打包 +task copyFile(type:Copy,dependsOn:compileJava){ + copy{ + with dataContent.call("${srcDir}/src") + with dataContent.call("${srcDir}/../designer/src") + into ('build/classes/main') + } + +} + + +//压缩项目中的js文件 +task compressJS{ + ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ + classpath { + + fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') + } + } + ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ + fileset (dir:"${srcDir}/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + + } + fileset (dir:"${srcDir}/../designer/src"){ + include (name:'**/*.js') + include (name:'**/*.css') + } + + } +} +jar.dependsOn compressJS + From 65596e57799bd9675dd6d0f7c84d1dd2111b935d Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 11 Nov 2016 13:07:56 +0800 Subject: [PATCH 190/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E5=90=8C=E6=AD=A5release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EditingMouseListener.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index 869ec2077f..0f916dd1de 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -288,24 +288,26 @@ public class EditingMouseListener extends MouseInputAdapter { if (component.isReport()) { xElementCase = (XElementCase)component; UIButton button = (UIButton)xElementCase.getCoverPane().getComponent(0); - JComponent button1= (JComponent) xElementCase.getCoverPane().getComponent(1); if(designer.getCursor().getType() ==Cursor.HAND_CURSOR) { - designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } // component.getParent() 是报表块所在的XWTitleLayout - int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); - int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); - int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); - int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); + designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } // component.getParent() 是报表块所在的XWTitleLayout + int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); + int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); if (e.getX() + GAP - xElementCase.getInsets().left > minX && e.getX() - GAP - xElementCase.getInsets().left < minX + button.getWidth()) { if (e.getY() + GAP - xElementCase.getInsets().top > minY && e.getY() - GAP - xElementCase.getInsets().top < minY + button.getHeight()) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } } xElementCase.setHelpBtnOnFocus(false); - if (e.getX() + GAP - xElementCase.getInsets().left > minX1 && e.getX() - GAP - xElementCase.getInsets().left < minX1 + button1.getWidth()) { - if (e.getY() + GAP - xElementCase.getInsets().top > minY1 && e.getY() - GAP - xElementCase.getInsets().top < minY1 + button1.getHeight()) { - designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - xElementCase.setHelpBtnOnFocus(true); + if (xElementCase.getCoverPane().getComponentCount() > 1) { + JComponent button1 = (JComponent) xElementCase.getCoverPane().getComponent(1); + int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); + int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); + if (e.getX() + GAP - xElementCase.getInsets().left > minX1 && e.getX() - GAP - xElementCase.getInsets().left < minX1 + button1.getWidth()) { + if (e.getY() + GAP - xElementCase.getInsets().top > minY1 && e.getY() - GAP - xElementCase.getInsets().top < minY1 + button1.getHeight()) { + designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + xElementCase.setHelpBtnOnFocus(true); + } } } xElementCase.displayCoverPane(true); From 4beb92ba7bf6564414c83a34cd0d975df3df3052 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 11 Nov 2016 13:59:33 +0800 Subject: [PATCH 191/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1,?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=80=89=E6=8B=A9=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99=E6=97=A0=E6=B3=95=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index 1c11aad2e4..8bf70c395a 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -61,7 +61,8 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane regPane.getRegComboBox().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem(); - if (!StringUtils.isNotEmpty(regExp.toRegText())) { + String regText = regExp.toRegText(); + if (regText != null && !StringUtils.isNotEmpty(regText)) { getRegErrorMsgTextField().setEnabled(false); } else { getRegErrorMsgTextField().setEnabled(true); From 2f064038cbca3937529ea81e3af10769cf883e88 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 11 Nov 2016 15:32:10 +0800 Subject: [PATCH 192/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1,?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=80=89=E6=8B=A9=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99=E6=97=A0=E6=B3=95=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index 8bf70c395a..3f30948538 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -61,8 +61,7 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane regPane.getRegComboBox().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem(); - String regText = regExp.toRegText(); - if (regText != null && !StringUtils.isNotEmpty(regText)) { + if (StringUtils.EMPTY.equals(regExp.toRegText())) { getRegErrorMsgTextField().setEnabled(false); } else { getRegErrorMsgTextField().setEnabled(true); From 50df64e5e4041b72a1ad644e0cf1997b3110e7a6 Mon Sep 17 00:00:00 2001 From: sunmondong Date: Fri, 11 Nov 2016 18:44:58 +0800 Subject: [PATCH 193/244] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.release.gradle | 4 +- build.release.gradle.bak | 85 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 build.release.gradle.bak diff --git a/build.release.gradle b/build.release.gradle index 44aacadb4d..e88da6b4b1 100644 --- a/build.release.gradle +++ b/build.release.gradle @@ -26,8 +26,8 @@ task appletJar<<{ fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") } - unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") - unjar(src:"${libDir}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") jar(jarfile:"build/libs/fr-applet-8.0.jar"){ fileset(dir:"build/classes"){ exclude(name:"*.*") diff --git a/build.release.gradle.bak b/build.release.gradle.bak new file mode 100644 index 0000000000..44aacadb4d --- /dev/null +++ b/build.release.gradle.bak @@ -0,0 +1,85 @@ +apply plugin: "java" +tasks.withType(JavaCompile){ + options.encoding = "UTF-8" +} +def basicDir="../../" +def libDir="${basicDir}/finereport-lib-stable/master" +//获取什么分支名 +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:"${libDir}/tmp-${branchName}") + mkdir(dir:"build/classes/") + 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") + + } + unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") + jar(jarfile:"build/libs/fr-applet-8.0.jar"){ + fileset(dir:"build/classes"){ + exclude(name:"*.*") + exclude(name:"bin/*.*") + exclude(name:"classes/**") + exclude(name:"com/fr/schedule/**") + exclude(name:"com/fr/cell/**") + exclude(name:"com/fr/dialog/**") + exclude(name:"com/fr/view/**") + exclude(name:"com/fr/web/**") + exclude(name:"com/fr/fs/**") + exclude(name:"com/fr/design/**") + exclude(name:"com/fr/start/**") + exclude(name:"com/fr/process/**") + } + fileset(dir:"${libDir}/tmp-${branchName}"){ + include(name:"javax/mail/**") + include(name:"javax/servlet/**") + include(name:"org/freehep/**") + include(name:"com/fr/third/JAI/**") + include(name:"com/fr/third/antlr/**") + include(name:"com/fr/third/javax/**") + include(name:"com/sun/xml/**") + include(name:"javax/xml/**") + + } + fileset(dir:"build/classes"){ + include(name:"com/fr/web/*.class") + include(name:"com/fr/web/attr/*.class") + } + } + delete(dir:"${libDir}/tmp-${branchName}") + def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" + def keystore="frapplet.store" + def keycert="fr.cert" + def keypassword="123456" + def keyalias="fr" + + exec(executable:"${jdk6home}/bin/keytool"){ + arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") + } + exec(executable:"${jdk6home}/bin/keytool"){ + arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") + } + + exec(executable:"${jdk6home}/bin/jarsigner"){ + arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") + } + delete(file:"${keystore}") + delete(file:"${keycert}") + delete(dir:"build/classes") + + } + +} \ No newline at end of file From 69c28085d5aedd517e71fb7148130e22614faa6b Mon Sep 17 00:00:00 2001 From: sunmondong Date: Mon, 14 Nov 2016 11:37:04 +0800 Subject: [PATCH 194/244] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E5=88=86=E6=94=AF=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.release.gradle | 4 ++-- build.release.gradle.bak | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.release.gradle b/build.release.gradle index e88da6b4b1..44aacadb4d 100644 --- a/build.release.gradle +++ b/build.release.gradle @@ -26,8 +26,8 @@ task appletJar<<{ fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") } - unjar(src:"${libDir}/${branchName}/3rd.jar",dest:"${libDir}/tmp-${branchName}") - unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") jar(jarfile:"build/libs/fr-applet-8.0.jar"){ fileset(dir:"build/classes"){ exclude(name:"*.*") diff --git a/build.release.gradle.bak b/build.release.gradle.bak index 44aacadb4d..d8afaf2bb8 100644 --- a/build.release.gradle.bak +++ b/build.release.gradle.bak @@ -27,7 +27,7 @@ task appletJar<<{ } unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") - unjar(src:"${libDir}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") + unjar(src:"${libDir}/${branchName}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") jar(jarfile:"build/libs/fr-applet-8.0.jar"){ fileset(dir:"build/classes"){ exclude(name:"*.*") From e221f1de4c31b99d560505a4042b707d61953e14 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 14 Nov 2016 11:51:07 +0800 Subject: [PATCH 195/244] =?UTF-8?q?=E6=9E=81=E9=80=9F=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A0=91=E6=9E=84=E5=BB=BA=E4=B8=AD=EF=BC=8C=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/frpane/TreeSettingPane.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java index 65df6f0625..70b0d2a402 100644 --- a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java @@ -18,6 +18,7 @@ import com.fr.form.ui.TreeEditor; import com.fr.form.ui.tree.LayerConfig; import com.fr.general.Inter; import com.fr.general.NameObject; +import edu.emory.mathcs.backport.java.util.Arrays; import javax.swing.*; import java.awt.*; @@ -133,7 +134,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { for (LayerConfig layerConfig : layerConfigList) { layerConfigs[i++] = layerConfig; } - this.layerDataControlPane.populate(new NameObject("tree", layerConfigs)); + this.layerDataControlPane.populate(new NameObject("Tree Layer Data", layerConfigs)); } else { buildBox.setSelectedIndex(2); } @@ -154,10 +155,12 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { if (buildBox.getSelectedIndex() == 1) { TableDataDictionary dictionary = this.autoBuildPane.update(); te.setAutoBuild(true); + te.setLayerBuild(false); te.setDictionary(dictionary); te.setNodeOrDict(dictionary); } else if (buildBox.getSelectedIndex() == 2) { te.setAutoBuild(false); + te.setLayerBuild(false); NameObject no = this.controlPane.update(); if (no != null) { TreeEditor editor = (TreeEditor) no.getObject(); @@ -174,6 +177,11 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { te.setNodeOrDict(editor.getTreeNodeAttr()); te.setPerformanceFirst(editor.isPerformanceFirst()); } + } else { + LayerConfig[] configs = (LayerConfig[]) layerDataControlPane.update().getObject(); + te.setAutoBuild(false); + te.setLayerBuild(true); + te.setLayerConfigs(Arrays.asList(configs)); } return te; } @@ -230,7 +238,12 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { tcb.setNodeOrDict(editor.getTreeNodeAttr()); tcb.setPerformanceFirst(editor.isPerformanceFirst()); } - } + }else { + LayerConfig[] configs = (LayerConfig[]) layerDataControlPane.update().getObject(); + tcb.setAutoBuild(false); + tcb.setLayerBuild(true); + tcb.setLayerConfigs(Arrays.asList(configs)); + } return tcb; } From 53726119e4913ff3d829dfa0b39f0d66d5d3b4ea Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 14 Nov 2016 11:56:10 +0800 Subject: [PATCH 196/244] =?UTF-8?q?=E6=9E=81=E9=80=9F=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A0=91=E6=9E=84=E5=BB=BA=E4=B8=AD=EF=BC=8C=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/frpane/TreeSettingPane.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java index 70b0d2a402..21e0caf3f9 100644 --- a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java @@ -214,15 +214,17 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { if (buildBox.getSelectedIndex() == 1) { TableDataDictionary dictionary = this.autoBuildPane.update(); tcb.setAutoBuild(true); - tcb.setDictionary(dictionary); - tcb.setNodeOrDict(dictionary); - } else if (buildBox.getSelectedIndex() == 2) { - tcb.setAutoBuild(false); - NameObject no = this.controlPane.update(); - if (no != null) { - if (no.getObject() instanceof TreeComboBoxEditor) { - return (TreeComboBoxEditor) no.getObject(); - } + tcb.setLayerBuild(false); + tcb.setDictionary(dictionary); + tcb.setNodeOrDict(dictionary); + } else if (buildBox.getSelectedIndex() == 2) { + tcb.setAutoBuild(false); + tcb.setLayerBuild(false); + NameObject no = this.controlPane.update(); + if (no != null) { + if (no.getObject() instanceof TreeComboBoxEditor) { + return (TreeComboBoxEditor) no.getObject(); + } TreeEditor editor = (TreeEditor) no.getObject(); tcb.setAllowBlank(editor.isAllowBlank()); From 722ded0e9b79593bebb56890c2a7bd998f8545ce Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 14 Nov 2016 14:17:35 +0800 Subject: [PATCH 197/244] =?UTF-8?q?REPORT-773=20=E5=8F=AA=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=9F=A9=E6=96=87=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E7=A4=BE=E5=8C=BA=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 8df23d70d9..f3d87cdd5f 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -122,6 +122,8 @@ public abstract class ToolBarMenuDock { ////////////////////////////////////////////////////////////////////////////////////////// public MenuDef[] menus(final ToolBarMenuDockPlus plus) { + Locale locale = FRContext.getLocale(); + java.util.List menuList = new java.util.ArrayList(); // 添加文件菜单 menuList.add(createFileMenuDef(plus)); @@ -138,6 +140,11 @@ public abstract class ToolBarMenuDock { // 添加帮助菜单 menuList.add(createHelpMenuDef()); + // 添加社区菜单 + if(!Locale.KOREA.equals(locale)){ + menuList.add(createCommunityMenuDef()); + } + return menuList.toArray(new MenuDef[menuList.size()]); } From 3788224902fa03433bb55de2793812ce2e9f3c44 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Mon, 14 Nov 2016 14:38:26 +0800 Subject: [PATCH 198/244] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/chart/gui/ChartDataPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java index 7c8589fb25..3cd2b830c8 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java @@ -68,6 +68,10 @@ public class ChartDataPane extends AbstractChartAttrPane { contentsPane.setSupportCellData(supportCellData); } } + + public boolean isSupportCellData() { + return supportCellData; + } /** * 设置数据界面是否支持单元格 From fd2f80b6c101ecd2775eed930d611530fec5425c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 14 Nov 2016 15:23:24 +0800 Subject: [PATCH 199/244] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JWorkBook.java | 2 + .../parameter/ParameterDefinitePane.java | 18 +- .../gui/icontainer/UIResizableContainer.java | 8 +- .../form/parameter/FormParaDesigner.java | 189 ++++++++-------- .../com/fr/design/mainframe/FormDesigner.java | 202 +++++++++--------- .../src/com/fr/design/mainframe/JForm.java | 4 +- 6 files changed, 216 insertions(+), 207 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/JWorkBook.java b/designer/src/com/fr/design/mainframe/JWorkBook.java index 1e27feeb58..f3722c4ac2 100644 --- a/designer/src/com/fr/design/mainframe/JWorkBook.java +++ b/designer/src/com/fr/design/mainframe/JWorkBook.java @@ -732,6 +732,7 @@ public class JWorkBook extends JTemplate { } } else { DesignerContext.getDesignerFrame().resetToolkitByPlus(JWorkBook.this); + EastRegionContainerPane.getInstance().removeParameterPane(); if (delegate4ToolbarMenuAdapter() instanceof PolyDesigner) { PolyDesigner polyDesigner = (PolyDesigner) delegate4ToolbarMenuAdapter(); if (polyDesigner.getSelectionType() == PolyDesigner.SelectionType.NONE || polyDesigner.getSelection() == null) { @@ -752,6 +753,7 @@ public class JWorkBook extends JTemplate { EastRegionContainerPane.getInstance().replaceUpPane(allowAuthorityUpPane()); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); } + centerPane.needToShowCoverAndHidPane(); } diff --git a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java index 1a547c3e6c..eb02932b67 100644 --- a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java @@ -20,7 +20,9 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.AuthorityToolBarPane; +import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.JWorkBook; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.*; import com.fr.design.module.DesignModuleFactory; @@ -244,7 +246,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus isdelayItem.setSelected(reportParameterAttr.isDelayPlaying()); isshowWindowItem.setSelected(reportParameterAttr.isShowWindow()); isEditing = true; - + EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height); ParameterBridge bridge = paraDesignEditor.getParaComponent(); if (parameterUI != null) { bridge.setDelayDisplayContent(reportParameterAttr.isDelayPlaying()); @@ -455,13 +457,13 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus */ public ShortCut[] shortcut4FileMenu() { return (ShortCut[]) ArrayUtils.addAll(BaseUtils.isAuthorityEditing() ? - new ShortCut[]{new SaveTemplateAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), - new UndoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), - new RedoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())} : - new ShortCut[]{new SaveTemplateAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), - new SaveAsTemplateAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), - new UndoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), - new RedoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())}, + new ShortCut[]{new SaveTemplateAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), + new UndoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), + new RedoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())} : + new ShortCut[]{new SaveTemplateAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), + new SaveAsTemplateAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), + new UndoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()), + new RedoAction(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())}, new ShortCut[0] ); } diff --git a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java index 86945674bf..13ea214ec5 100644 --- a/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -29,6 +29,7 @@ public class UIResizableContainer extends JPanel { private VerticalToolPane verticalToolPane; private int direction; + private boolean hasParameterPane; private static final int MAX_WIDTH = 300; private static final int MIN_WIDTH = 165; @@ -89,7 +90,6 @@ public class UIResizableContainer extends JPanel { add(horizontToolPane); add(downPane); add(verticalToolPane); - add(parameterPane); } public UIResizableContainer(JComponent upPane, int direction) { @@ -102,7 +102,6 @@ public class UIResizableContainer extends JPanel { setLayout(containerLayout); add(upPane); add(horizontToolPane); - add(parameterPane); } @@ -141,7 +140,7 @@ public class UIResizableContainer extends JPanel { * @param height */ public void setParameterHeight(int height) { - paraHeight = height; + paraHeight = hasParameterPane? height : 0; refreshContainer(); } @@ -274,13 +273,16 @@ public class UIResizableContainer extends JPanel { public void addParameterPane(JComponent pane) { add(this.parameterPane = pane); + hasParameterPane = true; refreshContainer(); } public void removeParameterPane() { remove(this.parameterPane); setParameterHeight(0); + hasParameterPane = false; refreshContainer(); + } /** diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index a7936a8288..692359bbd6 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -110,7 +110,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP public void initBeforeUpEdit() { WidgetToolBarPane.getInstance(this); EastRegionContainerPane.getInstance().replaceDownPane( - FormWidgetDetailPane.getInstance(this)); + FormWidgetDetailPane.getInstance(this)); if (!BaseUtils.isAuthorityEditing()) { EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); @@ -123,35 +123,35 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP } - /** - * 创建权限编辑面板 - * @return 面板 - */ + /** + * 创建权限编辑面板 + * @return 面板 + */ public AuthorityEditPane createAuthorityEditPane() { return new FormWidgetAuthorityEditPane(this); } - /** - * 内容属性表面板 - * @return 内容属性表面板 - */ + /** + * 内容属性表面板 + * @return 内容属性表面板 + */ public JPanel getEastUpPane() { return WidgetPropertyPane.getInstance(this); } - /** - * 参数属性表 - * @return 参数属性表 - */ + /** + * 参数属性表 + * @return 参数属性表 + */ public JPanel getEastDownPane() { return FormWidgetDetailPane.getInstance(this); } - /** - * 权限编辑面板 - * @return 权限编辑面板 - */ + /** + * 权限编辑面板 + * @return 权限编辑面板 + */ public AuthorityEditPane getAuthorityEditPane() { FormWidgetAuthorityEditPane formWidgetAuthorityEditPane = new FormWidgetAuthorityEditPane(this); formWidgetAuthorityEditPane.populateDetials(); @@ -233,6 +233,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP } ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray()); + EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height); } @@ -247,9 +248,9 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP return xx.isEmpty(); } - protected void setToolbarButtons(boolean flag) { - DesignerContext.getDesignerFrame().checkCombineUp(!flag, NAME_ARRAY_LIST); - } + protected void setToolbarButtons(boolean flag) { + DesignerContext.getDesignerFrame().checkCombineUp(!flag, NAME_ARRAY_LIST); + } /** * 看看参数面板中的控件是否有和模板参数同名的 @@ -311,17 +312,17 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP return SearchQueryCreators(rootContainer); } - /** - * 返回复制粘贴删除等动作 - * @return 同上 - */ - public Action[] getActions() { - if (designer_actions == null) { - designer_actions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this), - new FormDeleteAction(this)}; - } - return designer_actions; - } + /** + * 返回复制粘贴删除等动作 + * @return 同上 + */ + public Action[] getActions() { + if (designer_actions == null) { + designer_actions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + new FormDeleteAction(this)}; + } + return designer_actions; + } private boolean SearchQueryCreators(XLayoutContainer rootContainer) { boolean b = false; @@ -353,9 +354,9 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP ParameterPropertyPane.getInstance().populateBean(p); } - /** - * 初始化 - */ + /** + * 初始化 + */ public void initWidgetToolbarPane() { WidgetToolBarPane.getInstance(this); } @@ -377,38 +378,38 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP this.refreshRoot(); } - /** - * 报表直接判断底层是否是绝对布局 - * @return 是则返回true - */ - public boolean hasWAbsoluteLayout() { - return this.getTarget().getContainer() instanceof WAbsoluteLayout; - } - - /** - * 刷新底层容器 - */ - public void refreshRoot() { - XLayoutContainer layoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(this.getTarget() - .getContainer()); - if (layoutContainer == null) { - layoutContainer = new XWParameterLayout(); - } - layoutContainer.setSize(LARGE_PREFERRED_SIZE); - setRootComponent(layoutContainer); - } - - /** - * 是否是报表的参数面板 - * @return 是 - */ - public boolean isFormParaDesigner(){ - return true; - } - - public XLayoutContainer getParaComponent() { - return getRootComponent(); - } + /** + * 报表直接判断底层是否是绝对布局 + * @return 是则返回true + */ + public boolean hasWAbsoluteLayout() { + return this.getTarget().getContainer() instanceof WAbsoluteLayout; + } + + /** + * 刷新底层容器 + */ + public void refreshRoot() { + XLayoutContainer layoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(this.getTarget() + .getContainer()); + if (layoutContainer == null) { + layoutContainer = new XWParameterLayout(); + } + layoutContainer.setSize(LARGE_PREFERRED_SIZE); + setRootComponent(layoutContainer); + } + + /** + * 是否是报表的参数面板 + * @return 是 + */ + public boolean isFormParaDesigner(){ + return true; + } + + public XLayoutContainer getParaComponent() { + return getRootComponent(); + } private void paintLinkParameters(Graphics clipg) { Parameter[] paras = DesignModelAdapter.getCurrentModelAdapter().getParameters(); @@ -493,8 +494,8 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP public void populateRootSize() { ((FormParameterUI) getTarget()).setDesignSize(getRootComponent().getSize()); if (getParaComponent().acceptType(XWParameterLayout.class)) { - WParameterLayout layout = (WParameterLayout)getParaComponent().toData(); - layout.setDesignWidth(getRootComponent().getWidth()); + WParameterLayout layout = (WParameterLayout)getParaComponent().toData(); + layout.setDesignWidth(getRootComponent().getWidth()); } } @@ -551,12 +552,12 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP return true; } - /** - * 加入参数 - * @param parameter 参数 c - * @param currentIndex 位置 w - * @return 是否加入 s - */ + /** + * 加入参数 + * @param parameter 参数 c + * @param currentIndex 位置 w + * @return 是否加入 s + */ public boolean addingParameter2Editor(Parameter parameter, int currentIndex) { com.fr.form.ui.Label label = new com.fr.form.ui.Label(); String name = parameter.getName(); @@ -577,12 +578,12 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP } - /** - * 加入参数 - * @param parameter 参数 c - * @param currentIndex 位置 w - * @return 是否加入 s - */ + /** + * 加入参数 + * @param parameter 参数 c + * @param currentIndex 位置 w + * @return 是否加入 s + */ public boolean addingParameter2EditorWithQueryButton(Parameter parameter, int currentIndex) { com.fr.form.ui.Label label = new com.fr.form.ui.Label(); String name = parameter.getName(); @@ -611,12 +612,12 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP return true; } - /** - * 加入参数 - * @param parameterArray 参数 c - * @param currentIndex 位置 w - * @return 是否加入 s - */ + /** + * 加入参数 + * @param parameterArray 参数 c + * @param currentIndex 位置 w + * @return 是否加入 s + */ public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { for (int i = 0; i < parameterArray.length; i++) { com.fr.form.ui.Label label = new com.fr.form.ui.Label(); @@ -669,18 +670,18 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP return true; } - /** - * 工具栏 - * @return 工具栏面板 g - */ + /** + * 工具栏 + * @return 工具栏面板 g + */ public JPanel[] toolbarPanes4Form() { return new JPanel[]{FormParaPane.getInstance(this)}; } - /** - * 复制等按钮 - * @return 按钮组 a - */ + /** + * 复制等按钮 + * @return 按钮组 a + */ public JComponent[] toolBarButton4Form() { return new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(), new FormDeleteAction(this).createToolBarComponent()}; diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 8422bfdb40..6f5fe2a473 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -121,7 +121,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection private static final int H_GAP = 105; public FormDesigner(Form form) { - this(form, null); + this(form, null); } public FormDesigner(Form form, Action switchAction) { @@ -186,14 +186,14 @@ public class FormDesigner extends TargetComponent implements TreeSelection public void refreshParameter(){ XLayoutContainer rootContainer = this.getParaComponent(); if (rootContainer != null){ - java.util.List namelist = new ArrayList(); - rootContainer.getAllXCreatorNameList(rootContainer,namelist); - // parameterArray是报表的所有参数, nameList是已经在参数面板添加过控件的参数名 - // 与已有的参数列表比较 如果已经存在 就除去 - Parameter[] ps = getParameterArray(); - if (ps != null) { - removeSame(ps, namelist); - } + java.util.List namelist = new ArrayList(); + rootContainer.getAllXCreatorNameList(rootContainer,namelist); + // parameterArray是报表的所有参数, nameList是已经在参数面板添加过控件的参数名 + // 与已有的参数列表比较 如果已经存在 就除去 + Parameter[] ps = getParameterArray(); + if (ps != null) { + removeSame(ps, namelist); + } } ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean( getParameterArray() == null ? new Parameter[0] : getParameterArray()); @@ -201,15 +201,15 @@ public class FormDesigner extends TargetComponent implements TreeSelection EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); } - private void removeSame(Parameter[] parameters, List namelist){ - for (Parameter parameter : parameters) { - for (String name : namelist) { - if (name.equalsIgnoreCase(parameter.getName())) { - setParameterArray((Parameter[]) ArrayUtils.removeElement(getParameterArray(), parameter)); - } - } - } - } + private void removeSame(Parameter[] parameters, List namelist){ + for (Parameter parameter : parameters) { + for (String name : namelist) { + if (name.equalsIgnoreCase(parameter.getName())) { + setParameterArray((Parameter[]) ArrayUtils.removeElement(getParameterArray(), parameter)); + } + } + } + } /** @@ -405,10 +405,10 @@ public class FormDesigner extends TargetComponent implements TreeSelection * 加入参数面板 */ public void addParaComponent(){ - if (paraComponent != null) { - return ; - } - paraHeight = WBorderLayout.DEFAULT_SIZE; + if (paraComponent != null) { + return ; + } + paraHeight = WBorderLayout.DEFAULT_SIZE; paraComponent = new XWParameterLayout(); paraComponent.toData().setWidgetName("para"); paraComponent.setSize(paraComponent.initEditorSize()); @@ -428,10 +428,10 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @return 父容器 */ public Component getTopContainer(){ - if(rootComponent != null){ - // 返回root所在的父容器,非designer - return LayoutUtils.getTopContainer(rootComponent); - } + if(rootComponent != null){ + // 返回root所在的父容器,非designer + return LayoutUtils.getTopContainer(rootComponent); + } return XCreatorUtils.createXCreator(this.getTarget().getContainer()); } @@ -448,9 +448,9 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @param height 高度 */ public void setParaHeight(int height){ - XWBorderLayout container = (XWBorderLayout) getTopContainer(); - container.toData().setNorthSize(height); - container.setSize(container.getWidth(), container.getHeight() + height - getParaHeight()); + XWBorderLayout container = (XWBorderLayout) getTopContainer(); + container.toData().setNorthSize(height); + container.setSize(container.getWidth(), container.getHeight() + height - getParaHeight()); paraHeight = height; } @@ -475,39 +475,39 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @param elementCaseContainer 容器 */ public void switchTab(FormElementCaseContainerProvider elementCaseContainer){ - if(this.switchAction == null){ - return; - } - this.elementCaseContainer = elementCaseContainer; - this.switchAction.actionPerformed(null); + if(this.switchAction == null){ + return; + } + this.elementCaseContainer = elementCaseContainer; + this.switchAction.actionPerformed(null); } public void setElementCaseContainer(FormElementCaseContainerProvider elementCaseContainer){ - this.elementCaseContainer = elementCaseContainer; + this.elementCaseContainer = elementCaseContainer; } public FormElementCaseProvider getElementCase(){ - return this.elementCaseContainer.getElementCase(); + return this.elementCaseContainer.getElementCase(); } public String getElementCaseContainerName(){ - return this.elementCaseContainer.getElementCaseContainerName(); + return this.elementCaseContainer.getElementCaseContainerName(); } public void setElementCase(FormElementCaseProvider elementCase){ - this.elementCaseContainer.setElementCase(elementCase); + this.elementCaseContainer.setElementCase(elementCase); } public void setElementCaseBackground(BufferedImage image){ - this.elementCaseContainer.setBackground(image); + this.elementCaseContainer.setBackground(image); } public Dimension getElementCaseContainerSize(){ - return this.elementCaseContainer.getSize(); + return this.elementCaseContainer.getSize(); } public FormElementCaseContainerProvider getElementCaseContainer(){ - return this.elementCaseContainer; + return this.elementCaseContainer; } protected FormDesignerModeForSpecial createFormDesignerTargetMode() { @@ -604,7 +604,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @param width 指定的宽度 */ public void updateWidth(int width) { - //TODO + //TODO } /** @@ -615,12 +615,12 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @return 不返回任何对象 */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - if(rootComponent != null){ - LayoutUtils.layoutRootContainer(rootComponent); - } - if(paraComponent != null){ - LayoutUtils.layoutRootContainer(paraComponent); - } + if(rootComponent != null){ + LayoutUtils.layoutRootContainer(rootComponent); + } + if(paraComponent != null){ + LayoutUtils.layoutRootContainer(paraComponent); + } repaint(); return null; } @@ -640,7 +640,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection @Override public void fireCreatorModified(DesignerEvent evt) { - // 只有选择组件时不触发模版更新,其他都要触发 + // 只有选择组件时不触发模版更新,其他都要触发 if (evt.getCreatorEventID() != DesignerEvent.CREATOR_SELECTED) { FormDesigner.this.fireTargetModified(); //bug59192 @@ -702,7 +702,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection * 从root组件递归查找x,y所在的组件,注意是正在被设计的组件,因此其name属性必须不为空 */ private XCreator xCreatorAt(int x, int y, XCreator root, XCreator[] except) { - if (root == null || !root.isVisible()) { + if (root == null || !root.isVisible()) { return null; } x -= root.getX(); @@ -758,21 +758,21 @@ public class FormDesigner extends TargetComponent implements TreeSelection * 刷新底层容器 */ public void refreshRoot() { - // 撤销恢复操作都会refreshRoot,这时候的target.getContainer里的widget会和之前不一样,所以不用root判断来取 - XLayoutContainer formLayoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(this.getTarget().getContainer()); + // 撤销恢复操作都会refreshRoot,这时候的target.getContainer里的widget会和之前不一样,所以不用root判断来取 + XLayoutContainer formLayoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(this.getTarget().getContainer()); // 布局默认都是1,底层的border改为0,不然没意义 this.getTarget().getContainer().setMargin(new PaddingMargin(0,0,0,0)); formLayoutContainer.setBorder(null); if (formLayoutContainer.acceptType(XWBorderLayout.class)) { - WBorderLayout borderLayout = (WBorderLayout) formLayoutContainer.toData(); + WBorderLayout borderLayout = (WBorderLayout) formLayoutContainer.toData(); Widget northWidget = borderLayout.getLayoutWidget(WBorderLayout.NORTH); - Widget centerWidget = borderLayout.getLayoutWidget(WBorderLayout.CENTER); + Widget centerWidget = borderLayout.getLayoutWidget(WBorderLayout.CENTER); //本身含有,这儿得先清空再加 formLayoutContainer.removeAll(); refreshNorth(northWidget, formLayoutContainer); - refreshCenter(centerWidget, formLayoutContainer); + refreshCenter(centerWidget, formLayoutContainer); } else { formLayoutContainer.setSize(LARGE_PREFERRED_SIZE); @@ -781,43 +781,43 @@ public class FormDesigner extends TargetComponent implements TreeSelection } private void refreshNorth(Widget northWidget, XLayoutContainer formLayoutContainer) { - // 如果没有参数界面, 那么就处理下高度以及参数界面的按钮要点亮 - if (northWidget == null) { - paraComponent = null; - paraHeight = 0; - FormParaWidgetPane.getInstance(this); - return; - } - - XLayoutContainer northContainer = (XLayoutContainer) XCreatorUtils.createXCreator(northWidget); - paraHeight = ((XWBorderLayout)formLayoutContainer).toData().getNorthSize(); - paraComponent = northContainer; - northContainer.setSize(0,paraHeight); - formLayoutContainer.add(northContainer, WBorderLayout.NORTH); - } - - private void refreshCenter(Widget centerWidget, XLayoutContainer formLayoutContainer) { - // 不存在center块, 说明是新建的模板 - if (centerWidget == null) { - XLayoutContainer layoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(new WFitLayout("body")); - layoutContainer.setSize(LARGE_PREFERRED_SIZE); - setRootComponent(layoutContainer); - formLayoutContainer.add(rootComponent, WBorderLayout.CENTER); - return; - } - - XLayoutContainer centerContainer = (XLayoutContainer) XCreatorUtils.createXCreator(centerWidget); - Dimension d = new Dimension(); - d.width = ((WFitLayout) centerWidget).getContainerWidth(); - d.height = ((WFitLayout) centerWidget).getContainerHeight(); - centerContainer.setSize(d); - formLayoutContainer.setSize(d.width, d.height + paraHeight); - setRootComponent(centerContainer); - // 再次打开时,layout下root,有内边距的话组件加上 - LayoutUtils.layoutContainer(centerContainer); - formLayoutContainer.add(rootComponent, WBorderLayout.CENTER); + // 如果没有参数界面, 那么就处理下高度以及参数界面的按钮要点亮 + if (northWidget == null) { + paraComponent = null; + paraHeight = 0; + FormParaWidgetPane.getInstance(this); + return; } + XLayoutContainer northContainer = (XLayoutContainer) XCreatorUtils.createXCreator(northWidget); + paraHeight = ((XWBorderLayout)formLayoutContainer).toData().getNorthSize(); + paraComponent = northContainer; + northContainer.setSize(0,paraHeight); + formLayoutContainer.add(northContainer, WBorderLayout.NORTH); + } + + private void refreshCenter(Widget centerWidget, XLayoutContainer formLayoutContainer) { + // 不存在center块, 说明是新建的模板 + if (centerWidget == null) { + XLayoutContainer layoutContainer = (XLayoutContainer) XCreatorUtils.createXCreator(new WFitLayout("body")); + layoutContainer.setSize(LARGE_PREFERRED_SIZE); + setRootComponent(layoutContainer); + formLayoutContainer.add(rootComponent, WBorderLayout.CENTER); + return; + } + + XLayoutContainer centerContainer = (XLayoutContainer) XCreatorUtils.createXCreator(centerWidget); + Dimension d = new Dimension(); + d.width = ((WFitLayout) centerWidget).getContainerWidth(); + d.height = ((WFitLayout) centerWidget).getContainerHeight(); + centerContainer.setSize(d); + formLayoutContainer.setSize(d.width, d.height + paraHeight); + setRootComponent(centerContainer); + // 再次打开时,layout下root,有内边距的话组件加上 + LayoutUtils.layoutContainer(centerContainer); + formLayoutContainer.add(rootComponent, WBorderLayout.CENTER); + } + protected Insets getOutlineInsets() { return new Insets(10, 10, 10, 10); @@ -962,8 +962,8 @@ public class FormDesigner extends TargetComponent implements TreeSelection public void startDraggingComponent(XCreator xCreator, MouseEvent lastPressEvent, int x, int y) { // 根据所选择的组件的BeanInfo生成相应的AddingModel // AddingModel和StateModel不一样,适合当前选择的组件相关的 - int creatorWidth = xCreator.getWidth(); - int creatorHeight = xCreator.getHeight(); + int creatorWidth = xCreator.getWidth(); + int creatorHeight = xCreator.getHeight(); this.addingModel = new AddingModel(xCreator, x, y); TransferHandler handler = new DesignerTransferHandler(this, addingModel); setTransferHandler(handler); @@ -1007,9 +1007,9 @@ public class FormDesigner extends TargetComponent implements TreeSelection } } - /** - * 显示权限编辑界面 - */ + /** + * 显示权限编辑界面 + */ public void showAuthorityEditPane() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setAuthorityMode(true); if (isSupportAuthority()) { @@ -1023,9 +1023,9 @@ public class FormDesigner extends TargetComponent implements TreeSelection } /** - * 是否支持权限编辑 - * @return 是则返回true - */ + * 是否支持权限编辑 + * @return 是则返回true + */ public boolean isSupportAuthority() { int size = getSelectionModel().getSelection().size(); XCreator creator = size == 0 ? getRootComponent() : getSelectionModel().getSelection() @@ -1036,7 +1036,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection protected void setToolbarButtons(boolean flag) { //自适应布局和底层都不能删除 - DesignerContext.getDesignerFrame().checkCombineUp(!(isRoot(getSelectionModel().getSelection().getSelectedCreator()) || flag), NAME_ARRAY_LIST); + DesignerContext.getDesignerFrame().checkCombineUp(!(isRoot(getSelectionModel().getSelection().getSelectedCreator()) || flag), NAME_ARRAY_LIST); } private void invalidateLayout() { @@ -1092,7 +1092,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection */ public Action[] getActions() { if (designer_actions == null) { - //先把复制粘贴按钮去掉,只留下删除 + //先把复制粘贴按钮去掉,只留下删除 // designer_actions = new Action[]{new CutAction(this), new CopyAction(this), new PasteAction(this), // new FormDeleteAction(this)}; designer_actions = new Action[]{new FormDeleteAction(this)}; @@ -1236,7 +1236,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection public ToolBarMenuDockPlus getToolBarMenuDockPlus() { - return StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, ToolBarMenuDockPlus.class); + return StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, ToolBarMenuDockPlus.class); } /** diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index bbc1706d9b..4c015811c0 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -609,17 +609,19 @@ public class JForm extends JTemplate implements BaseJForm { EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); return; } + if (formDesign.isReportBlockEditing()) { if (elementCaseDesign != null) { + EastRegionContainerPane.getInstance().removeParameterPane(); EastRegionContainerPane.getInstance().replaceDownPane(elementCaseDesign.getEastDownPane()); EastRegionContainerPane.getInstance().replaceUpPane(elementCaseDesign.getEastUpPane()); return; } } - EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign)); EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign)); + EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(formDesign).getPreferredSize().height); if (EastRegionContainerPane.getInstance().getDownPane() == null) { new Thread() { public void run() { From 810ece19ba1131eb5d19bcbf6c963c6eecfe4094 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 14 Nov 2016 15:24:18 +0800 Subject: [PATCH 200/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1,?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=80=89=E6=8B=A9=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99=E6=97=A0=E6=B3=95=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/ui/TextFieldEditorDefinePane.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index 3f30948538..c9128627cc 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -61,11 +61,7 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane regPane.getRegComboBox().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem(); - if (StringUtils.EMPTY.equals(regExp.toRegText())) { - getRegErrorMsgTextField().setEnabled(false); - } else { - getRegErrorMsgTextField().setEnabled(true); - } + getRegErrorMsgTextField().setEnabled(regExp.errorMessageEditable()); } }); From 993f22837b42bf215f199b037396715382ef296c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 14 Nov 2016 15:46:37 +0800 Subject: [PATCH 201/244] rt --- .../design/mainframe/WidgetPropertyPane.java | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index 324ff62bb3..cc7f1d7690 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -124,15 +124,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper } componentTree = new ComponentTree(designer); - - ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel(); - XCreator root = (XCreator)treeModel.getRoot(); - int childCount = treeModel.getChildCount(root); - //按照节点添加para在下的,但这里需要para节点在上,调整一下位置 - if(childCount == NODE_LENGTH){ - adjustPosition(treeModel, designer); - } - widgetPropertyTables = new ArrayList(); propertyTable = new WidgetPropertyTable(designer); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable)); @@ -198,22 +189,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper isrefresh = false; } - - /** - * 调整结构树para和body的位置 - * - * @param treeModel - * @param formDesigner - */ - private void adjustPosition(ComponentTreeModel treeModel,FormDesigner formDesigner){ - XCreator root = (XCreator)treeModel.getRoot(); - if(treeModel.getChild(root,0) instanceof XWParameterLayout){ - return; - } - root.add((Component)(treeModel.getChild(root,0)),1); - treeModel.setRoot(root); - componentTree = new ComponentTree(formDesigner,treeModel); - } // /** * 选中的组件是否在参数面板里 From 9e732c70abee000ade8e10340b7a148d10cffb8a Mon Sep 17 00:00:00 2001 From: fr_shine Date: Mon, 14 Nov 2016 15:58:17 +0800 Subject: [PATCH 202/244] =?UTF-8?q?=E5=8B=BE=E9=80=89=E5=80=BC=E6=89=80?= =?UTF-8?q?=E5=8D=A0=E6=AF=94=E4=BE=8Bpercent=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/style/ChartDatapointLabelPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java index 1cfdb220f0..6afc7b7d76 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java @@ -432,7 +432,7 @@ public class ChartDatapointLabelPane extends BasicPane{ this.percentFormatPane = new FormatPane(); } if(this.percentFormat == null){ - DecimalFormat defaultFormat = new CoreDecimalFormat(new DecimalFormat(), "#.##%"); + DecimalFormat defaultFormat = new CoreDecimalFormat(new DecimalFormat("#.##%"), "#.##%"); percentFormatPane.populateBean(defaultFormat); this.percentFormat = defaultFormat; } From 8b9f2bc175191fdb07d2872af0799594b5c9ee29 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 14 Nov 2016 16:17:37 +0800 Subject: [PATCH 203/244] =?UTF-8?q?=E5=8F=AA=E5=88=A0=E9=99=A4=E9=9F=A9?= =?UTF-8?q?=E6=96=87=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8B=E7=9A=84=E7=A4=BE?= =?UTF-8?q?=E5=8C=BA=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/toolbar/ToolBarMenuDock.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index f3d87cdd5f..cde400571a 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -141,12 +141,26 @@ public abstract class ToolBarMenuDock { menuList.add(createHelpMenuDef()); // 添加社区菜单 - if(!Locale.KOREA.equals(locale)){ - menuList.add(createCommunityMenuDef()); + Locale [] locales =supportCommunityLocales(); + + // 添加社区菜单 + for(int i = 0; i < locales.length; i++) { + if(locale.equals(locales[i])){ + menuList.add(createCommunityMenuDef()); + } } return menuList.toArray(new MenuDef[menuList.size()]); } + + public Locale[] supportCommunityLocales() { + return new Locale[]{ + Locale.CHINA, + Locale.JAPAN, + Locale.TAIWAN, + Locale.US, + }; + } public void insertTemplateExtendMenu(ToolBarMenuDockPlus plus, MenuDef[] menuDefs) { // 给菜单加插件入口 From 397ac90901939cd352f3bde240e47ac166b0b4a3 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 14 Nov 2016 16:23:26 +0800 Subject: [PATCH 204/244] New changelist --- designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java index 21e0caf3f9..a8a72fc1e3 100644 --- a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java @@ -18,12 +18,12 @@ import com.fr.form.ui.TreeEditor; import com.fr.form.ui.tree.LayerConfig; import com.fr.general.Inter; import com.fr.general.NameObject; -import edu.emory.mathcs.backport.java.util.Arrays; import javax.swing.*; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.Arrays; public class TreeSettingPane extends BasicPane implements DataCreatorUI { private JTreeControlPane controlPane; From 609ed362ba2b31b893446a46f07c30a27c8f4fba Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 14 Nov 2016 16:39:43 +0800 Subject: [PATCH 205/244] =?UTF-8?q?=E5=8F=AA=E5=88=A0=E9=99=A4=E9=9F=A9?= =?UTF-8?q?=E6=96=87=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8B=E7=9A=84=E7=A4=BE?= =?UTF-8?q?=E5=8C=BA=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/toolbar/ToolBarMenuDock.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index cde400571a..2a3fa28d35 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -122,8 +122,6 @@ public abstract class ToolBarMenuDock { ////////////////////////////////////////////////////////////////////////////////////////// public MenuDef[] menus(final ToolBarMenuDockPlus plus) { - Locale locale = FRContext.getLocale(); - java.util.List menuList = new java.util.ArrayList(); // 添加文件菜单 menuList.add(createFileMenuDef(plus)); @@ -140,17 +138,21 @@ public abstract class ToolBarMenuDock { // 添加帮助菜单 menuList.add(createHelpMenuDef()); - // 添加社区菜单 - Locale [] locales =supportCommunityLocales(); - // 添加社区菜单 + addCommunityMenuDef(menuList); + + return menuList.toArray(new MenuDef[menuList.size()]); + } + + public void addCommunityMenuDef(java.util.List menuList){ + Locale locale = FRContext.getLocale(); + Locale [] locales =supportCommunityLocales(); for(int i = 0; i < locales.length; i++) { if(locale.equals(locales[i])){ menuList.add(createCommunityMenuDef()); + break; } } - - return menuList.toArray(new MenuDef[menuList.size()]); } public Locale[] supportCommunityLocales() { From 28a7a50aa14970ac5292113499d653729eab2ba4 Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 14 Nov 2016 17:01:21 +0800 Subject: [PATCH 206/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=8B=96=E6=8B=BD=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=9A=84=E5=90=88=E5=B9=B6=E5=8E=BB?= =?UTF-8?q?=E9=87=8D=E6=B2=A1=E6=9C=89=E8=80=83=E8=99=91=E5=88=B0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE=E9=9B=86=EF=BC=8C=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/BasicTableDataTreePane.java | 18 ++++++++++-------- .../data/datapane/TableDataTreePane.java | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java b/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java index 45cd0cea70..a76d4a1059 100644 --- a/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java @@ -118,7 +118,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp if (StringUtils.isBlank(tempName)) { nPanel.setShowText(Inter.getLocText(new String[]{"DS-TableData", "ISEMPTY", "PLEASE", "GIVE-NAME"}, new String[]{"", ",", "", "!"})); dg.setButtonEnabled(false); - } else if (!ComparatorUtils.equals(oldName, tempName) && isDsNameRepeaded(tempName, allDSNames)) { + } else if (!ComparatorUtils.equals(oldName, tempName) && isDsNameRepeaded(tempName)) { String[] waring = new String[]{"DS-TableData", "Utils-has_been_existed", "PLEASE", "Rename"}; String[] sign = new String[]{tempName, ",", "", "!"}; nPanel.setShowText(Inter.getLocText(waring, sign)); @@ -324,20 +324,22 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp private String createDsName(String prefix) { int count = 1; allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); - while (isDsNameRepeaded(prefix + count, allDSNames)) { + while (isDsNameRepeaded(prefix + count)) { count++; } return prefix + count; } - private boolean isDsNameRepeaded(String name, String[] names) { - boolean repeat = false; - for (int i = 0; i < names.length; i++) { - if (ComparatorUtils.equals(name, names[i])) { - repeat = true; + protected boolean isDsNameRepeaded(String name) { + if (allDSNames == null) { + allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); + } + for (int i = 0; i < allDSNames.length; i++) { + if (ComparatorUtils.equals(name, allDSNames[i])) { + return true; } } - return repeat; + return false; } protected KeyAdapter getTableTreeNodeListener(final UpdateAction editAction, final UpdateAction previewTableDataAction, final UpdateAction removeAction, final TableDataSourceOP op, final TableDataTree dataTree) { diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java index 2e605cafcf..219093c6d9 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java @@ -276,13 +276,14 @@ public class TableDataTreePane extends BasicTableDataTreePane { * @param tableDataSource 数据集 */ public void addTableData(String srcName, TableDataSource tableDataSource) { + allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); TableDataSource tds = tc.getBook(); Iterator tdIterator = tableDataSource.getTableDataNameIterator(); while (tdIterator.hasNext()) { String tdName = (String) tdIterator.next(); TableData td = tableDataSource.getTableData(tdName); - if (tds.getTableData(tdName) != null) {//如果有同名的就拼上来源名称 + if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称 tdName = srcName + tdName; } int i = 0; From 69a93ea9859a70db00ebb3b2013bf201f90ae185 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 15 Nov 2016 14:22:49 +0800 Subject: [PATCH 207/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E7=AD=89=E7=BA=A7?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 3515be8f24..0b76dd2d75 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -485,7 +485,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh extraChartDesignInterfaceList.add(tagName); } if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { - addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("priority", ChartTypeManager.CHART_PRIORITY),reader.getAttrAsString("plotID", ""), simplify); + addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("priority", ChartTypeManager.DEFAULT_PRIORITY),reader.getAttrAsString("plotID", ""), simplify); } } } From 0b8c85a005527180cf35191d373220d0d0ee7a0e Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 15 Nov 2016 15:34:16 +0800 Subject: [PATCH 208/244] =?UTF-8?q?REPORT-578=20=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E5=B8=83=E5=B1=80=E4=B8=8B=E9=9C=80=E8=A6=81=E8=80=83?= =?UTF-8?q?=E8=99=91=E5=88=86=E8=BE=A8=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/FRFitLayoutConstraints.java | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java index 6a9202c1cb..b58850eaa8 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java @@ -2,8 +2,6 @@ package com.fr.design.designer.properties; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; @@ -12,8 +10,9 @@ import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.utils.ComponentUtils; -import com.fr.form.ui.Widget; +import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.container.WFitLayout; +import com.fr.form.ui.container.WLayout; import com.fr.general.Inter; import javax.swing.*; @@ -30,8 +29,8 @@ import java.awt.*; */ //控件在自适应布局中宽度、高度属性,7.1.1不可编辑 public class FRFitLayoutConstraints implements ConstraintsGroupModel { - private static final int MINHEIGHT = XCreator.SMALL_PREFERRED_SIZE.height; - private static final int MINWIDTH = XCreator.SMALL_PREFERRED_SIZE.width; + private static final int MINHEIGHT = WLayout.MIN_HEIGHT; + private static final int MINWIDTH = WLayout.MIN_WIDTH; private static final int ROWNUM = 2; private DefaultTableCellRenderer renderer; @@ -91,31 +90,39 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { int v = value == null ? 0 : ((Number) value).intValue(); int difference = 0; Rectangle bounds = getBounds(); + Rectangle rec = ComponentUtils.getRelativeBounds(parent); + WFitLayout wFitLayout = parent.toData(); + int minHeight = (int)(MINHEIGHT * wFitLayout.getResolutionScaling()); + int minWidth = (int)(MINWIDTH * wFitLayout.getResolutionScaling()); + PaddingMargin margin= wFitLayout.getMargin(); switch (row) { case 0: - if(v < MINWIDTH){ - JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Width") + Integer.toString(MINWIDTH)); - v = xCreator.getWidth(); - } if (bounds.width == v){ return false; } + if(bounds.width == rec.width - margin.getLeft() - margin.getRight()){ + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); + }else if(v < minWidth){ + JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Width") + Integer.toString(minWidth)); + v = xCreator.getWidth(); + } difference = bounds.width - v; bounds.width = v; break; case 1: - if(v < MINHEIGHT){ - JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Height") + Integer.toString(MINHEIGHT)); - v = xCreator.getHeight(); - } if (bounds.height == v){ return false; } + if(bounds.height == rec.height - margin.getTop() - margin.getBottom()){ + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); + }else if(v < minHeight){ + JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Height") + Integer.toString(minHeight)); + v = xCreator.getHeight(); + } difference = bounds.height - v; bounds.height = v; break; } - WFitLayout wFitLayout = parent.toData(); wFitLayout.setBounds(xCreator.toData(),bounds); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); Rectangle backupBounds = getBounds(); @@ -131,7 +138,6 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { public Rectangle getBounds(){ Rectangle bounds = new Rectangle(xCreator.getBounds()); - XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); if (parent == null) { return bounds; } From 2de8ba4b10b53bff54b7a7bcf4a04d2a477b1763 Mon Sep 17 00:00:00 2001 From: zhouping Date: Tue, 15 Nov 2016 16:01:36 +0800 Subject: [PATCH 209/244] =?UTF-8?q?REPORT-750=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E5=86=85=E6=B5=8B=E9=97=AE=E9=A2=98=20dev?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=B0release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/properties/WidgetPropertyTable.java | 3 ++- designer_form/src/com/fr/design/mainframe/FormDesigner.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java b/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java index 9f53dddcce..f69771a54a 100644 --- a/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/WidgetPropertyTable.java @@ -21,6 +21,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout; +import com.fr.general.ComparatorUtils; public class WidgetPropertyTable extends AbstractPropertyTable { @@ -71,7 +72,7 @@ public class WidgetPropertyTable extends AbstractPropertyTable { if (size == 0 || size == 1) { XCreator creator = size == 0 ? designer.getRootComponent() : designer.getSelectionModel().getSelection() .getSelectedCreator(); - if (designer.isRoot(creator)) { + if (ComparatorUtils.equals(creator, designer.getRootComponent())) { groups = designer.getDesignerMode().createRootDesignerPropertyGroup(); } else { groups = getCreatorPropertyGroup(designer, creator); diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 6f5fe2a473..a3b197e91d 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -853,7 +853,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @return 是则返回true */ public boolean isRoot(XCreator comp) { - return comp == rootComponent; + return comp == rootComponent || comp.acceptType(XWAbsoluteBodyLayout.class); } // 计算鼠标事件e所发生的位置相对根组件的位置关系 From c9502311f96b5c9ebea5aab57a904a718185db71 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 15 Nov 2016 16:23:47 +0800 Subject: [PATCH 210/244] =?UTF-8?q?plot=20=E4=BC=A0=E5=85=A5=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/beans/BasicBeanPane.java | 8 ++++++++ .../gui/imenutable/UIMenuNameableCreator.java | 15 ++++++++++++--- .../SeriesCondition/DataSeriesConditionPane.java | 14 ++++++++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/beans/BasicBeanPane.java b/designer_base/src/com/fr/design/beans/BasicBeanPane.java index 2a8adfe19a..2ecc7440aa 100644 --- a/designer_base/src/com/fr/design/beans/BasicBeanPane.java +++ b/designer_base/src/com/fr/design/beans/BasicBeanPane.java @@ -23,6 +23,14 @@ public abstract class BasicBeanPane extends BasicPane { } + /** + * 设置plot + * @param plot + */ + public void setPlot(Object plot) { + + } + /** * 更新权限工具栏面板 */ diff --git a/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java b/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java index 5b6f8606df..9923bf5c18 100644 --- a/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java +++ b/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java @@ -9,13 +9,20 @@ public class UIMenuNameableCreator implements Nameable{ protected String name; protected Object obj; protected Class paneClazz; + protected Object edit; - public UIMenuNameableCreator(String name, Object obj, Class paneClazz) { + public UIMenuNameableCreator(Object edit, String name, Object obj, Class paneClazz) { + this.edit = edit; this.name = name; this.obj = obj; this.paneClazz = paneClazz; } + public UIMenuNameableCreator(String name, Object obj, Class paneClazz) { + this(null, name, obj, paneClazz); + } + + @Override public String getName() { return name; @@ -46,13 +53,15 @@ public class UIMenuNameableCreator implements Nameable{ } catch (IllegalAccessException e) { FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException"); } - return new UIMenuNameableCreator(name, cloneObj, this.paneClazz); + return new UIMenuNameableCreator(edit, name, cloneObj, this.paneClazz); } public BasicBeanPane getPane() { try { - return this.paneClazz.newInstance(); + BasicBeanPane pane = this.paneClazz.newInstance(); + pane.setPlot(edit); + return pane; } catch (InstantiationException e) { } catch (IllegalAccessException e) { diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java index fe2107fb42..05579418b8 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java @@ -27,13 +27,23 @@ import java.util.Iterator; * Time : 上午9:16 */ public class DataSeriesConditionPane extends ConditionAttributesPane { + protected Plot plot; - - public DataSeriesConditionPane() { + public DataSeriesConditionPane(Plot plot) { + this.plot = plot; initAvailableActionList(); initComponents(); } + @Override + public void setPlot(Object plot) { + this.plot = (Plot) plot; + } + + public DataSeriesConditionPane() { + this(null); + } + private void initAvailableActionList() { addBasicAction(); addAxisPositionAction(); From be778943f137a69ddc2e7c218070f85196649b71 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 15 Nov 2016 16:48:31 +0800 Subject: [PATCH 211/244] =?UTF-8?q?REPORT-578=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/properties/FRFitLayoutConstraints.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java index b58850eaa8..cf177f791a 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java @@ -47,7 +47,7 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { @Override public String getGroupName() { - return Inter.getLocText("Widget-Size"); + return Inter.getLocText("FR-Designer-Widget_Size"); } @Override @@ -70,9 +70,9 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { if (column == 0) { switch (row) { case 0: - return Inter.getLocText("Tree-Width"); + return Inter.getLocText("FR-Designer-Tree_Width"); default: - return Inter.getLocText("Tree-Height"); + return Inter.getLocText("FR-Designer-Tree_Height"); } } else { switch (row) { @@ -103,7 +103,7 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { if(bounds.width == rec.width - margin.getLeft() - margin.getRight()){ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); }else if(v < minWidth){ - JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Width") + Integer.toString(minWidth)); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Width") + Integer.toString(minWidth)); v = xCreator.getWidth(); } difference = bounds.width - v; @@ -116,7 +116,7 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { if(bounds.height == rec.height - margin.getTop() - margin.getBottom()){ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); }else if(v < minHeight){ - JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Height") + Integer.toString(minHeight)); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Height") + Integer.toString(minHeight)); v = xCreator.getHeight(); } difference = bounds.height - v; From 850b33e6f29b3d031170c308a3f126272b43f862 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Tue, 15 Nov 2016 17:16:46 +0800 Subject: [PATCH 212/244] update --- .../src/com/fr/design/beans/BasicBeanPane.java | 8 -------- .../design/gui/imenutable/UIMenuNameableCreator.java | 12 ++---------- .../SeriesCondition/DataSeriesConditionPane.java | 5 ++--- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/designer_base/src/com/fr/design/beans/BasicBeanPane.java b/designer_base/src/com/fr/design/beans/BasicBeanPane.java index 2ecc7440aa..2a8adfe19a 100644 --- a/designer_base/src/com/fr/design/beans/BasicBeanPane.java +++ b/designer_base/src/com/fr/design/beans/BasicBeanPane.java @@ -23,14 +23,6 @@ public abstract class BasicBeanPane extends BasicPane { } - /** - * 设置plot - * @param plot - */ - public void setPlot(Object plot) { - - } - /** * 更新权限工具栏面板 */ diff --git a/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java b/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java index 9923bf5c18..241669221d 100644 --- a/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java +++ b/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java @@ -9,20 +9,13 @@ public class UIMenuNameableCreator implements Nameable{ protected String name; protected Object obj; protected Class paneClazz; - protected Object edit; - public UIMenuNameableCreator(Object edit, String name, Object obj, Class paneClazz) { - this.edit = edit; + public UIMenuNameableCreator(String name, Object obj, Class paneClazz) { this.name = name; this.obj = obj; this.paneClazz = paneClazz; } - public UIMenuNameableCreator(String name, Object obj, Class paneClazz) { - this(null, name, obj, paneClazz); - } - - @Override public String getName() { return name; @@ -53,14 +46,13 @@ public class UIMenuNameableCreator implements Nameable{ } catch (IllegalAccessException e) { FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException"); } - return new UIMenuNameableCreator(edit, name, cloneObj, this.paneClazz); + return new UIMenuNameableCreator(name, cloneObj, this.paneClazz); } public BasicBeanPane getPane() { try { BasicBeanPane pane = this.paneClazz.newInstance(); - pane.setPlot(edit); return pane; } catch (InstantiationException e) { diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java index 05579418b8..8ba1bb4319 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/DataSeriesConditionPane.java @@ -35,9 +35,8 @@ public class DataSeriesConditionPane extends ConditionAttributesPane Date: Tue, 15 Nov 2016 17:17:59 +0800 Subject: [PATCH 213/244] update --- .../com/fr/design/gui/imenutable/UIMenuNameableCreator.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java b/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java index 241669221d..5b6f8606df 100644 --- a/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java +++ b/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java @@ -52,8 +52,7 @@ public class UIMenuNameableCreator implements Nameable{ public BasicBeanPane getPane() { try { - BasicBeanPane pane = this.paneClazz.newInstance(); - return pane; + return this.paneClazz.newInstance(); } catch (InstantiationException e) { } catch (IllegalAccessException e) { From c9cf6f76590ab553651efe89799de3d56efc7403 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 15 Nov 2016 19:09:01 +0800 Subject: [PATCH 214/244] rt --- .../mainframe/widget/UITreeComboBox.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index 38b62a99a1..c315bca3b8 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -15,6 +15,7 @@ import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.mainframe.ComponentTree; import com.sun.java.swing.plaf.motif.*; import com.sun.java.swing.plaf.windows.*; @@ -116,7 +117,6 @@ public class UITreeComboBox extends JComboBox{ JLabel lb = (JLabel)r.getTreeCellRendererComponent( tree, value, isSelected, false, false, index, cellHasFocus); - return lb; } return super.getListCellRendererComponent(list, value, index, @@ -129,7 +129,7 @@ public class UITreeComboBox extends JComboBox{ @Override public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { TreePath[] paths = tree.getSelectedTreePath(); if (tree != null && paths.length > 0) { tree.setAndScrollSelectionPath(paths[0]); @@ -137,9 +137,18 @@ public class UITreeComboBox extends JComboBox{ MenuSelectionManager.defaultManager().clearSelectedPath(); } - } else { + } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { + tree.refreshUI(); + TreePath[] paths = tree.getSelectedTreePath(); + if (tree != null && paths.length > 0) { + tree.setAndScrollSelectionPath(paths[0]); + setSelectedItem(paths[0]); + MenuSelectionManager.defaultManager().clearSelectedPath(); + } + } else { tree.refreshUI(); - repaint(); + setSelectedItem(null); + MenuSelectionManager.defaultManager().clearSelectedPath(); } } @@ -192,13 +201,12 @@ class TreePopup extends JPopupMenu implements ComboPopup{ public TreePopup(JComboBox comboBox){ this.comboBox = (UITreeComboBox)comboBox; - setBorder(BorderFactory.createLineBorder(Color.black)); setLayout(new BorderLayout()); setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled()); JTree tree = this.comboBox.getTree(); if(tree != null){ - scrollPane = new JScrollPane(tree); - scrollPane.setBorder(null); + scrollPane = new UIScrollPane(tree); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0,4,0,0)); add(scrollPane, BorderLayout.CENTER); } } From 275fe159b03545ac76976bf0b03c23db8075d198 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 00:08:07 +0800 Subject: [PATCH 215/244] rt --- .../src/com/fr/design/mainframe/widget/UITreeComboBox.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index c315bca3b8..ea44f01c31 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -145,10 +145,13 @@ public class UITreeComboBox extends JComboBox{ setSelectedItem(paths[0]); MenuSelectionManager.defaultManager().clearSelectedPath(); } - } else { + } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { tree.refreshUI(); setSelectedItem(null); MenuSelectionManager.defaultManager().clearSelectedPath(); + } else { + tree.refreshUI(); + tree.repaint(); } } From c3ba1c7e3a8ca3e9ff1455209eb18cf4bc312c58 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 09:27:34 +0800 Subject: [PATCH 216/244] rt --- .../fr/design/mainframe/ComponentTree.java | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index ca84e44c03..a3452f602f 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -38,29 +38,29 @@ public class ComponentTree extends JTree { this.refreshTreeRoot(); addTreeSelectionListener(designer); - this.addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent e) { - if (e.isPopupTrigger()) { - popupMenu(e); - } - } - - @Override - public void mousePressed(MouseEvent e) { - if (e.isPopupTrigger()) { - popupMenu(e); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - if (e.isPopupTrigger()) { - popupMenu(e); - } - } - }); +// this.addMouseListener(new MouseAdapter() { +// +// @Override +// public void mouseClicked(MouseEvent e) { +// if (e.isPopupTrigger()) { +// popupMenu(e); +// } +// } +// +// @Override +// public void mousePressed(MouseEvent e) { +// if (e.isPopupTrigger()) { +// popupMenu(e); +// } +// } +// +// @Override +// public void mouseReleased(MouseEvent e) { +// if (e.isPopupTrigger()) { +// popupMenu(e); +// } +// } +// }); setEditable(true); } @@ -121,19 +121,19 @@ public class ComponentTree extends JTree { scrollPathToVisible(treepath); } - private void popupMenu(MouseEvent e) { - TreePath path = this.getSelectionPath(); - if (path == null) { - return; - } - Component component = (Component) path.getLastPathComponent(); - if (!(component instanceof XCreator)) { - return; - } - ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component); - JPopupMenu menu = adapter.getContextPopupMenu(e); - menu.show(this, e.getX(), e.getY()); - } +// private void popupMenu(MouseEvent e) { +// TreePath path = this.getSelectionPath(); +// if (path == null) { +// return; +// } +// Component component = (Component) path.getLastPathComponent(); +// if (!(component instanceof XCreator)) { +// return; +// } +// ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component); +// JPopupMenu menu = adapter.getContextPopupMenu(e); +// menu.show(this, e.getX(), e.getY()); +// } /** * 刷新 From e533606177aae6a2ec8baab34afbaf36d41504db Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 15:50:11 +0800 Subject: [PATCH 217/244] rt --- .../mainframe/FormWidgetDetailPane.java | 112 +++++++++++++----- 1 file changed, 84 insertions(+), 28 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 5beea605c8..e74f9db1e8 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -21,6 +21,7 @@ import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.general.Inter; import com.fr.general.SiteCenter; +import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import javax.swing.*; @@ -44,13 +45,17 @@ import java.net.URISyntaxException; public class FormWidgetDetailPane extends FormDockView{ private UITabbedPane tabbedPane; - private UIScrollPane downPanel; + private UIScrollPane downPane; private JPanel reuWidgetPanel; private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; private UIButton downloadButton; private UIButton refreshButton; private UIButton deleteButton; + private UIButton resetButton; + private JPanel editPanel; + private JPanel resetPanel; + private JPanel menutPanel; private static final int OFFSET_X = 140; private static final int OFFSET_Y = 26; private SwingWorker sw; @@ -114,8 +119,6 @@ public class FormWidgetDetailPane extends FormDockView{ sw.execute(); } initReuWidgetPanel(); - createRefreshButton(); - createDownloadButton(); initMenuPanel(); tabbedPane = new UITabbedPane(); tabbedPane.setOpaque(true); @@ -131,34 +134,68 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化组件共享和复用面板 */ private void initReuWidgetPanel() { - downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); - reuWidgetPanel.add(downPanel); + downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); + reuWidgetPanel.add(downPane); } /** * 初始化菜单栏面板 */ private void initMenuPanel() { - JPanel menutPane = new JPanel(); - menutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - menutPane.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3)); - menutPane.setPreferredSize(new Dimension(240, 48)); - menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), + menutPanel = new JPanel(); + menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3)); + menutPanel.setPreferredSize(new Dimension(240, 48)); + menutPanel.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), SwingConstants.HORIZONTAL), BorderLayout.WEST); - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - buttonPanel.add(refreshButton, BorderLayout.WEST); - buttonPanel.add(downloadButton, BorderLayout.EAST); - menutPane.add(buttonPanel, BorderLayout.EAST); - menutPane.add(new JPanel(), BorderLayout.CENTER); + + menutPanel.add(initButtonPane(), BorderLayout.EAST); + menutPanel.add(new JPanel(), BorderLayout.CENTER); comboBox = new UIComboBox(getFormCategories()); comboBox.setPreferredSize(new Dimension(240, 30)); initComboBoxSelectedListener(); - menutPane.add(comboBox, BorderLayout.SOUTH); - reuWidgetPanel.add(menutPane, BorderLayout.NORTH); + menutPanel.add(comboBox, BorderLayout.SOUTH); + reuWidgetPanel.add(menutPanel, BorderLayout.NORTH); + + } + + /** + * 创建菜单栏按钮面板 + */ + private JPanel initButtonPane() { + editPanel = new JPanel(); + editPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + editPanel.add(createRefreshButton(), BorderLayout.WEST); + editPanel.add(createDownloadButton(), BorderLayout.EAST); + return editPanel; + } + + /** + * 创建取消删除面板 + */ + private JPanel initResetButtonPane() { + resetPanel = new JPanel(); + resetButton = new UIButton(Inter.getLocText("FR-Designer_Reset")); + resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + resetButton.set4ToolbarButton(); + resetButton.setOpaque(true); + resetButton.setBackground(new Color(184, 220, 242)); + resetButton.setForeground(Color.WHITE); + resetButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + refreshDownPanel(false); + replaceButtonPanel(false); + reuWidgetPanel.remove(deleteButton); + } + }); + resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + resetPanel.add(resetButton, BorderLayout.CENTER); + return resetPanel; } + private void initComboBoxSelectedListener() { comboBox.addItemListener(new ItemListener() { @Override @@ -176,7 +213,10 @@ public class FormWidgetDetailPane extends FormDockView{ }); } - private void createRefreshButton() { + /** + * 创建刷新按钮 + */ + private UIButton createRefreshButton() { refreshButton = new UIButton(); refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/refresh.png")); refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Refresh")); @@ -192,6 +232,7 @@ public class FormWidgetDetailPane extends FormDockView{ protected Object doInBackground() throws Exception { ShareLoader.getLoader().refreshModule(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + comboBox.setSelectedIndex(0); refreshDownPanel(false); return null; } @@ -199,13 +240,14 @@ public class FormWidgetDetailPane extends FormDockView{ sw.execute(); } }); + return refreshButton; } /** * 创建下载模板的按钮 */ - private void createDownloadButton() { + private UIButton createDownloadButton() { downloadButton = new UIButton(); downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png")); downloadButton.set4ToolbarButton(); @@ -263,6 +305,7 @@ public class FormWidgetDetailPane extends FormDockView{ deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + replaceButtonPanel(true); deleteFromDiskZipFile(); } }); @@ -271,27 +314,28 @@ public class FormWidgetDetailPane extends FormDockView{ } }); + return downloadButton; } private void deleteFromDiskZipFile() { deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove")); - deleteButton.setOpaque(true); + deleteButton.setBackground(Color.red); + deleteButton.repaint(); deleteButton.setPreferredSize(new Dimension(240, 40)); reuWidgetPanel.add(deleteButton, BorderLayout.SOUTH); deleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if(ShareLoader.getLoader().removeModulesFromList()) { + if (ShareLoader.getLoader().removeModulesFromList()) { refreshShareMoudule(); reuWidgetPanel.remove(deleteButton); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); refreshDownPanel(false); + replaceButtonPanel(false); } else { - reuWidgetPanel.remove(deleteButton); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); - refreshDownPanel(false); } } @@ -300,6 +344,18 @@ public class FormWidgetDetailPane extends FormDockView{ } + private void replaceButtonPanel(boolean isEdit) { + if (isEdit) { + menutPanel.remove(editPanel); + menutPanel.add(initResetButtonPane(), BorderLayout.EAST); + } else { + menutPanel.remove(resetPanel); + menutPanel.add(initButtonPane(), BorderLayout.EAST); + } + + + } + private void installFromDiskZipFile(File chosenFile) { try { ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile); @@ -326,15 +382,15 @@ public class FormWidgetDetailPane extends FormDockView{ * 获取报表块组件分类 */ public String[] getFormCategories() { - return ShareConstants.WIDGET_CATEGORIES; + return ArrayUtils.addAll(new String[] {Inter.getLocText("FR-Designer_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); } public void refreshDownPanel(boolean isEdit) { - reuWidgetPanel.remove(downPanel); - downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); - reuWidgetPanel.add(downPanel); + reuWidgetPanel.remove(downPane); + downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); + reuWidgetPanel.add(downPane); repaintContainer(); } From b1fa14a43912857e20d94fd3a77126a574837a9d Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 15:51:00 +0800 Subject: [PATCH 218/244] rt --- .../src/com/fr/design/mainframe/widget/UITreeComboBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index ea44f01c31..cf68a7ea7a 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -151,7 +151,7 @@ public class UITreeComboBox extends JComboBox{ MenuSelectionManager.defaultManager().clearSelectedPath(); } else { tree.refreshUI(); - tree.repaint(); + repaint(); } } From 5a77fe8ee6c1ade8cc1e0a4e44b2bd02fe3d4214 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 15:58:43 +0800 Subject: [PATCH 219/244] rt --- .../fr/design/mainframe/ComponentTree.java | 450 ++++++++++-------- 1 file changed, 249 insertions(+), 201 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index a3452f602f..ab1f2a980f 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -1,255 +1,303 @@ -package com.fr.design.mainframe; - -import java.awt.Component; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.ArrayList; - -import javax.swing.DropMode; -import javax.swing.JPopupMenu; -import javax.swing.JTree; -import javax.swing.tree.TreePath; -import javax.swing.tree.TreeSelectionModel; - -import com.fr.design.constants.UIConstants; -import com.fr.design.designer.beans.AdapterBus; -import com.fr.design.designer.beans.ComponentAdapter; +package com.fr.design.mainframe.widget; + +/** + * Created by xiaxiang on 2016/9/30. + */ +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.*; +import javax.swing.tree.*; + +import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.*; -import com.fr.design.designer.treeview.ComponentTreeCellRenderer; -import com.fr.design.designer.treeview.ComponentTreeModel; -import com.fr.stable.StringUtils; - -public class ComponentTree extends JTree { - - private FormDesigner designer; - private ComponentTreeModel model; - - public ComponentTree(FormDesigner designer) { - this.designer = designer; - this.setBackground(UIConstants.NORMAL_BACKGROUND); - setRootVisible(true); - setCellRenderer(new ComponentTreeCellRenderer()); - getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); - this.setDragEnabled(false); - this.setDropMode(DropMode.ON_OR_INSERT); - this.setTransferHandler(new TreeTransferHandler()); - this.refreshTreeRoot(); - addTreeSelectionListener(designer); - -// this.addMouseListener(new MouseAdapter() { -// -// @Override -// public void mouseClicked(MouseEvent e) { -// if (e.isPopupTrigger()) { -// popupMenu(e); -// } -// } -// -// @Override -// public void mousePressed(MouseEvent e) { -// if (e.isPopupTrigger()) { -// popupMenu(e); -// } -// } -// -// @Override -// public void mouseReleased(MouseEvent e) { -// if (e.isPopupTrigger()) { -// popupMenu(e); -// } -// } -// }); - setEditable(true); - } - - public FormDesigner getDesigner() { - return designer; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.mainframe.ComponentTree; +import com.sun.java.swing.plaf.motif.*; +import com.sun.java.swing.plaf.windows.*; + +/** + * 控件树下拉列表框 + */ +public class UITreeComboBox extends JComboBox{ + /** + * 显示用的树 + */ + private ComponentTree tree; + + public UITreeComboBox(ComponentTree componentTree){ + this.setTree(componentTree); + tree.getDesigner().addDesignerEditListener(new TreeComboBoxDesignerEditAdapter()); +// for(int i=0; iTitle: UITreeComboBoxRenderer

+ *

Description: 树形结构而来的DefaultListCellRenderer

+ */ + class UITreeComboBoxRenderer extends DefaultListCellRenderer { + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus){ + if(tree != null && tree.getSelectedTreePath().length > 0){ + TreePath path = tree.getSelectedTreePath()[0]; + tree.setAndScrollSelectionPath(path); + Object node = path.getLastPathComponent(); + value = node; + TreeCellRenderer r = tree.getCellRenderer(); + JLabel lb = (JLabel)r.getTreeCellRendererComponent( + tree, value, isSelected, false, false, index, + cellHasFocus); + return lb; + } + return super.getListCellRendererComponent(list, value, index, + isSelected, cellHasFocus); + } + } + private class TreeComboBoxDesignerEditAdapter implements DesignerEditListener { + + @Override + public void fireCreatorModified(DesignerEvent evt) { + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { + TreePath[] paths = tree.getSelectedTreePath(); + if (tree != null && paths.length > 0) { + tree.setAndScrollSelectionPath(paths[0]); + setSelectedItem(paths[0]); + MenuSelectionManager.defaultManager().clearSelectedPath(); + } + + } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { + tree.refreshUI(); + TreePath[] paths = tree.getSelectedTreePath(); + if (tree != null && paths.length > 0) { + tree.setAndScrollSelectionPath(paths[0]); + setSelectedItem(paths[0]); + MenuSelectionManager.defaultManager().clearSelectedPath(); + } + } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { + tree.refreshUI(); + setSelectedItem(null); + MenuSelectionManager.defaultManager().clearSelectedPath(); + } else { + tree.refreshUI(); + repaint(); + } - public TreePath[] getSelectedTreePath() { - XCreator[] creators = designer.getSelectionModel().getSelection().getSelectedCreators(); - TreePath[] paths = new TreePath[creators.length]; + } - for (int i = 0; i < paths.length; i++) { - paths[i] = buildTreePath(creators[i]); + @Override + public boolean equals(Object o) { + return o.getClass() == this.getClass(); } - return paths; } + /** + * 测试 + */ +// public static void main(String args[]){ +// JFrame frame = new JFrame("UITreeComboBox"); +// final UITreeComboBox box = new UITreeComboBox(new ComponentTree(new FormDesigner())); +// box.setPreferredSize(new Dimension(300, 28)); +// frame.getContentPane().add(box); +// frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); +// frame.pack(); +// frame.setVisible(true); +// } +} +/** + *

Title: UITreeComboBox

+ *

Description: TreePopup

+ */ +class TreePopup extends JPopupMenu implements ComboPopup{ + protected UITreeComboBox comboBox; + protected JScrollPane scrollPane; + protected MouseMotionListener mouseMotionListener; + protected MouseListener mouseListener; - /** - *搜索指定名称的路径 - * - * @param text 名称 - * @return 树路径 - */ - public TreePath[] search(String text) { - if (StringUtils.isNotEmpty(text)) { - text = text.toLowerCase(); - } - ArrayList searchList = new ArrayList(); - XLayoutContainer root = designer.getRootComponent(); - searchFormRoot(root, searchList, text); - TreePath[] paths = new TreePath[searchList.size()]; - for (int i = 0; i < paths.length; i++) { - paths[i] = buildTreePath(searchList.get(i)); + public void popupMenu(MouseEvent e) { + TreePath path = comboBox.getTree().getSelectionPath(); + if (path == null) { + return; } - if(paths.length > 0) { - setAndScrollSelectionPath(paths[0]); - } else { - setSelectionPath(); + Component component = (Component) path.getLastPathComponent(); + if (!(component instanceof XCreator)) { + return; + } + com.fr.design.designer.beans.ComponentAdapter adapter = AdapterBus.getComponentAdapter(comboBox.getTree().getDesigner(), (XCreator) component); + JPopupMenu menu = adapter.getContextPopupMenu(e); + menu.show(comboBox, e.getX(), e.getY()); + } + + public TreePopup(JComboBox comboBox){ + this.comboBox = (UITreeComboBox)comboBox; + setLayout(new BorderLayout()); + setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled()); + JTree tree = this.comboBox.getTree(); + if(tree != null){ + scrollPane = new UIScrollPane(tree); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0,2,0,0)); + add(scrollPane, BorderLayout.CENTER); } - return paths; } + public void show() { + updatePopup(); + show(comboBox, 0, comboBox.getHeight()); + comboBox.getTree().requestFocus(); + } - private void setSelectionPath(){ + public void hide(){ + setVisible(false); + comboBox.firePropertyChange("popupVisible", true, false); + } - /** - * 不让传null参数,所以只有自己定义 - */ - super.setSelectionPath(null); - clearSelection(); + protected JList list = new JList(); + public JList getList(){ + return list; } - private void searchFormRoot(XLayoutContainer container, ArrayList searchList, String text) { - if (StringUtils.isEmpty(text)) { - return; - } - for (int i = 0, size = container.getXCreatorCount(); i < size; i++) { - XCreator creator = container.getXCreator(i); - String xName = creator.toData().getWidgetName(); - if (xName.toLowerCase().contains(text)) { - searchList.add(creator); - } - if (creator instanceof XLayoutContainer) { - searchFormRoot((XLayoutContainer) creator, searchList, text); - } + public MouseMotionListener getMouseMotionListener(){ + if(mouseMotionListener == null){ + mouseMotionListener = new MouseMotionAdapter(){}; } + return mouseMotionListener; } - /** - * 触发 - */ - public void fireTreeChanged() { - designer.refreshDesignerUI(); + public KeyListener getKeyListener(){ + return null; } + public void uninstallingUI(){} + /** - * 刷新 + * Implementation of ComboPopup.getMouseListener(). + * + * @return a MouseListener or null + * @see ComboPopup#getMouseListener */ - public void refreshTreeRoot() { - model = new ComponentTreeModel(designer, designer.getTopContainer()); - setModel(model); - setDragEnabled(false); - setDropMode(DropMode.ON_OR_INSERT); - setTransferHandler(new TreeTransferHandler()); - repaint(); - } - - private TreePath buildTreePath(Component comp) { - ArrayList path = new ArrayList(); - Component parent = comp; - - while (parent != null) { - XCreator creator = (XCreator) parent; - path.add(0, parent); - if (creator != comp ) { - creator.notShowInComponentTree(path); + public MouseListener getMouseListener(){ + if(mouseListener == null){ + mouseListener = new InvocationMouseHandler(); + } + return mouseListener; + } + + protected void togglePopup(){ + if(isVisible()){ + hide(); + } else{ + show(); + } + } + protected void updatePopup(){ + setPreferredSize(new Dimension(comboBox.getSize().width, 200)); + Object selectedObj = comboBox.getSelectedItem(); + if(selectedObj != null){ + TreePath tp = (TreePath)selectedObj; + ((UITreeComboBox)comboBox).getTree().setSelectionPath(tp); + } + } + + protected class InvocationMouseHandler extends MouseAdapter{ + public void mousePressed(MouseEvent e){ + if(!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled()){ + return; } - //绝对布局作为body的时候不显示自适应布局父层 - if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class) - && (parent.getParent() != null) - && ((XCreator)parent.getParent()).acceptType(XWFitLayout.class)){ - parent = parent.getParent().getParent(); - continue; + if(comboBox.isEditable()){ + Component comp = comboBox.getEditor().getEditorComponent(); + if((!(comp instanceof JComponent)) || + ((JComponent)comp).isRequestFocusEnabled()){ + comp.requestFocus(); + } + } else if(comboBox.isRequestFocusEnabled()){ + comboBox.requestFocus(); + } + togglePopup(); + } + + public void mouseClicked (MouseEvent e){ + if (e.isMetaDown()) { + popupMenu(e); + } else { + return; } - parent = parent.getParent(); } - Object[] components = path.toArray(); - return new TreePath(components); } -} \ No newline at end of file + + + +} From 693e858233401513c6e602e55c539dc4bb947c2e Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 16:00:12 +0800 Subject: [PATCH 220/244] rt --- .../src/com/fr/design/mainframe/widget/UITreeComboBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index cf68a7ea7a..c3e1d7303c 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -209,7 +209,7 @@ class TreePopup extends JPopupMenu implements ComboPopup{ JTree tree = this.comboBox.getTree(); if(tree != null){ scrollPane = new UIScrollPane(tree); - scrollPane.setBorder(BorderFactory.createEmptyBorder(0,4,0,0)); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0,2,0,0)); add(scrollPane, BorderLayout.CENTER); } } From a5e30ec9739cb850c6db45dabf785ab47ff49bda Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 16:00:29 +0800 Subject: [PATCH 221/244] rt --- .../fr/design/mainframe/ComponentTree.java | 450 ++++++++---------- 1 file changed, 201 insertions(+), 249 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index ab1f2a980f..a3452f602f 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -1,303 +1,255 @@ -package com.fr.design.mainframe.widget; - -/** - * Created by xiaxiang on 2016/9/30. - */ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.plaf.*; -import javax.swing.plaf.basic.*; -import javax.swing.plaf.metal.*; -import javax.swing.tree.*; - -import com.fr.design.designer.beans.*; +package com.fr.design.mainframe; + +import java.awt.Component; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; + +import javax.swing.DropMode; +import javax.swing.JPopupMenu; +import javax.swing.JTree; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +import com.fr.design.constants.UIConstants; +import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.mainframe.ComponentTree; -import com.sun.java.swing.plaf.motif.*; -import com.sun.java.swing.plaf.windows.*; - -/** - * 控件树下拉列表框 - */ -public class UITreeComboBox extends JComboBox{ - /** - * 显示用的树 - */ - private ComponentTree tree; - - public UITreeComboBox(ComponentTree componentTree){ - this.setTree(componentTree); - tree.getDesigner().addDesignerEditListener(new TreeComboBoxDesignerEditAdapter()); -// for(int i=0; iTitle: UITreeComboBoxRenderer

- *

Description: 树形结构而来的DefaultListCellRenderer

+ * 刷新 */ - class UITreeComboBoxRenderer extends DefaultListCellRenderer { - public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus){ - if(tree != null && tree.getSelectedTreePath().length > 0){ - TreePath path = tree.getSelectedTreePath()[0]; - tree.setAndScrollSelectionPath(path); - Object node = path.getLastPathComponent(); - value = node; - TreeCellRenderer r = tree.getCellRenderer(); - JLabel lb = (JLabel)r.getTreeCellRendererComponent( - tree, value, isSelected, false, false, index, - cellHasFocus); - return lb; - } - return super.getListCellRendererComponent(list, value, index, - isSelected, cellHasFocus); - } + public void refreshUI() { + updateUI(); } - private class TreeComboBoxDesignerEditAdapter implements DesignerEditListener { - - @Override - public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { - TreePath[] paths = tree.getSelectedTreePath(); - if (tree != null && paths.length > 0) { - tree.setAndScrollSelectionPath(paths[0]); - setSelectedItem(paths[0]); - MenuSelectionManager.defaultManager().clearSelectedPath(); - } - - } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { - tree.refreshUI(); - TreePath[] paths = tree.getSelectedTreePath(); - if (tree != null && paths.length > 0) { - tree.setAndScrollSelectionPath(paths[0]); - setSelectedItem(paths[0]); - MenuSelectionManager.defaultManager().clearSelectedPath(); - } - } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { - tree.refreshUI(); - setSelectedItem(null); - MenuSelectionManager.defaultManager().clearSelectedPath(); - } else { - tree.refreshUI(); - repaint(); - } - } - @Override - public boolean equals(Object o) { - return o.getClass() == this.getClass(); + + public TreePath[] getSelectedTreePath() { + XCreator[] creators = designer.getSelectionModel().getSelection().getSelectedCreators(); + TreePath[] paths = new TreePath[creators.length]; + + for (int i = 0; i < paths.length; i++) { + paths[i] = buildTreePath(creators[i]); } + return paths; } - /** - * 测试 - */ -// public static void main(String args[]){ -// JFrame frame = new JFrame("UITreeComboBox"); -// final UITreeComboBox box = new UITreeComboBox(new ComponentTree(new FormDesigner())); -// box.setPreferredSize(new Dimension(300, 28)); -// frame.getContentPane().add(box); -// frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); -// frame.pack(); -// frame.setVisible(true); -// } -} - -/** - *

Title: UITreeComboBox

- *

Description: TreePopup

- */ -class TreePopup extends JPopupMenu implements ComboPopup{ - protected UITreeComboBox comboBox; - protected JScrollPane scrollPane; - protected MouseMotionListener mouseMotionListener; - protected MouseListener mouseListener; - public void popupMenu(MouseEvent e) { - TreePath path = comboBox.getTree().getSelectionPath(); - if (path == null) { - return; - } - Component component = (Component) path.getLastPathComponent(); - if (!(component instanceof XCreator)) { - return; + /** + *搜索指定名称的路径 + * + * @param text 名称 + * @return 树路径 + */ + public TreePath[] search(String text) { + if (StringUtils.isNotEmpty(text)) { + text = text.toLowerCase(); } - com.fr.design.designer.beans.ComponentAdapter adapter = AdapterBus.getComponentAdapter(comboBox.getTree().getDesigner(), (XCreator) component); - JPopupMenu menu = adapter.getContextPopupMenu(e); - menu.show(comboBox, e.getX(), e.getY()); - } + ArrayList searchList = new ArrayList(); + XLayoutContainer root = designer.getRootComponent(); + searchFormRoot(root, searchList, text); + TreePath[] paths = new TreePath[searchList.size()]; - public TreePopup(JComboBox comboBox){ - this.comboBox = (UITreeComboBox)comboBox; - setLayout(new BorderLayout()); - setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled()); - JTree tree = this.comboBox.getTree(); - if(tree != null){ - scrollPane = new UIScrollPane(tree); - scrollPane.setBorder(BorderFactory.createEmptyBorder(0,2,0,0)); - add(scrollPane, BorderLayout.CENTER); + for (int i = 0; i < paths.length; i++) { + paths[i] = buildTreePath(searchList.get(i)); + } + if(paths.length > 0) { + setAndScrollSelectionPath(paths[0]); + } else { + setSelectionPath(); } + return paths; } - public void show() { - updatePopup(); - show(comboBox, 0, comboBox.getHeight()); - comboBox.getTree().requestFocus(); - } - public void hide(){ - setVisible(false); - comboBox.firePropertyChange("popupVisible", true, false); - } + private void setSelectionPath(){ - protected JList list = new JList(); - public JList getList(){ - return list; + /** + * 不让传null参数,所以只有自己定义 + */ + super.setSelectionPath(null); + clearSelection(); } - public MouseMotionListener getMouseMotionListener(){ - if(mouseMotionListener == null){ - mouseMotionListener = new MouseMotionAdapter(){}; + private void searchFormRoot(XLayoutContainer container, ArrayList searchList, String text) { + if (StringUtils.isEmpty(text)) { + return; + } + for (int i = 0, size = container.getXCreatorCount(); i < size; i++) { + XCreator creator = container.getXCreator(i); + String xName = creator.toData().getWidgetName(); + if (xName.toLowerCase().contains(text)) { + searchList.add(creator); + } + if (creator instanceof XLayoutContainer) { + searchFormRoot((XLayoutContainer) creator, searchList, text); + } } - return mouseMotionListener; - } - - public KeyListener getKeyListener(){ - return null; } - public void uninstallingUI(){} - /** - * Implementation of ComboPopup.getMouseListener(). - * - * @return a MouseListener or null - * @see ComboPopup#getMouseListener + * 触发 */ - public MouseListener getMouseListener(){ - if(mouseListener == null){ - mouseListener = new InvocationMouseHandler(); - } - return mouseListener; - } - - protected void togglePopup(){ - if(isVisible()){ - hide(); - } else{ - show(); - } - } - protected void updatePopup(){ - setPreferredSize(new Dimension(comboBox.getSize().width, 200)); - Object selectedObj = comboBox.getSelectedItem(); - if(selectedObj != null){ - TreePath tp = (TreePath)selectedObj; - ((UITreeComboBox)comboBox).getTree().setSelectionPath(tp); - } + public void fireTreeChanged() { + designer.refreshDesignerUI(); } - protected class InvocationMouseHandler extends MouseAdapter{ - public void mousePressed(MouseEvent e){ - if(!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled()){ - return; - } - if(comboBox.isEditable()){ - Component comp = comboBox.getEditor().getEditorComponent(); - if((!(comp instanceof JComponent)) || - ((JComponent)comp).isRequestFocusEnabled()){ - comp.requestFocus(); - } - } else if(comboBox.isRequestFocusEnabled()){ - comboBox.requestFocus(); + /** + * 刷新 + */ + public void refreshTreeRoot() { + model = new ComponentTreeModel(designer, designer.getTopContainer()); + setModel(model); + setDragEnabled(false); + setDropMode(DropMode.ON_OR_INSERT); + setTransferHandler(new TreeTransferHandler()); + repaint(); + } + + private TreePath buildTreePath(Component comp) { + ArrayList path = new ArrayList(); + Component parent = comp; + + while (parent != null) { + XCreator creator = (XCreator) parent; + path.add(0, parent); + if (creator != comp ) { + creator.notShowInComponentTree(path); } - togglePopup(); - } - - public void mouseClicked (MouseEvent e){ - if (e.isMetaDown()) { - popupMenu(e); - } else { - return; + //绝对布局作为body的时候不显示自适应布局父层 + if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class) + && (parent.getParent() != null) + && ((XCreator)parent.getParent()).acceptType(XWFitLayout.class)){ + parent = parent.getParent().getParent(); + continue; } + parent = parent.getParent(); } + Object[] components = path.toArray(); + return new TreePath(components); } - - - -} +} \ No newline at end of file From b75e8f0422fa1e6ac2b36284d8760b6940291154 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 16:15:26 +0800 Subject: [PATCH 222/244] rt --- .../fr/design/mainframe/FormWidgetDetailPane.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index e74f9db1e8..2a490726fa 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -49,8 +49,6 @@ public class FormWidgetDetailPane extends FormDockView{ private JPanel reuWidgetPanel; private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; - private UIButton downloadButton; - private UIButton refreshButton; private UIButton deleteButton; private UIButton resetButton; private JPanel editPanel; @@ -149,7 +147,7 @@ public class FormWidgetDetailPane extends FormDockView{ menutPanel.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), SwingConstants.HORIZONTAL), BorderLayout.WEST); - menutPanel.add(initButtonPane(), BorderLayout.EAST); + menutPanel.add(initEditButtonPane(), BorderLayout.EAST); menutPanel.add(new JPanel(), BorderLayout.CENTER); comboBox = new UIComboBox(getFormCategories()); comboBox.setPreferredSize(new Dimension(240, 30)); @@ -162,7 +160,7 @@ public class FormWidgetDetailPane extends FormDockView{ /** * 创建菜单栏按钮面板 */ - private JPanel initButtonPane() { + private JPanel initEditButtonPane() { editPanel = new JPanel(); editPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); editPanel.add(createRefreshButton(), BorderLayout.WEST); @@ -217,7 +215,7 @@ public class FormWidgetDetailPane extends FormDockView{ * 创建刷新按钮 */ private UIButton createRefreshButton() { - refreshButton = new UIButton(); + UIButton refreshButton = new UIButton(); refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/refresh.png")); refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Refresh")); refreshButton.set4ToolbarButton(); @@ -248,7 +246,7 @@ public class FormWidgetDetailPane extends FormDockView{ * 创建下载模板的按钮 */ private UIButton createDownloadButton() { - downloadButton = new UIButton(); + UIButton downloadButton = new UIButton(); downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png")); downloadButton.set4ToolbarButton(); downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template")); @@ -350,7 +348,8 @@ public class FormWidgetDetailPane extends FormDockView{ menutPanel.add(initResetButtonPane(), BorderLayout.EAST); } else { menutPanel.remove(resetPanel); - menutPanel.add(initButtonPane(), BorderLayout.EAST); + menutPanel.add(initEditButtonPane(), BorderLayout.EAST); + ShareLoader.getLoader().resetRemovedModuleList(); } From 18ab59513070bab3deeb79fa5f468991d4f08c60 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 16:17:47 +0800 Subject: [PATCH 223/244] rt --- .../src/com/fr/design/mainframe/widget/UITreeComboBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index c3e1d7303c..0d7b224f64 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -209,7 +209,7 @@ class TreePopup extends JPopupMenu implements ComboPopup{ JTree tree = this.comboBox.getTree(); if(tree != null){ scrollPane = new UIScrollPane(tree); - scrollPane.setBorder(BorderFactory.createEmptyBorder(0,2,0,0)); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); add(scrollPane, BorderLayout.CENTER); } } From e1ea2ec04904dac22880d46dcba85aa34d91a1ce Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 16:31:49 +0800 Subject: [PATCH 224/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 2a490726fa..cde0288012 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -19,6 +19,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; +import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.general.SiteCenter; import com.fr.stable.ArrayUtils; @@ -257,11 +258,9 @@ public class FormWidgetDetailPane extends FormDockView{ UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png")); UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png")); - menu.add(downloadItem); menu.add(installItem); menu.add(deleteItem); - downloadItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -291,7 +290,7 @@ public class FormWidgetDetailPane extends FormDockView{ JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new JLabel(), Inter.getLocText("FR-Designer_Select")); + int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select")); if (returnValue == JFileChooser.APPROVE_OPTION) { final File chosenFile = fileChooser.getSelectedFile(); installFromDiskZipFile(chosenFile); @@ -364,7 +363,7 @@ public class FormWidgetDetailPane extends FormDockView{ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); } catch (IOException e) { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); - e.printStackTrace(); + FRLogger.getLogger().error(e.getMessage(), e); } } From 8c911275b7e3a8df09716c5e7251ff951bd8b35c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 16:33:41 +0800 Subject: [PATCH 225/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index cde0288012..e94974b61b 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -372,7 +372,7 @@ public class FormWidgetDetailPane extends FormDockView{ try { ShareLoader.getLoader().refreshModule(); } catch (Exception e) { - e.printStackTrace(); + FRLogger.getLogger().error(e.getMessage(), e); } } From e3b98e7ec1f6cb400cc37c6ffc761c6f7659a992 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 16:50:55 +0800 Subject: [PATCH 226/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index e94974b61b..c8f17031eb 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -272,7 +272,7 @@ public class FormWidgetDetailPane extends FormDockView{ try { Desktop.getDesktop().browse(new URI(url)); } catch (IOException exp) { - JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); } catch (URISyntaxException exp) { FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); From 10d591ada7f22b58b7588da6643fb1a747d554cd Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 16:59:08 +0800 Subject: [PATCH 227/244] rt --- .../src/com/fr/design/mainframe/ComponentTree.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index a3452f602f..d439629d59 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -241,12 +241,14 @@ public class ComponentTree extends JTree { creator.notShowInComponentTree(path); } //绝对布局作为body的时候不显示自适应布局父层 - if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class) - && (parent.getParent() != null) - && ((XCreator)parent.getParent()).acceptType(XWFitLayout.class)){ - parent = parent.getParent().getParent(); - continue; + if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class)) { + if ((parent.getParent() != null) + && ((XCreator)parent.getParent()).acceptType(XWFitLayout.class)){ + parent = parent.getParent().getParent(); + continue; + } } + parent = parent.getParent(); } Object[] components = path.toArray(); From 0aa3db1c0f10260690a4fa89454d170151395f72 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 17:17:29 +0800 Subject: [PATCH 228/244] rt --- .../mainframe/FormWidgetDetailPane.java | 112 +++++++++--------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index c8f17031eb..a9f4b6bf71 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -254,69 +254,69 @@ public class FormWidgetDetailPane extends FormDockView{ downloadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - UIPopupMenu menu = new UIPopupMenu(); - UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); - UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png")); - UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png")); - menu.add(downloadItem); - menu.add(installItem); - menu.add(deleteItem); - downloadItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url"); - if (StringUtils.isEmpty(url)) { - FRContext.getLogger().info("The URL is empty!"); - return; - } - try { - Desktop.getDesktop().browse(new URI(url)); - } catch (IOException exp) { - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); - FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); - } catch (URISyntaxException exp) { - FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); - } catch (Exception exp) { - FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); - FRContext.getLogger().error("Can not open the browser for URL: " + url); - } - - } - }); - - installItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select")); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File chosenFile = fileChooser.getSelectedFile(); - installFromDiskZipFile(chosenFile); - - } - } - }); - - deleteItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - replaceButtonPanel(true); - deleteFromDiskZipFile(); - } - }); - - GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y); - + initPopMenu(); } }); return downloadButton; } + /** + * 初始化下拉面板 + */ + private void initPopMenu() { + UIPopupMenu menu = new UIPopupMenu(); + UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); + UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png")); + UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png")); + menu.add(downloadItem); + menu.add(installItem); + menu.add(deleteItem); + downloadItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url"); + if (StringUtils.isEmpty(url)) { + FRContext.getLogger().info("The URL is empty!"); + return; + } + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException exp) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + } catch (URISyntaxException exp) { + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + } catch (Exception exp) { + FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); + FRContext.getLogger().error("Can not open the browser for URL: " + url); + } + } + }); + installItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select")); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + } + } + }); + deleteItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + replaceButtonPanel(true); + deleteFromDiskZipFile(); + } + }); + GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y); + } + private void deleteFromDiskZipFile() { deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove")); - deleteButton.setBackground(Color.red); deleteButton.repaint(); deleteButton.setPreferredSize(new Dimension(240, 40)); From 8eaf712d94e32bcf2efc292fcdaf2fbb1f8d2631 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 17:38:43 +0800 Subject: [PATCH 229/244] rt --- .../fr/design/mainframe/ComponentTree.java | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index d439629d59..4d58c4887d 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -37,30 +37,6 @@ public class ComponentTree extends JTree { this.setTransferHandler(new TreeTransferHandler()); this.refreshTreeRoot(); addTreeSelectionListener(designer); - -// this.addMouseListener(new MouseAdapter() { -// -// @Override -// public void mouseClicked(MouseEvent e) { -// if (e.isPopupTrigger()) { -// popupMenu(e); -// } -// } -// -// @Override -// public void mousePressed(MouseEvent e) { -// if (e.isPopupTrigger()) { -// popupMenu(e); -// } -// } -// -// @Override -// public void mouseReleased(MouseEvent e) { -// if (e.isPopupTrigger()) { -// popupMenu(e); -// } -// } -// }); setEditable(true); } @@ -121,19 +97,6 @@ public class ComponentTree extends JTree { scrollPathToVisible(treepath); } -// private void popupMenu(MouseEvent e) { -// TreePath path = this.getSelectionPath(); -// if (path == null) { -// return; -// } -// Component component = (Component) path.getLastPathComponent(); -// if (!(component instanceof XCreator)) { -// return; -// } -// ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component); -// JPopupMenu menu = adapter.getContextPopupMenu(e); -// menu.show(this, e.getX(), e.getY()); -// } /** * 刷新 From 52580743f16fddbd3a913a551f2ef6019aa2c5f5 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 17:52:54 +0800 Subject: [PATCH 230/244] rt --- .../parameter/ParameterToolBarPane.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java index d495e9c06a..0b23f290ae 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java @@ -29,16 +29,17 @@ public class ParameterToolBarPane extends BasicBeanPane { private UIButton addAll; private UILabel label; private int breakid; - + private static final int GAP_H = 4; private static final int GAP_V = 6; private static final int GAP_BV = 4; - + private static final int WIDTH = 225; + private static final int L_H = 18; public ParameterToolBarPane() { this.setLayout(new FlowParameterPaneLayout()); - + label = new UILabel() { private static final long serialVersionUID = 1L; @@ -51,7 +52,7 @@ public class ParameterToolBarPane extends BasicBeanPane { label.setHorizontalAlignment(SwingConstants.LEFT); label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); this.add(label); - + addAll = new UIButton(Inter.getLocText("Add-all")); this.add(addAll); @@ -61,7 +62,7 @@ public class ParameterToolBarPane extends BasicBeanPane { protected String title4PopupWindow() { return null; } - + public Parameter getTargetParameter(UIButton button) { int index = parameterSelectedLabellist.indexOf(button); if(index < 0 || index > parameterList.length - 1) { @@ -74,9 +75,9 @@ public class ParameterToolBarPane extends BasicBeanPane { public void populateBean(Parameter[] parameterArray) { parameterSelectedLabellist.clear(); this.removeAll(); - + this.add(label); - + if (parameterArray.length == 0) { this.setVisible(false); this.repaint(); @@ -84,14 +85,14 @@ public class ParameterToolBarPane extends BasicBeanPane { } else { this.setVisible(true); } - + parameterList = parameterArray; for (int i = 0; i < parameterList.length; i++) { UIButton parameterSelectedLabel = new UIButton(parameterList[i].getName()); parameterSelectedLabellist.add(parameterSelectedLabel); this.add(parameterSelectedLabel); } - + for(UIButton parameterSelectedLabel : parameterSelectedLabellist) { parameterSelectedLabel.addMouseListener(paraMouseListner); } @@ -128,9 +129,9 @@ public class ParameterToolBarPane extends BasicBeanPane { public Dimension preferredLayoutSize(Container parent) { int w = parent.getWidth(); - + layoutContainer(parent); - + int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (20 + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height); return new Dimension(w, h); } @@ -140,12 +141,12 @@ public class ParameterToolBarPane extends BasicBeanPane { } public void layoutContainer(Container parent) { - int width = parent.getWidth(); + int width = parent.getWidth() == 0 ? WIDTH : parent.getWidth(); int x = 0; int y = L_H + GAP_H; - + label.setBounds(0, 0, width, L_H); - + breakid = 1; for (UIButton tab : parameterSelectedLabellist) { Dimension dim = tab.getPreferredSize(); @@ -154,9 +155,9 @@ public class ParameterToolBarPane extends BasicBeanPane { x = 0; y += (dim.height + GAP_V); } - + tab.setBounds(x, y, dim.width, dim.height); - + x += (dim.width + GAP_H); } addAll.setBounds(0, y + GAP_V+ 20, width, addAll.getPreferredSize().height); From 2d9ab1ff073746dd09f910d8e15ef07c48cf4605 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 18:07:44 +0800 Subject: [PATCH 231/244] rt --- .../src/com/fr/design/parameter/ParameterToolBarPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java index 0b23f290ae..f7a6eec94c 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java @@ -48,12 +48,12 @@ public class ParameterToolBarPane extends BasicBeanPane { return new Dimension(super.getPreferredSize().width, 18); } }; - label.setText(Inter.getLocText("Following_parameters_are_not_generated")+":"); + label.setText(Inter.getLocText("FR-Following_parameters_are_not_generated")+":"); label.setHorizontalAlignment(SwingConstants.LEFT); label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); this.add(label); - addAll = new UIButton(Inter.getLocText("Add-all")); + addAll = new UIButton(Inter.getLocText("FR-Designer_Add_all")); this.add(addAll); } From 347bea91e6781da77d2f6fb36c2d828a1d91120f Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 18:55:49 +0800 Subject: [PATCH 232/244] rt --- .../com/fr/design/parameter/ParameterToolBarPane.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java index f7a6eec94c..2e97da5a73 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java @@ -33,6 +33,7 @@ public class ParameterToolBarPane extends BasicBeanPane { private static final int GAP_H = 4; private static final int GAP_V = 6; private static final int GAP_BV = 4; + private static final int BUTTON_HEIGHT = 20; private static final int WIDTH = 225; private static final int L_H = 18; @@ -48,12 +49,12 @@ public class ParameterToolBarPane extends BasicBeanPane { return new Dimension(super.getPreferredSize().width, 18); } }; - label.setText(Inter.getLocText("FR-Following_parameters_are_not_generated")+":"); + label.setText(Inter.getLocText("Following_parameters_are_not_generated")+":"); label.setHorizontalAlignment(SwingConstants.LEFT); label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); this.add(label); - addAll = new UIButton(Inter.getLocText("FR-Designer_Add_all")); + addAll = new UIButton(Inter.getLocText("Add-all")); this.add(addAll); } @@ -132,7 +133,7 @@ public class ParameterToolBarPane extends BasicBeanPane { layoutContainer(parent); - int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (20 + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height); + int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (BUTTON_HEIGHT + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height); return new Dimension(w, h); } @@ -160,7 +161,7 @@ public class ParameterToolBarPane extends BasicBeanPane { x += (dim.width + GAP_H); } - addAll.setBounds(0, y + GAP_V+ 20, width, addAll.getPreferredSize().height); + addAll.setBounds(0, y + GAP_V + BUTTON_HEIGHT, width, addAll.getPreferredSize().height); } } From e36d08e8b2b334aa24acbe5204cd5e941ad20b1d Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Nov 2016 18:57:27 +0800 Subject: [PATCH 233/244] rt --- .../src/com/fr/design/parameter/ParameterToolBarPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java index 2e97da5a73..aa7c11660a 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java @@ -49,12 +49,12 @@ public class ParameterToolBarPane extends BasicBeanPane { return new Dimension(super.getPreferredSize().width, 18); } }; - label.setText(Inter.getLocText("Following_parameters_are_not_generated")+":"); + label.setText(Inter.getLocText("FR-Following_parameters_are_not_generated")+":"); label.setHorizontalAlignment(SwingConstants.LEFT); label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); this.add(label); - addAll = new UIButton(Inter.getLocText("Add-all")); + addAll = new UIButton(Inter.getLocText("FR-Designer_Add_all")); this.add(addAll); } From d352f856a8df17611874c8e5ed43e193b22a77c1 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 17 Nov 2016 09:52:44 +0800 Subject: [PATCH 234/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index a9f4b6bf71..792f17dc34 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -133,6 +133,7 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化组件共享和复用面板 */ private void initReuWidgetPanel() { + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false)); reuWidgetPanel.add(downPane); } @@ -331,6 +332,7 @@ public class FormWidgetDetailPane extends FormDockView{ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); refreshDownPanel(false); replaceButtonPanel(false); + comboBox.setSelectedIndex(0); } else { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); } @@ -360,6 +362,7 @@ public class FormWidgetDetailPane extends FormDockView{ refreshShareMoudule(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); refreshDownPanel(false); + comboBox.setSelectedIndex(0); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); } catch (IOException e) { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); From af70499a81341460a7593c8dd971a3c3464995fa Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 17 Nov 2016 10:07:59 +0800 Subject: [PATCH 235/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 792f17dc34..1eb8f6bcfa 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -58,6 +58,8 @@ public class FormWidgetDetailPane extends FormDockView{ private static final int OFFSET_X = 140; private static final int OFFSET_Y = 26; private SwingWorker sw; + //组件面板是否可以编辑 + private boolean isEdit; public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -207,7 +209,7 @@ public class FormWidgetDetailPane extends FormDockView{ String filterName = comboBox.getSelectedItem().toString(); elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); } - refreshDownPanel(false); + refreshDownPanel(isEdit); } }); @@ -344,6 +346,7 @@ public class FormWidgetDetailPane extends FormDockView{ } private void replaceButtonPanel(boolean isEdit) { + this.isEdit = isEdit; if (isEdit) { menutPanel.remove(editPanel); menutPanel.add(initResetButtonPane(), BorderLayout.EAST); From 084cf12d85b3b8826af2b851312c8eb8a85d5153 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 17 Nov 2016 10:21:19 +0800 Subject: [PATCH 236/244] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 1eb8f6bcfa..73ac21246f 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -202,6 +202,7 @@ public class FormWidgetDetailPane extends FormDockView{ comboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { + ShareLoader.getLoader().resetRemovedModuleList(); int filterIndex = comboBox.getSelectedIndex(); if (filterIndex == 0) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); From 76a69cd25e8047629d15d424bc5c20654f22998b Mon Sep 17 00:00:00 2001 From: fr_shine Date: Thu, 17 Nov 2016 10:46:12 +0800 Subject: [PATCH 237/244] =?UTF-8?q?populate=E4=B9=8B=E5=89=8Dinit=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E8=AE=A9=E7=BB=84=E4=BB=B6=E6=B2=A1=E6=9C=89listener?= =?UTF-8?q?=E3=80=82typepane=E5=85=88=E5=92=8Cstylepane=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=EF=BC=8Cdev=E9=87=8C=E9=9D=A2=E6=88=91?= =?UTF-8?q?=E4=B8=8Dinit=E9=9D=A2=E6=9D=BF=EF=BC=8C=E5=8F=AA=E6=98=AF?= =?UTF-8?q?=E6=8A=8A=E6=89=80=E6=9C=89listener=20remove=E6=8E=89=EF=BC=8C?= =?UTF-8?q?=E8=BF=99=E6=A0=B7=E6=AF=94=E8=BE=83=E5=90=88=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/chart/gui/ChartTypePane.java | 4 ++++ 1 file changed, 4 insertions(+) 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 eab0010eae..964b5bc974 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 @@ -300,8 +300,12 @@ public class ChartTypePane extends AbstractChartAttrPane{ */ public void populate(ChartCollection collection) { Chart chart = collection.getSelectedChart(); + this.remove(leftContentPane); + initContentPane(); + this.removeAttributeChangeListener(); buttonPane.populateBean(collection); chartTypePane.populateBean(chart); + this.initAllListeners(); } /** From 25553accd027393ce5ed30c85d3b10aeb69d4812 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 17 Nov 2016 12:49:38 +0800 Subject: [PATCH 238/244] rt --- .../fr/design/mainframe/FormWidgetDetailPane.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 73ac21246f..be0b8f6b12 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -24,6 +24,7 @@ import com.fr.general.Inter; import com.fr.general.SiteCenter; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import com.fr.stable.collections.array.Array; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; @@ -36,6 +37,7 @@ import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.util.*; /** * Created with IntelliJ IDEA. @@ -235,7 +237,7 @@ public class FormWidgetDetailPane extends FormDockView{ protected Object doInBackground() throws Exception { ShareLoader.getLoader().refreshModule(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - comboBox.setSelectedIndex(0); + refreshComboxData(); refreshDownPanel(false); return null; } @@ -247,6 +249,11 @@ public class FormWidgetDetailPane extends FormDockView{ } + private void refreshComboxData() { + comboBox.setSelectedIndex(0); + comboBox.setModel(new DefaultComboBoxModel(getFormCategories())); + } + /** * 创建下载模板的按钮 */ @@ -335,7 +342,7 @@ public class FormWidgetDetailPane extends FormDockView{ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); refreshDownPanel(false); replaceButtonPanel(false); - comboBox.setSelectedIndex(0); + refreshComboxData(); } else { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); } @@ -366,7 +373,7 @@ public class FormWidgetDetailPane extends FormDockView{ refreshShareMoudule(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); refreshDownPanel(false); - comboBox.setSelectedIndex(0); + refreshComboxData(); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); } catch (IOException e) { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); From 79e0d87f0e803077b702bd050605f76333b24b0e Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 17 Nov 2016 14:57:30 +0800 Subject: [PATCH 239/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=85=B1=E4=BA=AB=E8=BF=9C=E7=A8=8B=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=90=8C=E6=AD=A5=E5=88=B0release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 44 +++++++++++++++++++ .../mainframe/FormWidgetDetailPane.java | 9 ---- .../fr/design/mainframe/ShareWidgetPane.java | 20 ++++----- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 6aff74d7ca..cbca9c2cab 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -22,6 +22,7 @@ import com.fr.file.CacheManager; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.file.filetree.FileNode; +import com.fr.form.share.ShareConstants; import com.fr.general.*; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; @@ -2105,4 +2106,47 @@ public class RemoteEnv implements Env { public void checkAndRegisterLic(FileNode node, Plugin plugin) throws Exception { } + + @Override + public File[] loadREUFile() throws Exception { + File target = new File(CacheManager.getProviderInstance().getCacheDirectory(), + "fr_share"); + StableUtils.deleteFile(target); + StableUtils.mkdirs(target); + File cacheDir = null; + File zip = null; + try { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_read_reufile"); + para.put("current_uid", this.createUserID()); + para.put("currentUsername", this.getUser()); + + HttpClient client = createHttpMethod(para); + InputStream input = client.getResponseStream(); + zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); + cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); + StableUtils.deleteFile(cacheDir); + StableUtils.mkdirs(cacheDir); + StableUtils.makesureFileExist(zip); + FileOutputStream out = new FileOutputStream(zip); + IOUtils.copyBinaryTo(input, out); + out.flush(); + out.close(); + IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录 + if (cacheDir.exists() && cacheDir.isDirectory()) { + return cacheDir.listFiles(new FilenameFilter() { + public boolean accept(File file, String s) { + return s.endsWith("reu"); + } + }); + } + + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage()); + } finally { + StableUtils.deleteFile(zip); + } + return new File[0]; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index be0b8f6b12..d660d9a580 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -2,11 +2,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.UIDialog; -import com.fr.design.extra.PluginWebBridge; -import com.fr.design.extra.ShopDialog; -import com.fr.design.extra.WebManagerPaneFactory; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; @@ -16,7 +11,6 @@ import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.general.FRLogger; @@ -24,7 +18,6 @@ import com.fr.general.Inter; import com.fr.general.SiteCenter; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.fr.stable.collections.array.Array; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; @@ -37,7 +30,6 @@ import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.util.*; /** * Created with IntelliJ IDEA. @@ -107,7 +99,6 @@ public class FormWidgetDetailPane extends FormDockView{ reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel.setBorder(null); if (elCaseBindInfoList == null) { - elCaseBindInfoList = new ElCaseBindInfo[0]; if (sw != null) { sw.cancel(true); } diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index cd04300bf1..c5659d9bc1 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe; - import com.fr.form.ui.ElCaseBindInfo; + import javax.swing.*; import java.awt.*; @@ -14,15 +14,15 @@ public class ShareWidgetPane extends JPanel { public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList, boolean isEdit) { this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 - int rowCount = (elCaseBindInfoList.length + 1) / 2; - this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); - for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { - ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); - widgetButton.setElementCaseEdit(isEdit); - this.add(widgetButton); + if (elCaseBindInfoList != null) { + int rowCount = (elCaseBindInfoList.length + 1) / 2; + this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); + for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { + ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); + widgetButton.setElementCaseEdit(isEdit); + this.add(widgetButton); + } + this.setPreferredSize(new Dimension(240, rowCount * 80)); } - this.setPreferredSize(new Dimension(240, rowCount * 80)); - } - } \ No newline at end of file From 263efee93d91cee34ed835d2022079e0f3f66d7d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 17 Nov 2016 15:16:25 +0800 Subject: [PATCH 240/244] update --- .../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 eab0010eae..2663ad5ab4 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 @@ -272,7 +272,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ Chart chart = collection.getSelectedChart(); String plotID = chart.getPlot().getPlotID(); boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ + if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID)) /*|| needRelayoutPlotPane*/){ editPane.reLayout(chart); } } From cae49c62bf6f98dd38cad1d3b3c1d35e54b7725f Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 17 Nov 2016 15:36:42 +0800 Subject: [PATCH 241/244] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E7=94=A8=E4=BA=86=E9=9D=9E=E6=B3=95=E7=9A=84=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=EF=BC=8C=E5=85=88=E5=86=99=E6=AD=BB=E5=86=8D?= =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index cbca9c2cab..ae8c589ee5 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -22,7 +22,6 @@ import com.fr.file.CacheManager; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.file.filetree.FileNode; -import com.fr.form.share.ShareConstants; import com.fr.general.*; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; @@ -32,8 +31,6 @@ import com.fr.plugin.Plugin; import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginLoader; -import com.fr.plugin.dependence.PluginServiceCreator; -import com.fr.plugin.dependence.PluginServiceManager; import com.fr.stable.*; import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.project.ProjectConstants; @@ -2125,7 +2122,7 @@ public class RemoteEnv implements Env { HttpClient client = createHttpMethod(para); InputStream input = client.getResponseStream(); zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); - cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); + cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "fr_share"); StableUtils.deleteFile(cacheDir); StableUtils.mkdirs(cacheDir); StableUtils.makesureFileExist(zip); From c7313ff1e6b91fa1072c595ef3a1b6c6b99833f6 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 17 Nov 2016 16:11:55 +0800 Subject: [PATCH 242/244] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/chart/gui/ChartTypePane.java | 7 ++++++- 1 file changed, 6 insertions(+), 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 4dbd362e9d..0eb9caf71d 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 @@ -291,8 +291,10 @@ public class ChartTypePane extends AbstractChartAttrPane{ paneState.setPaneState(collection.getState()); } + // TODO: 2016/11/17 因为现在populate面板时会重新构造面板,所以每次都需要重构 private boolean needReactor(ChartCollection collection) { - return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState(); + /*return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState();*/ + return true; } /** @@ -305,6 +307,9 @@ public class ChartTypePane extends AbstractChartAttrPane{ this.removeAttributeChangeListener(); buttonPane.populateBean(collection); chartTypePane.populateBean(chart); + //remove面板之后,就需要重构下拉框 + reactorChartTypePane(collection); + this.initAllListeners(); } From 23f80fd8b716897ee6785729ce2c46cd4f237fe5 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 17 Nov 2016 16:14:47 +0800 Subject: [PATCH 243/244] update --- .../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 0eb9caf71d..dc339057c6 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 @@ -272,7 +272,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ Chart chart = collection.getSelectedChart(); String plotID = chart.getPlot().getPlotID(); boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID)) /*|| needRelayoutPlotPane*/){ + if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ editPane.reLayout(chart); } } From 54150480d91f4e511489e5330ec3280124721b9f Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 18 Nov 2016 09:35:51 +0800 Subject: [PATCH 244/244] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 5 +++-- .../src/com/fr/design/mainframe/chart/gui/ChartTypePane.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 8d9ed81530..6c48772b06 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -275,8 +275,9 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen break; } } - if (editChartType != null) { - editChartType.populateBean(editingCollection.getSelectedChart()); + //切换时重新更新整个面板 + if (parent != null) { + parent.populate(editingCollection); } } } 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 dc339057c6..6c747c9cc1 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 @@ -304,7 +304,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ Chart chart = collection.getSelectedChart(); this.remove(leftContentPane); initContentPane(); - this.removeAttributeChangeListener(); + buttonPane.populateBean(collection); chartTypePane.populateBean(chart); //remove面板之后,就需要重构下拉框