Browse Source

update

master
fr_shine 7 years ago
parent
commit
1313aab564
  1. 4
      designer_base/src/com/fr/design/file/HistoryTemplateListPane.java
  2. 18
      designer_base/src/com/fr/design/gui/chart/DownLoadOnLineSourcesHelper.java
  3. 56
      designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java

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

@ -236,8 +236,8 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
@Override @Override
public void downLoadSources() { public void downLoadSources() {
DownLoadOnLineSourcesHelper pane = new DownLoadOnLineSourcesHelper(); DownLoadOnLineSourcesHelper pane = new DownLoadOnLineSourcesHelper();
pane.addSiteInfo("map.json", "/assets/map", 3.8); pane.addMapJSONSiteInfo();
pane.addSiteInfo("plugin.phantomjs", "/assist/phantomjs", 96.1); pane.addPhantomSiteInfo();
pane.installOnline(); pane.installOnline();
} }

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

@ -31,6 +31,7 @@ public class DownLoadOnLineSourcesHelper {
private static final int LOAD_WIDTH = 455; private static final int LOAD_WIDTH = 455;
private static final int INCIDENT_HEIGHT = 15; private static final int INCIDENT_HEIGHT = 15;
private static final int LOAD_HEIGHT = 295; private static final int LOAD_HEIGHT = 295;
private static final int PERCENT = 100;
//进度显示界面 //进度显示界面
private JDialog dialog; private JDialog dialog;
@ -46,6 +47,19 @@ public class DownLoadOnLineSourcesHelper {
//总共字节数 //总共字节数
private double totalBytes = 0; 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) { public void addSiteInfo(String siteKind, String localDir, double megaBits) {
if (new File(FRContext.getCurrentEnv().getPath() + localDir).exists()) { if (new File(FRContext.getCurrentEnv().getPath() + localDir).exists()) {
//本地有这个资源,不下载 //本地有这个资源,不下载
@ -56,7 +70,7 @@ public class DownLoadOnLineSourcesHelper {
//服务器连不上,不下载 //服务器连不上,不下载
return; return;
} }
totalBytes += megaBits * 1024 * 1024; totalBytes += megaBits;
list.add(new SiteInfo(siteKind, localDir)); list.add(new SiteInfo(siteKind, localDir));
} }
@ -176,7 +190,7 @@ public class DownLoadOnLineSourcesHelper {
private void setProgress(double current) { private void setProgress(double current) {
progressbar.setValue((int) current); progressbar.setValue((int) current);
progressbar.setString(current/totalBytes * 100 + "%"); progressbar.setString(current / totalBytes * PERCENT + "%");
progressbar.paintImmediately(new Rectangle(0, 0, LOAD_WIDTH, INCIDENT_HEIGHT * 2)); progressbar.paintImmediately(new Rectangle(0, 0, LOAD_WIDTH, INCIDENT_HEIGHT * 2));
} }

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

@ -44,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();
@ -71,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);
} }
} }
@ -97,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",
@ -142,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;
} }
} }
@ -169,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);
@ -194,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);
} }
@ -213,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);
} }
@ -245,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");
} }
@ -270,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);
} }
@ -278,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());
@ -287,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);
} }
} }

Loading…
Cancel
Save