Browse Source

Merge pull request #263 in DESIGN/design from ~ZHENG/c-design:release/10.0 to release/10.0

* commit '1139b44f1d204401c153ad4706d61081a9b0f753':
  代码质量
  CHART-2660 map10.0.zip
  CHART-2611
  CHART-2611
  CHART-2611 去掉新特性这几个字 出的问题
  CHART-2645 npe
master
zheng 7 years ago
parent
commit
ba41de8e90
  1. 2
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java
  2. 41
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  3. 14
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  4. 50
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  5. 4
      designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java
  6. 4
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java
  7. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  8. 2
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java

2
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java

@ -107,7 +107,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre
public void setImageWithSuffix(ImageWithSuffix image) {
this.image = image;
// need to reset the size of JViewPort.
if (this.image == null) {
if (this.image == null || this.image.getImage() == null) {
if (this.getParent() instanceof JViewport) {
UIScrollBar tmpJScrollBar = new UIScrollBar(UIScrollBar.HORIZONTAL);
Dimension newDimension = new Dimension(this.getSize().width - tmpJScrollBar.getPreferredSize().height, this.getSize().height

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

@ -39,7 +39,6 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.form.ui.ChartEditor;
import com.fr.general.IOUtils;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
@ -84,7 +83,7 @@ import com.fr.van.chart.structure.desinger.StructureIndependentVanChartInterface
import com.fr.van.chart.treemap.TreeMapIndependentVanChartInterface;
import com.fr.van.chart.wordcloud.designer.WordCloudIndependentVanChartInterface;
import javax.swing.*;
import javax.swing.Icon;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@ -92,7 +91,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static com.fr.chart.charttypes.ChartTypeManager.*;
import static com.fr.chart.charttypes.ChartTypeManager.CHART_PRIORITY;
import static com.fr.chart.charttypes.ChartTypeManager.VAN_CHART_PRIORITY;
/**
* Created by eason on 14/12/29.
@ -170,9 +170,6 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
private static void readVanChart() {
if (chartTypeInterfaces.containsKey(VAN_CHART_PRIORITY)) {
return;
}
addChartTypeInterface(VAN_CHART_PRIORITY, PiePlot4VanChart.VAN_CHART_PIE_PLOT, new PieIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new ColumnIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID, new BarIndependentVanChartInterface());
@ -196,10 +193,6 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
private static void readDefault() {
if (chartTypeInterfaces.containsKey(CHART_PRIORITY)) {
return;
}
addChartTypeInterface(CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface());
addChartTypeInterface(CHART_PRIORITY, ChartConstants.LINE_CHART, new LineIndependentChartInterface());
@ -254,17 +247,17 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
*
* @param paneList pane容器
*/
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList) {
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane) {
List<Integer> priorityList = getPriorityInOrder();
for (Integer aPriorityList : priorityList) {
String priority = String.valueOf(aPriorityList);
addPlotTypePaneList(priority, paneList);
addPlotTypePaneList(priority, paneList, allChartTypePane);
}
}
public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends Chart>> paneList) {
public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends Chart>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) {
@ -275,26 +268,18 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
Map.Entry<String, IndependentChartUIProvider> entry = iterator.next();
String plotID = entry.getKey();
if (enabledChart(plotID)) {
AbstractChartTypePane pane = entry.getValue().getPlotTypePane();
pane.setPlotID(plotID);
paneList.add(pane);
AbstractChartTypePane pane = entry.getValue().getPlotTypePane();
pane.setPlotID(plotID);
paneList.add(pane);
if (allChartTypePane.get(priority) == null) {
allChartTypePane.put(priority, new LinkedHashMap<String, FurtherBasicBeanPane<? extends Chart>>());
}
allChartTypePane.get(priority).put(plotID, pane);
}
}
}
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList,
String priority, String plotID) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) {
IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID);
AbstractChartTypePane pane = provider.getPlotTypePane();
pane.setPlotID(plotID);
paneList.add(pane);
}
}
private static String getChartName(String plotID, IndependentChartUIProvider provider) {
String name = provider.getPlotTypeTitle4PopupWindow();
if (StringUtils.isEmpty(name)) {

14
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -18,12 +18,20 @@ import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;

50
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -26,7 +26,10 @@ import java.awt.CardLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 图表 属性表, 类型选择 界面.
@ -121,10 +124,13 @@ public class ChartTypePane extends AbstractChartAttrPane{
}
class ComboBoxPane extends UIComboBoxPane<Chart>{
private Map<String, Map<String, FurtherBasicBeanPane<? extends Chart>>> allChartTypePane;
@Override
protected List<FurtherBasicBeanPane<? extends Chart>> initPaneList() {
List<FurtherBasicBeanPane<? extends Chart>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Chart>>();
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList);
allChartTypePane = new LinkedHashMap<String, Map<String, FurtherBasicBeanPane<? extends Chart>>>();
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane);
return paneList;
}
@ -198,7 +204,41 @@ public class ChartTypePane extends AbstractChartAttrPane{
});
}
public void relayout(ChartCollection collection){
private void addAllCards() {
Iterator<String> iterator = allChartTypePane.keySet().iterator();
while (iterator.hasNext()) {
addOnePriorityCards(iterator.next(), false);
}
}
private void addOnePriorityCards(String priority) {
addOnePriorityCards(priority, true);
}
private void addOnePriorityCards(String priority, boolean ignore) {
Map<String, FurtherBasicBeanPane<? extends Chart>> map = allChartTypePane.get(priority);
Iterator<Map.Entry<String, FurtherBasicBeanPane<? extends Chart>>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, FurtherBasicBeanPane<? extends Chart>> entry = iterator.next();
String plotID = entry.getKey();
if (ignore || ChartTypeManager.enabledChart(plotID)) {
cards.add(entry.getValue());
}
}
}
private void addOnePlotIDCards(String priority, String plotID) {
cards.add(allChartTypePane.get(priority).get(plotID));
}
//因为饼图(新特性)把(新特性)去掉了,和老的饼图同名,下拉框选项和typePane不能一一对应了
//处理办法:这边除了重构 下拉项选项和cardNames 还需要把cards重构下(不需要init pane,只需要我需要的拿出来就好了)
private void relayout(ChartCollection collection){
//重构需要重构下拉框选项和cardNames
Chart chart = collection.getSelectedChart();
String priority = chart.getPriority();
@ -210,12 +250,12 @@ public class ChartTypePane extends AbstractChartAttrPane{
cards.clear();
if (enabledChart) {
if (collection.getState() == SwitchState.DEFAULT) {
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(cards);
addAllCards();
} else {
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(priority, cards);
addOnePriorityCards(priority);
}
} else {
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(cards, priority, plotID);
addOnePlotIDCards(priority, plotID);
}
//下拉框重构开始。为了防止重构是触发update

4
designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java

@ -56,10 +56,10 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
this.addSiteInfo("plugin.phantomjs", ChartConstants.PHANTOMJS_URL, PHANTOM_MB);
}
private static final double MAP_JSON_MB = 3.8 * 1024 * 1024;
private static final double MAP_JSON_MB = 4.5 * 1024 * 1024;
public void addMapJSONSiteInfo() {
this.addSiteInfo("map.json", ChartConstants.MAP_JSON_URL, MAP_JSON_MB);
this.addSiteInfo("map10.json", ChartConstants.MAP_JSON_URL, MAP_JSON_MB);
}
public void addSiteInfo(String siteKind, String localDir, double megaBits) {

4
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java

@ -154,12 +154,12 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
isCustom = true;
//先重置自定义组合面板,如果不重置,无法获取选择顺序
if (lastState == customChart.length - 1 && samePlot) {
if (lastState == customChart.length - 1 && isSamePlot()) {
//更新数据配置,刪除已经不在的图表数据
dealCustomDefinition(chart);
customSelectPane.updateBean(chart);
} else if (samePlot) {//如果是同一个图表切换过来,则重置面板
} else if (isSamePlot()) {//如果是同一个图表切换过来,则重置面板
customSelectPane.populateBean(chart);
}
}

6
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -29,7 +29,11 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{
private static final long serialVersionUID = 7743244512351499265L;
private UICheckBox largeModelCheckBox;
protected Boolean samePlot;
private boolean samePlot;
protected boolean isSamePlot() {
return samePlot;
}
//新图表暂时还没有平面3d,渐变高光等布局。
@Override

2
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java

@ -113,7 +113,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
Plot plot = chart.getPlot();
if(plot instanceof VanChartMapPlot) {
sourceChoosePane.updateBean((VanChartMapPlot) plot);
if(!samePlot || (typeChanged && samePlot)){
if(!isSamePlot() || (typeChanged && isSamePlot())){
resetAttr(plot);
}
}

Loading…
Cancel
Save