Browse Source

CHART-19720 图表缩放控件面板

feature/10.0
白岳 3 years ago
parent
commit
8b0619f9dc
  1. 47
      designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java
  2. 198
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  3. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java
  4. 2
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java

47
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.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.awt.Component;
import java.util.Arrays; import java.util.Arrays;
import java.awt.Component;
/** /**
* 布局 标题+组件 * 布局 标题+组件
@ -21,13 +21,13 @@ import java.util.Arrays;
public class TableLayout4VanChartHelper { public class TableLayout4VanChartHelper {
private static final int SMALL_GAP = 20; private static final int SMALL_GAP = 20;
public static final int EXPANDABLE_PANE_WIDTH =290; public static final int EXPANDABLE_PANE_WIDTH = 290;
public static final int EXPANDABLE_PANE_HIGHT =24; public static final int EXPANDABLE_PANE_HIGHT = 24;
public static final int DESCRIPTION_AREA_WIDTH = 60; 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 SECOND_EDIT_AREA_WIDTH = 143;
public static final int COMPONENT_INTERVAL =12; public static final int COMPONENT_INTERVAL = 12;
public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0,12,0,0); public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0, 12, 0, 0);
public static JPanel createExpandablePaneWithTitleTopGap(String title, JPanel panel) { public static JPanel createExpandablePaneWithTitleTopGap(String title, JPanel panel) {
return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, 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) { public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) {
return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel){ return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) {
protected void setcontentPanelontentPanelBorder (){ protected void setcontentPanelontentPanelBorder() {
getContentPanel().setBorder(BorderFactory.createEmptyBorder(0 ,5, 0, 0)); getContentPanel().setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
} }
}; };
} }
@ -54,13 +54,23 @@ public class TableLayout4VanChartHelper {
return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH); 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) { 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 p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f, componentWidth}; double[] columnSize = {f, componentWidth};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
UILabel label = FRWidgetFactory.createLineWrapLabel(title); UILabel label = FRWidgetFactory.createLineWrapLabel(title);
if (topLabel) {
label.setVerticalAlignment(SwingConstants.TOP); label.setVerticalAlignment(SwingConstants.TOP);
}
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(component)}, new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(component)},
@ -93,60 +103,65 @@ public class TableLayout4VanChartHelper {
/** /**
* 标题布局(二级菜单距左边框46) * 标题布局(二级菜单距左边框46)
*
* @param title 标题 * @param title 标题
* @param component 组件 * @param component 组件
* @return 布局好的组件 * @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); return TableLayout4VanChartHelper.createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN);
} }
/** /**
* 标题布局(二级菜单距左边框46) * 标题布局(二级菜单距左边框46)
*
* @param label 标题label * @param label 标题label
* @param component 组件 * @param component 组件
* @return 布局好的组件 * @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); return TableLayout4VanChartHelper.createTitlePaneWithUILabel(label, component, LayoutConstants.CHART_ATTR_TOMARGIN);
} }
/** /**
* 标题布局(三级菜单距二级左侧20) * 标题布局(三级菜单距二级左侧20)
*
* @param title 标题 * @param title 标题
* @param component 组件 * @param component 组件
* @return 布局好的组件 * @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); return TableLayout4VanChartHelper.createTitlePane(title, component, TableLayout4VanChartHelper.SMALL_GAP);
} }
/** /**
* 标题布局指定gap * 标题布局指定gap
*
* @param title 标题 * @param title 标题
* @param component 组件 * @param component 组件
* @param gap 距左侧距离 * @param gap 距左侧距离
* @return 布局好的组件 * @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); return createTitlePaneWithUILabel(new UILabel(title), component, gap);
} }
/** /**
* 标题布局指定gap * 标题布局指定gap
*
* @param label 标题label * @param label 标题label
* @param component 组件 * @param component 组件
* @param gap 距左侧距离 * @param gap 距左侧距离
* @return 布局好的组件 * @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 p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {gap, f}; double[] columnSize = {gap, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{label,null}, new Component[]{label, null},
new Component[]{null,component}, new Component[]{null, component},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }

198
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.chart.chartglyph.ConditionCollection;
import com.fr.chartx.attr.LargeDataModeType; import com.fr.chartx.attr.LargeDataModeType;
import com.fr.design.formula.TinyFormulaPane; 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.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.UnsignedIntUISpinner;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; 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.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; 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.gantt.attr.AttrGanttLabel;
import com.fr.plugin.chart.map.line.condition.AttrLineEffect; import com.fr.plugin.chart.map.line.condition.AttrLineEffect;
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; 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.plugin.chart.vanchart.VanChart;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.van.chart.custom.component.VanChartHyperLinkPane; 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.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.Dimension;
import java.awt.event.ActionListener;
public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> { public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private static final long serialVersionUID = 8135452818502145597L; private static final long serialVersionUID = 8135452818502145597L;
private static final int AUTO_REFRESH_LEFT_GAP = 18; private static final int AUTO_REFRESH_LEFT_GAP = 18;
private static final double PERCENT = 100.0;
protected UICheckBox isSort; protected UICheckBox isSort;
protected UICheckBox exportImages; protected UICheckBox exportImages;
@ -72,15 +79,20 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private AutoRefreshPane autoRefreshPane; private AutoRefreshPane autoRefreshPane;
//图表缩放新设计 恢复用注释。删除下面八行代码。 //图表缩放新设计 恢复用注释。删除下面八行代码。
private UIButtonGroup zoomWidget; private UICheckBox zoomWidget;
protected UIButtonGroup zoomGesture;//地图手势缩放 protected UIButtonGroup zoomGesture;//地图手势缩放
private UIButtonGroup zoomResize;
private TinyFormulaPane from;
private TinyFormulaPane to;
private UIButtonGroup<String> zoomType; private UIButtonGroup<String> zoomType;
private JPanel changeEnablePane; private JPanel changeEnablePane;
private JPanel zoomTypePane; private JPanel zoomTypePane;
private UIButtonGroup<ControlType> controlType;
protected JPanel centerPane;
private UISpinner categoryNum;
private UINumberDragPane scaling;
private UIButtonGroup zoomResize;
private TinyFormulaPane from;
private TinyFormulaPane to;
//图表缩放新设计 恢复用注释。取消注释。 //图表缩放新设计 恢复用注释。取消注释。
//private ZoomPane zoomPane; //private ZoomPane zoomPane;
@ -126,7 +138,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
//new Component[]{createLargeDataModePane(), null}, //new Component[]{createLargeDataModePane(), null},
new Component[]{createAnimationPane(), null}, new Component[]{createAnimationPane(), null},
new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), 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[]{createAutoRefreshPane(plot), null},
new Component[]{createHyperlinkPane(), null} new Component[]{createHyperlinkPane(), null}
}; };
@ -172,7 +184,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
return false; return false;
} }
protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { protected JPanel createZoomPane(VanChartPlot plot) {
//图表缩放新设计 恢复用注释。取消注释。 //图表缩放新设计 恢复用注释。取消注释。
// zoomPane = createZoomPane(); // zoomPane = createZoomPane();
// if (zoomPane == null) { // if (zoomPane == null) {
@ -184,47 +196,118 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
if (!plot.isSupportZoomDirection()) { if (!plot.isSupportZoomDirection()) {
return null; 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")}); zoomWidget = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Open_Zoom_Control"));
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")}); zoomGesture = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")});
from = new TinyFormulaPane(); JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget);
to = new TinyFormulaPane(); JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture);
zoomType = new UIButtonGroup(getNameArray(), getValueArray()); 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 zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget); JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, plot);
JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture); zoomWidget.addActionListener((event) -> checkZoomPane());
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel);
}
Component[][] components = new Component[][]{ private void createChangeEnablePane(VanChartRectanglePlot plot) {
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Boundary")), zoomResize}, String scroll = Toolkit.i18nText("Fine-Design_Chart_Scroll");
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_From")), from}, String scaleAxis = Toolkit.i18nText("Fine-Design_Chart_Scale_Axis");
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_To")), to}, controlType = new UIButtonGroup<>(new String[]{scroll, scaleAxis}, ControlType.values());
JPanel scaleAxisPane = createScaleAxisPane();
JPanel scrollPane = createScrollPane(plot);
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 f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; 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 = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize);
changeEnablePane.setBorder(BorderFactory.createEmptyBorder(10, 12, 0, 0)); changeEnablePane.setBorder(BorderFactory.createEmptyBorder(5, 12, 0, 0));
zoomTypePane = getzoomTypePane(zoomType);
JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, changeEnablePane, zoomTypePane, plot); controlType.addActionListener((event) -> checkCardPane());
zoomWidget.addActionListener(new ActionListener() { }
@Override
public void actionPerformed(ActionEvent e) { private JPanel createScaleAxisPane() {
checkZoomPane(); 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 //图表缩放新设计 恢复用注释。删除下面八个方法getzoomTypePane createZoomPaneContent
// checkZoomEnabled getNameArray getValueArray checkZoomPane populateChartZoom updateChartZoom。 // checkZoomEnabled getNameArray getValueArray checkZoomPane populateChartZoom updateChartZoom。
protected JPanel getzoomTypePane(UIButtonGroup zoomType) { protected JPanel getZoomTypePane(UIButtonGroup zoomType) {
return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), 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)); JPanel panel = new JPanel(new BorderLayout(0, 4));
if (plot.isSupportZoomCategoryAxis()) {//支持缩放控件 if (plot.isSupportZoomCategoryAxis()) {//支持缩放控件
createChangeEnablePane((VanChartRectanglePlot) plot);
panel.add(zoomWidgetPane, BorderLayout.NORTH); panel.add(zoomWidgetPane, BorderLayout.NORTH);
panel.add(changeEnablePane, BorderLayout.CENTER); panel.add(changeEnablePane, BorderLayout.CENTER);
} }
@ -236,17 +319,18 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
if (zoomWidget != null && axisRotation != null) { if (zoomWidget != null && axisRotation != null) {
if (axisRotation.getSelectedIndex() == 0) { if (axisRotation.getSelectedIndex() == 0) {
//只有开启坐标轴翻转,才需要将缩放控件强制关闭。 //只有开启坐标轴翻转,才需要将缩放控件强制关闭。
zoomWidget.setSelectedIndex(1); zoomWidget.setSelected(false);
} }
checkZoomPane(); checkZoomPane();
zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1); zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1);
} }
checkCardPane();
} }
protected String[] getNameArray() { 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") return new String[]{Toolkit.i18nText("Fine-Design_Chart_X_Axis"), 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")}; , Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), Toolkit.i18nText("Fine-Design_Chart_Use_None")};
} }
protected String[] getValueArray() { protected String[] getValueArray() {
@ -256,9 +340,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
} }
private void checkZoomPane() { private void checkZoomPane() {
boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0; boolean zoomWidgetEnabled = zoomWidget.isSelected();
if (changeEnablePane != null) {
changeEnablePane.setVisible(zoomWidgetEnabled); changeEnablePane.setVisible(zoomWidgetEnabled);
zoomType.setEnabled(!zoomWidgetEnabled); }
zoomTypePane.setVisible(!zoomWidgetEnabled);
} }
private void populateChartZoom(VanChart chart) { private void populateChartZoom(VanChart chart) {
@ -266,8 +352,13 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
if (zoom == null) { if (zoom == null) {
zoom = new VanChartZoom(); zoom = new VanChartZoom();
} }
zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1); zoomWidget.setSelected(zoom.isZoomVisible());
zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1); zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1);
zoomType.setSelectedItem(zoom.getZoomType());
if (changeEnablePane != null) {
controlType.setSelectedItem(zoom.getControlType());
zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1);
if (zoom.getFrom() instanceof BaseFormula) { if (zoom.getFrom() instanceof BaseFormula) {
from.populateBean(((BaseFormula) zoom.getFrom()).getContent()); from.populateBean(((BaseFormula) zoom.getFrom()).getContent());
@ -279,7 +370,13 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
} else { } else {
to.populateBean(Utils.objectToString(zoom.getTo())); to.populateBean(Utils.objectToString(zoom.getTo()));
} }
zoomType.setSelectedItem(zoom.getZoomType()); if (categoryNum != null) {
categoryNum.setValue(zoom.getCategoryNum());
}
if (scaling != null) {
scaling.populateBean(zoom.getScaling() * PERCENT);
}
}
} }
private void updateChartZoom(VanChart chart) { private void updateChartZoom(VanChart chart) {
@ -288,8 +385,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
zoom = new VanChartZoom(); zoom = new VanChartZoom();
chart.setVanChartZoom(zoom); chart.setVanChartZoom(zoom);
} }
zoom.setZoomVisible(zoomWidget.getSelectedIndex() == 0); zoom.setZoomVisible(zoomWidget.isSelected());
zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0); zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0);
zoom.setZoomType(zoomType.getSelectedItem());
if (changeEnablePane != null) {
zoom.setControlType(controlType.getSelectedItem());
if (zoom.getControlType() == ControlType.ZOOM) {
zoom.setZoomResize(zoomResize.getSelectedIndex() == 0); zoom.setZoomResize(zoomResize.getSelectedIndex() == 0);
String fromString = from.updateBean(); String fromString = from.updateBean();
Object fromObject; Object fromObject;
@ -307,7 +408,15 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
toObject = toString; toObject = toString;
} }
zoom.setTo(toObject); zoom.setTo(toObject);
zoom.setZoomType(zoomType.getSelectedItem()); } else {
if (categoryNum != null) {
zoom.setCategoryNum((int) categoryNum.getValue());
}
if (scaling != null) {
zoom.setScaling(scaling.updateBean() / PERCENT);
}
}
}
} }
protected ZoomPane createZoomPane() { protected ZoomPane createZoomPane() {
@ -380,12 +489,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p,p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{chartAnimationLabel,isChartAnimation} 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); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel);
} }
@ -467,7 +576,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
//图表缩放新设计 恢复用注释。删除下面三行代码。 //图表缩放新设计 恢复用注释。删除下面三行代码。
if (plot.isSupportZoomDirection()) {//支持缩放方向=方向+控件 if (plot.isSupportZoomDirection()) {//支持缩放方向=方向+控件
populateChartZoom((VanChart) chart); populateChartZoom((VanChart) chart);
checkZoomPane();
} }
if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) {

2
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java

@ -12,7 +12,7 @@ public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneW
//图表缩放新设计 恢复用注释。删除下面方法 createZoomPaneContent。 //图表缩放新设计 恢复用注释。删除下面方法 createZoomPaneContent。
@Override @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)); JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(zoomWidgetPane, BorderLayout.NORTH); panel.add(zoomWidgetPane, BorderLayout.NORTH);
panel.add(zoomGesturePane, BorderLayout.CENTER); panel.add(zoomGesturePane, BorderLayout.CENTER);

2
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[][]{ Component[][] components = new Component[][]{
new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null},
new Component[]{createAnimationPane(), 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[]{createDrillToolsPane(), null},
new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createAutoRefreshPane(plot), null},
new Component[]{createHyperlinkPane(), null} new Component[]{createHyperlinkPane(), null}

Loading…
Cancel
Save