Browse Source

Merge pull request #1100 in BA/design from ~ZHENG/design:release/9.0 to release/9.0

* commit '1313aab564eb9c1f2182ffb4a3accab6036191a4':
  update
  update
  下载图表资源文件
  update
  打包类重复 重命名
master
superman 7 years ago
parent
commit
af1be2b520
  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. 1
      designer_base/src/com/fr/design/locale/designer.properties
  5. 1
      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. 1
      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. 5
      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

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.data.DesignTableDataManager;
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.ilable.UILabel;
import com.fr.design.gui.ilist.UIList;
@ -232,6 +233,13 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
getCurrentEditingTemplate().repaint();
}
@Override
public void downLoadSources() {
DownLoadOnLineSourcesHelper pane = new DownLoadOnLineSourcesHelper();
pane.addMapJSONSiteInfo();
pane.addPhantomSiteInfo();
pane.installOnline();
}
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

1
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-Limit=Height Limit
FR-Designer-AlphaFine_NO_Result=no search result
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=Select Color
FR-Designer-Basic_Dynamic_Parameter_Injection=Injection

1
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_Specify_Tip=Specify_Tip
FR-Designer-AlphaFine_NO_Result=no search result
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=Select Color
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=
FR-Designer_Mobile-Height-Percent=
FR-Designer_Mobile-Height-Limit=
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=
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=
FR-Designer_Mobile-Height-Percent=
FR-Designer_Mobile-Height-Limit=
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=
FR-Designer-Basic_Dynamic_Parameter_Injection=\
FR-Designer-Basic_Dynamic_Parameter_Injection=

1
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_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-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-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
M-New_FormBook=\u65B0\u589E\u6C7A\u7B56\u5831\u8868
FR-Designer-AlphaFine_NO_Result=\u7121\u641C\u7D22\u7D50\u679C
FR-Designer-Download_Online_Sources=
FR-Designer_Select_Color=
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() {
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.VanChartPlot;
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.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.axis.VanChartAxisPane;
import com.fr.plugin.chart.designer.style.axis.gauge.VanChartGaugeAxisPane;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.radar.VanChartRadarPlot;
import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.scatter.data.VanChartScatterPlotTableDataContentPane;
import java.lang.reflect.Constructor;
import java.util.HashMap;

5
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.general.FRLogger;
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.VanChartTools;
import com.fr.plugin.chart.custom.component.VanChartCustomPlotSelectPane;
import com.fr.plugin.chart.custom.type.CustomPlotType;
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.vanchart.VanChart;
@ -98,7 +97,6 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
}
@Override
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/plugin/chart/custom/images/column_line.png",
@ -195,6 +193,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
/**
* 不同图表切換重置chart屬性
*
* @param chart
* @param newPlot
*/

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.plugin.chart.attr.plot.VanChartPlot;
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.type.CustomPlotType;
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 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.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.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.designer.style.background.VanChartAxisAreaPane;
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.plugin.chart.attr.plot.VanChartPlot;
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.component.VanChartCustomPlotTabPane;
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.style.VanChartStylePane;
import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane;

Loading…
Cancel
Save