Browse Source

Merge pull request #1066 in DESIGN/design from ~ZHENG/c-design:refactor/19.4.3 to refactor/19.4.3

* commit 'bdf6cae85e5b0a9de5823f462343327f6c89a297':
  CHART-10225 兼容 折线类型和线宽
  CHART-10225 轴标签重叠策略 兼容
  CHART-10225 兼容 便签重叠策略
  CHART-10225 显示策略 属性兼容
  CHART-10225 图表缩放 兼容
research/11.0
zheng 5 years ago
parent
commit
0e4d0feba9
  1. 15
      designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java
  2. 9
      designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java
  3. 29
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java
  4. 6
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java
  5. 85
      designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java
  6. 99
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java
  7. 25
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java
  8. 173
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  9. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java
  10. 47
      designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java
  11. 224
      designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java
  12. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java
  13. 48
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  14. 19
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java
  15. 45
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  16. 172
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  17. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java
  18. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java
  19. 85
      designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java
  20. 64
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  21. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  22. 8
      designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java
  23. 25
      designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java
  24. 15
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java
  25. 26
      designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java
  26. 13
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java

15
designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java

@ -1,5 +1,6 @@
package com.fr.van.chart.bar; package com.fr.van.chart.bar;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
@ -9,7 +10,9 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.van.chart.column.VanChartColumnConditionPane; import com.fr.van.chart.column.VanChartColumnConditionPane;
import com.fr.van.chart.column.VanChartColumnSeriesPane; import com.fr.van.chart.column.VanChartColumnSeriesPane;
import com.fr.van.chart.designer.other.VanChartInteractivePane;
import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.VanChartOtherPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI;
@ -41,7 +44,17 @@ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanCha
*/ */
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){
VanChartStylePane stylePane = new VanChartBarStylePane(listener); VanChartStylePane stylePane = new VanChartBarStylePane(listener);
VanChartOtherPane otherPane = new VanChartOtherPane(); VanChartOtherPane otherPane = new VanChartOtherPane() {
@Override
protected BasicBeanPane<Chart> createInteractivePane() {
return new VanChartInteractivePane() {
@Override
protected ZoomPane createZoomPane() {
return new ZoomPane();
}
};
}
};
return new AbstractChartAttrPane[]{stylePane, otherPane}; return new AbstractChartAttrPane[]{stylePane, otherPane};
} }

9
designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java

@ -14,7 +14,9 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.van.chart.bubble.data.VanChartBubblePlotTableDataContentPane; import com.fr.van.chart.bubble.data.VanChartBubblePlotTableDataContentPane;
import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort;
import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.VanChartOtherPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI;
@ -70,7 +72,12 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh
VanChartStylePane stylePane = new VanChartBubbleStylePane(listener); VanChartStylePane stylePane = new VanChartBubbleStylePane(listener);
VanChartOtherPane otherPane = new VanChartOtherPane(){ VanChartOtherPane otherPane = new VanChartOtherPane(){
protected BasicBeanPane<Chart> createInteractivePane() { protected BasicBeanPane<Chart> createInteractivePane() {
return new VanChartBubbleInteractivePane(); return new VanChartInteractivePaneWithOutSort() {
@Override
protected ZoomPane createZoomPane() {
return new ZoomPane();
}
};
} }
}; };
return new AbstractChartAttrPane[]{stylePane, otherPane}; return new AbstractChartAttrPane[]{stylePane, otherPane};

29
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java

@ -1,29 +0,0 @@
package com.fr.van.chart.bubble;
import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort;
/**
* Created by Mitisky on 16/3/31.
*/
public class VanChartBubbleInteractivePane extends VanChartInteractivePaneWithOutSort {
protected String[] getNameArray() {
Plot plot = chart.getPlot();
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) {
return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")};
}
return super.getNameArray();
}
protected String[] getValueArray() {
Plot plot = chart.getPlot();
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) {
return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE};
}
return super.getValueArray();
}
}

6
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java

@ -6,10 +6,9 @@ import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chartx.attr.ZoomAttribute;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.bubble.BubbleIndependentVanChart; import com.fr.plugin.chart.bubble.BubbleIndependentVanChart;
import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel;
@ -145,8 +144,7 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
*/ */
@Override @Override
protected void resetChartAttr4SamePlot(Chart chart){ protected void resetChartAttr4SamePlot(Chart chart){
VanChartZoom vanChartZoom = new VanChartZoom(); ((VanChart) chart).setZoomAttribute(new ZoomAttribute());
((VanChart)chart).setVanChartZoom(vanChartZoom);
//重置监控刷新选项 //重置监控刷新选项
resetRefreshMoreLabelAttr((VanChart)chart); resetRefreshMoreLabelAttr((VanChart)chart);
} }

85
designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java

@ -0,0 +1,85 @@
package com.fr.van.chart.designer.component;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.general.FRFont;
import com.fr.plugin.chart.type.LineType;
import com.fr.stable.Constants;
import javax.swing.JLabel;
import javax.swing.JList;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* Created by shine on 2019/08/30.
*/
public class LineTypeComboBox extends UIComboBox {
public LineTypeComboBox(LineType[] lineType) {
super(lineType);
this.setRenderer(new CellRenderer());
}
private class CellRenderer extends UIComboBoxRenderer {
private LineType lineType;
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
this.lineType = (LineType) value;
comp.setText(null);
return comp;
}
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
g2d.setColor(getForeground());
switch (this.lineType) {
case NONE:
FRFont font = FRContext.getDefaultValues().getFRFont();
int resolution = ScreenResolution.getScreenResolution();
Font rfont = font.applyResolutionNP(resolution);
g2d.setFont(rfont);
FontMetrics fm = GraphHelper.getFontMetrics(rfont);
GraphHelper.drawString(g2d, Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent());
break;
case NORMAL:
GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2);
break;
case DASH:
GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2, Constants.LINE_DASH);
break;
default:
break;
}
}
public Dimension getPreferredSize() {
return new Dimension(60, 16);
}
public Dimension getMinimumSize() {
return getPreferredSize();
}
}
}

99
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java

@ -2,21 +2,24 @@ package com.fr.van.chart.designer.component;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox;
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.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.type.LineStyle; import com.fr.plugin.chart.type.LineStyle;
import com.fr.stable.Constants; import com.fr.plugin.chart.type.LineType;
import com.fr.stable.CoreConstants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
/** /**
* line相关设置 * line相关设置
@ -24,64 +27,99 @@ import java.awt.Component;
public class VanChartLineTypePane extends BasicPane { public class VanChartLineTypePane extends BasicPane {
private static final long serialVersionUID = -6581862503009962973L; private static final long serialVersionUID = -6581862503009962973L;
protected LineComboBox lineWidth;//线型 private LineTypeComboBox lineTypeComboBox;//线型
private UISpinner lineWidthSpinner;//线宽
protected UIButtonGroup<LineStyle> lineStyle;//形态 protected UIButtonGroup<LineStyle> lineStyle;//形态
protected UIButtonGroup nullValueBreak;//空值断开 private UIButtonGroup nullValueBreak;//空值断开
public VanChartLineTypePane() { public VanChartLineTypePane() {
lineWidth = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH});
lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2);
createLineStyle(); createLineStyle();
nullValueBreak = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); nullValueBreak = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")});
lineTypeComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkLineWidth();
}
});
this.setLayout(new BorderLayout());
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
this.add(createContentPane(p, f), BorderLayout.CENTER); double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
Component[] lineTypeComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineTypeComboBox},
lineWidthComponent = new Component[]{
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")),
UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)},
lineStyleComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle},
nullValueBreakComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak};
Component[][] components = createContentComponent(lineTypeComponent, lineWidthComponent, lineStyleComponent, nullValueBreakComponent);
double[] row = new double[components.length];
Arrays.fill(row, p);
double[] col = {f, e};
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout());
this.add(contentPane, BorderLayout.CENTER);
}
private JPanel createTypeAndWidthPane() {
//todo@shinerefactor:当前兼容工作到这边,因为finekit和移动端,暂停
JPanel panel = new JPanel(new BorderLayout(0, 6));
return panel;
} }
protected void createLineStyle() { protected void createLineStyle() {
String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Normal_Line"), String[] textArray = new String[]{Toolkit.i18nText("Fine-Design_Chart_Normal_Line"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_StepLine"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; Toolkit.i18nText("Fine-Design_Chart_StepLine"), Toolkit.i18nText("Fine-Design_Chart_CurveLine")};
lineStyle = new UIButtonGroup<LineStyle>(textArray, LineStyle.values()); lineStyle = new UIButtonGroup<LineStyle>(textArray, LineStyle.values());
} }
protected JPanel createContentPane(double p, double f) { protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent,
double[] row = {p, p, p, p}; Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; return new Component[][]{
double[] col = {f, e};
Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{ lineTypeComponent,
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidthComponent,
UIComponentUtils.wrapWithBorderLayoutPane(lineWidth) lineStyleComponent,
}, nullValueBreakComponent
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")),lineStyle},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")),nullValueBreak},
}; };
}
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); private void checkLineWidth() {
if (lineWidthSpinner != null && lineTypeComboBox != null) {
lineWidthSpinner.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(), LineType.NONE));
}
} }
public void checkLarge(boolean large){ public void checkLarge(boolean large){
if(large){ if(large){
lineWidth.setSelectedLineStyle(Constants.LINE_NONE); lineTypeComboBox.setSelectedItem(LineType.NONE);
} }
lineWidth.setEnabled(!large); lineTypeComboBox.setEnabled(!large);
lineStyle.setEnabled(!large); lineStyle.setEnabled(!large);
} }
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line"); return Toolkit.i18nText("Fine-Design_Chart_Line");
} }
public void populate(VanChartAttrLine line) { public void populate(VanChartAttrLine line) {
if (line == null) { if (line == null) {
line = initVanChartAttrLine(); line = initVanChartAttrLine();
} }
lineWidth.setSelectedLineStyle(line.getLineWidth()); lineTypeComboBox.setSelectedItem(line.getLineType());
lineWidthSpinner.setValue(line.getLineWidth());
lineStyle.setSelectedItem(line.getLineStyle()); lineStyle.setSelectedItem(line.getLineStyle());
nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1); nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1);
} }
@ -92,7 +130,8 @@ public class VanChartLineTypePane extends BasicPane {
public VanChartAttrLine update() { public VanChartAttrLine update() {
VanChartAttrLine line = new VanChartAttrLine(); VanChartAttrLine line = new VanChartAttrLine();
line.setLineWidth(lineWidth.getSelectedLineStyle()); line.setLineType((LineType) lineTypeComboBox.getSelectedItem());
line.setLineWidth(lineWidthSpinner.getValue());
line.setLineStyle(lineStyle.getSelectedItem()); line.setLineStyle(lineStyle.getSelectedItem());
line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0); line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0);
return line; return line;

25
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java

@ -1,30 +1,19 @@
package com.fr.van.chart.designer.component; package com.fr.van.chart.designer.component;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.Component; import java.awt.Component;
/** /**
* 线-线型 * 线型+线宽+空值断开
*/ */
public class VanChartLineWidthPane extends VanChartLineTypePane { public class VanChartLineWidthPane extends VanChartLineTypePane {
private static final long serialVersionUID = 4537158946119294689L; private static final long serialVersionUID = 4537158946119294689L;
protected JPanel createContentPane(double p, double f) { @Override
double[] row = {p, p, p}; protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; return new Component[][]{
double[] col = {f, e}; lineTypeComponent,
lineWidthComponent,
Component[][] components = new Component[][]{ nullValueBreakComponent
new Component[]{null,null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak},
}; };
return TableLayoutHelper.createTableLayoutPane(components, row, col);
} }
} }

173
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java

@ -1,40 +1,28 @@
package com.fr.van.chart.designer.other; package com.fr.van.chart.designer.other;
import com.fr.base.BaseFormula;
import com.fr.base.Utils;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.formula.TinyFormulaPane;
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.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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.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;
import com.fr.plugin.chart.axis.type.AxisPlotType; import com.fr.plugin.chart.axis.type.AxisPlotType;
import com.fr.plugin.chart.base.RefreshMoreLabel; import com.fr.plugin.chart.base.RefreshMoreLabel;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StableUtils;
import com.fr.van.chart.custom.component.VanChartHyperLinkPane; import com.fr.van.chart.custom.component.VanChartHyperLinkPane;
import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> { public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
@ -53,14 +41,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private AutoRefreshPane autoRefreshPane; private AutoRefreshPane autoRefreshPane;
private UIButtonGroup zoomWidget; private ZoomPane zoomPane;
protected UIButtonGroup zoomGesture;//地图手势缩放
private UIButtonGroup zoomResize;
private TinyFormulaPane from;
private TinyFormulaPane to;
private UIButtonGroup<String> zoomType;
private JPanel changeEnablePane;
private JPanel zoomTypePane;
protected VanChartHyperLinkPane superLink; protected VanChartHyperLinkPane superLink;
@ -111,54 +92,15 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
} }
protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) {
if (!plot.isSupportZoomDirection()) { zoomPane = createZoomPane();
if (zoomPane == null) {
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")}); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), zoomPane);
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();
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")});
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);
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},
};
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
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();
}
});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel);
}
protected JPanel getzoomTypePane(UIButtonGroup zoomType) {
return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType);
} }
protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { protected ZoomPane createZoomPane() {
JPanel panel = new JPanel(new BorderLayout(0, 4)); return null;
if (plot.isSupportZoomCategoryAxis()) {//支持缩放控件
panel.add(zoomWidgetPane, BorderLayout.NORTH);
panel.add(changeEnablePane, BorderLayout.CENTER);
}
panel.add(zoomTypePane, BorderLayout.SOUTH);
return panel;
} }
private JPanel createAxisRotationPane(double[] row, double[] col, VanChartPlot plot){ private JPanel createAxisRotationPane(double[] row, double[] col, VanChartPlot plot){
@ -167,12 +109,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
} }
axisRotation = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), axisRotation = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")});
axisRotation.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
checkZoomEnabled();
}
});
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Reversal")),axisRotation} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Reversal")),axisRotation}
@ -181,28 +118,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis"), panel);
} }
private void checkZoomEnabled() {
if (zoomWidget != null && axisRotation != null) {
if (axisRotation.getSelectedIndex() == 0) {
//只有开启坐标轴翻转,才需要将缩放控件强制关闭。
zoomWidget.setSelectedIndex(1);
}
checkZoomPane();
zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1);
}
}
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")};
}
protected String[] getValueArray() {
return new String[]{VanChartConstants.ZOOM_TYPE_X, VanChartConstants.ZOOM_TYPE_Y
,VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE};
}
protected JPanel createToolBarPane(double[] row, double[] col){ protected JPanel createToolBarPane(double[] row, double[] col){
isSort = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sort")); isSort = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sort"));
@ -263,27 +178,21 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
} }
private void checkZoomPane() {
boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0;
changeEnablePane.setVisible(zoomWidgetEnabled);
zoomType.setEnabled(!zoomWidgetEnabled);
}
@Override @Override
public void populateBean(Chart chart) { public void populateBean(Chart chart) {
if (chart == null || chart.getPlot() == null) { if (chart == null || chart.getPlot() == null) {
return; return;
} }
this.chart = chart; this.chart = chart;
VanChartPlot plot = (VanChartPlot)chart.getPlot(); VanChartPlot plot = chart.getPlot();
if(interactivePane == null){ if(interactivePane == null){
this.remove(leftcontentPane); this.remove(leftcontentPane);
reLayoutContentPane(plot); reLayoutContentPane(plot);
} }
if(plot.isSupportZoomDirection()){//支持缩放方向=方向+控件
populateChartZoom((VanChart)chart); if (zoomPane != null) {
checkZoomPane(); zoomPane.populateBean(((VanChart) chart).getZoomAttribute());
} }
if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE){ if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE){
@ -295,8 +204,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
populateAutoRefresh((VanChart)chart); populateAutoRefresh((VanChart)chart);
populateHyperlink(plot); populateHyperlink(plot);
checkZoomEnabled();
} }
@ -312,27 +219,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
collapse.setSelected(vanChartTools.isHidden()); collapse.setSelected(vanChartTools.isHidden());
} }
private void populateChartZoom(VanChart chart) {
VanChartZoom zoom = chart.getVanChartZoom();
if(zoom == null){
zoom = new VanChartZoom();
}
zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1);
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());
}
private void populateChartAxisRotation(VanChartPlot plot) { private void populateChartAxisRotation(VanChartPlot plot) {
axisRotation.setSelectedIndex(plot.isAxisRotation() ? 0 : 1); axisRotation.setSelectedIndex(plot.isAxisRotation() ? 0 : 1);
} }
@ -366,11 +252,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
return; return;
} }
VanChartPlot plot = (VanChartPlot)chart.getPlot(); VanChartPlot plot = chart.getPlot();
if(plot.isSupportZoomDirection()){ if (zoomPane != null) {
updateChartZoom((VanChart)chart); ((VanChart) chart).setZoomAttribute(zoomPane.updateBean());
} }
if(plot.getAxisPlotType() == AxisPlotType.RECTANGLE){ if(plot.getAxisPlotType() == AxisPlotType.RECTANGLE){
updateChartAxisRotation((VanChart)chart); updateChartAxisRotation((VanChart)chart);
} }
@ -393,34 +280,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
chart.setVanChartTools(vanChartTools); chart.setVanChartTools(vanChartTools);
} }
private void updateChartZoom(VanChart chart) {
VanChartZoom zoom = chart.getVanChartZoom();
if(zoom == null){
zoom = new VanChartZoom();
chart.setVanChartZoom(zoom);
}
zoom.setZoomVisible(zoomWidget.getSelectedIndex() == 0);
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());
}
private void updateChartAxisRotation(VanChart chart) { private void updateChartAxisRotation(VanChart chart) {
//坐标轴和plot都需要这个属性,因为坐标轴和plot是分开画的 //坐标轴和plot都需要这个属性,因为坐标轴和plot是分开画的
VanChartPlot plot = (VanChartPlot) chart.getPlot(); VanChartPlot plot = (VanChartPlot) chart.getPlot();

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

@ -1,19 +1,15 @@
package com.fr.van.chart.designer.other; package com.fr.van.chart.designer.other;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.van.chart.designer.other.zoom.MapZoomPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/** /**
* Created by mengao on 2017/4/7. * Created by mengao on 2017/4/7.
*/ */
public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneWithOutSort { public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneWithOutSort {
@Override @Override
protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { protected ZoomPane createZoomPane() {
JPanel panel = new JPanel(new BorderLayout(0, 4)); return new MapZoomPane();
panel.add(zoomWidgetPane, BorderLayout.NORTH);
panel.add(zoomGesturePane, BorderLayout.CENTER);
return panel;
} }
} }

47
designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java

@ -0,0 +1,47 @@
package com.fr.van.chart.designer.other.zoom;
import com.fr.chartx.attr.ZoomAttribute;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import java.awt.Component;
/**
* Created by shine on 2019/08/28.
*/
public class MapZoomPane extends ZoomPane {
private UIButtonGroup<Boolean> mapZoomWidget;//地图缩放控件
private UIButtonGroup<Boolean> gestureZoomGroup;//地图手势缩放
@Override
protected Component[][] getSouthComps() {
mapZoomWidget = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open")
, Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false});
gestureZoomGroup = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open")
, Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false});
return new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget")), mapZoomWidget},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_ZoomGesture")), gestureZoomGroup}
};
}
@Override
public void populateBean(ZoomAttribute ob) {
super.populateBean(ob);
mapZoomWidget.setSelectedItem(ob.isMapZoomWidget());
gestureZoomGroup.setSelectedItem(ob.isGestureZoom());
}
@Override
public ZoomAttribute updateBean() {
ZoomAttribute zoomAttribute = super.updateBean();
zoomAttribute.setMapZoomWidget(mapZoomWidget.getSelectedItem());
zoomAttribute.setGestureZoom(gestureZoomGroup.getSelectedItem());
return zoomAttribute;
}
}

224
designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java

@ -0,0 +1,224 @@
package com.fr.van.chart.designer.other.zoom;
import com.fr.chartx.attr.ZoomAttribute;
import com.fr.chartx.attr.ZoomInitialDisplayType;
import com.fr.chartx.attr.ZoomModeType;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
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.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.extended.chart.StringFormula;
import com.fr.general.ComparatorUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
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.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
/**
* Created by shine on 2019/08/28.
*/
public class ZoomPane extends BasicBeanPane<ZoomAttribute> {
private UIButtonGroup<ZoomModeType> modeTypeButtonGroup;
private JPanel customModePane;
private UIComboBox initialDisplayTypeComboBox;
private JPanel initialDisplayCardPane;
private UISpinner topCategorySpinner;
private TinyFormulaPane leftFormulaPane;
private TinyFormulaPane rightFormulaPane;
private UIButtonGroup<Boolean> selectionZoomGroup;
public ZoomPane() {
initComponent();
}
private void initComponent() {
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double p = TableLayout.PREFERRED;
double[] columnSize = {f, e};
JPanel northPane = createNorthPane(f, p);
initCustomModePane(columnSize, p);
JPanel southPane = createSouthPane(f, p);
this.setLayout(new BorderLayout(0, 6));
if (northPane != null) {
this.add(northPane, BorderLayout.NORTH);
}
if (customModePane != null) {
this.add(customModePane, BorderLayout.CENTER);
}
if (southPane != null) {
this.add(southPane, BorderLayout.SOUTH);
}
}
protected JPanel createNorthPane(double f, double p) {
modeTypeButtonGroup = new UIButtonGroup<ZoomModeType>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"),
Toolkit.i18nText("Fine-Design_Chart_Mode_Custom"),
Toolkit.i18nText("Fine-Design_Chart_Close")
}, new ZoomModeType[]{ZoomModeType.AUTO, ZoomModeType.CUSTOM, ZoomModeType.CLOSE});
modeTypeButtonGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
checkCustomModePane();
}
});
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Mode_type")), modeTypeButtonGroup}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p}
, new double[]{f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH});
}
private JPanel createSouthPane(double f, double p) {
Component[][] components = getSouthComps();
double[] rows = new double[components.length];
Arrays.fill(rows, p);
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rows
, new double[]{f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH});
}
protected Component[][] getSouthComps() {
selectionZoomGroup = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open")
, Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false});
return new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Selection_Zoom")), selectionZoomGroup}
};
}
protected void initCustomModePane(double[] columnSize, double p) {
initialDisplayTypeComboBox = new UIComboBox(new ZoomInitialDisplayType[]{
ZoomInitialDisplayType.TOP_CATEGORY,
ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY});
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_InitialDisplay")), initialDisplayTypeComboBox}
};
JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p}, columnSize);
initInitialDisplayCardPane(columnSize, p);
customModePane = new JPanel(new BorderLayout(0, 6));
customModePane.add(northPane, BorderLayout.NORTH);
customModePane.add(initialDisplayCardPane, BorderLayout.CENTER);
customModePane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
}
private void initInitialDisplayCardPane(double[] columnSize, double p) {
topCategorySpinner = new UISpinner(1, Integer.MAX_VALUE, 1);
Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category_Number")), topCategorySpinner}
};
final JPanel topPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components1, new double[]{p}, columnSize);
leftFormulaPane = new TinyFormulaPane();
rightFormulaPane = new TinyFormulaPane();
Component[][] components2 = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Left_Boundary")), leftFormulaPane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Right_Boundary")), rightFormulaPane}
};
final JPanel leftRightPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components2, new double[]{p, p}, columnSize);
initialDisplayCardPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
return initialDisplayTypeComboBox.getSelectedIndex() == 0 ? topPane.getPreferredSize() : leftRightPane.getPreferredSize();
}
};
initialDisplayCardPane.add(topPane, ZoomInitialDisplayType.TOP_CATEGORY.toString());
initialDisplayCardPane.add(leftRightPane, ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY.toString());
initialDisplayTypeComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkInitialDisplayCardPane();
}
});
}
private void checkCustomModePane() {
customModePane.setVisible(modeTypeButtonGroup.getSelectedItem() == ZoomModeType.CUSTOM);
}
private void checkInitialDisplayCardPane() {
CardLayout cardLayout = (CardLayout) initialDisplayCardPane.getLayout();
if (ComparatorUtils.equals(initialDisplayTypeComboBox.getSelectedItem(), ZoomInitialDisplayType.TOP_CATEGORY)) {
cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.TOP_CATEGORY.toString());
} else {
cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY.toString());
}
}
@Override
public void populateBean(ZoomAttribute ob) {
modeTypeButtonGroup.setSelectedItem(ob.getModeType());
initialDisplayTypeComboBox.setSelectedItem(ob.getInitialDisplayType());
topCategorySpinner.setValue(ob.getTopCategory());
if (ob.getLeft() != null) {
leftFormulaPane.populateBean(ob.getLeft().getContent());
}
if (ob.getRight() != null) {
rightFormulaPane.populateBean(ob.getRight().getContent());
}
selectionZoomGroup.setSelectedItem(ob.isSelectionZoom());
checkInitialDisplayCardPane();
checkCustomModePane();
}
@Override
public ZoomAttribute updateBean() {
ZoomAttribute zoomAttribute = new ZoomAttribute();
zoomAttribute.setModeType(modeTypeButtonGroup.getSelectedItem());
zoomAttribute.setInitialDisplayType((ZoomInitialDisplayType) initialDisplayTypeComboBox.getSelectedItem());
zoomAttribute.setTopCategory((int) topCategorySpinner.getValue());
zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean()));
zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean()));
zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem());
return zoomAttribute;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java

@ -0,0 +1,17 @@
package com.fr.van.chart.designer.other.zoom;
import javax.swing.JPanel;
/**
* Created by shine on 2019/08/28.
*/
public class ZoomPaneWithOutMode extends ZoomPane {
@Override
protected JPanel createNorthPane(double f, double p) {
return null;
}
@Override
protected void initCustomModePane(double[] columnSize, double p) {
}
}

48
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -8,12 +8,11 @@ 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.ilable.UILabel; 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.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -21,8 +20,8 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.VanChartFloatPositionPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane; import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane;
import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane;
import com.fr.van.chart.designer.style.component.LimitPane;
import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -55,11 +54,8 @@ public class VanChartPlotLegendPane extends BasicPane {
protected UIButtonGroup<Integer> location; protected UIButtonGroup<Integer> location;
protected UIToggleButton customFloatPositionButton; protected UIToggleButton customFloatPositionButton;
protected VanChartFloatPositionPane customFloatPositionPane; protected VanChartFloatPositionPane customFloatPositionPane;
protected UIButtonGroup<Integer> limitSize;
protected UISpinner maxProportion;
private UILabel limitSizeTitle;
private JPanel maxProportionPane;
private LimitPane limitPane;
//高亮显示的按钮 //高亮显示的按钮
protected UIButtonGroup<Boolean> highlightButton; protected UIButtonGroup<Boolean> highlightButton;
@ -232,25 +228,8 @@ public class VanChartPlotLegendPane extends BasicPane {
} }
protected JPanel createDisplayStrategy(){ protected JPanel createDisplayStrategy(){
maxProportion = new UISpinner(0,100,1,30); limitPane = new LimitPane(false);
limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); return limitPane;
limitSizeTitle = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"));
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),limitSize);
maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion,TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER);
limitSize.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse();
}
});
return panel;
} }
private JPanel createHighlightPane(){ private JPanel createHighlightPane(){
@ -276,15 +255,8 @@ public class VanChartPlotLegendPane extends BasicPane {
//检查显示策略界面是否可用 //检查显示策略界面是否可用
protected void checkDisplayStrategyUse() { protected void checkDisplayStrategyUse() {
limitSize.setEnabled(!customFloatPositionButton.isSelected()); GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected());
checkMaxProPortionUse(); limitPane.checkMaxProPortionUse();
}
//检查最大显示占比是否可用
private void checkMaxProPortionUse() {
maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
} }
protected void checkBoxUse() { protected void checkBoxUse() {
@ -315,8 +287,7 @@ public class VanChartPlotLegendPane extends BasicPane {
legend.setPosition(-1); legend.setPosition(-1);
} }
legend.setFloating(customFloatPositionButton.isSelected()); legend.setFloating(customFloatPositionButton.isSelected());
legend.setLimitSize(limitSize.getSelectedIndex() == 0); legend.setLimitAttribute(limitPane.updateBean());
legend.setMaxHeight(maxProportion.getValue());
legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x());
legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y());
if(highlightButton != null && highlightButton.getSelectedItem() != null){ if(highlightButton != null && highlightButton.getSelectedItem() != null){
@ -336,8 +307,7 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionButton.setSelected(legend.isFloating());
customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX());
customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY());
limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1); limitPane.populateBean(legend.getLimitAttribute());
maxProportion.setValue(legend.getMaxHeight());
if(highlightButton != null){ if(highlightButton != null){
highlightButton.setSelectedItem(legend.isHighlight()); highlightButton.setSelectedItem(legend.isHighlight());
} }

19
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java

@ -192,26 +192,13 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
public void populateBean(VanChartLegend legend) { public void populateBean(VanChartLegend legend) {
VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend; VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend;
if (scatterLegend != null) { if (scatterLegend != null) {
isLegendVisible.setSelected(scatterLegend.isLegendVisible());
textAttrPane.populate(scatterLegend.getFRFont()); super.populateBean(scatterLegend);
borderPane.populate(scatterLegend);
backgroundPane.populate(scatterLegend);
if(!scatterLegend.isFloating()){
location.setSelectedItem(scatterLegend.getPosition());
}
customFloatPositionButton.setSelected(scatterLegend.isFloating());
customFloatPositionPane.setFloatPosition_x(scatterLegend.getFloatPercentX());
customFloatPositionPane.setFloatPosition_y(scatterLegend.getFloatPercentY());
limitSize.setSelectedIndex(scatterLegend.isLimitSize() ? 0 : 1);
maxProportion.setValue(scatterLegend.getMaxHeight());
//范围图例部分 //范围图例部分
legendTypeButton.setSelectedItem(scatterLegend.getLegendType()); legendTypeButton.setSelectedItem(scatterLegend.getLegendType());
gradualLegendPane.populate(scatterLegend.getGradualLegend()); gradualLegendPane.populate(scatterLegend.getGradualLegend());
sectionLegendPane.populate(scatterLegend.getSectionLegend()); sectionLegendPane.populate(scatterLegend.getSectionLegend());
if(highlightButton != null){
highlightButton.setSelectedItem(legend.isHighlight());
}
} }
checkAllUse(); checkAllUse();
this.checkHighlightVisible(); this.checkHighlightVisible();

45
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -11,12 +11,11 @@ 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.ilable.UILabel; 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.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartTitle; import com.fr.plugin.chart.attr.VanChartTitle;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
@ -27,8 +26,8 @@ import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.VanChartFloatPositionPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutShadowWithRadiusPane; import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutShadowWithRadiusPane;
import com.fr.van.chart.designer.style.component.LimitPane;
import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
@ -60,9 +59,8 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private UIToggleButton useHtml; private UIToggleButton useHtml;
private UIToggleButton customFloatPositionButton; private UIToggleButton customFloatPositionButton;
private VanChartFloatPositionPane customFloatPositionPane; private VanChartFloatPositionPane customFloatPositionPane;
private UIButtonGroup<Integer> limitSize;
private UISpinner maxProportion; private LimitPane limitPane;
private JPanel maxProportionPane;
protected VanChartStylePane parent; protected VanChartStylePane parent;
@ -171,24 +169,8 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} }
private JPanel createDisplayStrategy(){ private JPanel createDisplayStrategy(){
maxProportion = new UISpinner(0,100,1,30); limitPane = new LimitPane();
limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); return limitPane;
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),limitSize);
maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER);
limitSize.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse();
}
});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel);
} }
private void initPositionListener(){ private void initPositionListener(){
@ -250,15 +232,10 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
//检查显示策略界面是否可用 //检查显示策略界面是否可用
private void checkDisplayStrategyUse() { private void checkDisplayStrategyUse() {
limitSize.setEnabled(!customFloatPositionButton.isSelected()); GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected());
checkMaxProPortionUse(); limitPane.checkMaxProPortionUse();
} }
//检查最大显示占比是否可用
private void checkMaxProPortionUse() {
maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
}
/** /**
* 弹出框的界面标题 * 弹出框的界面标题
@ -301,8 +278,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
customFloatPositionButton.setSelected(title.isFloating()); customFloatPositionButton.setSelected(title.isFloating());
customFloatPositionPane.setFloatPosition_x(title.getFloatPercentX()); customFloatPositionPane.setFloatPosition_x(title.getFloatPercentX());
customFloatPositionPane.setFloatPosition_y(title.getFloatPercentY()); customFloatPositionPane.setFloatPosition_y(title.getFloatPercentY());
limitSize.setSelectedIndex(title.isLimitSize() ? 0 : 1); limitPane.populateBean(title.getLimitAttribute());
maxProportion.setValue(title.getMaxHeight());
checkAllUse(); checkAllUse();
} }
@ -335,8 +311,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} }
title.setUseHtml(useHtml.isSelected()); title.setUseHtml(useHtml.isSelected());
title.setFloating(customFloatPositionButton.isSelected()); title.setFloating(customFloatPositionButton.isSelected());
title.setLimitSize(limitSize.getSelectedIndex() == 0); title.setLimitAttribute(limitPane.updateBean());
title.setMaxHeight(maxProportion.getValue());
title.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); title.setFloatPercentX(customFloatPositionPane.getFloatPosition_x());
title.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); title.setFloatPercentY(customFloatPositionPane.getFloatPosition_y());
textAttrPane.update(textAttr); textAttrPane.update(textAttr);

172
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -13,8 +13,8 @@ import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
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.itextfield.UITextField;
import com.fr.design.gui.style.FormatPane; import com.fr.design.gui.style.FormatPane;
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.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
@ -23,19 +23,24 @@ import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; 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.base.OverlapHandleType;
import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.type.AxisTickLineType; import com.fr.plugin.chart.type.AxisTickLineType;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.component.LimitPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
@ -58,10 +63,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected UIButtonGroup showLabel; protected UIButtonGroup showLabel;
protected ChartTextAttrPane labelTextAttrPane; protected ChartTextAttrPane labelTextAttrPane;
protected UINumberDragPane labelTextRotation; protected UINumberDragPane labelTextRotation;
private UIButtonGroup<OverlapHandleType> overlapHandleTypeGroup;
protected UIButtonGroup<Integer> labelGapStyle; protected UIButtonGroup<Integer> labelGapStyle;
protected UITextField labelGapValue; protected UISpinner labelGapValue;
protected JPanel labelPanel;
protected JPanel labelPanel;
private JPanel labelGapStylePane;
private JPanel labelGapValuePane;
protected LineComboBox axisLineStyle; protected LineComboBox axisLineStyle;
protected ColorSelectBox axisLineColor; protected ColorSelectBox axisLineColor;
@ -71,15 +80,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected UIButtonGroup<Integer> position; protected UIButtonGroup<Integer> position;
protected UIButtonGroup<Boolean> reversed; protected UIButtonGroup<Boolean> reversed;
protected UIButtonGroup<Integer> axisLimitSize; private LimitPane limitPane;
protected UISpinner maxProportion;
protected JPanel maxProportionPane;
protected UIButtonGroup valueFormatStyle; protected UIButtonGroup valueFormatStyle;
protected FormatPane valueFormat; protected FormatPane valueFormat;
protected JPanel centerPane; protected JPanel centerPane;
private VanChartHtmlLabelPane htmlLabelPane; private VanChartHtmlLabelPane htmlLabelPane;
private JPanel labelGapValuePane;
public VanChartBaseAxisPane(){ public VanChartBaseAxisPane(){
this(true); this(true);
@ -166,32 +172,22 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected JPanel createLabelPane(double[] row, double[] col){ protected JPanel createLabelPane(double[] row, double[] col){
double p = TableLayout.PREFERRED;
showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")});
labelTextAttrPane = getChartTextAttrPane(); labelTextAttrPane = getChartTextAttrPane();
labelTextRotation = new UINumberDragPane(-ROTATION_MAX,ROTATION_MAX); JPanel rotationPane = createLabelRotationPane(col);
labelGapStyle = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); JPanel overlapPane = createLabelOverlapPane();
labelGapValue = new UITextField();
Component[][] gapComponents = new Component[][]{
new Component[]{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")),
UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation)
},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle},
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col);
labelGapValuePane= TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText(""),labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
JPanel gapPanel = new JPanel(new BorderLayout());
gapPanel.add(panel, BorderLayout.CENTER);
gapPanel.add(labelGapValuePane, BorderLayout.SOUTH);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{labelTextAttrPane, null}, new Component[]{labelTextAttrPane, null},
new Component[]{gapPanel,null}, new Component[]{rotationPane, null},
new Component[]{overlapPane, null},
}; };
JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel); JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel);
labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, col);
labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0));
showLabel.addActionListener(new ActionListener() { showLabel.addActionListener(new ActionListener() {
@Override @Override
@ -199,16 +195,61 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
checkLabelPane(); checkLabelPane();
} }
}); });
JPanel jPanel = new JPanel(new BorderLayout());
jPanel.add(showLabelPane, BorderLayout.NORTH);
jPanel.add(labelPanel, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel);
}
private JPanel createLabelRotationPane(double[] col) {
labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX);
Component[][] gapComponents = new Component[][]{
new Component[]{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")),
UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation)
}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, new double[]{TableLayout.PREFERRED}, col);
}
private JPanel createLabelOverlapPane() {
labelGapStyle = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")});
labelGapStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_Interval"), labelGapStyle, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
labelGapValue = new UISpinner(0, Integer.MAX_VALUE, 1, 1);
labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(StringUtils.EMPTY, labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
JPanel panel = new JPanel(new BorderLayout(0, 0));
addOverlapGroupButton(panel);
panel.add(labelGapStylePane, BorderLayout.CENTER);
panel.add(labelGapValuePane, BorderLayout.SOUTH);
labelGapStyle.addActionListener(new ActionListener() { labelGapStyle.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkLabelGapValuePane(); checkLabelGapValuePane();
} }
}); });
JPanel jPanel = new JPanel(new BorderLayout());
jPanel.add(showLabelPane, BorderLayout.NORTH); return panel;
jPanel.add(labelPanel, BorderLayout.CENTER); }
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel);
protected void addOverlapGroupButton(JPanel panel) {
overlapHandleTypeGroup = new UIButtonGroup<OverlapHandleType>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Label_OverlapAbbreviate"), Toolkit.i18nText("Fine-Design_Chart_Label_OverlapInterval")},
new OverlapHandleType[]{OverlapHandleType.ABBREVIATE, OverlapHandleType.INTERVAL});
JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_WhenOverlap"), overlapHandleTypeGroup, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
panel.add(north, BorderLayout.NORTH);
overlapHandleTypeGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
checkLabelGapAndStylePane();
}
});
} }
protected ChartTextAttrPane getChartTextAttrPane(){ protected ChartTextAttrPane getChartTextAttrPane(){
@ -286,24 +327,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected JPanel createDisplayStrategy(double[] row, double[] col){ protected JPanel createDisplayStrategy(double[] row, double[] col){
maxProportion = new UISpinner(0,100,1,30); limitPane = new LimitPane();
axisLimitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); return limitPane;
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),axisLimitSize);
maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER);
axisLimitSize.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse();
}
});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel);
} }
protected JPanel createValueStylePane(){ protected JPanel createValueStylePane(){
@ -360,7 +385,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected void checkAllUse() { protected void checkAllUse() {
checkCardPane(); checkCardPane();
checkLabelPane(); checkLabelPane();
checkMaxProPortionUse();
} }
protected void checkCardPane() { protected void checkCardPane() {
@ -381,24 +405,31 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
labelPanel.setVisible(enabled); labelPanel.setVisible(enabled);
} }
if(enabled){ if(enabled){
checkLabelGapValuePane(); checkLabelGapAndStylePane();
} }
} }
} }
protected void checkLabelGapValuePane() { private void checkLabelGapAndStylePane() {
if(labelGapValuePane != null && labelGapStyle != null){ if (overlapHandleTypeGroup != null && labelGapStylePane != null) {
labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1); boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL;
labelGapStylePane.setVisible(visible);
} }
checkLabelGapValuePane();
} }
//检查最大显示占比是否可用 protected void checkLabelGapValuePane() {
private void checkMaxProPortionUse() { if (labelGapValuePane != null && labelGapStyle != null) {
if(maxProportionPane != null && axisLimitSize != null){ boolean visible = labelGapStyle.getSelectedIndex() == 1;
maxProportionPane.setVisible(axisLimitSize.getSelectedIndex() == 0 && axisLimitSize.isEnabled()); if (overlapHandleTypeGroup != null) {
visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL;
}
labelGapValuePane.setVisible(visible);
} }
} }
/** /**
* 是否是指定类型 * 是否是指定类型
* @param ob 对象 * @param ob 对象
@ -477,11 +508,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
if(labelTextRotation != null){ if(labelTextRotation != null){
labelTextRotation.populateBean((double)labelTextAttr.getRotation()); labelTextRotation.populateBean((double)labelTextAttr.getRotation());
} }
if (overlapHandleTypeGroup != null) {
overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType());
}
if(labelGapStyle != null){ if(labelGapStyle != null){
labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1); labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1);
} }
if(labelGapValue != null){ if(labelGapValue != null){
labelGapValue.setText(axis.getLabelNumber().getContent()); labelGapValue.setValue(axis.getIntervalNumber());
} }
} }
@ -516,13 +550,9 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
//显示策略 //显示策略
private void populateDisplayStrategy(VanChartAxis axis) { private void populateDisplayStrategy(VanChartAxis axis) {
if(axisLimitSize != null){ if (limitPane != null) {
axisLimitSize.setSelectedIndex(axis.isLimitSize() ? 0 : 1); limitPane.populateBean(axis.getLimitAttribute());
} }
if(maxProportion != null){
maxProportion.setValue(axis.getMaxHeight());
}
} }
//格式 //格式
@ -597,15 +627,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
if(labelTextRotation != null){ if(labelTextRotation != null){
labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); labelTextAttr.setRotation(labelTextRotation.updateBean().intValue());
} }
if (overlapHandleTypeGroup != null) {
axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem());
}
if(labelGapStyle != null){ if(labelGapStyle != null){
axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0);
} }
if(labelGapValue != null){ if(labelGapValue != null){
if(axis.isAutoLabelGap()){ axis.setIntervalNumber((int) labelGapValue.getValue());
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1"));
} else {
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText()));
}
} }
} }
@ -637,11 +666,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
//显示策略 //显示策略
private void updateDisplayStrategy(VanChartAxis axis){ private void updateDisplayStrategy(VanChartAxis axis){
if(axisLimitSize != null){ if (limitPane != null) {
axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0); axis.setLimitAttribute(limitPane.updateBean());
}
if(maxProportion != null){
axis.setMaxHeight(maxProportion.getValue());
} }
} }

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java

@ -17,7 +17,6 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartTimeAxis; import com.fr.plugin.chart.attr.axis.VanChartTimeAxis;
import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.base.VanChartConstants;
@ -80,6 +79,10 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
@Override
protected void addOverlapGroupButton(JPanel panel) {
}
private JPanel createValueDefinition(){ private JPanel createValueDefinition(){
timeMinMaxValuePane = new TimeMinMaxValuePane(); timeMinMaxValuePane = new TimeMinMaxValuePane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), timeMinMaxValuePane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), timeMinMaxValuePane);

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java

@ -7,7 +7,6 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
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.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartValueAxis; import com.fr.plugin.chart.attr.axis.VanChartValueAxis;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -61,6 +60,10 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane {
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
@Override
protected void addOverlapGroupButton(JPanel panel) {
}
protected JPanel createMinMaxValuePane(double[] row, double[] col){ protected JPanel createMinMaxValuePane(double[] row, double[] col){
JPanel panel = createCommenValuePane(row,col); JPanel panel = createCommenValuePane(row,col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), panel);

85
designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java

@ -0,0 +1,85 @@
package com.fr.van.chart.designer.style.component;
import com.fr.chartx.attr.LimitAttribute;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by shine on 2019/08/28.
*/
public class LimitPane extends BasicBeanPane<LimitAttribute> {
private UIButtonGroup<Boolean> autoCustomTypeGroup;
private UISpinner maxProportion;
private JPanel maxProportionPane;
public LimitPane() {
this(true);
}
public LimitPane(boolean hasTitle) {
initComponent(hasTitle);
}
private void initComponent(boolean hasTitle) {
maxProportion = new UISpinner(0, 100, 1, 30);
autoCustomTypeGroup = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto")
, Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}, new Boolean[]{true, false});
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), autoCustomTypeGroup);
maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER);
autoCustomTypeGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse();
}
});
this.setLayout(new BorderLayout());
if (hasTitle) {
JPanel contentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel);
this.add(contentPane);
} else {
this.add(panel);
}
}
//检查最大显示占比是否可用
public void checkMaxProPortionUse() {
maxProportion.setVisible(!autoCustomTypeGroup.getSelectedItem() && autoCustomTypeGroup.isEnabled());
maxProportionPane.setVisible(!autoCustomTypeGroup.getSelectedItem() && autoCustomTypeGroup.isEnabled());
}
@Override
public void populateBean(LimitAttribute ob) {
autoCustomTypeGroup.setSelectedItem(ob.isAuto());
maxProportion.setValue(ob.getMaxSize());
}
@Override
public LimitAttribute updateBean() {
LimitAttribute attribute = new LimitAttribute();
attribute.setAuto(autoCustomTypeGroup.getSelectedItem());
attribute.setMaxSize(maxProportion.getValue());
return attribute;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

64
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

@ -5,20 +5,23 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
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.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot;
import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.OverlapHandleType;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -38,7 +41,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
protected BasicBeanPane<AttrTooltipContent> dataLabelContentPane; protected BasicBeanPane<AttrTooltipContent> dataLabelContentPane;
protected UIButtonGroup<Integer> position; protected UIButtonGroup<Integer> position;
protected UIButtonGroup<Boolean> autoAdjust;
private UIButtonGroup<Boolean> allowOverlap;
private UIComboBox overlapHandleType;
protected UIToggleButton tractionLine; protected UIToggleButton tractionLine;
protected UIButtonGroup<Integer> style; protected UIButtonGroup<Integer> style;
@ -118,8 +124,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
} }
position = new UIButtonGroup<Integer>(names, values); position = new UIButtonGroup<Integer>(names, values);
autoAdjust = new UIButtonGroup<Boolean>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false});
allowOverlap = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"),
Toolkit.i18nText("Fine-Design_Chart_NO")}, new Boolean[]{true, false});
overlapHandleType = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Chart_Label_OverlapHide"),
Toolkit.i18nText("Fine-Design_Chart_Label_OverlapAdjust")});
Component[][] comps = new Component[2][2]; Component[][] comps = new Component[2][2];
@ -134,13 +143,33 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
panel.add(tractionLinePane, BorderLayout.SOUTH); panel.add(tractionLinePane, BorderLayout.SOUTH);
initPositionListener(); initPositionListener();
} else if(PlotFactory.plotAutoAdjustLabelPosition(plot)){ } else if(PlotFactory.plotAutoAdjustLabelPosition(plot)){
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"),autoAdjust), BorderLayout.SOUTH); panel.add(createOverlapLabelPane(), BorderLayout.SOUTH);
} }
return panel; return panel;
} }
return new JPanel(); return new JPanel();
} }
private JPanel createOverlapLabelPane() {
allowOverlap.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
checkOverlap();
}
});
JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_AllowOverlap"), allowOverlap);
JPanel center = new JPanel(new BorderLayout());
center.add(overlapHandleType, BorderLayout.CENTER);
center.setBorder(BorderFactory.createEmptyBorder(0, 78, 0, 0));
JPanel result = new JPanel(new BorderLayout(0, 6));
result.add(north, BorderLayout.NORTH);
result.add(center, BorderLayout.CENTER);
return result;
}
protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){
JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col);
return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel);
@ -208,10 +237,16 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
private void checkAllUse() { private void checkAllUse() {
checkStyleUse(); checkStyleUse();
if(tractionLine == null){ checkOverlap();
return; if (tractionLine != null) {
checkPositionEnabled();
}
}
private void checkOverlap() {
if (overlapHandleType != null && allowOverlap != null) {
overlapHandleType.setVisible(!allowOverlap.getSelectedItem());
} }
checkPositionEnabled();
} }
private void checkStyleUse() { private void checkStyleUse() {
@ -235,8 +270,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
if(tractionLine != null){ if(tractionLine != null){
tractionLine.setSelected(detail.isShowGuidLine()); tractionLine.setSelected(detail.isShowGuidLine());
} }
if(autoAdjust != null){ if (allowOverlap != null) {
autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1); allowOverlap.setSelectedItem(detail.isAllowOverlap());
}
if (overlapHandleType != null) {
overlapHandleType.setSelectedIndex(detail.getOverlapHandleType() == OverlapHandleType.HIDE ? 0 : 1);
} }
style.setSelectedIndex(detail.isCustom() ? 1 : 0); style.setSelectedIndex(detail.isCustom() ? 1 : 0);
textFontPane.populate(detail.getTextAttr()); textFontPane.populate(detail.getTextAttr());
@ -259,7 +297,13 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
position.setSelectedItem(detail.getPosition()); position.setSelectedItem(detail.getPosition());
} }
detail.setAutoAdjust(autoAdjust != null && autoAdjust.getSelectedItem()); if (allowOverlap != null) {
detail.setAllowOverlap(allowOverlap.getSelectedItem());
}
if (overlapHandleType != null) {
detail.setOverlapHandleType(overlapHandleType.getSelectedIndex() == 0 ? OverlapHandleType.HIDE : OverlapHandleType.ADJUST);
}
if(tractionLine != null){ if(tractionLine != null){
detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE); detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE);

4
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -7,6 +7,7 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chart.chartglyph.DataSheet; import com.fr.chart.chartglyph.DataSheet;
import com.fr.chartx.attr.ZoomAttribute;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.MultilineLabel; import com.fr.design.gui.ilable.MultilineLabel;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
@ -16,7 +17,6 @@ import com.fr.js.NameJavaScriptGroup;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -100,7 +100,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
protected void resetChartAttr(Chart chart, Plot newPlot){ protected void resetChartAttr(Chart chart, Plot newPlot){
chart.setPlot(newPlot); chart.setPlot(newPlot);
if(newPlot.isSupportZoomDirection() && !newPlot.isSupportZoomCategoryAxis()){ if(newPlot.isSupportZoomDirection() && !newPlot.isSupportZoomCategoryAxis()){
((VanChart)chart).setVanChartZoom(new VanChartZoom()); ((VanChart) chart).setZoomAttribute(new ZoomAttribute());
} }
//重置工具栏选项 //重置工具栏选项
((VanChart)chart).setVanChartTools(createVanChartTools()); ((VanChart)chart).setVanChartTools(createVanChartTools());

8
designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java

@ -15,6 +15,7 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort;
import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.VanChartOtherPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.scatter.component.VanChartScatterStylePane; import com.fr.van.chart.scatter.component.VanChartScatterStylePane;
import com.fr.van.chart.scatter.data.VanChartScatterPlotTableDataContentPane; import com.fr.van.chart.scatter.data.VanChartScatterPlotTableDataContentPane;
@ -68,7 +69,12 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC
VanChartOtherPane otherPane = new VanChartOtherPane(){ VanChartOtherPane otherPane = new VanChartOtherPane(){
@Override @Override
protected BasicBeanPane<Chart> createInteractivePane() { protected BasicBeanPane<Chart> createInteractivePane() {
return new VanChartInteractivePaneWithOutSort(); return new VanChartInteractivePaneWithOutSort() {
@Override
protected ZoomPane createZoomPane() {
return new ZoomPane();
}
};
} }
}; };

25
designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java

@ -1,16 +1,11 @@
package com.fr.van.chart.scatter.component; package com.fr.van.chart.scatter.component;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.type.LineStyle; import com.fr.plugin.chart.type.LineStyle;
import com.fr.stable.Constants; import com.fr.plugin.chart.type.LineType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartLineTypePane; import com.fr.van.chart.designer.component.VanChartLineTypePane;
import javax.swing.JPanel;
import java.awt.Component; import java.awt.Component;
/** /**
@ -26,24 +21,20 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane {
} }
@Override @Override
protected JPanel createContentPane(double p, double f) { protected Component[][] createContentComponent(Component[] lineTypeComponent, Component[] lineWidthComponent, Component[] lineStyleComponent, Component[] nullValueBreakComponent) {
double[] row = {p,p,p}; return new Component[][]{
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; new Component[]{null, null},
double[] col = {f, e}; lineTypeComponent,
Component[][] components = new Component[][]{ lineWidthComponent,
new Component[]{null,null}, lineStyleComponent
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle},
}; };
return TableLayoutHelper.createTableLayoutPane(components, row, col);
} }
@Override @Override
protected VanChartAttrLine initVanChartAttrLine() { protected VanChartAttrLine initVanChartAttrLine() {
VanChartAttrLine attrLine = new VanChartAttrLine(); VanChartAttrLine attrLine = new VanChartAttrLine();
//默认为无线型,且默認空值不斷開 //默认为无线型,且默認空值不斷開
attrLine.setLineWidth(Constants.LINE_NONE); attrLine.setLineType(LineType.NONE);
attrLine.setNullValueBreak(false); attrLine.setNullValueBreak(false);
return attrLine; return attrLine;
} }

15
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java

@ -11,10 +11,10 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort;
import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.VanChartOtherPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import com.fr.van.chart.designer.other.zoom.ZoomPaneWithOutMode;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.structure.desinger.data.StructurePlotReportDataContentPane; import com.fr.van.chart.structure.desinger.data.StructurePlotReportDataContentPane;
import com.fr.van.chart.structure.desinger.data.StructurePlotTableDataContentPane; import com.fr.van.chart.structure.desinger.data.StructurePlotTableDataContentPane;
@ -61,16 +61,9 @@ public class StructureIndependentVanChartInterface extends AbstractIndependentVa
return new VanChartInteractivePaneWithOutSort(){ return new VanChartInteractivePaneWithOutSort(){
@Override @Override
protected String[] getNameArray() { protected ZoomPane createZoomPane() {
return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; return new ZoomPaneWithOutMode();
}
@Override
protected String[] getValueArray() {
return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE};
} }
}; };
} }
}; };

26
designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java

@ -1,6 +1,10 @@
package com.fr.van.chart.vanchart; package com.fr.van.chart.vanchart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane;
@ -9,6 +13,10 @@ import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContent
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.van.chart.designer.data.VanChartMoreCateReportDataContentPane; import com.fr.van.chart.designer.data.VanChartMoreCateReportDataContentPane;
import com.fr.van.chart.designer.data.VanChartMoreCateTableDataContentPane; import com.fr.van.chart.designer.data.VanChartMoreCateTableDataContentPane;
import com.fr.van.chart.designer.other.VanChartInteractivePane;
import com.fr.van.chart.designer.other.VanChartOtherPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
/** /**
* Created by mengao on 2017/7/6. * Created by mengao on 2017/7/6.
@ -28,4 +36,22 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndepende
} }
return new VanChartMoreCateReportDataContentPane(parent); return new VanChartMoreCateReportDataContentPane(parent);
} }
@Override
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) {
VanChartStylePane stylePane = new VanChartStylePane(listener);
VanChartOtherPane otherPane = new VanChartOtherPane() {
@Override
protected BasicBeanPane<Chart> createInteractivePane() {
return new VanChartInteractivePane() {
@Override
protected ZoomPane createZoomPane() {
return new ZoomPane();
}
};
}
};
return new AbstractChartAttrPane[]{stylePane, otherPane};
}
} }

13
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java

@ -11,9 +11,10 @@ import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort;
import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.VanChartOtherPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import com.fr.van.chart.designer.other.zoom.ZoomPaneWithOutMode;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI;
import com.fr.van.chart.wordcloud.designer.other.VanChartWordCloudConditionPane; import com.fr.van.chart.wordcloud.designer.other.VanChartWordCloudConditionPane;
@ -72,14 +73,8 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa
return new VanChartInteractivePaneWithOutSort(){ return new VanChartInteractivePaneWithOutSort(){
@Override @Override
protected String[] getNameArray() { protected ZoomPane createZoomPane() {
return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; return new ZoomPaneWithOutMode();
}
@Override
protected String[] getValueArray() {
return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE};
} }
}; };
} }

Loading…
Cancel
Save