From f026765d25ed46b04bd5ab205ab54af435c33aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 7 Jul 2020 17:05:26 +0800 Subject: [PATCH 1/4] =?UTF-8?q?CHART-14346=20&&=20CHART-14180=20=20?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E5=9B=BE=E8=A1=A8=E9=85=8D=E7=BD=AE=E7=BB=84?= =?UTF-8?q?=E5=90=88=E5=9B=BE=E4=B8=8D=E8=83=BD=E9=80=89=E6=8B=A9=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC=E6=95=B0=E6=8D=AE=E6=BA=90=20&&=20=E8=BD=B4?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E9=9A=90=E8=97=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/custom/VanChartCustomDataPane.java | 1 + ...VanChartCustomPlotDataContentsTabPane.java | 12 + .../style/axis/VanChartBaseAxisPane.java | 260 ++++++++++-------- 3 files changed, 162 insertions(+), 111 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java index 6c5f714bf..ec15e4cf9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java @@ -27,6 +27,7 @@ public class VanChartCustomDataPane extends ChartDataPane { } contentsTabPane = new VanChartCustomPlotDataContentsTabPane((VanChartCustomPlot)chart.getPlot(), VanChartCustomDataPane.this, listener); + contentsTabPane.setSupportCellData(isSupportCellData()); content.add(contentsTabPane, BorderLayout.CENTER); return content; diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java index e8f6f3a0a..6dbe9577c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java @@ -22,10 +22,21 @@ import java.util.Map; * Created by Fangjie on 2016/4/29. */ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane { + + private boolean supportCellData = true; + public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) { super(plot, parent, listener); } + public boolean isSupportCellData() { + return supportCellData; + } + + public void setSupportCellData(boolean supportCellData) { + this.supportCellData = supportCellData; + } + @Override protected void initTabTitle() { @@ -60,6 +71,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab for (int i = 0; i < customPlotList.size(); i++){ //根据不同的plot创建不同的数据配置界面 ChartDataPane contentPane = new VanChartDataPane(listener); + contentPane.setSupportCellData(supportCellData); paneList.add(contentPane); } 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 064a7156b..d96b1e40f 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 @@ -54,11 +54,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { private static final long serialVersionUID = -5717246802333308973L; private static final double ROTATION_MAX = 90.0; + protected UIButtonGroup showTitle; protected TinyFormulaPane titleContent; protected UIButtonGroup titleAlignPane; protected UIToggleButton titleUseHtml; protected ChartTextAttrPane titleTextAttrPane; protected UINumberDragPane titleTextRotation; + protected JPanel titlePane; protected UIButtonGroup showLabel; protected ChartTextAttrPane labelTextAttrPane; @@ -96,11 +98,11 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected JPanel centerPane; private VanChartHtmlLabelPane htmlLabelPane; - public VanChartBaseAxisPane(){ + public VanChartBaseAxisPane() { this(true); } - public VanChartBaseAxisPane(boolean isXAxis){ + public VanChartBaseAxisPane(boolean isXAxis) { this.setLayout(new BorderLayout()); this.add(createContentPane(isXAxis), BorderLayout.CENTER); } @@ -108,12 +110,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { public void setParentPane(VanChartStylePane parent) { htmlLabelPane.setParent(parent); } - protected void reLayoutPane(boolean isXAxis){ + + protected void reLayoutPane(boolean isXAxis) { this.removeAll(); this.add(createContentPane(isXAxis), BorderLayout.CENTER); } - protected JPanel createContentPane(boolean isXAxis){ + protected JPanel createContentPane(boolean isXAxis) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -121,7 +124,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double[] columnSize = {f, e}; double[] column = {f, s}; - double[] rowSize = {p, p, p, p, p, p, p,p}; + double[] rowSize = {p, p, p, p, p, p, p, p}; Component[][] components = new Component[][]{ new Component[]{createTitlePane(new double[]{p, p, p, p, p, p}, columnSize, isXAxis), null}, new Component[]{createLabelPane(new double[]{p, p}, column), null}, @@ -131,39 +134,52 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { new Component[]{createValueStylePane(), null}, }; - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } - protected JPanel createTitlePane(double[] row, double[] col, boolean isXAxis){ + protected JPanel createTitlePane(double[] row, double[] col, boolean isXAxis) { + showTitle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); titleAlignPane = isXAxis ? getXAxisTitleAlignPane() : getYAxisTitleAlignPane(); titleAlignPane.setSelectedItem(Constants.CENTER); titleContent = new TinyFormulaPane(); titleUseHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); UIComponentUtils.setLineWrap(titleUseHtml); titleTextAttrPane = new ChartTextAttrPane(); - titleTextRotation = new UINumberDragPane(-ROTATION_MAX,ROTATION_MAX); - if(isXAxis){ + titleTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); + if (isXAxis) { titleTextRotation.populateBean(0.0); } else { titleTextRotation.populateBean(-ROTATION_MAX); } Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")),titleContent}, - new Component[]{null,titleUseHtml}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),titleAlignPane}, - new Component[]{titleTextAttrPane,null}, + new Component[]{null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), titleContent}, + new Component[]{null, titleUseHtml}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), titleAlignPane}, + new Component[]{titleTextAttrPane, null}, new Component[]{ FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), UIComponentUtils.wrapWithBorderLayoutPane(titleTextRotation) }, }; + titlePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_TITLE_TITLE, panel); + JPanel showTitlePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Title"), showTitle); + showTitle.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkTitlePane(); + } + }); + + JPanel jPanel = new JPanel(new BorderLayout()); + jPanel.add(showTitlePane, BorderLayout.NORTH); + jPanel.add(titlePane, BorderLayout.CENTER); + + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_TITLE_TITLE, jPanel); } - private UIButtonGroup getXAxisTitleAlignPane(){ + private UIButtonGroup getXAxisTitleAlignPane() { Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; @@ -171,7 +187,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { return new UIButtonGroup(alignmentIconArray, alignment); } - private UIButtonGroup getYAxisTitleAlignPane(){ + + private UIButtonGroup getYAxisTitleAlignPane() { Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png")}; @@ -180,7 +197,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { return new UIButtonGroup(alignmentIconArray, alignment); } - protected JPanel createLabelPane(double[] row, double[] col){ + protected JPanel createLabelPane(double[] row, double[] col) { 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(); @@ -205,9 +222,9 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { new Component[]{gapPanel, 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.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); + labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); showLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -308,11 +325,11 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } - protected ChartTextAttrPane getChartTextAttrPane(){ - return new ChartTextAttrPane(){ + protected ChartTextAttrPane getChartTextAttrPane() { + return new ChartTextAttrPane() { @Override - protected JPanel getContentPane (JPanel buttonPane) { + protected JPanel getContentPane(JPanel buttonPane) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; @@ -324,10 +341,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { }; } - protected JPanel createLineStylePane(double[] row, double[] col){ + protected JPanel createLineStylePane(double[] row, double[] col) { axisLineStyle = createLineComboBox(); axisLineColor = new ColorSelectBox(100); - String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}; + String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}; AxisTickLineType[] values = new AxisTickLineType[]{AxisTickLineType.TICK_LINE_OUTSIDE, AxisTickLineType.TICK_LINE_NONE}; mainTick = new UIButtonGroup(strings, values); secondTick = new UIButtonGroup(strings, values); @@ -342,15 +359,15 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected Component[][] getLineStylePaneComponents() { return new Component[][]{ - new Component[]{null,null} , - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")),axisLineStyle} , - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),axisLineColor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")),mainTick}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")),secondTick}, + new Component[]{null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), axisLineStyle}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), axisLineColor}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTick}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secondTick}, }; } - protected JPanel createAxisPositionPane(double[] row, double[] col, boolean isXAxis){ + protected JPanel createAxisPositionPane(double[] row, double[] col, boolean isXAxis) { position = new UIButtonGroup(getAxisPositionNameArray(isXAxis), getAxisPositionValueArray(isXAxis)); reversed = new UIButtonGroup(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}); Component[][] components = new Component[][]{ @@ -359,30 +376,30 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Position")), UIComponentUtils.wrapWithBorderLayoutPane(position) }, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")),reversed}, - } ; + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")), reversed}, + }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), panel); } - private String[] getAxisPositionNameArray(boolean isXAxis){ - if(isXAxis){ + private String[] getAxisPositionNameArray(boolean isXAxis) { + if (isXAxis) { return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Vertical_Zero")}; } else { return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Vertical_Zero")}; } } - private Integer[] getAxisPositionValueArray(boolean isXAxis){ - if(isXAxis){ + private Integer[] getAxisPositionValueArray(boolean isXAxis) { + if (isXAxis) { return new Integer[]{VanChartConstants.AXIS_TOP, VanChartConstants.AXIS_BOTTOM, VanChartConstants.AXIS_VERTICAL_ZERO}; } else { return new Integer[]{VanChartConstants.AXIS_LEFT, VanChartConstants.AXIS_RIGHT, VanChartConstants.AXIS_VERTICAL_ZERO}; } } - protected JPanel createDisplayStrategy(){ + protected JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。删除到return,即除了注释的代码都删除。 maxProportion = new UISpinner(0, 100, 1, 30); axisLimitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); @@ -408,7 +425,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { // return limitPane; } - protected JPanel createValueStylePane(){ + protected JPanel createValueStylePane() { valueFormatStyle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); @@ -418,19 +435,19 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { htmlLabelPane = new VanChartHtmlLabelPane(); centerPane = new JPanel(new CardLayout()); - centerPane.add(valueFormat,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); + centerPane.add(valueFormat, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); centerPane.add(htmlLabelPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] columnSize = {p,f}; - double[] rowSize = {p,p,p}; + double[] columnSize = {p, f}; + double[] rowSize = {p, p, p}; 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_Axis_Label_Format"), SwingConstants.LEFT), valueFormatStyle}, new Component[]{null, centerPane}, }; - JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); + JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); valueFormatStyle.addActionListener(new ActionListener() { @@ -443,12 +460,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane); } - protected FormatPane createFormatPane(){ - return new FormatPane(){ - protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { + protected FormatPane createFormatPane() { + return new FormatPane() { + protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) { typePane.setBorder(BorderFactory.createEmptyBorder()); return new Component[][]{ - new Component[]{typePane,null}, + new Component[]{typePane, null}, new Component[]{centerPane, null}, }; } @@ -462,6 +479,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected void checkAllUse() { checkCardPane(); checkLabelPane(); + checkTitlePane(); //区域显示策略 恢复用注释。删除下面一行。 checkMaxProPortionUse(); @@ -480,10 +498,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } protected void checkCardPane() { - if(centerPane != null && valueFormatStyle != null){ + if (centerPane != null && valueFormatStyle != null) { CardLayout cardLayout = (CardLayout) centerPane.getLayout(); if (valueFormatStyle.getSelectedIndex() == 1) { - cardLayout.show(centerPane,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); + cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); } else { cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); } @@ -491,12 +509,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } protected void checkLabelPane() { - if(showLabel != null){ + if (showLabel != null) { boolean enabled = showLabel.getSelectedIndex() == 0; - if(labelPanel != null){ + if (labelPanel != null) { labelPanel.setVisible(enabled); } - if(enabled){ + if (enabled) { //轴标签缩略间隔显示 恢复用注释。下面1行删除。 checkLabelGapValuePane(); //轴标签缩略间隔显示 恢复用注释。取消注释。 @@ -505,6 +523,15 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } } + protected void checkTitlePane() { + if (showTitle != null) { + boolean enabled = showTitle.getSelectedIndex() == 0; + if (titlePane != null) { + titlePane.setVisible(enabled); + } + } + } + private void checkLabelGapAndStylePane() { if (overlapHandleTypeGroup != null && labelGapStylePane != null) { boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; @@ -528,28 +555,31 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { /** * 是否是指定类型 + * * @param ob 对象 * @return 是否是指定类型 */ - public boolean accept(Object ob){ + public boolean accept(Object ob) { return false; } /** * title应该是一个属性,不只是对话框的标题时用到,与其他组件结合时,也会用得到 + * * @return 绥化狂标题 */ @Override - public String title4PopupWindow(){ + public String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Axis"); } /** * 重置 */ - public void reset(){ + public void reset() { } + @Override public void populateBean(VanChartAxis axis) { populateTitle(axis); @@ -568,50 +598,53 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } //标题 - private void populateTitle(VanChartAxis axis){ + private void populateTitle(VanChartAxis axis) { + if (showTitle != null) { + showTitle.setSelectedIndex(axis.isShowAxisTitle() ? 0 : 1); + } Title axisTitle = axis.getTitle(); - if(axisTitle != null){ + if (axisTitle != null) { if (axisTitle.getTextObject() instanceof BaseFormula && titleContent != null) { titleContent.populateBean(((BaseFormula) axisTitle.getTextObject()).getContent()); - } else if(titleContent != null){ + } else if (titleContent != null) { titleContent.populateBean(Utils.objectToString(axisTitle.getTextObject())); } - if(titleAlignPane != null){ + if (titleAlignPane != null) { titleAlignPane.setSelectedItem(axisTitle.getPosition()); } - if(titleTextAttrPane != null){ + if (titleTextAttrPane != null) { titleTextAttrPane.populate(axisTitle.getTextAttr()); } - if(titleUseHtml != null){ + if (titleUseHtml != null) { titleUseHtml.setSelected(axis.isTitleUseHtml()); } - if(titleTextRotation != null){ - titleTextRotation.populateBean((double)axisTitle.getTextAttr().getRotation()); + if (titleTextRotation != null) { + titleTextRotation.populateBean((double) axisTitle.getTextAttr().getRotation()); } } } //标签 - private void populateLabel(VanChartAxis axis){ - if(showLabel != null){ + private void populateLabel(VanChartAxis axis) { + if (showLabel != null) { showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1); } TextAttr labelTextAttr = axis.getTextAttr(); - if(labelTextAttrPane != null){ + if (labelTextAttrPane != null) { labelTextAttrPane.populate(labelTextAttr); } - if(labelTextRotation != null){ - labelTextRotation.populateBean((double)labelTextAttr.getRotation()); + if (labelTextRotation != null) { + labelTextRotation.populateBean((double) labelTextAttr.getRotation()); } //轴标签缩略间隔显示 恢复用注释。取消注释。 // if (overlapHandleTypeGroup != null) { // overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); // } - if(labelGapStyle != null){ + if (labelGapStyle != null) { labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1); } - if(labelGapValue != null){ + if (labelGapValue != null) { //轴标签缩略间隔显示 恢复用注释。下面1行删除。 labelGapValue.setText(axis.getLabelNumber().getContent()); //轴标签缩略间隔显示 恢复用注释。取消注释。 @@ -620,30 +653,30 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } //轴线样式 - private void populateLineStyle(VanChartAxis axis){ - if(axisLineStyle != null){ + private void populateLineStyle(VanChartAxis axis) { + if (axisLineStyle != null) { axisLineStyle.setSelectedLineStyle(axis.getAxisStyle()); } - if(axisLineColor != null){ + if (axisLineColor != null) { axisLineColor.setSelectObject(axis.getAxisColor()); } - if(mainTick != null){ + if (mainTick != null) { mainTick.setSelectedItem(axis.getMainTickLine()); } - if(secondTick != null){ + if (secondTick != null) { secondTick.setSelectedItem(axis.getSecTickLine()); } } //位置 - private void populatePosition(VanChartAxis axis){ - if(position != null){ + private void populatePosition(VanChartAxis axis) { + if (position != null) { position.setSelectedItem(axis.getPosition()); - if(position.getSelectedItem() == null){ + if (position.getSelectedItem() == null) { position.setSelectedIndex(1); } } - if(reversed != null){ + if (reversed != null) { reversed.setSelectedIndex(axis.hasAxisReversed() == true ? 0 : 1); } } @@ -666,13 +699,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //格式 protected void populateFormat(VanChartAxis axis) { - if(valueFormatStyle != null){ + if (valueFormatStyle != null) { valueFormatStyle.setSelectedIndex(axis.isCommonValueFormat() ? 0 : 1); } - if(valueFormat != null){ + if (valueFormat != null) { valueFormat.populateBean(axis.getFormat()); } - if(htmlLabelPane != null){ + if (htmlLabelPane != null) { htmlLabelPane.populate(axis.getHtmlLabel()); } } @@ -690,15 +723,19 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { updateFormat(axis); } + //标题 - private void updateTitle(VanChartAxis axis){ + private void updateTitle(VanChartAxis axis) { + if (showTitle != null) { + axis.setShowAxisTitle(showTitle.getSelectedIndex() == 0); + } Title axisTitle = axis.getTitle(); - if(axisTitle == null){ + if (axisTitle == null) { axisTitle = new Title(); axis.setTitle(axisTitle); } - if(titleContent != null){ + if (titleContent != null) { String titleString = titleContent.updateBean(); Object titleObj; if (StableUtils.maybeFormula(titleString)) { @@ -708,42 +745,42 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } axisTitle.setTextObject(titleObj); } - if(titleAlignPane != null){ + if (titleAlignPane != null) { axisTitle.setPosition(titleAlignPane.getSelectedItem()); } TextAttr textAttr = axisTitle.getTextAttr(); - if(titleTextAttrPane != null){ + if (titleTextAttrPane != null) { titleTextAttrPane.update(textAttr); } - if(titleUseHtml != null){ + if (titleUseHtml != null) { axis.setTitleUseHtml(titleUseHtml.isSelected()); } - if(titleTextRotation != null){ + if (titleTextRotation != null) { textAttr.setRotation(titleTextRotation.updateBean().intValue()); } } //标签 - private void updateLabel(VanChartAxis axis){ - if(showLabel != null){ + private void updateLabel(VanChartAxis axis) { + if (showLabel != null) { axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0); } TextAttr labelTextAttr = axis.getTextAttr(); - if(labelTextAttrPane != null){ + if (labelTextAttrPane != null) { labelTextAttrPane.update(labelTextAttr); } - if(labelTextRotation != null){ + if (labelTextRotation != null) { labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); } //轴标签缩略间隔显示 恢复用注释。取消注释。 // if (overlapHandleTypeGroup != null) { // axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem()); // } - if(labelGapStyle != null){ + if (labelGapStyle != null) { axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); } - if(labelGapValue != null){ + if (labelGapValue != null) { //轴标签缩略间隔显示 恢复用注释。下面5行删除。 if (axis.isAutoLabelGap()) { axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1")); @@ -756,33 +793,33 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } //轴线样式 - private void updateLineStyle(VanChartAxis axis){ - if(axisLineStyle != null){ + private void updateLineStyle(VanChartAxis axis) { + if (axisLineStyle != null) { axis.setAxisStyle(axisLineStyle.getSelectedLineStyle()); } - if(axisLineColor != null){ + if (axisLineColor != null) { axis.setAxisColor(axisLineColor.getSelectObject()); } - if(mainTick != null){ + if (mainTick != null) { axis.setMainTickLine(mainTick.getSelectedItem()); } - if(secondTick != null){ + if (secondTick != null) { axis.setSecTickLine(secondTick.getSelectedItem()); } } //位置 - private void updatePosition(VanChartAxis axis){ - if(position != null){ + private void updatePosition(VanChartAxis axis) { + if (position != null) { axis.setPosition(position.getSelectedItem()); } - if(reversed != null){ + if (reversed != null) { axis.setAxisReversed(reversed.getSelectedItem()); } } //显示策略 - private void updateDisplayStrategy(VanChartAxis axis){ + private void updateDisplayStrategy(VanChartAxis axis) { //区域显示策略 恢复用注释。下面6行删除。 if (axisLimitSize != null) { axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0); @@ -797,29 +834,30 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } protected void updateFormat(VanChartAxis axis) { - if(valueFormatStyle != null){ + if (valueFormatStyle != null) { axis.setCommonValueFormat(valueFormatStyle.getSelectedIndex() == 0); } - if(valueFormat != null){ + if (valueFormat != null) { axis.setFormat(valueFormat.update()); } - if(htmlLabelPane != null){ + if (htmlLabelPane != null) { htmlLabelPane.update(axis.getHtmlLabel()); } } /** * X坐标轴不同类型切换,new一个新的 + * * @param axisName 坐标轴名称 * @return 新的axis */ - public VanChartAxis updateBean(String axisName, int position){ + public VanChartAxis updateBean(String axisName, int position) { VanChartAxis axis = new VanChartAxis(axisName, position); this.updateBean(axis); return axis; } - public VanChartAxis updateBean(){ + public VanChartAxis updateBean() { return null; } } From 7b66e7b244cb2484e222bafc7a6f0e6842993e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 7 Jul 2020 17:10:23 +0800 Subject: [PATCH 2/4] =?UTF-8?q?CHART-14180=20=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/designer/style/axis/VanChartBaseAxisPane.java | 7 ++----- 1 file changed, 2 insertions(+), 5 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 d96b1e40f..fcc34958e 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 @@ -524,11 +524,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } protected void checkTitlePane() { - if (showTitle != null) { - boolean enabled = showTitle.getSelectedIndex() == 0; - if (titlePane != null) { - titlePane.setVisible(enabled); - } + if (showTitle != null && titlePane != null) { + titlePane.setVisible(showTitle.getSelectedIndex() == 0); } } From b90617919fe53e3ad11e2b5d9593ce33cbade421 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Tue, 7 Jul 2020 17:59:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-34954=20=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E4=B8=8A=E6=A0=87=E4=B8=8B=E6=A0=87=E5=8F=AF=E4=BB=A5=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/cell/editor/RichTextToolBar.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java index 52a33ff12..4541ac3ba 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java @@ -256,8 +256,11 @@ public class RichTextToolBar extends BasicPane{ @Override public void actionPerformed(ActionEvent e) { boolean isSub = RichTextToolBar.this.subPane.isSelected(); - // 调用setCharacterAttributes函数设置文本区选择文本的字体 MutableAttributeSet attr = new SimpleAttributeSet(); + if (!isSub && RichTextToolBar.this.superPane.isSelected()) { + StyleConstants.setSuperscript(attr, false); + } + // 调用setCharacterAttributes函数设置文本区选择文本的字体 StyleConstants.setSubscript(attr, !isSub); setCharacterAttributes(RichTextToolBar.this.textPane, attr, false); } @@ -269,6 +272,9 @@ public class RichTextToolBar extends BasicPane{ boolean isSuper = RichTextToolBar.this.superPane.isSelected(); // 调用setCharacterAttributes函数设置文本区选择文本的字体 MutableAttributeSet attr = new SimpleAttributeSet(); + if (!isSuper && RichTextToolBar.this.subPane.isSelected()) { + StyleConstants.setSubscript(attr, false); + } StyleConstants.setSuperscript(attr, !isSuper); setCharacterAttributes(RichTextToolBar.this.textPane, attr, false); } From b4bb3235df0fa7eb37c4284d0575b26e188ca83f Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Wed, 8 Jul 2020 09:30:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?REPORT-34954=20=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E4=B8=8A=E6=A0=87=E4=B8=8B=E6=A0=87=E4=B8=8D=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=90=8C=E6=97=B6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/cell/editor/RichTextToolBar.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java index 4541ac3ba..b3a78d34d 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java @@ -408,7 +408,7 @@ public class RichTextToolBar extends BasicPane{ bold.setSelected(isBold); italic.setSelected(isItalic); underline.setSelected(isUnderline); - subPane.setSelected(isSubscript); + subPane.setSelected(isSuperscript ? false : isSubscript); superPane.setSelected(isSuperscript); //为什么字体名称, 大小, 颜色, 不需要去判断是否全相同呢 //因为如果全相同, 则设置为第一个字符的样式, 如果不全相同, 那么默认也设置成第一个字符的样式.