Browse Source

Merge pull request #1120 in DESIGN/design from ~BJORN/design:feature/10.0 to feature/10.0

* commit '6c6b16522614afbf794325ffb1814eacd8026125':
  CHART-10233 对新接口做了适配和兼容
research/11.0
Bjorn 5 years ago
parent
commit
2b9f84e5dd
  1. 76
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  2. 4
      designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java
  3. 2
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java

76
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -125,7 +125,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public static final String TYPE_PANE_DEFAULT_TITLE = "DEFAULT_NAME";
public synchronized static ChartTypeInterfaceManager getInstance() {
return classManager;
}
@ -158,7 +158,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
});
}
public static WidgetOption[] initWidgetOption() {
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs();
@ -201,8 +201,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface());
}
private static void readDefault() {
addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
@ -225,7 +225,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
private static void addChartTypeInterface(String priority, String plotID, ChartTypeUIProvider provider) {
if (chartTypeInterfaces != null) {
if (!chartTypeInterfaces.containsKey(priority)) {
//新建一个具体图表列表
@ -252,14 +252,14 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
return null;
}
/**
* 把所有的pane加到list里
*
* @param paneList pane容器
*/
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) {
List<Integer> priorityList = getPriorityInOrder();
for (Integer aPriorityList : priorityList) {
String priority = String.valueOf(aPriorityList);
@ -302,9 +302,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
public String getTitle4PopupWindow(String plotID) {
return getName(plotID);
}
private List<Integer> getPriorityInOrder() {
List<Integer> priorityList = new ArrayList<Integer>();
if (chartTypeInterfaces != null) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
@ -468,7 +468,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return provider.getPlotTypePane().title4PopupWindow();
}
public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) {
ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
@ -477,7 +477,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return new ChartDataPane(listener);
}
public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) {
ChartTypeUIProvider provider = getChartTypeInterface(plotID);
if (provider != null) {
@ -485,9 +485,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
return new AbstractChartAttrPane[0];
}
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
@ -497,7 +497,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null;
}
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
@ -507,7 +507,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null;
}
public ConditionAttributesPane getPlotConditionPane(Plot plot) {
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
@ -517,7 +517,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null;
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID());
@ -527,7 +527,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return null;
}
/**
* 是否使用默认的界面为了避免界面来回切换
*
@ -540,7 +540,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
if (provider != null) {
return provider.isUseDefaultPane();
}
return true;
}
@ -555,31 +555,37 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return true;
}
@Override
public void mount(PluginSingleInjection injection) {
if (isIndependentChartUIProvider(injection)) {
if (isChartTypeUIProvider(injection)) {
String id = injection.getAttribute("chartID");
if (StringUtils.isEmpty(id)) {
id = injection.getAttribute("plotID");
}
String priority = injection.getAttribute("priority", DEFAULT_PRIORITY);
String plotID = injection.getAttribute("plotID");
ChartTypeUIProvider instance = (ChartTypeUIProvider) injection.getObject();
addChartTypeInterface(priority, plotID, instance);
addChartTypeInterface(priority, id, instance);
}
}
@Override
public void demount(PluginSingleInjection injection) {
if (isIndependentChartUIProvider(injection)) {
if (isChartTypeUIProvider(injection)) {
String priority = injection.getAttribute("priority", DEFAULT_PRIORITY);
String plotID = injection.getAttribute("plotID");
removeChartTypeInterface(priority, plotID);
String id = injection.getAttribute("chartID");
if (StringUtils.isEmpty(id)) {
id = injection.getAttribute("plotID");
}
removeChartTypeInterface(priority, id);
}
}
private void removeChartTypeInterface(String priority, String plotID) {
if (chartTypeInterfaces != null) {
if (chartTypeInterfaces.containsKey(priority)) {
Map<String, ChartTypeUIProvider> chartUIList = chartTypeInterfaces.get(priority);
@ -587,11 +593,11 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
}
}
}
private boolean isIndependentChartUIProvider(PluginSingleInjection injection) {
return !(injection == null || injection.getObject() == null) && ChartTypeUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof ChartTypeUIProvider;
private boolean isChartTypeUIProvider(PluginSingleInjection injection) {
return !(injection == null || injection.getObject() == null) && (ChartTypeUIProvider.XML_TAG.equals(injection.getName()) || ChartTypeUIProvider.OLD_TAG.equals(injection.getName())) && injection.getObject() instanceof ChartTypeUIProvider;
}

4
designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java

@ -23,7 +23,9 @@ import com.fr.stable.fun.Level;
*/
public interface ChartTypeUIProvider extends Level {
String XML_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();
String XML_TAG = "ChartTypeUIProvider";
String OLD_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();
int CURRENT_API_LEVEL = 3;

2
designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java

@ -16,10 +16,12 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* Created by shine on 2019/09/03.
*/
@API(level = ChartTypeUIProvider.CURRENT_API_LEVEL)
public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider {
@Override

Loading…
Cancel
Save