Browse Source

Merge branch 'release/9.0' of http://www.finedevelop.com:2015/scm/~xiaofu.qin/chart-design into release/9.0

master
Qin Xiaofu 7 years ago
parent
commit
aeecb44770
  1. 8
      designer_base/src/com/fr/design/file/HistoryTemplateListPane.java
  2. 224
      designer_base/src/com/fr/design/gui/chart/DownLoadOnLineSourcesHelper.java
  3. BIN
      designer_base/src/com/fr/design/gui/chart/background.png
  4. 3
      designer_base/src/com/fr/design/locale/designer.properties
  5. 3
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  6. 1
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  7. 3
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  8. 3
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  9. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  10. 6
      designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
  11. 5
      designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java
  12. 59
      designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java
  13. 4
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java
  14. 2
      designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisAreaPane.java
  15. 2
      designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotLabelTabPane.java
  16. 14
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  17. 7
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

8
designer_base/src/com/fr/design/file/HistoryTemplateListPane.java

@ -8,6 +8,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.gui.chart.DownLoadOnLineSourcesHelper;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ilist.UIList; import com.fr.design.gui.ilist.UIList;
@ -232,6 +233,13 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
getCurrentEditingTemplate().repaint(); getCurrentEditingTemplate().repaint();
} }
@Override
public void downLoadSources() {
DownLoadOnLineSourcesHelper pane = new DownLoadOnLineSourcesHelper();
pane.addMapJSONSiteInfo();
pane.addPhantomSiteInfo();
pane.installOnline();
}
private class HistoryListCellRender extends DefaultListCellRenderer { private class HistoryListCellRender extends DefaultListCellRenderer {

224
designer_base/src/com/fr/design/gui/chart/DownLoadOnLineSourcesHelper.java

@ -0,0 +1,224 @@
package com.fr.design.gui.chart;
import com.fr.base.FRContext;
import com.fr.design.RestartHelper;
import com.fr.design.extra.PluginConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2017/8/21.
*/
public class DownLoadOnLineSourcesHelper {
// 定义加载窗口大小
private static final int LOAD_WIDTH = 455;
private static final int INCIDENT_HEIGHT = 15;
private static final int LOAD_HEIGHT = 295;
private static final int PERCENT = 100;
//进度显示界面
private JDialog dialog;
//进度条
private JProgressBar progressbar;
private List<SiteInfo> list = new ArrayList<>();
//安装结果
private boolean result = true;
//链接服务器的客户端
private HttpClient httpClient;
//总共字节数
private double totalBytes = 0;
private static final double PHANTOM_MB = 96.1 * 1024 * 1024;
public void addPhantomSiteInfo() {
this.addSiteInfo("plugin.phantomjs", "/assist/phantomjs", PHANTOM_MB);
}
private static final double MAP_JSON_MB = 3.8 * 1024 * 1024;
public void addMapJSONSiteInfo() {
this.addSiteInfo("map.json", "/assets/map", MAP_JSON_MB);
}
public void addSiteInfo(String siteKind, String localDir, double megaBits) {
if (new File(FRContext.getCurrentEnv().getPath() + localDir).exists()) {
//本地有这个资源,不下载
return;
}
httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(siteKind));
if (httpClient.getResponseCode() != HttpURLConnection.HTTP_OK) {
//服务器连不上,不下载
return;
}
totalBytes += megaBits;
list.add(new SiteInfo(siteKind, localDir));
}
public void installOnline() {
int choose = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer-Download_Online_Sources"), null, JOptionPane.YES_NO_OPTION);
if (choose == JOptionPane.OK_OPTION) {
initDialog();
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
//取消下载
result = false;
exitDialog();
}
public void windowOpened(WindowEvent e) {
downloadAndInstallPluginDependenceFile();
exitDialog();
}
});
dialog.setVisible(true);
}
}
/**
* 下载和安装不分开是因为本地如果只安装好了一个依赖下次就不需要重复下载了
* 如果下载依赖后不安装则后面的插件会把前面的插件覆盖故而下载好了一个安装一个
*
* @return
* @throws Exception
*/
private void downloadAndInstallPluginDependenceFile() {
try {
double currentBytesRead = 0;
for (int i = 0; i < list.size(); i++) {
SiteInfo siteInfo = list.get(i);
httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(siteInfo.siteKind));
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
InputStream reader = httpClient.getResponseStream();
String temp = StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE);
File file = new File(temp);
StableUtils.makesureFileExist(file);
FileOutputStream writer = new FileOutputStream(temp);
byte[] buffer = new byte[PluginConstants.BYTES_NUM];
int bytesRead;
while ((bytesRead = reader.read(buffer)) > 0 && result) {
writer.write(buffer, 0, bytesRead);
buffer = new byte[PluginConstants.BYTES_NUM];
currentBytesRead += bytesRead;
setProgress(currentBytesRead);
}
reader.close();
writer.flush();
writer.close();
if (result) {
//安装文件
IOUtils.unZipFilesGBK(temp, FRContext.getCurrentEnv().getPath() + siteInfo.localDir);
}
} else {
result = false;
}
}
} catch (Exception e) {
result = false;
}
}
private void initDialog() {
// 创建标签,并在标签上放置一张图片
BufferedImage image = IOUtils.readImage("/com/fr/design/gui/chart/background.png");
ImageIcon imageIcon = new ImageIcon(image);
UILabel label = new UILabel(imageIcon);
label.setBounds(0, 0, LOAD_WIDTH, LOAD_HEIGHT);
progressbar = new JProgressBar();
// 显示当前进度值信息
progressbar.setStringPainted(true);
// 设置进度条边框不显示
progressbar.setBorderPainted(false);
// 设置进度条的前景色
progressbar.setForeground(new Color(0x38aef5));
// 设置进度条的背景色
progressbar.setBackground(new Color(188, 190, 194));
progressbar.setBounds(0, LOAD_HEIGHT, LOAD_WIDTH, INCIDENT_HEIGHT);
progressbar.setMinimum(0);
progressbar.setMaximum((int) totalBytes);
setProgress(0);
dialog = new JDialog();
dialog.setTitle(Inter.getLocText("FR-Designer-Dependence_Install_Online"));
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(label, BorderLayout.CENTER);
contentPane.add(progressbar, BorderLayout.SOUTH);
dialog.getContentPane().add(contentPane);
dialog.setModal(true);
dialog.setResizable(true);
dialog.setSize(LOAD_WIDTH, LOAD_HEIGHT + INCIDENT_HEIGHT);
dialog.setResizable(false);
GUICoreUtils.centerWindow(dialog);
dialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
}
private void setProgress(double current) {
progressbar.setValue((int) current);
progressbar.setString(current / totalBytes * PERCENT + "%");
progressbar.paintImmediately(new Rectangle(0, 0, LOAD_WIDTH, INCIDENT_HEIGHT * 2));
}
private void exitDialog() {
dialog.dispose();
if (result) {
int choose = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_Work_After_Restart_Designer"), null, JOptionPane.YES_NO_OPTION);
if (choose == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
} else {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Dependence_Install_Failed"));
}
}
private class SiteInfo {
String siteKind;
String localDir;
SiteInfo(String siteKind, String localDir) {
this.siteKind = siteKind;
this.localDir = localDir;
}
}
}

BIN
designer_base/src/com/fr/design/gui/chart/background.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

3
designer_base/src/com/fr/design/locale/designer.properties

@ -2127,5 +2127,6 @@ FS-Designer_DS_Filter_Specify_Tip=Specify_Tip
FR-Designer_Mobile-Height-Percent=Max Percent FR-Designer_Mobile-Height-Percent=Max Percent
FR-Designer_Mobile-Height-Limit=Height Limit FR-Designer_Mobile-Height-Limit=Height Limit
FR-Designer-AlphaFine_NO_Result=no search result FR-Designer-AlphaFine_NO_Result=no search result
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=Select Color FR-Designer_Select_Color=Select Color
FR-Designer-Basic_Dynamic_Parameter_Injection=Injection FR-Designer-Basic_Dynamic_Parameter_Injection=Injection

3
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2123,5 +2123,6 @@ FS-Designer_DS_Filter_Odd_Tip=Odd_Tip
FS-Designer_DS_Filter_Even_Tip=Even_Tip FS-Designer_DS_Filter_Even_Tip=Even_Tip
FS-Designer_DS_Filter_Specify_Tip=Specify_Tip FS-Designer_DS_Filter_Specify_Tip=Specify_Tip
FR-Designer-AlphaFine_NO_Result=no search result FR-Designer-AlphaFine_NO_Result=no search result
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=Select Color FR-Designer_Select_Color=Select Color
FR-Designer-Basic_Dynamic_Parameter_Injection=Injection FR-Designer-Basic_Dynamic_Parameter_Injection=Injection

1
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2121,5 +2121,6 @@ FS-Designer_DS_Filter_Even_Tip=
FS-Designer_DS_Filter_Specify_Tip= FS-Designer_DS_Filter_Specify_Tip=
FR-Designer_Mobile-Height-Percent= FR-Designer_Mobile-Height-Percent=
FR-Designer_Mobile-Height-Limit= FR-Designer_Mobile-Height-Limit=
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color= FR-Designer_Select_Color=
FR-Designer-Basic_Dynamic_Parameter_Injection=\ FR-Designer-Basic_Dynamic_Parameter_Injection=\

3
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2122,5 +2122,6 @@ FS-Designer_DS_Filter_Even_Tip=
FS-Designer_DS_Filter_Specify_Tip= FS-Designer_DS_Filter_Specify_Tip=
FR-Designer_Mobile-Height-Percent= FR-Designer_Mobile-Height-Percent=
FR-Designer_Mobile-Height-Limit= FR-Designer_Mobile-Height-Limit=
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color= FR-Designer_Select_Color=
FR-Designer-Basic_Dynamic_Parameter_Injection=\ FR-Designer-Basic_Dynamic_Parameter_Injection=

3
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2134,5 +2134,6 @@ FS-Designer_DS_Filter_Odd_Tip=\u63D0\u793A\uFF1A\u5E8F\u53F7\u4ECE1\u5F00\u59CB\
FS-Designer_DS_Filter_Even_Tip=\u63D0\u793A\uFF1A\u5E8F\u53F7\u4ECE1\u5F00\u59CB\uFF0C\u9009\u62E9\u4E86\u5076\u6570\u96C6(2,4,6...) FS-Designer_DS_Filter_Even_Tip=\u63D0\u793A\uFF1A\u5E8F\u53F7\u4ECE1\u5F00\u59CB\uFF0C\u9009\u62E9\u4E86\u5076\u6570\u96C6(2,4,6...)
FS-Designer_DS_Filter_Specify_Tip=\u63D0\u793A\uFF1A\u683C\u5F0F\u4E3A1,2-3,5,8\uFF0C\u5E8F\u53F7\u4ECE1\u5F00\u59CB\uFF0C\u5185\u503C\u53C2\u6570$_count_\u8868\u793A\u603B\u4E2A\u6570 FS-Designer_DS_Filter_Specify_Tip=\u63D0\u793A\uFF1A\u683C\u5F0F\u4E3A1,2-3,5,8\uFF0C\u5E8F\u53F7\u4ECE1\u5F00\u59CB\uFF0C\u5185\u503C\u53C2\u6570$_count_\u8868\u793A\u603B\u4E2A\u6570
FR-Designer-AlphaFine_NO_Result=\u65E0\u641C\u7D22\u7ED3\u679C FR-Designer-AlphaFine_NO_Result=\u65E0\u641C\u7D22\u7ED3\u679C
FR-Designer-Download_Online_Sources=\u56FE\u8868\u9700\u8981\u4E0B\u8F7D\u6700\u65B0\u7684\u8D44\u6E90\u6587\u4EF6\uFF0C\u662F\u5426\u5B89\u88C5\uFF1F
FR-Designer_Select_Color=\u9009\u62E9\u989C\u8272 FR-Designer_Select_Color=\u9009\u62E9\u989C\u8272
FR-Designer-Basic_Dynamic_Parameter_Injection=\u6CE8\u5165 FR-Designer-Basic_Dynamic_Parameter_Injection=\u6CE8\u5165

1
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2126,5 +2126,6 @@ FS-Designer_DS_Filter_Even_Tip=\u63D0\u793A\uFF1A\u5E8F\u865F\u5F9E1\u958B\u59CB
FS-Designer_DS_Filter_Specify_Tip=\u63D0\u793A\uFF1A\u683C\u5F0F\u70BA1,2-3,5,8\uFF0C\u5E8F\u865F\u5F9E1\u958B\u59CB\uFF0C\u5185\u7F6E\u53C3\u6578$_count_\u8868\u793A\u7E02\u500B\u6578 FS-Designer_DS_Filter_Specify_Tip=\u63D0\u793A\uFF1A\u683C\u5F0F\u70BA1,2-3,5,8\uFF0C\u5E8F\u865F\u5F9E1\u958B\u59CB\uFF0C\u5185\u7F6E\u53C3\u6578$_count_\u8868\u793A\u7E02\u500B\u6578
M-New_FormBook=\u65B0\u589E\u6C7A\u7B56\u5831\u8868 M-New_FormBook=\u65B0\u589E\u6C7A\u7B56\u5831\u8868
FR-Designer-AlphaFine_NO_Result=\u7121\u641C\u7D22\u7D50\u679C FR-Designer-AlphaFine_NO_Result=\u7121\u641C\u7D22\u7D50\u679C
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color= FR-Designer_Select_Color=
FR-Designer-Basic_Dynamic_Parameter_Injection=\u6CE8\u5165 FR-Designer-Basic_Dynamic_Parameter_Injection=\u6CE8\u5165

6
designer_chart/src/com/fr/design/chart/gui/ChartComponent.java

@ -331,4 +331,10 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
public void callback() { public void callback() {
this.repaint(); this.repaint();
} }
@Override
public void downLoadSources() {
HistoryTemplateListPane.getInstance().downLoadSources();
}
} }

5
designer_chart/src/com/fr/plugin/chart/custom/CustomPlotDesignerPaneFactory.java

@ -10,17 +10,16 @@ import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane;
import com.fr.plugin.chart.custom.component.CustomPlotLocationPane; import com.fr.plugin.chart.custom.component.CustomPlotLocationPane;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane;
import com.fr.plugin.chart.scatter.data.VanChartScatterPlotTableDataContentPane;
import com.fr.plugin.chart.designer.style.VanChartStylePane; import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane; import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane;
import com.fr.plugin.chart.designer.style.axis.gauge.VanChartGaugeAxisPane; import com.fr.plugin.chart.designer.style.axis.gauge.VanChartGaugeAxisPane;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.radar.VanChartRadarPlot; import com.fr.plugin.chart.radar.VanChartRadarPlot;
import com.fr.plugin.chart.scatter.VanChartScatterPlot; import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.scatter.data.VanChartScatterPlotTableDataContentPane;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.HashMap; import java.util.HashMap;

59
designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java

@ -11,12 +11,11 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.custom.component.VanChartCustomPlotSelectPane; import com.fr.plugin.chart.custom.component.VanChartCustomPlotSelectPane;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.custom.type.CustomStyle; import com.fr.plugin.chart.custom.type.CustomStyle;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
@ -45,7 +44,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
//自定义和自动版面的容器,cardLayOut布局 //自定义和自动版面的容器,cardLayOut布局
private JPanel contentPane; private JPanel contentPane;
protected Component[][] getPaneComponents(JPanel typePane){ protected Component[][] getPaneComponents(JPanel typePane) {
initContent(); initContent();
@ -72,14 +71,14 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
customPane = TableLayoutHelper.createTableLayoutPane(components, rowSize , columnSize); customPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
contentPane = new JPanel(new CardLayout()){ contentPane = new JPanel(new CardLayout()) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if(isCustom){ if (isCustom) {
return customPane.getPreferredSize(); return customPane.getPreferredSize();
} else{ } else {
return new Dimension(autoPane.getWidth(), 0); return new Dimension(autoPane.getWidth(), 0);
} }
} }
@ -98,7 +97,6 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
} }
@Override @Override
protected String[] getTypeIconPath() { protected String[] getTypeIconPath() {
return new String[]{"/com/fr/plugin/chart/custom/images/column_line.png", return new String[]{"/com/fr/plugin/chart/custom/images/column_line.png",
@ -143,22 +141,22 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
} }
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes;
for(int i = 0, len = customChart.length; i < len; i++){ for (int i = 0, len = customChart.length; i < len; i++) {
if(typeDemo.get(i).isPressing){ if (typeDemo.get(i).isPressing) {
if (i == customChart.length-1){ if (i == customChart.length - 1) {
isCustom = true; isCustom = true;
//先重置自定义组合面板,如果不重置,无法获取选择顺序 //先重置自定义组合面板,如果不重置,无法获取选择顺序
if (lastState == customChart.length-1 && samePlot) { if (lastState == customChart.length - 1 && samePlot) {
//更新数据配置,刪除已经不在的图表数据 //更新数据配置,刪除已经不在的图表数据
dealCustomDefinition(chart); dealCustomDefinition(chart);
customSelectPane.updateBean(chart); customSelectPane.updateBean(chart);
}else if (samePlot){//如果是同一个图表切换过来,则重置面板 } else if (samePlot) {//如果是同一个图表切换过来,则重置面板
customSelectPane.populateBean(chart); customSelectPane.populateBean(chart);
} }
} }
}else { } else {
isCustom = false; isCustom = false;
} }
} }
@ -170,20 +168,20 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
private void dealCustomDefinition(Chart chart) { private void dealCustomDefinition(Chart chart) {
CustomDefinition definition = (CustomDefinition) chart.getFilterDefinition(); CustomDefinition definition = (CustomDefinition) chart.getFilterDefinition();
if (definition == null){ if (definition == null) {
return; return;
} }
Map<CustomPlotType, TopDefinitionProvider> definitionMap = definition.getDefinitionProviderMap(); Map<CustomPlotType, TopDefinitionProvider> definitionMap = definition.getDefinitionProviderMap();
if (definitionMap == null){ if (definitionMap == null) {
return; return;
} }
Map<CustomPlotType, TopDefinitionProvider> newDefinitionMap = new HashMap<CustomPlotType, TopDefinitionProvider>(); Map<CustomPlotType, TopDefinitionProvider> newDefinitionMap = new HashMap<CustomPlotType, TopDefinitionProvider>();
VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot(); VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot();
for (int i = 0; i < customPlot.getCustomPlotList().size(); i++){ for (int i = 0; i < customPlot.getCustomPlotList().size(); i++) {
CustomPlotType plotType = CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i)); CustomPlotType plotType = CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i));
TopDefinitionProvider definitionProvider = definitionMap.get(plotType); TopDefinitionProvider definitionProvider = definitionMap.get(plotType);
@ -195,16 +193,17 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
/** /**
* 不同图表切換重置chart屬性 * 不同图表切換重置chart屬性
*
* @param chart * @param chart
* @param newPlot * @param newPlot
*/ */
@Override @Override
protected void resetChartAttr(Chart chart, Plot newPlot){ protected void resetChartAttr(Chart chart, Plot newPlot) {
super.resetChartAttr(chart, newPlot); super.resetChartAttr(chart, newPlot);
//切换图表清空数据配置 //切换图表清空数据配置
chart.setFilterDefinition(null); chart.setFilterDefinition(null);
//设置默认不排序 //设置默认不排序
VanChartTools tools = ((VanChart)chart).getVanChartTools(); VanChartTools tools = ((VanChart) chart).getVanChartTools();
if (tools != null) { if (tools != null) {
tools.setSort(false); tools.setSort(false);
} }
@ -214,19 +213,19 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
* 更新界面内容 * 更新界面内容
*/ */
public void populateBean(Chart chart) { public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) { for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false; imagePane.isPressing = false;
} }
//获取上次选中的图标 //获取上次选中的图标
VanChartCustomPlot customPlot = (VanChartCustomPlot)chart.getPlot(); VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot();
lastTypeIndex = customPlot.getCustomStyle().ordinal(); lastTypeIndex = customPlot.getCustomStyle().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true; typeDemo.get(lastTypeIndex).isPressing = true;
isCustom = customPlot.getCustomStyle() == CustomStyle.CUSTOM; isCustom = customPlot.getCustomStyle() == CustomStyle.CUSTOM;
//自定义选择时,更新自定义面板 //自定义选择时,更新自定义面板
if (isCustom){ if (isCustom) {
customSelectPane.populateBean(chart); customSelectPane.populateBean(chart);
} }
@ -246,17 +245,17 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
return VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID; return VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID;
} }
protected Plot getSelectedClonedPlot(){ protected Plot getSelectedClonedPlot() {
VanChartCustomPlot newPlot = null; VanChartCustomPlot newPlot = null;
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes;
for(int i = 0, len = customChart.length; i < len; i++){ for (int i = 0, len = customChart.length; i < len; i++) {
if(typeDemo.get(i).isPressing){ if (typeDemo.get(i).isPressing) {
newPlot = (VanChartCustomPlot)customChart[i].getPlot(); newPlot = (VanChartCustomPlot) customChart[i].getPlot();
} }
} }
Plot cloned = null; Plot cloned = null;
try { try {
cloned = (Plot)newPlot.clone(); cloned = (Plot) newPlot.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error In ScatterChart"); FRLogger.getLogger().error("Error In ScatterChart");
} }
@ -271,7 +270,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
/** /**
*删除配置的条件属性 *删除配置的条件属性
*/ */
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException {
cloneOldDefaultAttrConditionCollection(oldPlot, newPlot); cloneOldDefaultAttrConditionCollection(oldPlot, newPlot);
} }
@ -279,7 +278,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
/** /**
* 删除线型配置 * 删除线型配置
*/ */
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException {
if (oldPlot.getConditionCollection() != null) { if (oldPlot.getConditionCollection() != null) {
ConditionCollection newCondition = new ConditionCollection(); ConditionCollection newCondition = new ConditionCollection();
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone());
@ -288,7 +287,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
//删除线型设置 //删除线型设置
ConditionAttr attrList = newCondition.getDefaultAttr(); ConditionAttr attrList = newCondition.getDefaultAttr();
DataSeriesCondition attr = attrList.getExisted(VanChartAttrLine.class); DataSeriesCondition attr = attrList.getExisted(VanChartAttrLine.class);
if (attr != null){ if (attr != null) {
attrList.remove(VanChartAttrLine.class); attrList.remove(VanChartAttrLine.class);
} }
} }

4
designer_chart/src/com/fr/plugin/chart/custom/component/VanChartCustomPlotSelectPane.java

@ -8,11 +8,11 @@ import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.custom.type.CustomStyle; import com.fr.plugin.chart.custom.type.CustomStyle;
import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;

2
designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomAxisAreaPane.java

@ -2,9 +2,9 @@ package com.fr.plugin.chart.custom.style;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory;
import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.designer.style.background.VanChartAxisAreaPane; import com.fr.plugin.chart.designer.style.background.VanChartAxisAreaPane;
import java.util.List; import java.util.List;

2
designer_chart/src/com/fr/plugin/chart/custom/style/VanChartCustomPlotLabelTabPane.java

@ -5,10 +5,10 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.designer.PlotFactory; import com.fr.plugin.chart.designer.PlotFactory;
import com.fr.plugin.chart.designer.style.VanChartStylePane; import com.fr.plugin.chart.designer.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane;

14
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -49,6 +49,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable
private JTableHeader header;//把表头单独get出来作为一个组件 private JTableHeader header;//把表头单独get出来作为一个组件
private UIHeadGroup tabsHeaderIconPane; private UIHeadGroup tabsHeaderIconPane;
private XComponent lastAffectedCreator;
public static WidgetPropertyPane getInstance() { public static WidgetPropertyPane getInstance() {
@ -132,9 +133,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
*/ */
private void createPropertyTable() { private void createPropertyTable() {
formWidgetCardPane = new FormWidgetCardPane(designer); formWidgetCardPane = new FormWidgetCardPane(designer);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane)); designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
psp = new UIScrollPane(formWidgetCardPane); // 用来装载属性表table psp = new UIScrollPane(formWidgetCardPane); // 用来装载属性表table
psp.setBorder(null); psp.setBorder(null);
} }
@ -318,6 +317,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
private class WidgetPropertyDesignerAdapter implements DesignerEditListener { private class WidgetPropertyDesignerAdapter implements DesignerEditListener {
FormWidgetCardPane formWidgetCardPane; FormWidgetCardPane formWidgetCardPane;
WidgetPropertyDesignerAdapter(FormWidgetCardPane formWidgetCardPane) { WidgetPropertyDesignerAdapter(FormWidgetCardPane formWidgetCardPane) {
this.formWidgetCardPane = formWidgetCardPane; this.formWidgetCardPane = formWidgetCardPane;
} }
@ -329,14 +329,19 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { || evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) {
formWidgetCardPane.populate(); formWidgetCardPane.populate();
}else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED){ }else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED){
formWidgetCardPane = new FormWidgetCardPane(designer); // 防止多次触发
if (lastAffectedCreator != null && lastAffectedCreator == evt.getAffectedCreator()) {
return;
}
lastAffectedCreator = evt.getAffectedCreator();
refreshDockingView();
formWidgetCardPane.populate(); formWidgetCardPane.populate();
} }
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).formWidgetCardPane == this.formWidgetCardPane; return o instanceof WidgetPropertyDesignerAdapter;
} }
} }
@ -345,7 +350,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
*/ */
private class EventPropertyDesignerAdapter implements DesignerEditListener { private class EventPropertyDesignerAdapter implements DesignerEditListener {
EventPropertyTable propertyTable; EventPropertyTable propertyTable;
private XComponent lastAffectedCreator;
EventPropertyDesignerAdapter(EventPropertyTable eventTable) { EventPropertyDesignerAdapter(EventPropertyTable eventTable) {
this.propertyTable = eventTable; this.propertyTable = eventTable;

7
designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -27,7 +27,7 @@ import java.awt.*;
* Created by ibm on 2017/7/25. * Created by ibm on 2017/7/25.
*/ */
public class FormWidgetCardPane extends AbstractAttrNoScrollPane { public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
private AttributeChangeListener listener2; private AttributeChangeListener listener;
private FormDesigner designer; private FormDesigner designer;
//当前的编辑器属性定义面板 //当前的编辑器属性定义面板
private DataModify<Widget> currentEditorDefinePane; private DataModify<Widget> currentEditorDefinePane;
@ -81,7 +81,6 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
} else { } else {
return null; return null;
} }
} }
/** /**
@ -138,7 +137,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
jPanel.add(attriCardPane, BorderLayout.CENTER); jPanel.add(attriCardPane, BorderLayout.CENTER);
this.listener2 = new AttributeChangeListener() { this.listener = new AttributeChangeListener() {
@Override @Override
public void attributeChange() { public void attributeChange() {
updateCreator(); updateCreator();
@ -196,7 +195,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
} }
widgetPropertyPane.populate(cellWidget); widgetPropertyPane.populate(cellWidget);
reinitAllListeners(); reinitAllListeners();
this.addAttributeChangeListener(listener2); this.addAttributeChangeListener(listener);
} }

Loading…
Cancel
Save