Browse Source

KERNEL-1167 命名修改&部分类重写

pull/1/head
白岳 5 years ago
parent
commit
3a40ec0125
  1. 6
      docs/claim.md
  2. 7
      src/main/java/com/fanruan/api/design/chart/BaseChartTypeUI.java
  3. 5
      src/main/java/com/fanruan/api/design/chart/BaseDataPane.java
  4. 5
      src/main/java/com/fanruan/api/design/chart/BaseOtherPane.java
  5. 70
      src/main/java/com/fanruan/api/design/chart/DefaultTypePane.java
  6. 6
      src/main/java/com/fanruan/api/design/chart/SingleDataPane.java
  7. 78
      src/main/java/com/fanruan/api/design/chart/field/AbstractDataSetFieldsPane.java
  8. 20
      src/main/java/com/fanruan/api/design/chart/field/BaseCellDataFieldsPane.java
  9. 118
      src/main/java/com/fanruan/api/design/chart/field/BaseDataSetFieldsPane.java
  10. 52
      src/main/java/com/fanruan/api/design/ui/component/chart/CalculateComboBox.java
  11. 65
      src/main/java/com/fanruan/api/design/ui/component/chart/DataFunctionType.java
  12. 6
      src/main/java/com/fanruan/api/engine/chart/BaseChartType.java
  13. 7
      src/main/java/com/fanruan/api/engine/chart/BaseChartWithData.java
  14. 2
      src/main/java/com/fanruan/api/engine/chart/field/BaseColumnFieldCollection.java

6
docs/claim.md

@ -39,3 +39,9 @@ com.fr.web.struct.Registry
com.fr.web.struct.category.ScriptPath
com.fr.web.struct.category.StylePath
com.fr.chart.ChartWebPara
com.fr.chartx.data.field.ColumnField
com.fr.js.NameJavaScriptGroup

7
src/main/java/com/fanruan/api/design/chart/AbstractChartTypeUI.java → src/main/java/com/fanruan/api/design/chart/BaseChartTypeUI.java

@ -1,5 +1,6 @@
package com.fanruan.api.design.chart;
import com.fr.design.chart.fun.impl.AbstractChartTypeUI;
import com.fr.design.gui.frpane.AttributeChangeListener;
/**
@ -7,7 +8,7 @@ import com.fr.design.gui.frpane.AttributeChangeListener;
* @version 10.0
* Created by Bjorn on 2019-09-19
*/
public abstract class AbstractChartTypeUI extends com.fr.design.chart.fun.impl.AbstractChartTypeUI {
public abstract class BaseChartTypeUI extends AbstractChartTypeUI {
/**
* 定义图表类型选择界面
@ -25,7 +26,7 @@ public abstract class AbstractChartTypeUI extends com.fr.design.chart.fun.impl.A
* @return 数据配置界面
*/
@Override
public abstract AbstractDataPane getChartDataPane(AttributeChangeListener listener);
public abstract BaseDataPane getChartDataPane(AttributeChangeListener listener);
/**
* 定义其他界面
@ -33,7 +34,7 @@ public abstract class AbstractChartTypeUI extends com.fr.design.chart.fun.impl.A
* @return 其他界面集合
*/
@Override
public abstract AbstractOtherPane[] getAttrPaneArray(AttributeChangeListener listener);
public abstract BaseOtherPane[] getAttrPaneArray(AttributeChangeListener listener);
/**
* 定义图表类型选择界面子类型的名称

5
src/main/java/com/fanruan/api/design/chart/AbstractDataPane.java → src/main/java/com/fanruan/api/design/chart/BaseDataPane.java

@ -1,5 +1,6 @@
package com.fanruan.api.design.chart;
import com.fr.design.chartx.impl.AbstractDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
/**
@ -7,12 +8,12 @@ import com.fr.design.gui.frpane.AttributeChangeListener;
* @version 10.0
* Created by Bjorn on 2019-09-18
*/
public abstract class AbstractDataPane extends com.fr.design.chartx.impl.AbstractDataPane {
public abstract class BaseDataPane extends AbstractDataPane {
/**
* 构造函数
*/
public AbstractDataPane(AttributeChangeListener listener) {
public BaseDataPane(AttributeChangeListener listener) {
super(listener);
}

5
src/main/java/com/fanruan/api/design/chart/AbstractOtherPane.java → src/main/java/com/fanruan/api/design/chart/BaseOtherPane.java

@ -1,6 +1,7 @@
package com.fanruan.api.design.chart;
import com.fanruan.api.engine.chart.AbstractChartWithData;
import com.fanruan.api.engine.chart.BaseChartWithData;
import com.fr.design.chartx.impl.AbstractOtherPane;
import javax.swing.JPanel;
@ -9,7 +10,7 @@ import javax.swing.JPanel;
* @version 10.0
* Created by Bjorn on 2019-09-17
*/
public abstract class AbstractOtherPane<T extends AbstractChartWithData> extends com.fr.design.chartx.impl.AbstractOtherPane<T> {
public abstract class BaseOtherPane<T extends BaseChartWithData> extends AbstractOtherPane<T> {
/**
* 创建内容面板

70
src/main/java/com/fanruan/api/design/chart/DefaultTypePane.java

@ -1,7 +1,11 @@
package com.fanruan.api.design.chart;
import com.fanruan.api.engine.chart.AbstractChartWithData;
import com.fanruan.api.engine.chart.BaseChartWithData;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import javax.swing.JPanel;
import java.awt.Component;
@ -11,7 +15,7 @@ import java.awt.Component;
* @version 10.0
* Created by Bjorn on 2019-09-18
*/
public class DefaultTypePane<T extends AbstractChartWithData> extends com.fr.design.chartx.impl.DefaultTypePane<T> {
public class DefaultTypePane<T extends BaseChartWithData> extends AbstractChartTypePane<T> {
/**
* 获取图表类型界面图表选择子类型的缩略图路径默认使用UI界面插入图表时子类型的图片路径
@ -20,7 +24,7 @@ public class DefaultTypePane<T extends AbstractChartWithData> extends com.fr.des
*/
@Override
protected String[] getTypeIconPath() {
return super.getTypeIconPath();
return ChartTypeInterfaceManager.getInstance().getDemoImagePath(getPlotID());
}
/**
@ -30,7 +34,7 @@ public class DefaultTypePane<T extends AbstractChartWithData> extends com.fr.des
*/
@Override
protected String[] getTypeTipName() {
return super.getTypeTipName();
return ChartTypeInterfaceManager.getInstance().getSubName(getPlotID());
}
/**
@ -40,7 +44,7 @@ public class DefaultTypePane<T extends AbstractChartWithData> extends com.fr.des
*/
@Override
public ChartProvider getDefaultChart() {
return super.getDefaultChart();
return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0];
}
/**
@ -50,7 +54,7 @@ public class DefaultTypePane<T extends AbstractChartWithData> extends com.fr.des
*/
@Override
public String title4PopupWindow() {
return super.title4PopupWindow();
return ChartTypeInterfaceManager.getInstance().getName(getPlotID());
}
/**
@ -58,24 +62,68 @@ public class DefaultTypePane<T extends AbstractChartWithData> extends com.fr.des
*
* @return 子类型序号
*/
@Override
protected int getSelectIndexInChart(T chart) {
return super.getSelectIndexInChart(chart);
return 0;
}
/**
* 根据图表子类型序号还原图表对象对应的属性
*/
@Override
protected void setSelectIndexInChart(T chart, int index) {
super.setSelectIndexInChart(chart, index);
}
/**
* 根据图表子类型序号还原图表对象对应的属性
* 通过图表对象的属性还原选择的图表类型
*/
@Override
public void populateBean(T ob) {
if (getTypeIconPath().length > 0) {
for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
typeDemo.get(getSelectIndexInChart(ob)).isPressing = true;
checkDemosBackground();
}
}
/**
* 根据所选择的图表类型还原图表类型的属性
*/
@Override
public void updateBean(T ob) {
if (getTypeIconPath().length > 0) {
for (int index = 0, len = typeDemo.size(); index < len; index++) {
if (typeDemo.get(index).isPressing) {
setSelectIndexInChart(ob, index);
return;
}
}
}
}
/**
* 构建类型选择面板的组件
*
* @return 面板组件集合
*/
@Override
protected Component[][] getPaneComponents(JPanel typePane) {
return super.getPaneComponents(typePane);
}
//TODO 已经在父类中加了默认实现,jar包更新后直接删除
@Override
protected String[] getTypeLayoutPath() {
return new String[0];
}
@Override
protected String[] getTypeLayoutTipName() {
return new String[0];
}
@Override
protected String getPlotTypeID() {
return null;
}
}

6
src/main/java/com/fanruan/api/design/chart/SingleDataPane.java

@ -1,7 +1,7 @@
package com.fanruan.api.design.chart;
import com.fanruan.api.design.chart.field.AbstractCellDataFieldsPane;
import com.fanruan.api.design.chart.field.AbstractDataSetFieldsPane;
import com.fanruan.api.design.chart.field.BaseCellDataFieldsPane;
import com.fanruan.api.design.chart.field.BaseDataSetFieldsPane;
/**
* @author Bjorn
@ -13,7 +13,7 @@ public class SingleDataPane extends com.fr.design.chartx.single.SingleDataPane {
/**
* 构造函数组合数据集数据源配置面板和单元格数据源配置面板
*/
public SingleDataPane(AbstractDataSetFieldsPane dataSetFieldsPane, AbstractCellDataFieldsPane cellDataFieldsPane) {
public SingleDataPane(BaseDataSetFieldsPane dataSetFieldsPane, BaseCellDataFieldsPane cellDataFieldsPane) {
super(dataSetFieldsPane, cellDataFieldsPane);
}
}

78
src/main/java/com/fanruan/api/design/chart/field/AbstractDataSetFieldsPane.java

@ -1,78 +0,0 @@
package com.fanruan.api.design.chart.field;
import com.fanruan.api.design.ui.component.UIComboBox;
import com.fanruan.api.engine.chart.field.ColumnFieldCollection;
import javax.swing.JPanel;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-17
*/
public abstract class AbstractDataSetFieldsPane<T extends ColumnFieldCollection> extends com.fr.design.chartx.fields.AbstractDataSetFieldsPane<T> {
/**
* 初始化面板布局默认会加载北部中部和南部的面板
*/
@Override
protected void initComponents() {
super.initComponents();
}
/**
* 创建中部位置的面板默认会通过所有的组件和组件名称生成面板
*
* @return 面板
*/
@Override
protected JPanel createCenterPane() {
return super.createCenterPane();
}
/**
* 创建北部位置的面板默认生成空面板
*
* @return 面板
*/
@Override
protected JPanel createNorthPane() {
return super.createNorthPane();
}
/**
* 创建南部位置的面板默认生成空面板
*
* @return 面板
*/
@Override
protected JPanel createSouthPane() {
return super.createSouthPane();
}
/**
* 面板中所有组件,默认会去获取所有下拉框组件
*
* @return 所有组件的集合
*/
@Override
protected Component[] fieldComponents() {
return super.fieldComponents();
}
/**
* 面板中所有组件的名称
*
* @return 所有组件的名称集合
*/
@Override
protected abstract String[] fieldLabels();
/**
* 面板中的下拉框组件
*
* @return 下拉框组件的集合
*/
@Override
protected abstract UIComboBox[] filedComboBoxes();
}

20
src/main/java/com/fanruan/api/design/chart/field/AbstractCellDataFieldsPane.java → src/main/java/com/fanruan/api/design/chart/field/BaseCellDataFieldsPane.java

@ -1,7 +1,9 @@
package com.fanruan.api.design.chart.field;
import com.fanruan.api.design.ui.component.formula.UIFormulaTextField;
import com.fanruan.api.engine.chart.field.ColumnFieldCollection;
import com.fanruan.api.engine.chart.field.BaseColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import javax.swing.JPanel;
import java.awt.Component;
@ -11,7 +13,7 @@ import java.awt.Component;
* @version 10.0
* Created by Bjorn on 2019-09-17
*/
public abstract class AbstractCellDataFieldsPane<T extends ColumnFieldCollection> extends com.fr.design.chartx.fields.AbstractCellDataFieldsPane<T> {
public abstract class BaseCellDataFieldsPane<T extends BaseColumnFieldCollection> extends AbstractCellDataFieldsPane<T> {
/**
* 初始化面板布局默认会加载北部中部和南部的面板
@ -76,4 +78,18 @@ public abstract class AbstractCellDataFieldsPane<T extends ColumnFieldCollection
*/
@Override
protected abstract UIFormulaTextField[] formulaPanes();
/**
* 根据字段对象的属性更新公式组件的值
*/
protected void populateField(UIFormulaTextField formulaPane, ColumnField field) {
AbstractCellDataFieldsPane.populateField(formulaPane, field);
}
/**
* 根据公式组件的值更新字段对象的属性
*/
protected void updateField(UIFormulaTextField formulaPane, ColumnField field) {
AbstractCellDataFieldsPane.updateField(formulaPane, field);
}
}

118
src/main/java/com/fanruan/api/design/chart/field/BaseDataSetFieldsPane.java

@ -0,0 +1,118 @@
package com.fanruan.api.design.chart.field;
import com.fanruan.api.design.ui.component.UIComboBox;
import com.fanruan.api.design.ui.component.chart.CalculateComboBox;
import com.fanruan.api.engine.chart.field.BaseColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.general.GeneralUtils;
import javax.swing.JPanel;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-17
*/
public abstract class BaseDataSetFieldsPane<T extends BaseColumnFieldCollection> extends AbstractDataSetFieldsPane<T> {
/**
* 初始化面板布局默认会加载北部中部和南部的面板
*/
@Override
protected void initComponents() {
super.initComponents();
}
/**
* 创建中部位置的面板默认会通过所有的组件和组件名称生成面板
*
* @return 面板
*/
@Override
protected JPanel createCenterPane() {
return super.createCenterPane();
}
/**
* 创建北部位置的面板默认生成空面板
*
* @return 面板
*/
@Override
protected JPanel createNorthPane() {
return super.createNorthPane();
}
/**
* 创建南部位置的面板默认生成空面板
*
* @return 面板
*/
@Override
protected JPanel createSouthPane() {
return super.createSouthPane();
}
/**
* 面板中所有组件,默认会去获取所有下拉框组件
*
* @return 所有组件的集合
*/
@Override
protected Component[] fieldComponents() {
return super.fieldComponents();
}
/**
* 面板中所有组件的名称
*
* @return 所有组件的名称集合
*/
@Override
protected abstract String[] fieldLabels();
/**
* 面板中的下拉框组件
*
* @return 下拉框组件的集合
*/
@Override
protected abstract UIComboBox[] filedComboBoxes();
/**
* 根据字段对象的属性更新下拉选择组件的值
*/
protected void populateField(UIComboBox comboBox, ColumnField field) {
AbstractDataSetFieldsPane.populateField(comboBox, field);
}
/**
* 根据下拉选择组件的值更新字段对象的属性
*/
protected void updateField(UIComboBox comboBox, ColumnField field) {
AbstractDataSetFieldsPane.updateField(comboBox, field);
}
/**
* 根据字段对象的属性更新下拉选择组件和汇总方式选择组件的值
*/
protected void populateFunctionField(UIComboBox comboBox, CalculateComboBox calculateComboBox, ColumnField field) {
comboBox.setSelectedItem(field.getFieldName());
if (calculateComboBox != null) {
calculateComboBox.populateBean(field.getDataFunction());
}
}
/**
* 根据下拉选择组件和汇总方式选择组件的值更新字段对象的属性
*/
protected void updateFunctionField(UIComboBox comboBox, CalculateComboBox calculateComboBox, ColumnField field) {
field.setFieldName(GeneralUtils.objectToString(comboBox.getSelectedItem()));
if (calculateComboBox != null) {
field.setDataFunction(calculateComboBox.updateBean());
} else {
field.setDataFunction(null);
}
}
}

52
src/main/java/com/fanruan/api/design/ui/component/chart/CalculateComboBox.java

@ -1,9 +1,59 @@
package com.fanruan.api.design.ui.component.chart;
import com.fanruan.api.design.ui.component.UIComboBox;
import com.fr.data.util.function.DataFunction;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-23
*/
public class CalculateComboBox extends com.fr.design.mainframe.chart.gui.data.CalculateComboBox {
public class CalculateComboBox extends UIComboBox {
private static String[] functionName = initItem();
private static String[] initItem() {
String[] functionLocaleNames = DataFunctionType.getFunctionLocaleNames();
for (int i = 0; i < functionLocaleNames.length; i++) {
functionLocaleNames[i] = Toolkit.i18nText(functionLocaleNames[i]);
}
return functionLocaleNames;
}
public CalculateComboBox() {
super(functionName);
setSelectedIndex(0);
}
public void reset() {
this.setSelectedItem(0);
}
/**
* 通过公式对象更新界面的公式选择
*/
public void populateBean(DataFunction function) {
int index = DataFunctionType.getIndexByFunction(function);
if (index > 0) {
this.setSelectedIndex(index);
}
}
/**
* 根据界面选择的公式返回公式对象
*/
public DataFunction updateBean() {
try {
int selectIndex = getSelectedIndex();
DataFunction functionByIndex = DataFunctionType.getFunctionByIndex(selectIndex);
return functionByIndex;
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error("Function Error");
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error("Function Error");
}
return null;
}
}

65
src/main/java/com/fanruan/api/design/ui/component/chart/DataFunctionType.java

@ -0,0 +1,65 @@
package com.fanruan.api.design.ui.component.chart;
import com.fr.data.util.function.AverageFunction;
import com.fr.data.util.function.CountFunction;
import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.MaxFunction;
import com.fr.data.util.function.MinFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.data.util.function.SumFunction;
import com.fr.general.ComparatorUtils;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-24
*/
public enum DataFunctionType {
NONE_FUNCTION("Fine-Design_Chart_Data_Function_None", NoneFunction.class),
SUM_FUNCTION("Fine-Design_Chart_Data_Function_Sum", SumFunction.class),
AVERAGE_FUNCTION("Fine-Design_Chart_Data_Function_Average", AverageFunction.class),
MAX_FUNCTION("Fine-Design_Chart_Data_Function_Max", MaxFunction.class),
MIN_FUNCTION("Fine-Design_Chart_Data_Function_Min", MinFunction.class),
COUNT_FUNCTION("Fine-Design_Chart_Data_Function_Count", CountFunction.class);
String functionLocaleName;
Class functionClass;
public static final int NONE_FUNCTION_INDEX = 0;
DataFunctionType(String functionLocaleName, Class functionClass) {
this.functionLocaleName = functionLocaleName;
this.functionClass = functionClass;
}
public static int getIndexByFunction(DataFunction function) {
if (function == null) {
return NONE_FUNCTION_INDEX;
}
for (DataFunctionType dataFunctionType : DataFunctionType.values()) {
if (ComparatorUtils.equals(dataFunctionType.functionClass, function.getClass())) {
return dataFunctionType.ordinal();
}
}
return NONE_FUNCTION_INDEX;
}
public static DataFunction getFunctionByIndex(int index) throws IllegalAccessException, InstantiationException {
DataFunctionType[] values = DataFunctionType.values();
if (index < values.length) {
return (DataFunction) values[index].functionClass.newInstance();
}
return null;
}
public static String[] getFunctionLocaleNames() {
DataFunctionType[] values = DataFunctionType.values();
String[] functionLocaleNames = new String[values.length];
for (int i = 0; i < values.length; i++) {
functionLocaleNames[i] = values[i].functionLocaleName;
}
return functionLocaleNames;
}
}

6
src/main/java/com/fanruan/api/engine/chart/AbstractChartType.java → src/main/java/com/fanruan/api/engine/chart/BaseChartType.java

@ -1,11 +1,13 @@
package com.fanruan.api.engine.chart;
import com.fr.chart.impl.AbstractChartType;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2019-09-17
*/
public abstract class AbstractChartType extends com.fr.chart.impl.AbstractChartType {
public abstract class BaseChartType extends AbstractChartType {
/**
* 该种图表所有的图表对象实例比如柱形图就有堆积柱形图百分比堆积柱形图等等
@ -13,7 +15,7 @@ public abstract class AbstractChartType extends com.fr.chart.impl.AbstractChartT
* @return 图表所有的对象实例
*/
@Override
public abstract AbstractChartWithData[] getChartTypes();
public abstract BaseChartWithData[] getChartTypes();
/**
* 图表在web端展现时需要的JS文件路径

7
src/main/java/com/fanruan/api/engine/chart/AbstractChartWithData.java → src/main/java/com/fanruan/api/engine/chart/BaseChartWithData.java

@ -1,8 +1,9 @@
package com.fanruan.api.engine.chart;
import com.fanruan.api.engine.chart.field.ColumnFieldCollection;
import com.fanruan.api.engine.chart.field.BaseColumnFieldCollection;
import com.fr.base.chart.cross.FormulaProcessor;
import com.fr.chart.ChartWebPara;
import com.fr.chart.impl.AbstractChartWithData;
import com.fr.js.NameJavaScriptGroup;
import com.fr.json.JSONObject;
@ -13,7 +14,7 @@ import java.awt.Image;
* @version 10.0
* Created by Bjorn on 2019-09-17
*/
public abstract class AbstractChartWithData extends com.fr.chart.impl.AbstractChartWithData {
public abstract class BaseChartWithData extends AbstractChartWithData {
/**
* 获取所有的超链
@ -64,7 +65,7 @@ public abstract class AbstractChartWithData extends com.fr.chart.impl.AbstractCh
*
* @return 字段集合对象
*/
public <T extends ColumnFieldCollection> T getColumnFieldCollection(Class<T> var1) {
public <T extends BaseColumnFieldCollection> T getColumnFieldCollection(Class<T> var1) {
return super.getFieldCollection(var1);
}
}

2
src/main/java/com/fanruan/api/engine/chart/field/ColumnFieldCollection.java → src/main/java/com/fanruan/api/engine/chart/field/BaseColumnFieldCollection.java

@ -7,6 +7,6 @@ import com.fr.chartx.data.field.AbstractColumnFieldCollection;
* @version 10.0
* Created by Bjorn on 2019-09-17
*/
public class ColumnFieldCollection extends AbstractColumnFieldCollection {
public class BaseColumnFieldCollection extends AbstractColumnFieldCollection {
}
Loading…
Cancel
Save