Browse Source

REPORT-79271 feat:考虑兼容

newui
Carlson 1 year ago
parent
commit
22a75e42c8
  1. 27
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java
  2. 13
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java
  3. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java

27
designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java

@ -13,8 +13,28 @@ public class ChartEditContext {
private static ChartEditMode current = ChartEditMode.NORMAL;
private static ChartEditSupportDataType supportDataType = ChartEditSupportDataType.BOTH;
/**
* 切换图表编辑模式
* @param mode 图表编辑模式
*/
public static void switchTo(ChartEditMode mode) {
if (mode == ChartEditMode.NORMAL) {
switchTo(mode, ChartEditSupportDataType.BOTH);
} else if (mode == ChartEditMode.DUCHAMP) {
switchTo(mode, ChartEditSupportDataType.TABLE_DATA);
}
}
/**
* 切换图表编辑模式
* @param mode 图表编辑模式
* @param type 图表支持的数据来源
*/
public static void switchTo(ChartEditMode mode, ChartEditSupportDataType type) {
current = mode;
supportDataType = type;
}
public static boolean duchampMode() {
@ -33,4 +53,11 @@ public class ChartEditContext {
public static boolean supportTheme() {
return !DesignModeContext.isDuchampMode();
}
/**
* 当前模式下是否支持单元格数据来源
*/
public static boolean supportReportData() {
return supportDataType == ChartEditSupportDataType.REPORT || supportDataType == ChartEditSupportDataType.BOTH;
}
}

13
designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditSupportDataType.java

@ -0,0 +1,13 @@
package com.fr.design.mainframe.chart.mode;
/**
* @author Carlson
* @version 11.0
* Created by Carlson on 2023/8/1 14:25
* @description 图表数据来源兼容用
**/
public enum ChartEditSupportDataType {
TABLE_DATA, // 数据集数据
REPORT, // 单元格数据
BOTH // 包含二者
}

5
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java

@ -7,6 +7,7 @@ import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.van.chart.designer.AbstractVanChartScrollPane;
@ -67,7 +68,9 @@ public class NormalChartDataPane extends DataContentsPane {
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT));
northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null}));
northPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,8));
this.add(northPane, BorderLayout.NORTH);
if (ChartEditContext.supportReportData()) {
this.add(northPane, BorderLayout.NORTH);
}
this.add(cardPane, BorderLayout.CENTER);
}

Loading…
Cancel
Save