From 9391e36c98d529b61c06c46adc444f7bf930075c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 18 Sep 2020 10:10:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?CHART-15840=20=E5=9B=BE=E8=A1=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E5=8A=A0=E8=BD=BD=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/chart/ChartDesignerActivator.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index 0cd81f783..8a5e0e7d8 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -15,6 +15,7 @@ import com.fr.locale.LocaleScope; import com.fr.module.Activator; import com.fr.module.extension.Prepare; import com.fr.plugin.chart.vanchart.export.ImagePainter; +import com.fr.plugin.chart.vanchart.export.PainterDispatcher; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.DownloadOnlineSourcesHelper; @@ -46,6 +47,7 @@ public class ChartDesignerActivator extends Activator implements Prepare { ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance()); + PainterDispatcher.getInstance().distributeDesignPainter(); ChartTypeInterfaceManager.addPluginChangedListener(); } From 50b2fcfde5e90b817e860a8d535ae56ed1333bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 21 Sep 2020 16:36:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?CHART-15518=20=E8=BD=B4=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=88=B020=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chart/ChartDesignerActivator.java | 2 - ...nChartCustomStackAndAxisConditionPane.java | 8 +- .../component/VanChartAxisButtonPane.java | 75 ++++++++++--------- 3 files changed, 46 insertions(+), 39 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index 8a5e0e7d8..0cd81f783 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -15,7 +15,6 @@ import com.fr.locale.LocaleScope; import com.fr.module.Activator; import com.fr.module.extension.Prepare; import com.fr.plugin.chart.vanchart.export.ImagePainter; -import com.fr.plugin.chart.vanchart.export.PainterDispatcher; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.DownloadOnlineSourcesHelper; @@ -47,7 +46,6 @@ public class ChartDesignerActivator extends Activator implements Prepare { ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance()); - PainterDispatcher.getInstance().distributeDesignPainter(); ChartTypeInterfaceManager.addPluginChangedListener(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java index ceb9bf480..86766676b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java @@ -6,18 +6,19 @@ import com.fr.data.condition.ListCondition; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.LiteConditionPane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JPanel; +import javax.swing.ScrollPaneConstants; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; @@ -46,10 +47,13 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane { private static final int B_W = 56; private static final int B_H = 21; private static final int COL_COUNT = 3; + private static final int MAX_COUNT = 20; private UIButton addButton; private UIPopupMenu popupMenu; + private UIMenuItem itemX; + private UIMenuItem itemY; private List indexList_X = new ArrayList(); private List indexList_Y = new ArrayList(); @@ -51,7 +53,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane { private VanChartAxisPane parent; - public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane){ + public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane) { this.parent = vanChartAxisPane; this.setLayout(new BorderLayout()); @@ -66,6 +68,20 @@ public class VanChartAxisButtonPane extends BasicBeanPane { buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0)); this.add(buttonPane, BorderLayout.CENTER); + itemX = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX); + itemX.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + addXAxis(); + } + }); + itemY = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX); + itemY.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + addYAxis(); + } + }); addButton.addActionListener(addListener); } @@ -92,12 +108,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane { pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); buttonPane.add(pane); } - if(pane != null) { + if (pane != null) { pane.add(indexList_Y.get(i)); } } - if(popupMenu != null){ + if (popupMenu != null) { popupMenu.setVisible(false); } @@ -114,19 +130,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane { indexList_X.clear(); indexList_Y.clear(); List xList = plot.getXAxisList(); - for(VanChartAxis axis : xList){ + for (VanChartAxis axis : xList) { ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis)); x.setToolTipText(plot.getXAxisName(axis)); indexList_X.add(x); } List yList = plot.getYAxisList(); - for(VanChartAxis axis : yList){ + for (VanChartAxis axis : yList) { ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis)); y.setToolTipText(plot.getYAxisName(axis)); indexList_Y.add(y); } - if(indexList_X.isEmpty()){ + if (indexList_X.isEmpty()) { this.removeAll(); } else { indexList_X.get(0).setSelected(true); @@ -143,7 +159,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane { return null; } - public String getNewChartName(List existList, String prefix){ + public String getNewChartName(List existList, String prefix) { int count = existList.size() + 1; while (true) { String name_test = prefix + count; @@ -165,31 +181,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane { ActionListener addListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if(popupMenu == null){ - popupMenu = new UIPopupMenu(); - UIMenuItem item_x = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX); - item_x.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - addXAxis(); - } - }); - UIMenuItem item_y = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX); - item_y.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - addYAxis(); - } - }); - popupMenu.add(item_x); - popupMenu.add(item_y); + popupMenu = new UIPopupMenu(); + if (indexList_X.size() < MAX_COUNT) { + popupMenu.add(itemX); + } + if (indexList_Y.size() < MAX_COUNT) { + popupMenu.add(itemY); } popupMenu.setVisible(true); GUICoreUtils.showPopupMenu(popupMenu, addButton, addButton.getWidth() - popupMenu.getPreferredSize().width, addButton.getY() - 1 + addButton.getHeight()); } }; - private void addXAxis(){ + private void addXAxis() { String name = getNewChartName(indexList_X, VanChartAttrHelper.X_AXIS_PREFIX); ChartAxisButton button = new ChartAxisButton(name); @@ -199,7 +203,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane { layoutPane(); } - private void addYAxis(){ + private void addYAxis() { String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX); ChartAxisButton button = new ChartAxisButton(name); @@ -216,9 +220,10 @@ public class VanChartAxisButtonPane extends BasicBeanPane { private class AddButton extends UIButton { - public AddButton(Icon icon){ + public AddButton(Icon icon) { super(icon); } + /** * 组件是否需要响应添加的观察者事件 * @@ -277,19 +282,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane { } private void noSelected() { - for(ChartAxisButton button : indexList_X){ + for (ChartAxisButton button : indexList_X) { button.setSelected(false); } - for(ChartAxisButton button : indexList_Y){ + for (ChartAxisButton button : indexList_Y) { button.setSelected(false); } } private void checkMoveOn(boolean moveOn) { - for(ChartAxisButton button : indexList_X){ + for (ChartAxisButton button : indexList_X) { button.isMoveOn = false; } - for(ChartAxisButton button : indexList_Y){ + for (ChartAxisButton button : indexList_Y) { button.isMoveOn = false; }