From ac96f72254f57c6011d4fe754b0c0244cbb40329 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 17 Feb 2020 19:48:59 +0800 Subject: [PATCH] =?UTF-8?q?CHART-12733=20=E8=BD=B4=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E9=97=B4=E9=9A=94=E6=98=BE=E7=A4=BA=20?= =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/axis/VanChartBaseAxisPane.java | 110 ++++++++++++++---- 1 file changed, 89 insertions(+), 21 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index cb60e95cea..064a7156bd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; 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.i18n.Toolkit; import com.fr.design.layout.TableLayout; @@ -63,9 +64,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected ChartTextAttrPane labelTextAttrPane; protected UINumberDragPane labelTextRotation; + //轴标签缩略间隔显示 恢复用注释。下面6行删除。 + protected UITextField labelGapValue; + private UIButtonGroup overlapHandleTypeGroup; protected UIButtonGroup labelGapStyle; - protected UISpinner labelGapValue; + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //protected UISpinner labelGapValue; protected JPanel labelPanel; private JPanel labelGapStylePane; @@ -176,22 +181,32 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } 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")}); labelTextAttrPane = getChartTextAttrPane(); - JPanel rotationPane = createLabelRotationPane(col); - JPanel overlapPane = createLabelOverlapPane(); - + labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); + labelGapStyle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); + 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[][]{ new Component[]{labelTextAttrPane, null}, - new Component[]{rotationPane, null}, - new Component[]{overlapPane, null}, + new Component[]{gapPanel, null}, }; JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel); - labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, col); + labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); showLabel.addActionListener(new ActionListener() { @Override @@ -199,12 +214,48 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { checkLabelPane(); } }); + labelGapStyle.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkLabelGapValuePane(); + } + }); 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); } +// 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")}); +// labelTextAttrPane = getChartTextAttrPane(); +// +// JPanel rotationPane = createLabelRotationPane(col); +// JPanel overlapPane = createLabelOverlapPane(); +// +// +// Component[][] components = new Component[][]{ +// new Component[]{labelTextAttrPane, 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); +// labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, col); +// labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); +// showLabel.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// 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); @@ -222,7 +273,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { labelGapStyle = new UIButtonGroup(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); + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //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)); @@ -445,7 +497,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { labelPanel.setVisible(enabled); } if(enabled){ - checkLabelGapAndStylePane(); + //轴标签缩略间隔显示 恢复用注释。下面1行删除。 + checkLabelGapValuePane(); + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //checkLabelGapAndStylePane(); } } } @@ -462,9 +517,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected void checkLabelGapValuePane() { if (labelGapValuePane != null && labelGapStyle != null) { boolean visible = labelGapStyle.getSelectedIndex() == 1; - if (overlapHandleTypeGroup != null) { - visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; - } + //轴标签缩略间隔显示 恢复用注释。取消注释。 +// if (overlapHandleTypeGroup != null) { +// visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; +// } labelGapValuePane.setVisible(visible); } } @@ -548,14 +604,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if(labelTextRotation != null){ labelTextRotation.populateBean((double)labelTextAttr.getRotation()); } - if (overlapHandleTypeGroup != null) { - overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); - } + //轴标签缩略间隔显示 恢复用注释。取消注释。 +// if (overlapHandleTypeGroup != null) { +// overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); +// } if(labelGapStyle != null){ labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1); } if(labelGapValue != null){ - labelGapValue.setValue(axis.getIntervalNumber()); + //轴标签缩略间隔显示 恢复用注释。下面1行删除。 + labelGapValue.setText(axis.getLabelNumber().getContent()); + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //labelGapValue.setValue(axis.getIntervalNumber()); } } @@ -676,14 +736,22 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if(labelTextRotation != null){ labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); } - if (overlapHandleTypeGroup != null) { - axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem()); - } + //轴标签缩略间隔显示 恢复用注释。取消注释。 +// if (overlapHandleTypeGroup != null) { +// axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem()); +// } if(labelGapStyle != null){ axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); } if(labelGapValue != null){ - axis.setIntervalNumber((int) labelGapValue.getValue()); + //轴标签缩略间隔显示 恢复用注释。下面5行删除。 + if (axis.isAutoLabelGap()) { + axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1")); + } else { + axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText())); + } + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //axis.setIntervalNumber((int) labelGapValue.getValue()); } }