Browse Source

Merge pull request #880 in BA/design from ~MANGO/design:dev to dev

* commit 'bf75d4d9b9979ca5aa7a989223bdea870d7eb657': (27 commits)
  删除多余实现
  修改PMD问题
  删除部分多余代码,API等级改为由用户设置
  提供需要继承的抽象类
  去掉不需要的方法,不需要的面板返回null。
  接口代码优化
  优化代码
  优化代码
  优化接口设计代码
  优化接口设计代码
  优化代码
  修改文件换行格式
  修改代码中存在的一些问题。 修改文件名,删除多余的类,修改一些方法。
  格式化代码
  还原多修改的代码
  添加一些注释
  接口设计
  第三方图表接口设计
  接口设计
  第三方图表接口
  ...
master
zack 8 years ago
parent
commit
432dbb4155
  1. 7
      designer/src/com/fr/quickeditor/ChartQuickEditor.java
  2. 3
      designer_base/src/com/fr/design/gui/chart/BaseChartPropertyPane.java
  3. 257
      designer_base/src/com/fr/design/module/DesignModuleFactory.java
  4. 25
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  5. 2
      designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java
  6. 6
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java
  7. 85
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI4Custom.java
  8. 4
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java
  9. 18
      designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java
  10. 17
      designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java
  11. 2
      designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java
  12. 46
      designer_chart/src/com/fr/design/mainframe/chart/ThirdChartEditPane.java
  13. 2
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java
  14. 18
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java

7
designer/src/com/fr/quickeditor/ChartQuickEditor.java

@ -1,24 +1,24 @@
package com.fr.quickeditor;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.selection.QuickEditor;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
import com.fr.poly.PolyDesigner;
import com.fr.poly.creator.ChartBlockEditor;
import com.fr.report.cell.Elem;
import com.fr.design.selection.QuickEditor;
import java.awt.*;
public class ChartQuickEditor extends QuickEditor<TargetComponent>{
// kunsnat: editingPropertyPane初始化 避开设计器启动, 在用到的时候再初始化.
//private BaseChartPropertyPane editingPropertyPane = null;
public ChartQuickEditor() {
setLayout(new BorderLayout());
setBorder(null);
@ -45,8 +45,9 @@ public class ChartQuickEditor extends QuickEditor<TargetComponent>{
element = ((ElementCasePane)tc).getEditingElementCase().getFloatElement(fs.getSelectedFloatName());
}
collection = (BaseChartCollection) element.getValue();
String plotID=((ChartCollection)collection).getSelectedChart().getPlot().getPlotID();
add(editingPropertyPane = DesignModuleFactory.getChartPropertyPane(), BorderLayout.CENTER);
editingPropertyPane.addChartEditPane(plotID);
editingPropertyPane.setSupportCellData(true);
}
editingPropertyPane.populateChartPropertyPane(collection, tc);

3
designer_base/src/com/fr/design/gui/chart/BaseChartPropertyPane.java

@ -2,7 +2,6 @@ package com.fr.design.gui.chart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.designer.TargetComponent;
import com.fr.design.mainframe.BaseWidgetPropertyPane;
import com.fr.design.mainframe.DockingView;
/**
@ -23,5 +22,7 @@ public abstract class BaseChartPropertyPane extends DockingView {
public abstract ChartEditPaneProvider getChartEditPane();
public abstract void addChartEditPane(String plotID);
//public abstract void clear();
}

257
designer_base/src/com/fr/design/module/DesignModuleFactory.java

File diff suppressed because one or more lines are too long

25
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -11,9 +11,11 @@ import com.fr.design.chart.fun.IndependentChartUIProvider;
import com.fr.design.chart.gui.ChartWidgetOption;
import com.fr.design.chartinterface.*;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.extra.ChartTypeInterfaceCloseableHandler;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
@ -21,11 +23,13 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane
import com.fr.design.module.DesignModuleFactory;
import com.fr.file.XMLFileManager;
import com.fr.form.ui.ChartEditor;
import com.fr.general.*;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.plugin.PluginCollector;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.PluginMessage;
import com.fr.design.extra.ChartTypeInterfaceCloseableHandler;
import com.fr.plugin.proxy.PluginInstanceProxyFactory;
import com.fr.plugin.proxy.PluginInvocationHandler;
import com.fr.stable.ArrayUtils;
@ -410,6 +414,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getTableDataSourcePane(plot, parent);
}
//获取指定图表的编辑面板
public ChartEditPane getChartConfigPane(String plotID) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plotID, priority)) {
return getChartConfigPane(priority, plotID);
}
}
return getChartConfigPane(ChartTypeManager.CHART_PRIORITY, plotID);
}
private ChartEditPane getChartConfigPane(String priority, String plotID) {
return chartTypeInterfaces.get(priority).get(plotID).getChartConfigPane(plotID);
}
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();

2
designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java

@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
@ -89,5 +90,6 @@ public interface IndependentChartUIProvider extends Level {
*/
String getPlotTypeTitle4PopupWindow();
ChartEditPane getChartConfigPane(String plotID);
}

6
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java

@ -7,9 +7,11 @@ import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
/**
@ -30,6 +32,7 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr
public ChartDataPane getChartDataPane(AttributeChangeListener listener){
return new ChartDataPane(listener);
}
/**
* 是否使用默认的界面为了避免界面来回切换
* @return 是否使用默认的界面
@ -53,4 +56,7 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new DataSeriesConditionPane();
}
public ChartEditPane getChartConfigPane(String plotID){ return StableUtils.construct(ChartEditPane.class);}
}

85
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI4Custom.java

@ -0,0 +1,85 @@
package com.fr.design.chart.fun.impl;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider;
import com.fr.design.condition.ConditionAttributesPane;
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.ChartStylePane;
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.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.PiePlotPane;
import com.fr.general.ComparatorUtils;
/**
* Created by mengao on 2017/4/24.
* 用户使用第三方图表需要继承的面板抽象类
*/
public abstract class AbstractIndependentChartUI4Custom implements IndependentChartUIProvider {
@Override
public AbstractChartTypePane getPlotTypePane() {
return new PiePlotPane();
}
@Override
public ChartDataPane getChartDataPane(AttributeChangeListener listener) {
return null;
}
@Override
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
return null;
}
@Override
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
return null;
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){
return null;
}
public BasicBeanPane<Plot> getPlotSeriesPane(){
return null;
}
public boolean equals(Object obj) {
return obj != null && ComparatorUtils.equals(obj.getClass(), this.getClass());
}
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return null;
}
@Override
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){
return new AbstractChartAttrPane[]{};
}
@Override
public boolean isUseDefaultPane(){
return false;
}
@Override
public String getIconPath() {
return "com/fr/design/images/form/toolbar/ChartF-Column.png";
}
@Override
/**
* plot面板的标题
* 插件兼容
*/
public String getPlotTypeTitle4PopupWindow(){
return getPlotTypePane().title4PopupWindow();
}
}

4
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java

@ -7,9 +7,11 @@ import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
/**
* Created by Mitisky on 16/3/7.
@ -65,4 +67,6 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ
public String getPlotTypeTitle4PopupWindow(){
return getPlotTypePane().title4PopupWindow();
}
public ChartEditPane getChartConfigPane(String plotID){ return StableUtils.construct(ChartEditPane.class);}
}

18
designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java

@ -3,26 +3,20 @@
*/
package com.fr.design.mainframe;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.SwingConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import java.awt.*;
public class ChartPropertyPane extends MiddleChartPropertyPane{
/**
* 创建图表属性表实例.
*/
private synchronized static ChartPropertyPane getInstance() {
if(singleton == null) {
singleton = new ChartPropertyPane();
}
singleton.setSureProperty();
//todo
//创建新图表时,创建属性表配置面板
singleton = new ChartPropertyPane();
return singleton;
}

17
designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java

@ -3,14 +3,10 @@
*/
package com.fr.design.mainframe;
import java.awt.BorderLayout;
import javax.swing.Icon;
import javax.swing.JComponent;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.ChartEditPaneProvider;
@ -19,7 +15,9 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
@ -38,10 +36,13 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
createNameLabel();
this.add(createNorthComponent(), BorderLayout.NORTH);
chartEditPane = StableUtils.construct(ChartEditPane.class);
}
public void addChartEditPane(String plotID){
chartEditPane = ChartTypeInterfaceManager.getInstance().getChartConfigPane(plotID);
chartEditPane.setSupportCellData(true);
this.createMainPane();
setSureProperty();
}
protected abstract void createNameLabel();

2
designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java

@ -51,7 +51,6 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
protected JPanel center;
private TargetComponentContainer container = null;
private TitleChangeListener titleChangeListener = null;
private Calendar lastTime;
protected ChartEditPane() {
@ -108,6 +107,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
}
AbstractChartAttrPane selectedPane = paneList.get(tabsHeaderIconPane.getSelectedIndex());
selectedPane.update(collection);
if (!ComparatorUtils.equals(collection, lastCollection)) {
//此处画图

46
designer_chart/src/com/fr/design/mainframe/chart/ThirdChartEditPane.java

@ -0,0 +1,46 @@
package com.fr.design.mainframe.chart;
import com.fr.chart.chartattr.ChartCollection;
/**
* Created by mengao on 2017/5/3.
*/
public abstract class ThirdChartEditPane extends ChartEditPane {
protected void createTabsPane() {}
public String getSelectedTabName() {
return paneList.get(1).title4PopupWindow();
}
public void populate(ChartCollection collection) {
populateBean(collection.getSelectedChart());
}
protected void dealWithStyleChange(){
populateBean(collection.getSelectedChart());
}
/**
* 图表设计器显示选中的面板
*/
public void populateSelectedTabPane() {
populateBean(collection.getSelectedChart());
}
/**
* 数据集改变的事件监听
*/
public void registerDSChangeListener() {
}
@Override
protected String title4PopupWindow() {
return "CustomChart";
}
protected abstract void populateBean(Object ob);
protected abstract void updateBean(Object ob);
}

2
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java

@ -28,7 +28,7 @@ public class ChartDataPane extends AbstractChartAttrPane {
super();
this.listener = listener;
}
@Override
protected JPanel createContentPane() {
contentsPane = new NormalChartDataPane(listener, ChartDataPane.this);

18
designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java

@ -22,7 +22,7 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
private static final int TOP = -5;
private DatabaseTableDataPane tableDataPane;
private AbstractTableDataContentPane dataContentPane;
private ChartDataPane parent;
protected AbstractTableDataContentPane getDataContentPane() {
@ -33,10 +33,10 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
this.parent = parent;
initDataPane();
}
private void initDataPane() {
UILabel label = new BoldFontTextLabel(Inter.getLocText("Chart-DS_TableData") + ":", SwingConstants.RIGHT) ;
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT));
UILabel label = new BoldFontTextLabel(Inter.getLocText("Chart-DS_TableData") + ":", SwingConstants.RIGHT) ;
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT));
tableDataPane = new DatabaseTableDataPane(label) {
@Override
protected void userEvent() {
@ -46,18 +46,18 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
};
tableDataPane.setBorder(BorderFactory.createMatteBorder(0,6,0, 0, getBackground()));
tableDataPane.setBorder(BorderFactory.createEmptyBorder(0,1,0,1));
tableDataPane.setBorder(BorderFactory.createEmptyBorder(0,1,0,1));
tableDataPane.setPreferredSize(new Dimension(205 , 20));
this.setBorder(BorderFactory.createEmptyBorder(TOP,0,0,0));
this.setBorder(BorderFactory.createEmptyBorder(TOP,0,0,0));
this.add(tableDataPane, BorderLayout.NORTH);
}
/**
* 检查box是否可用.
*/
public void checkBoxUse() {
TableDataWrapper dataWrap = tableDataPane.getTableDataWrapper();
if(dataContentPane != null) {
dataContentPane.checkBoxUse(dataWrap != null);
}
@ -140,7 +140,7 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
}
onSelectTableData();
checkBoxUse();
tableDataPane.populateBean(tableData);
}

Loading…
Cancel
Save