|
|
|
@ -17,11 +17,11 @@ import com.fr.stable.Constants;
|
|
|
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.JSeparator; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public abstract class AbstractChartTypePane<T extends ChartProvider> extends FurtherBasicBeanPane<T> { |
|
|
|
@ -31,7 +31,7 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
protected static final int STYLE_SHADE = 0; |
|
|
|
|
protected static final int STYLE_TRANSPARENT = 1; |
|
|
|
|
protected static final int STYLE_PLANE3D = 2; |
|
|
|
|
protected static final int STYLE_HIGHLIGHT = 3; |
|
|
|
|
protected static final int STYLE_HIGHLIGHT = 3; |
|
|
|
|
|
|
|
|
|
protected static final int BAIDU = 0; |
|
|
|
|
protected static final int GOOGLE = 1; |
|
|
|
@ -43,15 +43,24 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
|
|
|
|
|
protected JPanel stylePane; //样式布局的面板
|
|
|
|
|
private JPanel typePane; |
|
|
|
|
|
|
|
|
|
protected abstract String[] getTypeIconPath(); |
|
|
|
|
|
|
|
|
|
protected abstract String[] getTypeTipName(); |
|
|
|
|
protected abstract String[] getTypeLayoutPath(); |
|
|
|
|
protected abstract String[] getTypeLayoutTipName(); |
|
|
|
|
|
|
|
|
|
protected String[] getTypeLayoutPath() { |
|
|
|
|
return new String[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected String[] getTypeLayoutTipName() { |
|
|
|
|
return new String[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected int lastStyleIndex = -1; |
|
|
|
|
protected boolean typeChanged = false;//图表类型是否发生变化
|
|
|
|
|
|
|
|
|
|
protected String[] getNormalLayoutTipName() { |
|
|
|
|
return new String[] { |
|
|
|
|
return new String[]{ |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade"), |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Transparent"), |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Plane3D"), |
|
|
|
@ -75,37 +84,37 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
checkDemosBackground(); |
|
|
|
|
|
|
|
|
|
typePane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(4); |
|
|
|
|
for(int i = 0; i < typeDemo.size(); i++) { |
|
|
|
|
for (int i = 0; i < typeDemo.size(); i++) { |
|
|
|
|
ChartImagePane tmp = typeDemo.get(i); |
|
|
|
|
typePane.add(tmp); |
|
|
|
|
tmp.setDemoGroup(typeDemo.toArray(new ChartSelectDemoPane[typeDemo.size()])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JPanel layoutPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(4); |
|
|
|
|
if(styleList != null && !styleList.isEmpty()) { |
|
|
|
|
for(int i = 0; i < styleList.size(); i ++) { |
|
|
|
|
if (styleList != null && !styleList.isEmpty()) { |
|
|
|
|
for (int i = 0; i < styleList.size(); i++) { |
|
|
|
|
ChartImagePane tmp = styleList.get(i); |
|
|
|
|
layoutPane.add(tmp); |
|
|
|
|
tmp.setDemoGroup(styleList.toArray(new ChartSelectDemoPane[styleList.size()])); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
double[] columnSize = { p, vs, f }; |
|
|
|
|
double[] rowSize = { p,p,p,p,p,p,p}; |
|
|
|
|
double[] columnSize = {p, vs, f}; |
|
|
|
|
double[] rowSize = {p, p, p, p, p, p, p}; |
|
|
|
|
|
|
|
|
|
if(styleList != null && !styleList.isEmpty()) { |
|
|
|
|
if (styleList != null && !styleList.isEmpty()) { |
|
|
|
|
Component[][] styleComp = new Component[][]{ |
|
|
|
|
new Component[]{new JSeparator()}, |
|
|
|
|
new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout"))}, |
|
|
|
|
new Component[]{layoutPane}, |
|
|
|
|
}; |
|
|
|
|
stylePane = TableLayoutHelper.createTableLayoutPane(styleComp,rowSize,columnSize); |
|
|
|
|
stylePane = TableLayoutHelper.createTableLayoutPane(styleComp, rowSize, columnSize); |
|
|
|
|
stylePane.setVisible(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(typePane),rowSize,columnSize); |
|
|
|
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(typePane), rowSize, columnSize); |
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
this.add(panel,BorderLayout.CENTER); |
|
|
|
|
this.add(panel, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected List<ChartImagePane> createTypeDemoList() { |
|
|
|
@ -120,7 +129,7 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
List<ChartImagePane> list = new ArrayList<ChartImagePane>(); |
|
|
|
|
int iconLen = iconPaths.length; |
|
|
|
|
int tipLen = tipNames.length; |
|
|
|
|
for(int i = 0, len = Math.min(iconLen, tipLen); i < len; i++) { |
|
|
|
|
for (int i = 0, len = Math.min(iconLen, tipLen); i < len; i++) { |
|
|
|
|
boolean isDrawRightLine = (i != len - 1 || (i + 1) % ONE_LINE_NUM != 0); |
|
|
|
|
ChartImagePane imagePane = new ChartImagePane(iconPaths[i], tipNames[i], isDrawRightLine); |
|
|
|
|
imagePane.isPressing = (i == 0); |
|
|
|
@ -129,7 +138,7 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Component[][] getPaneComponents(JPanel typePane){ |
|
|
|
|
protected Component[][] getPaneComponents(JPanel typePane) { |
|
|
|
|
return new Component[][]{ |
|
|
|
|
new Component[]{typePane}, |
|
|
|
|
new Component[]{stylePane} |
|
|
|
@ -137,14 +146,14 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//子类覆盖
|
|
|
|
|
protected <T extends Plot> T getSelectedClonedPlot(){ |
|
|
|
|
protected <T extends Plot> T getSelectedClonedPlot() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void checkTypeChange(Plot oldPlot){ |
|
|
|
|
if(styleList != null && !styleList.isEmpty()){ |
|
|
|
|
for(int i = 0; i < typeDemo.size(); i++){ |
|
|
|
|
if(typeDemo.get(i).isPressing && i != oldPlot.getDetailType()){ |
|
|
|
|
protected void checkTypeChange(Plot oldPlot) { |
|
|
|
|
if (styleList != null && !styleList.isEmpty()) { |
|
|
|
|
for (int i = 0; i < typeDemo.size(); i++) { |
|
|
|
|
if (typeDemo.get(i).isPressing && i != oldPlot.getDetailType()) { |
|
|
|
|
typeChanged = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -154,8 +163,8 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void checkDemosBackground() { |
|
|
|
|
if(this.styleList != null && !styleList.isEmpty()){ |
|
|
|
|
for(int i = 0; i < styleList.size(); i++) { |
|
|
|
|
if (this.styleList != null && !styleList.isEmpty()) { |
|
|
|
|
for (int i = 0; i < styleList.size(); i++) { |
|
|
|
|
styleList.get(i).checkBorder(); |
|
|
|
|
styleList.get(i).repaint(); |
|
|
|
|
} |
|
|
|
@ -177,7 +186,7 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//图表区属性清空
|
|
|
|
|
protected void resetChart(Chart chart){ |
|
|
|
|
protected void resetChart(Chart chart) { |
|
|
|
|
chart.setTitle(new Title(chart.getTitle().getTextObject())); |
|
|
|
|
chart.setBorderStyle(Constants.LINE_NONE); |
|
|
|
|
chart.setBorderColor(new Color(150, 150, 150)); |
|
|
|
@ -192,20 +201,22 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 此接口已删除,不用实现了 |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* 获取各图表类型界面ID, 本质是plotID |
|
|
|
|
* 使用getPlotID |
|
|
|
|
* |
|
|
|
|
* @return 图表类型界面ID |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
protected abstract String getPlotTypeID(); |
|
|
|
|
protected String getPlotTypeID() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getPlotID() { |
|
|
|
|
return plotID; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param ob 对象 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
@ -216,13 +227,13 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected boolean needsResetChart(Chart chart){ |
|
|
|
|
protected boolean needsResetChart(Chart chart) { |
|
|
|
|
return chart != null |
|
|
|
|
&&chart.getPlot() != null |
|
|
|
|
&& chart.getPlot() != null |
|
|
|
|
&& chart.getPlot().getPlotStyle() != ChartConstants.STYLE_NONE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected JPanel getTypePane(){ |
|
|
|
|
protected JPanel getTypePane() { |
|
|
|
|
return typePane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|