diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java b/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java index f377cee91..030581768 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java @@ -12,8 +12,8 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.Border; -import java.awt.Component; import java.util.Arrays; +import java.awt.Component; /** * 布局 标题+组件 @@ -21,13 +21,13 @@ import java.util.Arrays; public class TableLayout4VanChartHelper { private static final int SMALL_GAP = 20; - public static final int EXPANDABLE_PANE_WIDTH =290; - public static final int EXPANDABLE_PANE_HIGHT =24; + public static final int EXPANDABLE_PANE_WIDTH = 290; + public static final int EXPANDABLE_PANE_HIGHT = 24; public static final int DESCRIPTION_AREA_WIDTH = 60; - public static final int EDIT_AREA_WIDTH =155; + public static final int EDIT_AREA_WIDTH = 155; public static final int SECOND_EDIT_AREA_WIDTH = 143; - public static final int COMPONENT_INTERVAL =12; - public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0,12,0,0); + public static final int COMPONENT_INTERVAL = 12; + public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0, 12, 0, 0); public static JPanel createExpandablePaneWithTitleTopGap(String title, JPanel panel) { return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) { @@ -43,9 +43,9 @@ public class TableLayout4VanChartHelper { } public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) { - return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel){ - protected void setcontentPanelontentPanelBorder (){ - getContentPanel().setBorder(BorderFactory.createEmptyBorder(0 ,5, 0, 0)); + return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) { + protected void setcontentPanelontentPanelBorder() { + getContentPanel().setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); } }; } @@ -54,13 +54,23 @@ public class TableLayout4VanChartHelper { return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH); } + public static JPanel createGapTableLayoutPaneWithoutTop(String title, Component component) { + return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH, false); + } + public static JPanel createGapTableLayoutPane(String title, Component component, double componentWidth) { + return createGapTableLayoutPane(title, component, componentWidth, true); + } + + public static JPanel createGapTableLayoutPane(String title, Component component, double componentWidth, boolean topLabel) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f, componentWidth}; double[] rowSize = {p, p}; UILabel label = FRWidgetFactory.createLineWrapLabel(title); - label.setVerticalAlignment(SwingConstants.TOP); + if (topLabel) { + label.setVerticalAlignment(SwingConstants.TOP); + } Component[][] components = new Component[][]{ new Component[]{null, null}, new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(component)}, @@ -93,60 +103,65 @@ public class TableLayout4VanChartHelper { /** * 标题布局(二级菜单距左边框46) - * @param title 标题 + * + * @param title 标题 * @param component 组件 * @return 布局好的组件 */ - public static JPanel createTableLayoutPaneWithTitle(String title, Component component){ + public static JPanel createTableLayoutPaneWithTitle(String title, Component component) { return TableLayout4VanChartHelper.createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN); } /** * 标题布局(二级菜单距左边框46) - * @param label 标题label + * + * @param label 标题label * @param component 组件 * @return 布局好的组件 */ - public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component){ + public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component) { return TableLayout4VanChartHelper.createTitlePaneWithUILabel(label, component, LayoutConstants.CHART_ATTR_TOMARGIN); } /** * 标题布局(三级菜单距二级左侧20) - * @param title 标题 + * + * @param title 标题 * @param component 组件 * @return 布局好的组件 */ - public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component){ + public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component) { return TableLayout4VanChartHelper.createTitlePane(title, component, TableLayout4VanChartHelper.SMALL_GAP); } /** * 标题布局(指定gap) - * @param title 标题 + * + * @param title 标题 * @param component 组件 - * @param gap 距左侧距离 + * @param gap 距左侧距离 * @return 布局好的组件 */ - public static JPanel createTitlePane(String title, Component component, int gap){ + public static JPanel createTitlePane(String title, Component component, int gap) { return createTitlePaneWithUILabel(new UILabel(title), component, gap); } /** * 标题布局(指定gap) - * @param label 标题label + * + * @param label 标题label * @param component 组件 - * @param gap 距左侧距离 + * @param gap 距左侧距离 * @return 布局好的组件 */ - public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){ + 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}, + new Component[]{label, null}, + new Component[]{null, component}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index 885931cb9..d1ac6aa14 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -8,15 +8,19 @@ import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chartx.attr.LargeDataModeType; import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.ispinner.UnsignedIntUISpinner; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; @@ -32,6 +36,8 @@ import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.gantt.attr.AttrGanttLabel; import com.fr.plugin.chart.map.line.condition.AttrLineEffect; import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; +import com.fr.plugin.chart.type.AxisType; +import com.fr.plugin.chart.type.ControlType; import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.StableUtils; import com.fr.van.chart.custom.component.VanChartHyperLinkPane; @@ -45,14 +51,15 @@ import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import java.awt.Dimension; public class VanChartInteractivePane extends AbstractVanChartScrollPane { private static final long serialVersionUID = 8135452818502145597L; private static final int AUTO_REFRESH_LEFT_GAP = 18; + private static final double PERCENT = 100.0; protected UICheckBox isSort; protected UICheckBox exportImages; @@ -72,15 +79,20 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private AutoRefreshPane autoRefreshPane; //图表缩放新设计 恢复用注释。删除下面八行代码。 - private UIButtonGroup zoomWidget; + private UICheckBox zoomWidget; protected UIButtonGroup zoomGesture;//地图手势缩放 - private UIButtonGroup zoomResize; - private TinyFormulaPane from; - private TinyFormulaPane to; private UIButtonGroup zoomType; private JPanel changeEnablePane; private JPanel zoomTypePane; + private UIButtonGroup controlType; + protected JPanel centerPane; + private UISpinner categoryNum; + private UINumberDragPane scaling; + private UIButtonGroup zoomResize; + private TinyFormulaPane from; + private TinyFormulaPane to; + //图表缩放新设计 恢复用注释。取消注释。 //private ZoomPane zoomPane; @@ -126,7 +138,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { //new Component[]{createLargeDataModePane(), null}, new Component[]{createAnimationPane(), null}, new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null}, - new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(plot), null}, new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createHyperlinkPane(), null} }; @@ -172,7 +184,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return false; } - protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { + protected JPanel createZoomPane(VanChartPlot plot) { //图表缩放新设计 恢复用注释。取消注释。 // zoomPane = createZoomPane(); // if (zoomPane == null) { @@ -184,47 +196,118 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (!plot.isSupportZoomDirection()) { return null; } - zoomWidget = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - zoomResize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Non_Adjustment")}); - from = new TinyFormulaPane(); - to = new TinyFormulaPane(); + zoomWidget = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Open_Zoom_Control")); + zoomGesture = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); + JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget); + JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture); zoomType = new UIButtonGroup(getNameArray(), getValueArray()); - zoomGesture = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); + zoomTypePane = getZoomTypePane(zoomType); + + JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, plot); + zoomWidget.addActionListener((event) -> checkZoomPane()); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel); + } - JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget); - JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture); + private void createChangeEnablePane(VanChartRectanglePlot plot) { + String scroll = Toolkit.i18nText("Fine-Design_Chart_Scroll"); + String scaleAxis = Toolkit.i18nText("Fine-Design_Chart_Scale_Axis"); + controlType = new UIButtonGroup<>(new String[]{scroll, scaleAxis}, ControlType.values()); + JPanel scaleAxisPane = createScaleAxisPane(); + JPanel scrollPane = createScrollPane(plot); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Boundary")), zoomResize}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_From")), from}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_To")), to}, + centerPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (controlType.getSelectedItem() == ControlType.ZOOM) { + return scaleAxisPane.getPreferredSize(); + } else { + return scrollPane.getPreferredSize(); + } + } }; + centerPane.add(scaleAxisPane, scroll); + centerPane.add(scrollPane, scaleAxis); + double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double[] columnSize = {f, e}; + double[] row = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Control_Type")), controlType}, + new Component[]{centerPane, null} + }; changeEnablePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); - changeEnablePane.setBorder(BorderFactory.createEmptyBorder(10, 12, 0, 0)); - zoomTypePane = getzoomTypePane(zoomType); - JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, changeEnablePane, zoomTypePane, plot); - zoomWidget.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkZoomPane(); + changeEnablePane.setBorder(BorderFactory.createEmptyBorder(5, 12, 0, 0)); + + controlType.addActionListener((event) -> checkCardPane()); + } + + private JPanel createScaleAxisPane() { + zoomResize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Change"), Toolkit.i18nText("Fine-Design_Chart_Non_Adjustment")}); + from = new TinyFormulaPane(); + to = new TinyFormulaPane(); + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Widget_Boundary")), zoomResize}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_From")), from}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_To")), to}, + }; + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] row = {p, p, p}; + JPanel resizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); + return resizePane; + } + + + private JPanel createScrollPane(VanChartRectanglePlot plot) { + VanChartAxis vanChartAxis = plot.getCategoryAxisList().get(0); + AxisType axisType = vanChartAxis.getAxisType(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] row = {p}; + Component[][] components; + if (axisType == AxisType.AXIS_CATEGORY) { + categoryNum = new UnsignedIntUISpinner(1, Double.MAX_VALUE, 1); + components = new Component[][]{ + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Initial_Cate_Num")), categoryNum}, + }; + } else { + scaling = new UINumberDragPaneWithPercent(1, 100, 1); + components = new Component[][]{ + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Scaling")), scaling}, + }; + } + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); + } + + protected void checkCardPane() { + if (centerPane != null && controlType != null) { + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + if (controlType.getSelectedItem() == ControlType.ZOOM) { + cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scroll")); + } else { + cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scale_Axis")); } - }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel); + } } //图表缩放新设计 恢复用注释。删除下面八个方法getzoomTypePane createZoomPaneContent // checkZoomEnabled getNameArray getValueArray checkZoomPane populateChartZoom updateChartZoom。 - protected JPanel getzoomTypePane(UIButtonGroup zoomType) { - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType); + protected JPanel getZoomTypePane(UIButtonGroup zoomType) { + return TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType); } - protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { + protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, VanChartPlot plot) { JPanel panel = new JPanel(new BorderLayout(0, 4)); if (plot.isSupportZoomCategoryAxis()) {//支持缩放控件 + createChangeEnablePane((VanChartRectanglePlot) plot); panel.add(zoomWidgetPane, BorderLayout.NORTH); panel.add(changeEnablePane, BorderLayout.CENTER); } @@ -236,17 +319,18 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (zoomWidget != null && axisRotation != null) { if (axisRotation.getSelectedIndex() == 0) { //只有开启坐标轴翻转,才需要将缩放控件强制关闭。 - zoomWidget.setSelectedIndex(1); + zoomWidget.setSelected(false); } checkZoomPane(); zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1); } + checkCardPane(); } protected String[] getNameArray() { - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_X_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Y_Axis") - , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; + return new String[]{Toolkit.i18nText("Fine-Design_Chart_X_Axis"), Toolkit.i18nText("Fine-Design_Chart_Y_Axis") + , Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), Toolkit.i18nText("Fine-Design_Chart_Use_None")}; } protected String[] getValueArray() { @@ -256,9 +340,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } private void checkZoomPane() { - boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0; - changeEnablePane.setVisible(zoomWidgetEnabled); - zoomType.setEnabled(!zoomWidgetEnabled); + boolean zoomWidgetEnabled = zoomWidget.isSelected(); + if (changeEnablePane != null) { + changeEnablePane.setVisible(zoomWidgetEnabled); + } + zoomTypePane.setVisible(!zoomWidgetEnabled); } private void populateChartZoom(VanChart chart) { @@ -266,20 +352,31 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (zoom == null) { zoom = new VanChartZoom(); } - zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1); + zoomWidget.setSelected(zoom.isZoomVisible()); zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1); - zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); - if (zoom.getFrom() instanceof BaseFormula) { - from.populateBean(((BaseFormula) zoom.getFrom()).getContent()); - } else { - from.populateBean(Utils.objectToString(zoom.getFrom())); - } - if (zoom.getTo() instanceof BaseFormula) { - to.populateBean(((BaseFormula) zoom.getTo()).getContent()); - } else { - to.populateBean(Utils.objectToString(zoom.getTo())); - } zoomType.setSelectedItem(zoom.getZoomType()); + + if (changeEnablePane != null) { + controlType.setSelectedItem(zoom.getControlType()); + + zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); + if (zoom.getFrom() instanceof BaseFormula) { + from.populateBean(((BaseFormula) zoom.getFrom()).getContent()); + } else { + from.populateBean(Utils.objectToString(zoom.getFrom())); + } + if (zoom.getTo() instanceof BaseFormula) { + to.populateBean(((BaseFormula) zoom.getTo()).getContent()); + } else { + to.populateBean(Utils.objectToString(zoom.getTo())); + } + if (categoryNum != null) { + categoryNum.setValue(zoom.getCategoryNum()); + } + if (scaling != null) { + scaling.populateBean(zoom.getScaling() * PERCENT); + } + } } private void updateChartZoom(VanChart chart) { @@ -288,26 +385,38 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { zoom = new VanChartZoom(); chart.setVanChartZoom(zoom); } - zoom.setZoomVisible(zoomWidget.getSelectedIndex() == 0); + zoom.setZoomVisible(zoomWidget.isSelected()); zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0); - zoom.setZoomResize(zoomResize.getSelectedIndex() == 0); - String fromString = from.updateBean(); - Object fromObject; - if (StableUtils.maybeFormula(fromString)) { - fromObject = BaseFormula.createFormulaBuilder().build(fromString); - } else { - fromObject = fromString; - } - zoom.setFrom(fromObject); - String toString = to.updateBean(); - Object toObject; - if (StableUtils.maybeFormula(toString)) { - toObject = BaseFormula.createFormulaBuilder().build(toString); - } else { - toObject = toString; - } - zoom.setTo(toObject); zoom.setZoomType(zoomType.getSelectedItem()); + if (changeEnablePane != null) { + zoom.setControlType(controlType.getSelectedItem()); + if (zoom.getControlType() == ControlType.ZOOM) { + zoom.setZoomResize(zoomResize.getSelectedIndex() == 0); + String fromString = from.updateBean(); + Object fromObject; + if (StableUtils.maybeFormula(fromString)) { + fromObject = BaseFormula.createFormulaBuilder().build(fromString); + } else { + fromObject = fromString; + } + zoom.setFrom(fromObject); + String toString = to.updateBean(); + Object toObject; + if (StableUtils.maybeFormula(toString)) { + toObject = BaseFormula.createFormulaBuilder().build(toString); + } else { + toObject = toString; + } + zoom.setTo(toObject); + } else { + if (categoryNum != null) { + zoom.setCategoryNum((int) categoryNum.getValue()); + } + if (scaling != null) { + zoom.setScaling(scaling.updateBean() / PERCENT); + } + } + } } protected ZoomPane createZoomPane() { @@ -380,12 +489,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; - double[] rowSize = {p,p}; + double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{chartAnimationLabel,isChartAnimation} + new Component[]{null, null}, + new Component[]{chartAnimationLabel, isChartAnimation} }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel); } @@ -467,7 +576,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { //图表缩放新设计 恢复用注释。删除下面三行代码。 if (plot.isSupportZoomDirection()) {//支持缩放方向=方向+控件 populateChartZoom((VanChart) chart); - checkZoomPane(); } if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java index 7de7ca3d5..3ed3251d0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java @@ -12,7 +12,7 @@ public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneW //图表缩放新设计 恢复用注释。删除下面方法 createZoomPaneContent。 @Override - protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { + protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, VanChartPlot plot) { JPanel panel = new JPanel(new BorderLayout(0, 4)); panel.add(zoomWidgetPane, BorderLayout.NORTH); panel.add(zoomGesturePane, BorderLayout.CENTER); diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index 1c8c98f42..c7386ed0a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -42,7 +42,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith Component[][] components = new Component[][]{ new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, new Component[]{createAnimationPane(), null}, - new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(plot), null}, new Component[]{createDrillToolsPane(), null}, new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createHyperlinkPane(), null}