forked from fanruan/design
zheng
7 years ago
944 changed files with 36862 additions and 36472 deletions
@ -1,231 +0,0 @@
|
||||
package com.fr.plugin.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 implements DownloadSourcesEvent { |
||||
// 定义加载窗口大小
|
||||
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/plugin/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((int) (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")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void downloadSources() { |
||||
this.addMapJSONSiteInfo(); |
||||
this.addPhantomSiteInfo(); |
||||
this.installOnline(); |
||||
} |
||||
|
||||
private class SiteInfo { |
||||
String siteKind; |
||||
String localDir; |
||||
|
||||
SiteInfo(String siteKind, String localDir) { |
||||
this.siteKind = siteKind; |
||||
this.localDir = localDir; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
package com.fr.plugin.chart.area; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.condition.ConditionAttributesPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/11/18. |
||||
*/ |
||||
public class AreaIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { |
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/design/images/form/toolbar/area.png"; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new VanChartAreaPlotPane(); |
||||
} |
||||
|
||||
public ConditionAttributesPane getPlotConditionPane(Plot plot){ |
||||
return new VanChartAreaConditionPane(plot); |
||||
} |
||||
|
||||
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ |
||||
return new VanChartAreaSeriesPane(parent, plot); |
||||
} |
||||
|
||||
/** |
||||
* plot面板的标题 |
||||
* 插件兼容 |
||||
*/ |
||||
public String getPlotTypeTitle4PopupWindow(){ |
||||
return VanChartAreaPlotPane.TITLE; |
||||
} |
||||
|
||||
} |
@ -1,96 +0,0 @@
|
||||
package com.fr.plugin.chart.area; |
||||
|
||||
import com.fr.chart.base.AttrBackground; |
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; |
||||
import com.fr.plugin.chart.attr.EffectHelper; |
||||
import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground; |
||||
import com.fr.plugin.chart.base.AttrDataSheet; |
||||
import com.fr.plugin.chart.base.AttrEffect; |
||||
import com.fr.plugin.chart.base.AttrLabel; |
||||
import com.fr.plugin.chart.base.AttrTooltip; |
||||
import com.fr.plugin.chart.base.VanChartAttrLine; |
||||
import com.fr.plugin.chart.base.VanChartAttrMarker; |
||||
import com.fr.plugin.chart.base.VanChartAttrTrendLine; |
||||
import com.fr.plugin.chart.designer.PlotFactory; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartAreaFillColorConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartDataSheetContentPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartLineTypeConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartMarkerConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartTrendLineConditionPane; |
||||
import com.fr.plugin.chart.glyph.VanChartMultiCategoryDataPoint; |
||||
import com.fr.plugin.chart.scatter.large.VanChartLargeModelMarkerConditionPane; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/11/18. |
||||
*/ |
||||
public class VanChartAreaConditionPane extends DataSeriesConditionPane { |
||||
private static final long serialVersionUID = -7180705321732069806L; |
||||
|
||||
public VanChartAreaConditionPane(Plot plot) { |
||||
super(plot); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
//添加全部条件属性后被遮挡
|
||||
liteConditionPane.setPreferredSize(new Dimension(300, 400)); |
||||
} |
||||
|
||||
@Override |
||||
protected void addBasicAction() { |
||||
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); |
||||
classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this)); |
||||
classPaneMap.put(AttrAreaSeriesFillColorBackground.class, new VanChartAreaFillColorConditionPane(this, plot)); |
||||
classPaneMap.put(VanChartAttrLine.class, new VanChartLineTypeConditionPane(this)); |
||||
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); |
||||
//是否使用数据表
|
||||
if (plot.getDataSheet().isVisible()) { |
||||
classPaneMap.put(AttrDataSheet.class, new VanChartDataSheetContentPane(this, plot)); |
||||
} |
||||
if(PlotFactory.largeDataModel(plot)){ |
||||
classPaneMap.put(VanChartAttrMarker.class, new VanChartLargeModelMarkerConditionPane(this)); |
||||
} else { |
||||
classPaneMap.put(VanChartAttrMarker.class, new VanChartMarkerConditionPane(this)); |
||||
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getAreaPlotDefaultEffect())); |
||||
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); |
||||
} |
||||
} |
||||
|
||||
protected void addStyleAction() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected ChartConditionPane createListConditionPane() { |
||||
return new ChartConditionPane(){ |
||||
@Override |
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
ChartConstants.CATEGORY_INDEX, |
||||
ChartConstants.CATEGORY_NAME, |
||||
ChartConstants.SERIES_INDEX, |
||||
ChartConstants.SERIES_NAME, |
||||
ChartConstants.VALUE, |
||||
VanChartMultiCategoryDataPoint.CATEGORY_ARRAY, |
||||
}; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 返回图表class对象 |
||||
* @return class对象 |
||||
*/ |
||||
public Class<? extends Plot> class4Correspond() { |
||||
return VanChartAreaPlot.class; |
||||
} |
||||
} |
@ -1,81 +0,0 @@
|
||||
package com.fr.plugin.chart.area; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/11/18. |
||||
*/ |
||||
public class VanChartAreaPlotPane extends AbstractVanChartTypePane { |
||||
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewArea"); |
||||
private static final long serialVersionUID = -8161581682558781651L; |
||||
|
||||
@Override |
||||
protected String[] getTypeIconPath() { |
||||
|
||||
return new String[]{"/com/fr/plugin/chart/area/images/area.png", |
||||
"/com/fr/plugin/chart/area/images/stack.png", |
||||
"/com/fr/plugin/chart/area/images/percentStack.png", |
||||
"/com/fr/plugin/chart/area/images/custom.png", |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeTipName() { |
||||
String area = Inter.getLocText("FR-Chart-Type_Area"); |
||||
String stack = Inter.getLocText("FR-Chart-Type_Stacked"); |
||||
String percent = Inter.getLocText("FR-Chart-Use_Percent"); |
||||
return new String[]{ |
||||
area, |
||||
stack + area, |
||||
percent + stack + area, |
||||
Inter.getLocText("FR-Chart-Mode_Custom") |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 返回界面标题 |
||||
* |
||||
* @return 界面标题 |
||||
*/ |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_NewArea"); |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 获取各图表类型界面ID, 本质是plotID |
||||
* |
||||
* @return 图表类型界面ID |
||||
*/ |
||||
@Override |
||||
protected String getPlotTypeID() { |
||||
return VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID; |
||||
} |
||||
|
||||
protected Plot getSelectedClonedPlot() { |
||||
VanChartAreaPlot newPlot = null; |
||||
Chart[] areaChart = AreaIndependentVanChart.AreaVanChartTypes; |
||||
for (int i = 0, len = areaChart.length; i < len; i++) { |
||||
if (typeDemo.get(i).isPressing) { |
||||
newPlot = (VanChartAreaPlot) areaChart[i].getPlot(); |
||||
} |
||||
} |
||||
Plot cloned = null; |
||||
try { |
||||
cloned = (Plot) newPlot.clone(); |
||||
} catch (CloneNotSupportedException e) { |
||||
FRLogger.getLogger().error("Error In AreaChart"); |
||||
} |
||||
return cloned; |
||||
} |
||||
|
||||
public Chart getDefaultChart() { |
||||
return AreaIndependentVanChart.AreaVanChartTypes[0]; |
||||
} |
||||
|
||||
} |
@ -1,46 +0,0 @@
|
||||
package com.fr.plugin.chart.area; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.plugin.chart.column.VanChartCustomStackAndAxisConditionPane; |
||||
import com.fr.plugin.chart.line.VanChartLineSeriesPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class VanChartAreaSeriesPane extends VanChartLineSeriesPane{ |
||||
|
||||
private static final long serialVersionUID = 5497989595104913025L; |
||||
|
||||
public VanChartAreaSeriesPane(ChartStylePane parent, Plot plot){ |
||||
super(parent, plot); |
||||
} |
||||
|
||||
protected JPanel getContentInPlotType(){ |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] row = {p,p,p,p,p,p,p}; |
||||
double[] col = {f}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{getColorPane()}, |
||||
new Component[]{createLineTypePane()}, |
||||
new Component[]{createMarkerPane()}, |
||||
new Component[]{createAreaFillColorPane()}, |
||||
new Component[]{createStackedAndAxisPane()}, |
||||
new Component[]{createLargeDataModelPane()}, |
||||
new Component[]{createTrendLinePane()}, |
||||
}; |
||||
|
||||
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); |
||||
return contentPane; |
||||
} |
||||
|
||||
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() { |
||||
return VanChartCustomStackAndAxisConditionPane.class; |
||||
} |
||||
} |
@ -1,56 +0,0 @@
|
||||
package com.fr.plugin.chart.bar; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.condition.ConditionAttributesPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.AbstractChartAttrPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.plugin.chart.column.VanChartColumnConditionPane; |
||||
import com.fr.plugin.chart.column.VanChartColumnSeriesPane; |
||||
import com.fr.plugin.chart.designer.other.VanChartOtherPane; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/10/20. |
||||
*/ |
||||
public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { |
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/design/images/form/toolbar/bar.png"; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new VanChartBarPlotPane(); |
||||
} |
||||
|
||||
public ConditionAttributesPane getPlotConditionPane(Plot plot){ |
||||
return new VanChartColumnConditionPane(plot); |
||||
} |
||||
|
||||
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ |
||||
return new VanChartColumnSeriesPane(parent, plot); |
||||
} |
||||
|
||||
/** |
||||
* 图表的属性界面数组 |
||||
* @return 属性界面 |
||||
*/ |
||||
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ |
||||
VanChartStylePane stylePane = new VanChartBarStylePane(listener); |
||||
VanChartOtherPane otherPane = new VanChartOtherPane(); |
||||
return new AbstractChartAttrPane[]{stylePane, otherPane}; |
||||
} |
||||
|
||||
/** |
||||
* plot面板的标题 |
||||
* 插件兼容 |
||||
*/ |
||||
public String getPlotTypeTitle4PopupWindow(){ |
||||
return VanChartBarPlotPane.TITLE; |
||||
} |
||||
|
||||
} |
@ -1,81 +0,0 @@
|
||||
package com.fr.plugin.chart.bar; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.column.VanChartColumnPlot; |
||||
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/10/20. |
||||
*/ |
||||
public class VanChartBarPlotPane extends AbstractVanChartTypePane { |
||||
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBar"); |
||||
|
||||
private static final long serialVersionUID = 2879689884048643002L; |
||||
|
||||
@Override |
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{"/com/fr/plugin/chart/bar/images/bar.png", |
||||
"/com/fr/plugin/chart/bar/images/stack.png", |
||||
"/com/fr/plugin/chart/bar/images/percentstack.png", |
||||
"/com/fr/plugin/chart/bar/images/custom.png", |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeTipName() { |
||||
String bar = Inter.getLocText("FR-Chart-Type_Bar"); |
||||
String stack = Inter.getLocText("FR-Chart-Type_Stacked"); |
||||
String percent = Inter.getLocText("FR-Chart-Use_Percent"); |
||||
return new String[]{ |
||||
bar, |
||||
stack + bar, |
||||
percent + stack + bar, |
||||
Inter.getLocText("FR-Chart-Mode_Custom") |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 返回界面标题 |
||||
* @return 界面标题 |
||||
*/ |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_NewBar"); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取各图表类型界面ID, 本质是plotID |
||||
* |
||||
* @return 图表类型界面ID |
||||
*/ |
||||
@Override |
||||
protected String getPlotTypeID() { |
||||
return VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID; |
||||
} |
||||
|
||||
protected Plot getSelectedClonedPlot(){ |
||||
VanChartColumnPlot newPlot = null; |
||||
Chart[] barChart = BarIndependentVanChart.BarVanChartTypes; |
||||
for(int i = 0, len = barChart.length; i < len; i++){ |
||||
if(typeDemo.get(i).isPressing){ |
||||
newPlot = (VanChartColumnPlot)barChart[i].getPlot(); |
||||
} |
||||
} |
||||
|
||||
Plot cloned = null; |
||||
try { |
||||
cloned = (Plot)newPlot.clone(); |
||||
} catch (CloneNotSupportedException e) { |
||||
FRLogger.getLogger().error("Error In ColumnChart"); |
||||
} |
||||
return cloned; |
||||
} |
||||
|
||||
public Chart getDefaultChart() { |
||||
return BarIndependentVanChart.BarVanChartTypes[0]; |
||||
} |
||||
|
||||
} |
@ -1,23 +0,0 @@
|
||||
package com.fr.plugin.chart.bar; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.axis.bar.VanChartBarAxisPane; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/6/8. |
||||
*/ |
||||
public class VanChartBarStylePane extends VanChartStylePane { |
||||
public VanChartBarStylePane(AttributeChangeListener listener) { |
||||
super(listener); |
||||
} |
||||
|
||||
@Override |
||||
protected void createVanChartAxisPane(List<BasicPane> paneList, VanChartAxisPlot plot) { |
||||
paneList.add(new VanChartBarAxisPane(plot, VanChartBarStylePane.this)); |
||||
} |
||||
} |
@ -1,85 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.condition.ConditionAttributesPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.AbstractChartAttrPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.BubblePlotReportDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane; |
||||
import com.fr.plugin.chart.designer.other.VanChartOtherPane; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.vanchart.AbstractIndependentVanChartUI; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class BubbleIndependentVanChartInterface extends AbstractIndependentVanChartUI { |
||||
/** |
||||
* 图表的类型定义界面类型,就是属性表的第一个界面 |
||||
* |
||||
* @return 图表的类型定义界面类型 |
||||
*/ |
||||
@Override |
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new VanChartBubblePlotPane(); |
||||
} |
||||
|
||||
/** |
||||
* 图标路径 |
||||
* |
||||
* @return 图标路径 |
||||
*/ |
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/design/images/form/toolbar/bubble.png"; |
||||
} |
||||
@Override |
||||
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ |
||||
return new VanChartBubbleSeriesPane(parent, plot); |
||||
} |
||||
|
||||
@Override |
||||
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ |
||||
if(((VanChartBubblePlot) plot).isForceBubble()){ |
||||
return super.getTableDataSourcePane(plot, parent); |
||||
} |
||||
return new VanChartBubblePlotTableDataContentPane(parent); |
||||
} |
||||
|
||||
@Override |
||||
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ |
||||
if(((VanChartBubblePlot) plot).isForceBubble()){ |
||||
return super.getReportDataSourcePane(plot, parent); |
||||
} |
||||
return new BubblePlotReportDataContentPane(parent); |
||||
} |
||||
|
||||
/** |
||||
* 图表的属性界面数组 |
||||
* @return 属性界面 |
||||
*/ |
||||
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ |
||||
VanChartStylePane stylePane = new VanChartBubbleStylePane(listener); |
||||
VanChartOtherPane otherPane = new VanChartOtherPane(){ |
||||
protected BasicBeanPane<Chart> createInteractivePane() { |
||||
return new VanChartBubbleInteractivePane(); |
||||
} |
||||
}; |
||||
return new AbstractChartAttrPane[]{stylePane, otherPane}; |
||||
} |
||||
|
||||
public ConditionAttributesPane getPlotConditionPane(Plot plot){ |
||||
return new VanChartBubbleConditionPane(plot); |
||||
} |
||||
|
||||
public String getPlotTypeTitle4PopupWindow(){ |
||||
return VanChartBubblePlotPane.TITLE; |
||||
} |
||||
} |
@ -1,94 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble; |
||||
|
||||
import com.fr.chart.base.AttrAlpha; |
||||
import com.fr.chart.base.AttrBackground; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; |
||||
import com.fr.plugin.chart.attr.EffectHelper; |
||||
import com.fr.plugin.chart.base.AttrEffect; |
||||
import com.fr.plugin.chart.base.AttrLabel; |
||||
import com.fr.plugin.chart.base.AttrTooltip; |
||||
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; |
||||
import com.fr.plugin.chart.designer.PlotFactory; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartBubbleSetConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; |
||||
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; |
||||
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltip; |
||||
import com.fr.plugin.chart.scatter.component.label.VanChartScatterLabelConditionPane; |
||||
import com.fr.plugin.chart.scatter.component.tooltip.VanChartScatterTooltipConditionPane; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartBubbleConditionPane extends DataSeriesConditionPane { |
||||
private static final long serialVersionUID = -7180705321732069806L; |
||||
|
||||
public VanChartBubbleConditionPane(Plot plot) { |
||||
super(plot); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
//添加全部条件属性后被遮挡
|
||||
liteConditionPane.setPreferredSize(new Dimension(300, 400)); |
||||
} |
||||
|
||||
private boolean forceBubble() { |
||||
return plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChartConditionPane createListConditionPane() { |
||||
return forceBubble() ? new ChartConditionPane() : new VanChartBubbleConditionSelectionPane(); |
||||
} |
||||
|
||||
@Override |
||||
protected void addBasicAction() { |
||||
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); |
||||
classPaneMap.put(VanChartAttrBubble.class, new VanChartBubbleSetConditionPane(this)); |
||||
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); |
||||
|
||||
if(forceBubble()){ |
||||
addForceAction(); |
||||
} else if(PlotFactory.largeDataModel(plot)){ |
||||
addLargeAction(); |
||||
} else { |
||||
addNormalAction(); |
||||
} |
||||
} |
||||
|
||||
private void addNormalAction() { |
||||
classPaneMap.put(ScatterAttrLabel.class, new VanChartScatterLabelConditionPane(this, plot)); |
||||
classPaneMap.put(ScatterAttrTooltip.class, new VanChartScatterTooltipConditionPane(this, plot)); |
||||
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect())); |
||||
} |
||||
|
||||
private void addForceAction() { |
||||
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); |
||||
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); |
||||
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect())); |
||||
} |
||||
|
||||
private void addLargeAction() { |
||||
classPaneMap.put(ScatterAttrTooltip.class, new VanChartScatterTooltipConditionPane(this, plot)); |
||||
} |
||||
|
||||
|
||||
protected void addStyleAction() { |
||||
} |
||||
|
||||
/** |
||||
* 返回图表class对象 |
||||
* @return class对象 |
||||
*/ |
||||
public Class<? extends Plot> class4Correspond() { |
||||
return VanChartBubblePlot.class; |
||||
} |
||||
} |
@ -1,22 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||
import com.fr.plugin.chart.scatter.VanChartScatterDataPoint; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartBubbleConditionSelectionPane extends ChartConditionPane { |
||||
|
||||
|
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
ChartConstants.SERIES_INDEX, |
||||
ChartConstants.SERIES_NAME, |
||||
VanChartScatterDataPoint.X, |
||||
VanChartScatterDataPoint.Y, |
||||
ChartConstants.VALUE |
||||
}; |
||||
} |
||||
} |
@ -1,28 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.base.VanChartConstants; |
||||
import com.fr.plugin.chart.designer.other.VanChartInteractivePaneWithOutSort; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartBubbleInteractivePane extends VanChartInteractivePaneWithOutSort { |
||||
protected String[] getNameArray() { |
||||
Plot plot = chart.getPlot(); |
||||
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { |
||||
return new String[]{Inter.getLocText("Plugin-ChartF_XYAxis"), Inter.getLocText("Chart-Use_None")}; |
||||
} |
||||
return super.getNameArray(); |
||||
} |
||||
|
||||
protected String[] getValueArray() { |
||||
Plot plot = chart.getPlot(); |
||||
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { |
||||
return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; |
||||
} |
||||
return super.getValueArray(); |
||||
} |
||||
|
||||
} |
@ -1,150 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble; |
||||
|
||||
import com.fr.chart.base.AttrAlpha; |
||||
import com.fr.chart.base.DataSeriesCondition; |
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartglyph.ConditionAttr; |
||||
import com.fr.chart.chartglyph.ConditionCollection; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.base.VanChartTools; |
||||
import com.fr.plugin.chart.base.VanChartZoom; |
||||
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; |
||||
import com.fr.plugin.chart.vanchart.VanChart; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartBubblePlotPane extends AbstractVanChartTypePane { |
||||
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBubble");; |
||||
|
||||
private static final long serialVersionUID = -3481633368542654247L; |
||||
|
||||
private static final float FORCE_ALPHA = 1.0f; |
||||
|
||||
private static final float ALPHA = 0.7f; |
||||
|
||||
@Override |
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{"/com/fr/plugin/chart/bubble/images/bubble.png", |
||||
"/com/fr/plugin/chart/bubble/images/force.png" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeTipName() { |
||||
return new String[]{ |
||||
Inter.getLocText("FR-Chart-Chart_BubbleChart"), |
||||
Inter.getLocText("Plugin-ChartF_NewForceBubble") |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 返回界面标题 |
||||
* @return 界面标题 |
||||
*/ |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_NewBubble"); |
||||
} |
||||
|
||||
|
||||
private void removeDefaultAttr(ConditionAttr conditionAttr, Class <? extends DataSeriesCondition> targetClass) { |
||||
DataSeriesCondition attr = conditionAttr.getExisted(targetClass); |
||||
if (attr != null){ |
||||
conditionAttr.remove(targetClass); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取各图表类型界面ID, 本质是plotID |
||||
* |
||||
* @return 图表类型界面ID |
||||
*/ |
||||
@Override |
||||
protected String getPlotTypeID() { |
||||
return VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID; |
||||
} |
||||
|
||||
protected Plot getSelectedClonedPlot(){ |
||||
VanChartBubblePlot newPlot = null; |
||||
Chart[] bubbleChart = BubbleIndependentVanChart.BubbleVanChartTypes; |
||||
for(int i = 0, len = bubbleChart.length; i < len; i++){ |
||||
if(typeDemo.get(i).isPressing){ |
||||
newPlot = (VanChartBubblePlot)bubbleChart[i].getPlot(); |
||||
} |
||||
} |
||||
|
||||
Plot cloned = null; |
||||
try { |
||||
cloned = (Plot)newPlot.clone(); |
||||
} catch (CloneNotSupportedException e) { |
||||
FRLogger.getLogger().error("Error In BubbleChart"); |
||||
} |
||||
return cloned; |
||||
} |
||||
|
||||
public Chart getDefaultChart() { |
||||
return BubbleIndependentVanChart.BubbleVanChartTypes[0]; |
||||
} |
||||
|
||||
@Override |
||||
/** |
||||
* 力學氣泡圖切換到其他氣泡圖時,刪除條件屬性 |
||||
* 并且将bubbleAttr属性重置 |
||||
*/ |
||||
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
||||
cloneOldDefaultAttrConditionCollection(oldPlot, newPlot); |
||||
} |
||||
|
||||
@Override |
||||
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
||||
if (oldPlot.getConditionCollection() != null) { |
||||
ConditionCollection newCondition = new ConditionCollection(); |
||||
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); |
||||
newPlot.setConditionCollection(newCondition); |
||||
|
||||
ConditionAttr attrList = newCondition.getDefaultAttr(); |
||||
|
||||
//根据气泡图类型,重设透明度属性
|
||||
removeDefaultAttr(attrList, AttrAlpha.class); |
||||
|
||||
//删除标签属性(防止切换到大数据气泡图标签属性会拷贝过去)
|
||||
removeDefaultAttr(attrList, ScatterAttrLabel.class); |
||||
|
||||
AttrAlpha attrAlpha = new AttrAlpha(); |
||||
attrAlpha.setAlpha(((VanChartBubblePlot)newPlot).isForceBubble() ? FORCE_ALPHA : ALPHA); |
||||
|
||||
attrList.addDataSeriesCondition(attrAlpha); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { |
||||
if(oldPlot instanceof VanChartBubblePlot && newPlot instanceof VanChartBubblePlot){ |
||||
if(((VanChartBubblePlot) oldPlot).isForceBubble() == ((VanChartBubblePlot) newPlot).isForceBubble()){ |
||||
super.cloneHotHyperLink(oldPlot, newPlot); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected VanChartTools createVanChartTools() { |
||||
VanChartTools tools = new VanChartTools(); |
||||
tools.setSort(false); |
||||
return tools; |
||||
} |
||||
|
||||
/** |
||||
* 气泡图相同图表类型之间切换的时候,chart的部分属性也需要重置 |
||||
* @param chart |
||||
*/ |
||||
@Override |
||||
protected void resetChartAttr4SamePlot(Chart chart){ |
||||
VanChartZoom vanChartZoom = new VanChartZoom(); |
||||
((VanChart)chart).setVanChartZoom(vanChartZoom); |
||||
//重置监控刷新选项
|
||||
resetRefreshMoreLabelAttr((VanChart)chart); |
||||
} |
||||
} |
@ -1,100 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartglyph.ConditionAttr; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; |
||||
import com.fr.plugin.chart.bubble.component.VanChartBubblePane; |
||||
import com.fr.plugin.chart.custom.component.VanChartCustomAxisConditionPane; |
||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||
import com.fr.plugin.chart.designer.style.series.VanChartAbstractPlotSeriesPane; |
||||
import com.fr.plugin.chart.designer.style.series.VanChartStackedAndAxisListControlPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { |
||||
private static final long serialVersionUID = 5595016643808487932L; |
||||
private VanChartBubblePane bubblePane; |
||||
|
||||
public VanChartBubbleSeriesPane(ChartStylePane parent, Plot plot) { |
||||
super(parent, plot); |
||||
} |
||||
|
||||
protected JPanel getContentInPlotType() { |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] row = {p, p, p, p, p, p}; |
||||
double[] col = {f}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{getColorPane()}, |
||||
new Component[]{createBubblePane()}, |
||||
new Component[]{createStackedAndAxisPane()}, |
||||
new Component[]{null} |
||||
}; |
||||
|
||||
if (!((VanChartBubblePlot)plot).isForceBubble()) { |
||||
components[3] = new Component[]{createLargeDataModelPane()}; |
||||
} |
||||
|
||||
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); |
||||
return contentPane; |
||||
} |
||||
|
||||
//设置色彩面板内容
|
||||
@Override |
||||
protected void setColorPaneContent (JPanel panel) { |
||||
panel.add(createAlphaPane(), BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
//堆积和坐标轴设置(自定义柱形图等用到)
|
||||
protected JPanel createStackedAndAxisPane() { |
||||
stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane(){ |
||||
@Override |
||||
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() { |
||||
return VanChartCustomAxisConditionPane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String getPaneTitle(){ |
||||
return Inter.getLocText("Plugin-ChartF_Custom_Axis"); |
||||
} |
||||
}; |
||||
stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); |
||||
return stackAndAxisEditExpandablePane; |
||||
} |
||||
|
||||
private JPanel createBubblePane() { |
||||
bubblePane = new VanChartBubblePane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_Bubble"), bubblePane); |
||||
} |
||||
|
||||
protected void populateCondition(ConditionAttr defaultAttr){ |
||||
super.populateCondition(defaultAttr); |
||||
if(bubblePane != null) { |
||||
VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); |
||||
bubblePane.populateBean(attrBubble); |
||||
} |
||||
} |
||||
|
||||
protected void updateCondition(ConditionAttr defaultAttr){ |
||||
super.updateCondition(defaultAttr); |
||||
if(bubblePane != null){ |
||||
VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); |
||||
if (attrBubble != null) { |
||||
defaultAttr.remove(attrBubble); |
||||
} |
||||
defaultAttr.addDataSeriesCondition(bubblePane.updateBean()); |
||||
} |
||||
} |
||||
} |
@ -1,57 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; |
||||
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleAreaPane; |
||||
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleLabelPane; |
||||
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleTooltipPane; |
||||
import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; |
||||
import com.fr.plugin.chart.scatter.component.VanChartScatterStylePane; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartBubbleStylePane extends VanChartScatterStylePane { |
||||
|
||||
public VanChartBubbleStylePane(AttributeChangeListener listener) { |
||||
super(listener); |
||||
} |
||||
|
||||
@Override |
||||
protected void createVanChartLabelPane(List<BasicPane> paneList) { |
||||
Plot plot = getChart().getPlot(); |
||||
|
||||
if(((VanChartBubblePlot) plot).isForceBubble()){ |
||||
paneList.add(new VanChartForceBubbleLabelPane(VanChartBubbleStylePane.this)); |
||||
} else { |
||||
super.createVanChartLabelPane(paneList); |
||||
} |
||||
} |
||||
|
||||
protected void addVanChartTooltipPane(List<BasicPane> paneList){ |
||||
Plot plot = getChart().getPlot(); |
||||
if(((VanChartBubblePlot) plot).isForceBubble()){ |
||||
paneList.add(new VanChartForceBubbleTooltipPane(VanChartBubbleStylePane.this)); |
||||
} else { |
||||
super.addVanChartTooltipPane(paneList); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void addVanChartAreaPane(List<BasicPane> paneList) { |
||||
if (((VanChartBubblePlot)getChart().getPlot()).isForceBubble()){ |
||||
paneList.add(new VanChartForceBubbleAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); |
||||
}else { |
||||
paneList.add(new VanChartAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected ChartSeriesPane createChartSeriesPane() { |
||||
return new ChartSeriesPane(VanChartBubbleStylePane.this); |
||||
} |
||||
} |
@ -1,82 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble.component; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
* 气泡大小等设置界面 |
||||
*/ |
||||
public class VanChartBubblePane extends BasicBeanPane<VanChartAttrBubble> { |
||||
private UISpinner minDiameter; |
||||
private UISpinner maxDiameter; |
||||
private UIButtonGroup<Integer> shadow; |
||||
private UIButtonGroup<Integer> displayNegative; |
||||
|
||||
public VanChartBubblePane(){ |
||||
minDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); |
||||
maxDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); |
||||
shadow = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Open"), |
||||
Inter.getLocText("Plugin-ChartF_Close")}); |
||||
displayNegative = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Open"), |
||||
Inter.getLocText("Plugin-ChartF_Close")}); |
||||
|
||||
|
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(getContentPane(), BorderLayout.CENTER); |
||||
} |
||||
|
||||
protected JPanel getContentPane () { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] row = {p, p, p, p, p}; |
||||
double[] col = {p, f}; |
||||
|
||||
return TableLayoutHelper.createTableLayoutPane(getComponent(), row, col); |
||||
} |
||||
|
||||
protected Component[][] getComponent () { |
||||
return new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_MinDiameter")), minDiameter}, |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_MaxDiameter")), maxDiameter}, |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Shadow")), shadow}, |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_DisplayNegative")), displayNegative}, |
||||
|
||||
}; |
||||
} |
||||
|
||||
public void populateBean(VanChartAttrBubble bubble) { |
||||
if(bubble == null){ |
||||
bubble = new VanChartAttrBubble(); |
||||
} |
||||
minDiameter.setValue(bubble.getMinDiameter()); |
||||
maxDiameter.setValue(bubble.getMaxDiameter()); |
||||
shadow.setSelectedIndex(bubble.isShadow() ? 0 : 1); |
||||
displayNegative.setSelectedIndex(bubble.isDisplayNegative() ? 0 : 1); |
||||
} |
||||
|
||||
public VanChartAttrBubble updateBean() { |
||||
VanChartAttrBubble bubble = new VanChartAttrBubble(); |
||||
bubble.setMinDiameter(minDiameter.getValue()); |
||||
bubble.setMaxDiameter(maxDiameter.getValue()); |
||||
bubble.setShadow(shadow.getSelectedIndex() == 0); |
||||
bubble.setDisplayNegative(displayNegative.getSelectedIndex() == 0); |
||||
return bubble; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_Bubble"); |
||||
} |
||||
} |
@ -1,178 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble.data; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.chart.chartattr.BubblePlot; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartdata.BubbleTableDefinition; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.List; |
||||
|
||||
public class VanChartBubblePlotTableDataContentPane extends AbstractTableDataContentPane { |
||||
|
||||
private static final Dimension PREFERRED_SIZE = new Dimension(100, 20); |
||||
protected UIComboBox seriesName; |
||||
protected UIComboBox xCombox; |
||||
protected UIComboBox yCombox; |
||||
protected UIComboBox bubbleSize; |
||||
|
||||
private ChartDataFilterPane dataScreeningPane; |
||||
|
||||
public VanChartBubblePlotTableDataContentPane(ChartDataPane parent) { |
||||
seriesName = new UIComboBox(); |
||||
xCombox = new UIComboBox(); |
||||
yCombox = new UIComboBox(); |
||||
|
||||
dataScreeningPane = new ChartDataFilterPane(new BubblePlot(), parent); |
||||
|
||||
seriesName.setPreferredSize(PREFERRED_SIZE); |
||||
xCombox.setPreferredSize(PREFERRED_SIZE); |
||||
yCombox.setPreferredSize(PREFERRED_SIZE); |
||||
|
||||
seriesName.addItem(Inter.getLocText("Chart-Use_None")); |
||||
|
||||
initBubbleSize(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
double[] columnSize_north = {f, COMPONENT_WIDTH}; |
||||
double[] rowSize_north = {p, p, p, p}; |
||||
|
||||
Component[][] components_north = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("Chart-Series_Name")), seriesName}, |
||||
new Component[]{new UILabel("x" ), xCombox}, |
||||
new Component[]{new UILabel("y"), yCombox}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Chart_Bubble_Size")), bubbleSize}, |
||||
}; |
||||
|
||||
JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north,rowSize_north,columnSize_north); |
||||
north.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15)); |
||||
JPanel filterPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("FR-Chart-Data_Filter"),dataScreeningPane); |
||||
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); |
||||
filterPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); |
||||
|
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(getJSeparator(), BorderLayout.NORTH); |
||||
this.add(north, BorderLayout.CENTER); |
||||
this.add(filterPane, BorderLayout.SOUTH); |
||||
|
||||
seriesName.addItemListener(tooltipListener); |
||||
xCombox.addItemListener(tooltipListener); |
||||
yCombox.addItemListener(tooltipListener); |
||||
bubbleSize.addItemListener(tooltipListener); |
||||
} |
||||
|
||||
protected void initBubbleSize() { |
||||
bubbleSize = new UIComboBox(); |
||||
bubbleSize.setPreferredSize(new Dimension(100, 20)); |
||||
} |
||||
|
||||
/** |
||||
* 检查box是否使用, donothing |
||||
* @param hasUse 是否使用. |
||||
*/ |
||||
public void checkBoxUse(boolean hasUse) { |
||||
|
||||
} |
||||
|
||||
protected void refreshBoxListWithSelectTableData(List list) { |
||||
refreshBoxItems(seriesName, list); |
||||
seriesName.addItem(Inter.getLocText("Chart-Use_None")); |
||||
refreshBoxItems(xCombox, list); |
||||
refreshBoxItems(yCombox, list); |
||||
refreshBoxItems(bubbleSize, list); |
||||
} |
||||
|
||||
/** |
||||
* 清空所有的box设置 |
||||
*/ |
||||
public void clearAllBoxList(){ |
||||
clearBoxItems(seriesName); |
||||
seriesName.addItem(Inter.getLocText("Chart-Use_None")); |
||||
clearBoxItems(xCombox); |
||||
clearBoxItems(yCombox); |
||||
clearBoxItems(bubbleSize); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ChartCollection collection) { |
||||
super.populateBean(collection); |
||||
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); |
||||
if (!(top instanceof BubbleTableDefinition)) { |
||||
return; |
||||
} |
||||
BubbleTableDefinition definition = (BubbleTableDefinition) top; |
||||
|
||||
if(definition.getSeriesName() == null || ComparatorUtils.equals(StringUtils.EMPTY, definition.getSeriesName())) { |
||||
seriesName.setSelectedItem(Inter.getLocText("Chart-Use_None")); |
||||
} else { |
||||
combineCustomEditValue(seriesName, definition.getSeriesName()); |
||||
} |
||||
|
||||
combineCustomEditValue(xCombox, definition.getBubbleX()); |
||||
combineCustomEditValue(yCombox, definition.getBubbleY()); |
||||
//气泡图不配置“无”
|
||||
populateBubbleSize(definition); |
||||
|
||||
dataScreeningPane.populateBean(collection); |
||||
} |
||||
|
||||
protected void populateBubbleSize(BubbleTableDefinition definition) { |
||||
if (ComparatorUtils.equals(definition.getBubbleSize(), Inter.getLocText("Chart-Use_None"))){ |
||||
combineCustomEditValue(bubbleSize, StringUtils.EMPTY); |
||||
}else { |
||||
combineCustomEditValue(bubbleSize, definition.getBubbleSize()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ChartCollection collection) { |
||||
BubbleTableDefinition definition = new BubbleTableDefinition(); |
||||
collection.getSelectedChart().setFilterDefinition(definition); |
||||
|
||||
Object resultName = seriesName.getSelectedItem(); |
||||
Object resultX = xCombox.getSelectedItem(); |
||||
Object resultY = yCombox.getSelectedItem(); |
||||
Object resultSize = bubbleSize.getSelectedItem(); |
||||
|
||||
if(resultName == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultName)) { |
||||
definition.setSeriesName(StringUtils.EMPTY); |
||||
} else { |
||||
definition.setSeriesName(resultName.toString()); |
||||
} |
||||
|
||||
if (resultX != null) { |
||||
definition.setBubbleX(resultX.toString()); |
||||
} |
||||
if (resultY != null) { |
||||
definition.setBubbleY(resultY.toString()); |
||||
} |
||||
if (resultSize != null) { |
||||
definition.setBubbleSize(resultSize.toString()); |
||||
} |
||||
|
||||
dataScreeningPane.updateBean(collection); |
||||
} |
||||
|
||||
/** |
||||
* 重新布局 |
||||
*/ |
||||
public void redoLayoutPane(){ |
||||
dataScreeningPane.relayoutPane(this.isNeedSummaryCaculateMethod()); |
||||
} |
||||
} |
@ -1,28 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble.force; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.plugin.chart.bubble.VanChartBubblePlot; |
||||
import com.fr.plugin.chart.designer.component.VanChartRefreshTooltipContentPane; |
||||
import com.fr.plugin.chart.designer.component.VanChartTooltipContentPane; |
||||
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane; |
||||
import com.fr.plugin.chart.scatter.VanChartScatterRefreshTooltipContentPane; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/6/12. |
||||
*/ |
||||
public class VanChartBubbleRefreshTooltipPane extends VanChartPlotRefreshTooltipPane { |
||||
|
||||
public VanChartBubbleRefreshTooltipPane(Plot plot) { |
||||
super(plot); |
||||
} |
||||
|
||||
@Override |
||||
protected VanChartTooltipContentPane getTooltipContentPane(Plot plot){ |
||||
if (((VanChartBubblePlot)plot).isForceBubble()) { |
||||
return new VanChartRefreshTooltipContentPane(parent, VanChartBubbleRefreshTooltipPane.this); |
||||
} else { |
||||
return new VanChartScatterRefreshTooltipContentPane(parent, VanChartBubbleRefreshTooltipPane.this); |
||||
} |
||||
|
||||
} |
||||
} |
@ -1,23 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble.force; |
||||
|
||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||
import com.fr.plugin.chart.designer.style.background.VanChartAreaBackgroundPane; |
||||
|
||||
import java.awt.*; |
||||
|
||||
//图表区|绘图区 边框和背景
|
||||
public class VanChartForceBubbleAreaBackgroundPane extends VanChartAreaBackgroundPane { |
||||
|
||||
|
||||
public VanChartForceBubbleAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) { |
||||
super(isPlot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected Component[][] initComponents() { |
||||
return new Component[][]{ |
||||
new Component[]{chartBorderPane}, |
||||
new Component[]{chartBackgroundPane}, |
||||
}; |
||||
} |
||||
} |
@ -1,26 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble.force; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
|
||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||
|
||||
|
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
|
||||
import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; |
||||
|
||||
|
||||
/** |
||||
* 属性表, 图表样式-背景界面. |
||||
*/ |
||||
public class VanChartForceBubbleAreaPane extends VanChartAreaPane { |
||||
|
||||
public VanChartForceBubbleAreaPane(Plot plot, VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) { |
||||
plotPane = new VanChartForceBubbleAreaBackgroundPane(true, parent); |
||||
} |
||||
} |
@ -1,19 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble.force; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.label.VanChartLabelPane; |
||||
import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartForceBubbleLabelPane extends VanChartLabelPane { |
||||
public VanChartForceBubbleLabelPane(VanChartStylePane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
protected VanChartPlotLabelPane getLabelPane(Plot plot) { |
||||
return new VanChartPlotLabelPane(plot, parent); |
||||
} |
||||
} |
@ -1,18 +0,0 @@
|
||||
package com.fr.plugin.chart.bubble.force; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; |
||||
import com.fr.plugin.chart.designer.style.tooltip.VanChartTooltipPane; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartForceBubbleTooltipPane extends VanChartTooltipPane { |
||||
public VanChartForceBubbleTooltipPane(VanChartStylePane parent) { |
||||
super(parent); |
||||
} |
||||
protected VanChartPlotTooltipPane getTooltipPane(Plot plot) { |
||||
return new VanChartPlotTooltipPane(plot, parent); |
||||
} |
||||
} |
@ -1,43 +0,0 @@
|
||||
package com.fr.plugin.chart.column; |
||||
|
||||
import com.fr.design.chart.comp.BorderAttriPane; |
||||
import com.fr.design.gui.icombobox.LineComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.stable.CoreConstants; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by hufan on 2016/8/11. |
||||
*/ |
||||
public class ColumnBorderAttriPane extends BorderAttriPane { |
||||
private UISpinner radius; |
||||
|
||||
public ColumnBorderAttriPane() { |
||||
this(Inter.getLocText("plugin-ChartF_Radius")); |
||||
} |
||||
|
||||
public ColumnBorderAttriPane(String radiusString) { |
||||
this.add(new UILabel(radiusString + ":")); |
||||
radius = new UISpinner(0,1000,1,0); |
||||
this.add(radius); |
||||
radius.setPreferredSize(new Dimension(60, 18)); |
||||
} |
||||
|
||||
public void setRadius(int value) { |
||||
this.radius.setValue(value); |
||||
} |
||||
|
||||
public double getRadius() { |
||||
return this.radius.getValue(); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "Border"; |
||||
} |
||||
} |
@ -1,36 +0,0 @@
|
||||
package com.fr.plugin.chart.column; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.condition.ConditionAttributesPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/9/24. |
||||
*/ |
||||
public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { |
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/design/images/form/toolbar/column.png"; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new VanChartColumnPlotPane(); |
||||
} |
||||
|
||||
|
||||
public ConditionAttributesPane getPlotConditionPane(Plot plot){ |
||||
return new VanChartColumnConditionPane(plot); |
||||
} |
||||
|
||||
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ |
||||
return new VanChartColumnSeriesPane(parent, plot); |
||||
} |
||||
|
||||
public String getPlotTypeTitle4PopupWindow(){ |
||||
return VanChartColumnPlotPane.TITLE; |
||||
} |
||||
} |
@ -1,93 +0,0 @@
|
||||
package com.fr.plugin.chart.column; |
||||
|
||||
import com.fr.chart.base.AttrAlpha; |
||||
import com.fr.chart.base.AttrBackground; |
||||
import com.fr.chart.base.AttrBorder; |
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; |
||||
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; |
||||
import com.fr.plugin.chart.attr.EffectHelper; |
||||
import com.fr.plugin.chart.base.AttrDataSheet; |
||||
import com.fr.plugin.chart.base.AttrEffect; |
||||
import com.fr.plugin.chart.base.AttrFloatColor; |
||||
import com.fr.plugin.chart.base.AttrLabel; |
||||
import com.fr.plugin.chart.base.AttrSeriesImageBackground; |
||||
import com.fr.plugin.chart.base.AttrTooltip; |
||||
import com.fr.plugin.chart.base.VanChartAttrTrendLine; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartDataSheetContentPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartFloatColorConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesImageBackgroundConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; |
||||
import com.fr.plugin.chart.designer.other.condition.item.VanChartTrendLineConditionPane; |
||||
import com.fr.plugin.chart.glyph.VanChartMultiCategoryDataPoint; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/9/28. |
||||
*/ |
||||
public class VanChartColumnConditionPane extends DataSeriesConditionPane{ |
||||
private static final long serialVersionUID = -7180705321732069806L; |
||||
|
||||
public VanChartColumnConditionPane(Plot plot) { |
||||
super(plot); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
//添加全部条件属性后被遮挡
|
||||
liteConditionPane.setPreferredSize(new Dimension(300, 400)); |
||||
} |
||||
|
||||
@Override |
||||
protected void addBasicAction() { |
||||
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); |
||||
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); |
||||
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this)); |
||||
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); |
||||
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this)); |
||||
classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this)); |
||||
classPaneMap.put(AttrSeriesImageBackground.class, new VanChartSeriesImageBackgroundConditionPane(this)); |
||||
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getColumnPlotDefaultEffect())); |
||||
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); |
||||
//是否使用数据表
|
||||
//自定义柱形图设置多X坐标轴时,不支持数据表
|
||||
if (plot.getDataSheet().isVisible() && ((VanChartColumnPlot) plot).getXAxisList().size() == 1) { |
||||
classPaneMap.put(AttrDataSheet.class, new VanChartDataSheetContentPane(this, plot)); |
||||
} |
||||
} |
||||
|
||||
protected void addStyleAction() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected ChartConditionPane createListConditionPane() { |
||||
return new ChartConditionPane(){ |
||||
@Override |
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
ChartConstants.CATEGORY_INDEX, |
||||
ChartConstants.CATEGORY_NAME, |
||||
ChartConstants.SERIES_INDEX, |
||||
ChartConstants.SERIES_NAME, |
||||
ChartConstants.VALUE, |
||||
VanChartMultiCategoryDataPoint.CATEGORY_ARRAY, |
||||
}; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 返回图表class对象 |
||||
* @return class对象 |
||||
*/ |
||||
public Class<? extends Plot> class4Correspond() { |
||||
return VanChartColumnPlot.class; |
||||
} |
||||
} |
@ -1,34 +0,0 @@
|
||||
package com.fr.plugin.chart.column; |
||||
import com.fr.chart.base.AttrBorder; |
||||
import com.fr.chart.base.DataSeriesCondition; |
||||
import com.fr.design.chart.comp.BorderAttriPane; |
||||
import com.fr.design.chart.series.SeriesCondition.LabelBorderPane; |
||||
import com.fr.design.condition.ConditionAttributesPane; |
||||
|
||||
/** |
||||
* Created by hufan on 2016/8/11. |
||||
*/ |
||||
public class VanChartColumnLabelBorderPane extends LabelBorderPane { |
||||
public VanChartColumnLabelBorderPane(ConditionAttributesPane conditionAttributesPane) { |
||||
super(conditionAttributesPane); |
||||
} |
||||
|
||||
@Override |
||||
protected BorderAttriPane initBorderAttrPane(){ |
||||
return new ColumnBorderAttriPane(); |
||||
} |
||||
|
||||
public void populate(DataSeriesCondition condition) { |
||||
super.populate(condition); |
||||
if (condition instanceof AttrBorder) { |
||||
((ColumnBorderAttriPane)linePane).setRadius(attrBorder.getRoundRadius()); |
||||
} |
||||
} |
||||
|
||||
public DataSeriesCondition update() { |
||||
super.update(); |
||||
attrBorder.setRoundRadius((int) ((ColumnBorderAttriPane)linePane).getRadius()); |
||||
attrBorder.setRoundBorder(true); |
||||
return attrBorder; |
||||
} |
||||
} |
@ -1,81 +0,0 @@
|
||||
package com.fr.plugin.chart.column; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/9/24. |
||||
*/ |
||||
public class VanChartColumnPlotPane extends AbstractVanChartTypePane { |
||||
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewColumn"); |
||||
|
||||
private static final long serialVersionUID = 5950923001789733745L; |
||||
|
||||
|
||||
@Override |
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{"/com/fr/plugin/chart/column/images/column.png", |
||||
"/com/fr/plugin/chart/column/images/stack.png", |
||||
"/com/fr/plugin/chart/column/images/percentstack.png", |
||||
"/com/fr/plugin/chart/column/images/custom.png", |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeTipName() { |
||||
String column = Inter.getLocText("FR-Chart-Type_Column"); |
||||
String stack = Inter.getLocText("FR-Chart-Type_Stacked"); |
||||
String percent = Inter.getLocText("FR-Chart-Use_Percent"); |
||||
return new String[]{ |
||||
column, |
||||
stack + column, |
||||
percent + stack + column, |
||||
Inter.getLocText("FR-Chart-Mode_Custom") |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 返回界面标题 |
||||
* @return 界面标题 |
||||
*/ |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_NewColumn"); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取各图表类型界面ID, 本质是plotID |
||||
* |
||||
* @return 图表类型界面ID |
||||
*/ |
||||
@Override |
||||
protected String getPlotTypeID() { |
||||
return VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID; |
||||
} |
||||
|
||||
protected Plot getSelectedClonedPlot(){ |
||||
VanChartColumnPlot newPlot = null; |
||||
Chart[] columnChart = ColumnIndependentVanChart.ColumnVanChartTypes; |
||||
for(int i = 0, len = columnChart.length; i < len; i++){ |
||||
if(typeDemo.get(i).isPressing){ |
||||
newPlot = (VanChartColumnPlot)columnChart[i].getPlot(); |
||||
} |
||||
} |
||||
|
||||
Plot cloned = null; |
||||
try { |
||||
cloned = (Plot)newPlot.clone(); |
||||
} catch (CloneNotSupportedException e) { |
||||
FRLogger.getLogger().error("Error In ColumnChart"); |
||||
} |
||||
return cloned; |
||||
} |
||||
|
||||
public Chart getDefaultChart() { |
||||
return ColumnIndependentVanChart.ColumnVanChartTypes[0]; |
||||
} |
||||
|
||||
} |
@ -1,196 +0,0 @@
|
||||
package com.fr.plugin.chart.column; |
||||
|
||||
import com.fr.base.background.ImageBackground; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartglyph.ConditionAttr; |
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.base.AttrSeriesImageBackground; |
||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||
import com.fr.plugin.chart.designer.component.border.VanChartBorderPane; |
||||
import com.fr.plugin.chart.designer.component.border.VanChartBorderWithRadiusPane; |
||||
import com.fr.plugin.chart.designer.style.series.VanChartAbstractPlotSeriesPane; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* 新条形图系列界面 |
||||
*/ |
||||
public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { |
||||
|
||||
private static final long serialVersionUID = -8875943419420081420L; |
||||
private UIButtonGroup<Integer> isFixedWidth;//是否固定宽度
|
||||
private UISpinner columnWidth;//宽度
|
||||
|
||||
private UINumberDragPane categoryGap;//分类间隔
|
||||
private UINumberDragPane seriesGap;//系列间隔
|
||||
private UIButtonGroup<Integer> isFillWithImage;//是否使用图片填充
|
||||
private ImageBackgroundQuickPane imagePane;//填充图片选择界面
|
||||
|
||||
public VanChartColumnSeriesPane(ChartStylePane parent, Plot plot) { |
||||
super(parent, plot); |
||||
} |
||||
|
||||
protected JPanel getContentInPlotType() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{getColorPane()}, |
||||
new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{f,e})}, |
||||
new Component[]{createBorderPane()}, |
||||
new Component[]{createStackedAndAxisPane()}, |
||||
new Component[]{createTrendLinePane()}, |
||||
}; |
||||
|
||||
contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
|
||||
return contentPane; |
||||
} |
||||
|
||||
//边框(有圆角)
|
||||
protected VanChartBorderPane createDiffBorderPane() { |
||||
return new VanChartBorderWithRadiusPane(); |
||||
} |
||||
|
||||
private JPanel createSeriesStylePane(double[] row, double[] col) { |
||||
isFixedWidth = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); |
||||
columnWidth = new UISpinner(0,1000,1,0); |
||||
columnWidth.setBorder(BorderFactory.createEmptyBorder(0, (int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); |
||||
seriesGap = new UINumberDragPane(-100, 100); |
||||
categoryGap = new UINumberDragPane(0, 100); |
||||
isFillWithImage = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); |
||||
imagePane = new ImageBackgroundQuickPane(false); |
||||
imagePane.setBorder(BorderFactory.createEmptyBorder(0,(int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); |
||||
|
||||
JPanel panel1 = new JPanel(new BorderLayout()); |
||||
JPanel isFixedWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-ChartF_Fixed_Column_Width"),isFixedWidth); |
||||
isFixedWidthPane.setBorder(BorderFactory.createEmptyBorder(0,0,6,0)); |
||||
panel1.add(isFixedWidthPane, BorderLayout.NORTH); |
||||
panel1.add(columnWidth, BorderLayout.CENTER); |
||||
|
||||
Component[][] components2 = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Gap_Series")),seriesGap}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Gap_Category")),categoryGap}, |
||||
}; |
||||
JPanel panel2 = TableLayout4VanChartHelper.createGapTableLayoutPane(components2, row, col); |
||||
|
||||
Component[][] components3 = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Filled_With_Image")),isFillWithImage}, |
||||
}; |
||||
JPanel panel3 = TableLayout4VanChartHelper.createGapTableLayoutPane(components3, row, col); |
||||
|
||||
JPanel panel = new JPanel(new BorderLayout(0, 4)); |
||||
panel.add(panel1, BorderLayout.NORTH); |
||||
panel.add(panel2, BorderLayout.CENTER); |
||||
panel.add(panel3, BorderLayout.SOUTH); |
||||
|
||||
JPanel borderPane = new JPanel(new BorderLayout()); |
||||
borderPane.add(panel, BorderLayout.NORTH); |
||||
borderPane.add(imagePane, BorderLayout.CENTER); |
||||
isFixedWidth.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkColumnWidth(); |
||||
} |
||||
}); |
||||
isFillWithImage.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkImagePane(); |
||||
} |
||||
}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), borderPane); |
||||
} |
||||
|
||||
private void checkAll() { |
||||
checkColumnWidth(); |
||||
checkImagePane(); |
||||
} |
||||
|
||||
private void checkColumnWidth() { |
||||
boolean b = isFixedWidth.getSelectedIndex() == 0; |
||||
columnWidth.setVisible(b); |
||||
seriesGap.setEnabled(!b); |
||||
} |
||||
|
||||
private void checkImagePane() { |
||||
imagePane.setVisible(isFillWithImage.getSelectedIndex() == 0); |
||||
} |
||||
|
||||
public void populateBean(Plot plot) { |
||||
if(plot == null) { |
||||
return; |
||||
} |
||||
super.populateBean(plot); |
||||
|
||||
if(plot instanceof VanChartColumnPlot){ |
||||
VanChartColumnPlot columnPlot4VanChart = (VanChartColumnPlot)plot; |
||||
|
||||
isFixedWidth.setSelectedIndex(columnPlot4VanChart.isFixedWidth() ? 0 : 1); |
||||
columnWidth.setValue(columnPlot4VanChart.getColumnWidth()); |
||||
categoryGap.populateBean(columnPlot4VanChart.getCategoryIntervalPercent()); |
||||
seriesGap.populateBean(columnPlot4VanChart.getSeriesOverlapPercent()); |
||||
isFillWithImage.setSelectedIndex(columnPlot4VanChart.isFilledWithImage() ? 0 : 1); |
||||
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); |
||||
|
||||
if(columnPlot4VanChart.isFilledWithImage()){ |
||||
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); |
||||
if(attrSeriesImageBackground != null){ |
||||
imagePane.populateBean(attrSeriesImageBackground.getSeriesBackground()); |
||||
} |
||||
} |
||||
} |
||||
checkAll(); |
||||
} |
||||
|
||||
public void updateBean(Plot plot) { |
||||
if(plot == null) { |
||||
return; |
||||
} |
||||
super.updateBean(plot); |
||||
|
||||
if(plot instanceof VanChartColumnPlot){ |
||||
VanChartColumnPlot columnPlot4VanChart = (VanChartColumnPlot)plot; |
||||
|
||||
columnPlot4VanChart.setFixedWidth(isFixedWidth.getSelectedIndex() == 0); |
||||
columnPlot4VanChart.setColumnWidth((int)columnWidth.getValue()); |
||||
columnPlot4VanChart.setCategoryIntervalPercent(categoryGap.updateBean()); |
||||
columnPlot4VanChart.setSeriesOverlapPercent(seriesGap.updateBean()); |
||||
columnPlot4VanChart.setFilledWithImage(isFillWithImage.getSelectedIndex() == 0); |
||||
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); |
||||
if(isFillWithImage.getSelectedIndex() == 0){ |
||||
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); |
||||
if(attrSeriesImageBackground == null){ |
||||
attrSeriesImageBackground = new AttrSeriesImageBackground(); |
||||
defaultAttr.addDataSeriesCondition(attrSeriesImageBackground); |
||||
} |
||||
attrSeriesImageBackground.setSeriesBackground(imagePane.updateBean()); |
||||
//设置背景图片平铺方式
|
||||
ImageBackground imageBackground = (ImageBackground) attrSeriesImageBackground.getSeriesBackground(); |
||||
if (imageBackground != null){ |
||||
imageBackground.setLayout(Constants.IMAGE_TILED); |
||||
} |
||||
|
||||
} else { |
||||
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); |
||||
if(attrSeriesImageBackground != null){ |
||||
defaultAttr.remove(attrSeriesImageBackground); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,139 +0,0 @@
|
||||
package com.fr.plugin.chart.column; |
||||
|
||||
import com.fr.chart.chartglyph.ConditionAttr; |
||||
import com.fr.data.condition.AbstractCondition; |
||||
import com.fr.data.condition.ListCondition; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.condition.LiteConditionPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; |
||||
import com.fr.plugin.chart.designer.style.series.VanChartSeriesConditionPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* 堆积和坐标轴设置 |
||||
*/ |
||||
public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<ConditionAttr> { |
||||
private static final long serialVersionUID = 2713124322060048526L; |
||||
|
||||
protected UIButtonGroup<Integer> XAxis; |
||||
protected UIButtonGroup<Integer> YAxis; |
||||
protected UIButtonGroup<Integer> isStacked; |
||||
protected UIButtonGroup<Integer> isPercentStacked; |
||||
|
||||
private LiteConditionPane liteConditionPane; |
||||
|
||||
public VanChartCustomStackAndAxisConditionPane() { |
||||
|
||||
} |
||||
|
||||
private void doLayoutPane() { |
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
||||
this.removeAll(); |
||||
|
||||
//配置界面
|
||||
JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
this.add(deployPane); |
||||
|
||||
deployPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Plugin-ChartF_Deploy") + ":", null)); |
||||
deployPane.add(createDeployPane()); |
||||
|
||||
//条件界面
|
||||
JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
this.add(conditionPane); |
||||
conditionPane.setBorder(BorderFactory.createEmptyBorder()); |
||||
|
||||
conditionPane.add(liteConditionPane = new VanChartSeriesConditionPane()); |
||||
liteConditionPane.setPreferredSize(new Dimension(300, 300)); |
||||
} |
||||
|
||||
private JPanel createDeployPane() { |
||||
isStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); |
||||
isPercentStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); |
||||
double p = TableLayout.PREFERRED; |
||||
double[] columnSize = {p, p}; |
||||
double[] rowSize = {p, p, p, p}; |
||||
|
||||
return TableLayoutHelper.createTableLayoutPane(getDeployComponents(), rowSize, columnSize); |
||||
} |
||||
|
||||
protected Component[][] getDeployComponents() { |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")), XAxis}, |
||||
new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")), YAxis}, |
||||
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Type_Stacked")), isStacked}, |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_PercentStacked")), isPercentStacked}, |
||||
}; |
||||
|
||||
isStacked.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkBox(); |
||||
} |
||||
}); |
||||
return components; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_StackAndSeries"); |
||||
} |
||||
|
||||
private void checkBox() { |
||||
isPercentStacked.setEnabled(isStacked.getSelectedIndex() == 0); |
||||
} |
||||
|
||||
public void populateBean(ConditionAttr conditionAttr) { |
||||
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis) conditionAttr.getExisted(AttrSeriesStackAndAxis.class); |
||||
XAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getXAxisNamesArray()); |
||||
YAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getYAxisNameArray()); |
||||
|
||||
doLayoutPane(); |
||||
XAxis.setSelectedIndex(seriesStackAndAxis.getXAxisIndex()); |
||||
YAxis.setSelectedIndex(seriesStackAndAxis.getYAxisIndex()); |
||||
isStacked.setSelectedIndex(seriesStackAndAxis.isStacked() ? 0 : 1); |
||||
isPercentStacked.setSelectedIndex(seriesStackAndAxis.isPercentStacked() ? 0 : 1); |
||||
|
||||
if (conditionAttr.getCondition() == null) { |
||||
this.liteConditionPane.populateBean(new ListCondition()); |
||||
} else { |
||||
this.liteConditionPane.populateBean(conditionAttr.getCondition()); |
||||
} |
||||
|
||||
checkBox(); |
||||
} |
||||
|
||||
protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) { |
||||
seriesStackAndAxis.setStacked(isStacked.getSelectedIndex() == 0); |
||||
if (seriesStackAndAxis.isStacked()) { |
||||
seriesStackAndAxis.setPercentStacked(isPercentStacked.getSelectedIndex() == 0); |
||||
} else { |
||||
seriesStackAndAxis.setPercentStacked(false); |
||||
} |
||||
} |
||||
|
||||
public ConditionAttr updateBean() { |
||||
ConditionAttr conditionAttr = new ConditionAttr(); |
||||
AttrSeriesStackAndAxis seriesStackAndAxis = new AttrSeriesStackAndAxis(); |
||||
seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex()); |
||||
seriesStackAndAxis.setYAxisIndex(YAxis.getSelectedIndex()); |
||||
|
||||
updateStackAndPercent(seriesStackAndAxis); |
||||
conditionAttr.addDataSeriesCondition(seriesStackAndAxis); |
||||
|
||||
AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean(); |
||||
conditionAttr.setCondition(con); |
||||
return conditionAttr; |
||||
} |
||||
|
||||
} |
@ -1,56 +0,0 @@
|
||||
package com.fr.plugin.chart.custom; |
||||
|
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.AbstractChartAttrPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.plugin.chart.custom.other.VanChartCustomOtherPane; |
||||
import com.fr.plugin.chart.custom.style.VanChartCustomStylePane; |
||||
import com.fr.plugin.chart.designer.other.VanChartOtherPane; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.vanchart.AbstractIndependentVanChartUI; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/2/16. |
||||
*/ |
||||
public class CustomIndependentVanChartInterface extends AbstractIndependentVanChartUI { |
||||
/** |
||||
* 图表的类型定义界面类型,就是属性表的第一个界面 |
||||
* |
||||
* @return 图表的类型定义界面类型 |
||||
*/ |
||||
@Override |
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new VanChartCustomPlotPane(); |
||||
} |
||||
|
||||
/** |
||||
* 图标路径 |
||||
* |
||||
* @return 图标路径 |
||||
*/ |
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/design/images/form/toolbar/custom.png"; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
/** |
||||
* 图表的属性界面数组 |
||||
* @return 属性界面 |
||||
*/ |
||||
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ |
||||
VanChartStylePane stylePane = new VanChartCustomStylePane(listener); |
||||
VanChartOtherPane otherPane = new VanChartCustomOtherPane(); |
||||
return new AbstractChartAttrPane[]{stylePane, otherPane}; |
||||
} |
||||
|
||||
public ChartDataPane getChartDataPane(AttributeChangeListener listener){ |
||||
return new VanChartCustomDataPane(listener); |
||||
} |
||||
|
||||
public String getPlotTypeTitle4PopupWindow(){ |
||||
return VanChartCustomPlotPane.TITLE; |
||||
} |
||||
} |
@ -1,133 +0,0 @@
|
||||
package com.fr.plugin.chart.custom; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; |
||||
import com.fr.general.FRLogger; |
||||
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.bubble.data.VanChartBubblePlotTableDataContentPane; |
||||
import com.fr.plugin.chart.custom.component.CustomPlotLocationPane; |
||||
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||
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; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/6/23. |
||||
*/ |
||||
public class CustomPlotDesignerPaneFactory { |
||||
|
||||
//图表类型对应数据配置界面
|
||||
private static Map<Class<? extends Plot>, Class<? extends AbstractTableDataContentPane>> plotTableDataContentPaneMap = new HashMap<Class<? extends Plot>, Class<? extends AbstractTableDataContentPane>>(); |
||||
|
||||
|
||||
|
||||
|
||||
//图表类型对应的位置面板
|
||||
private static Map<Class<? extends Plot>, Class<? extends BasicBeanPane<Plot>>> plotPositionMap = new HashMap<Class<? extends Plot>, Class<? extends BasicBeanPane<Plot>>>(); |
||||
|
||||
static { |
||||
plotPositionMap.put(PiePlot4VanChart.class, CustomPlotLocationPane.class); |
||||
plotPositionMap.put(VanChartRadarPlot.class, CustomPlotLocationPane.class); |
||||
plotPositionMap.put(VanChartGaugePlot.class, CustomPlotLocationPane.class); |
||||
} |
||||
|
||||
/** |
||||
* 根据图表类型创建位置面板 |
||||
* @param plot 图表 |
||||
* @return 位置面板 |
||||
*/ |
||||
public static BasicBeanPane<Plot> createCustomPlotPositionPane(Plot plot) { |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(plotPositionMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends BasicBeanPane<Plot>> cl = plotPositionMap.get(key); |
||||
Constructor<? extends BasicBeanPane<Plot> > constructor = cl.getConstructor(); |
||||
return constructor.newInstance(); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 每种类型对应的数据配置界面 |
||||
* @return |
||||
*/ |
||||
static { |
||||
plotTableDataContentPaneMap.put(VanChartScatterPlot.class, VanChartScatterPlotTableDataContentPane.class); |
||||
plotTableDataContentPaneMap.put(VanChartBubblePlot.class, VanChartBubblePlotTableDataContentPane.class); |
||||
} |
||||
|
||||
/** |
||||
* 根据图表类型创建数据配置 |
||||
* @param plot 图表 |
||||
* @param parent |
||||
* @return 数据配置界面 |
||||
*/ |
||||
public static AbstractTableDataContentPane createCustomPlotTableDataContentPane(Plot plot, ChartDataPane parent) { |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(plotTableDataContentPaneMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends AbstractTableDataContentPane> cl = plotTableDataContentPaneMap.get(key); |
||||
Constructor<? extends AbstractTableDataContentPane > constructor = cl.getConstructor(ChartDataPane.class); |
||||
return constructor.newInstance(parent); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new CategoryPlotTableDataContentPane(parent); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* plotType是否需要建立新的坐标系面板 |
||||
*/ |
||||
private static Map<CustomPlotType, Class<? extends VanChartAxisPane>> diffAxisMap = new HashMap<CustomPlotType, Class<? extends VanChartAxisPane>>(); |
||||
static { |
||||
diffAxisMap.put(CustomPlotType.POINTER_360, VanChartGaugeAxisPane.class); |
||||
diffAxisMap.put(CustomPlotType.POINTER_180, VanChartGaugeAxisPane.class); |
||||
diffAxisMap.put(CustomPlotType.RING, VanChartGaugeAxisPane.class); |
||||
diffAxisMap.put(CustomPlotType.SLOT, VanChartGaugeAxisPane.class); |
||||
diffAxisMap.put(CustomPlotType.CUVETTE, VanChartGaugeAxisPane.class); |
||||
diffAxisMap.put(CustomPlotType.RADAR, null);//默认的为null,直接new,不用反射
|
||||
diffAxisMap.put(CustomPlotType.STACK_RADAR, null); |
||||
} |
||||
|
||||
public static Boolean isUseDiffAxisPane(VanChartPlot plot){ |
||||
CustomPlotType customPlotType = CustomPlotFactory.getCustomType(plot); |
||||
return diffAxisMap.containsKey(customPlotType); |
||||
} |
||||
|
||||
public static VanChartAxisPane createAxisPane(VanChartAxisPlot plot, VanChartStylePane parent) { |
||||
CustomPlotType key = CustomPlotFactory.getCustomType((VanChartPlot)plot); |
||||
if(diffAxisMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends VanChartAxisPane> cl = diffAxisMap.get(key); |
||||
if(cl != null) { |
||||
Constructor<? extends VanChartAxisPane> constructor = cl.getConstructor(VanChartAxisPlot.class, VanChartStylePane.class); |
||||
return constructor.newInstance(plot, parent); |
||||
} |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new VanChartAxisPane(plot,parent); |
||||
} |
||||
|
||||
} |
@ -1,66 +0,0 @@
|
||||
package com.fr.plugin.chart.custom; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/29. |
||||
*/ |
||||
public class VanChartCustomDataPane extends ChartDataPane { |
||||
private VanChartCustomPlotDataContentsTabPane contentsTabPane; |
||||
private Chart chart; |
||||
public VanChartCustomDataPane(AttributeChangeListener listener) { |
||||
super(listener); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
JPanel content = new JPanel(new BorderLayout()); |
||||
if (chart == null) { |
||||
return content; |
||||
} |
||||
|
||||
contentsTabPane = new VanChartCustomPlotDataContentsTabPane((VanChartCustomPlot)chart.getPlot(), VanChartCustomDataPane.this, listener); |
||||
|
||||
content.add(contentsTabPane, BorderLayout.CENTER); |
||||
return content; |
||||
|
||||
|
||||
} |
||||
|
||||
public void populate(ChartCollection collection) { |
||||
this.chart = collection.getSelectedChart(); |
||||
this.remove(leftContentPane); |
||||
initContentPane(); |
||||
this.removeAttributeChangeListener(); |
||||
contentsTabPane.populateBean(collection); |
||||
this.addAttributeChangeListener(listener); |
||||
this.initAllListeners(); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
/** |
||||
* 返回绑定的属性事件. |
||||
* @param listener 增加监听 |
||||
*/ |
||||
public void addAttributeChangeListener(AttributeChangeListener listener) { |
||||
super.addAttributeChangeListener(listener); |
||||
contentsTabPane.addAttributeChangeListener(listener); |
||||
} |
||||
|
||||
@Override |
||||
/** |
||||
* 保存 数据界面内容 |
||||
*/ |
||||
public void update(ChartCollection collection){ |
||||
if(contentsTabPane != null) { |
||||
contentsTabPane.updateBean(collection); |
||||
} |
||||
} |
||||
} |
@ -1,175 +0,0 @@
|
||||
package com.fr.plugin.chart.custom; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; |
||||
import com.fr.plugin.chart.custom.component.VanChartDataPane; |
||||
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/29. |
||||
*/ |
||||
public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, ChartCollection> { |
||||
public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) { |
||||
super(plot, parent, listener); |
||||
} |
||||
|
||||
@Override |
||||
protected void initTabTitle() { |
||||
|
||||
if (plot == null){ |
||||
return; |
||||
} |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; |
||||
for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { |
||||
JPanel pane = paneList.get(i); |
||||
//获取点的tooltip作为标题
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); |
||||
|
||||
NameArray[i] = CustomPlotFactory.getTitle(plotType); |
||||
centerPane.add(pane, NameArray[i]); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected List<JPanel> initPaneList() { |
||||
|
||||
if (plot == null){ |
||||
return null; |
||||
} |
||||
|
||||
List<JPanel> paneList = new ArrayList<JPanel>(); |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
//根据不同的plot创建不同的数据配置界面
|
||||
ChartDataPane contentPane = new VanChartDataPane(listener); |
||||
paneList.add(contentPane); |
||||
} |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ChartCollection chartCollection){ |
||||
|
||||
plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot(); |
||||
|
||||
if (paneList == null){ |
||||
paneList = initPaneList(); |
||||
} |
||||
|
||||
if (paneList != null){ |
||||
|
||||
try { |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
|
||||
|
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) { |
||||
//將plot包裝起来,主要是为了获取dataDefinition
|
||||
ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); |
||||
|
||||
//设置collection的plot
|
||||
cloneCollection.getSelectedChart().setPlot(customPlotList.get(i)); |
||||
|
||||
//获取definitionMap中的dataDefinition
|
||||
TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition(); |
||||
TopDefinitionProvider dataDefinition = null; |
||||
if (definition != null && definition instanceof CustomDefinition) { |
||||
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = ((CustomDefinition)definition).getDefinitionProviderMap(); |
||||
dataDefinition = definitionProviderMap.get(CustomPlotFactory.getCustomType(customPlotList.get(i))); |
||||
} |
||||
cloneCollection.getSelectedChart().setFilterDefinition(dataDefinition); |
||||
|
||||
((ChartDataPane) paneList.get(i)).populate(cloneCollection); |
||||
} |
||||
}catch (Exception e){ |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public ChartCollection updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ChartCollection collection){ |
||||
if (paneList == null || plot == null){ |
||||
return; |
||||
} |
||||
try { |
||||
|
||||
Map<CustomPlotType, TopDefinitionProvider> definitionMap = new HashMap<CustomPlotType, TopDefinitionProvider>(); |
||||
|
||||
//已经有的数据配置不允许重置
|
||||
|
||||
for (int i = 0; i < paneList.size() && i < plot.getCustomPlotList().size(); i++) { |
||||
//将plot包裝起来,主要是为了获取dataDefinition
|
||||
ChartCollection cloneCollection = (ChartCollection) collection.clone(); |
||||
|
||||
//设置Collection的plot
|
||||
cloneCollection.getSelectedChart().setPlot(plot.getCustomPlotList().get(i)); |
||||
|
||||
//重置
|
||||
cloneCollection.getSelectedChart().setFilterDefinition(null); |
||||
|
||||
//更新
|
||||
((ChartDataPane) paneList.get(i)).update(cloneCollection); |
||||
|
||||
CustomPlotFactory.setCustomCategoryAttr(plot); |
||||
|
||||
//将处理好的dataDefinition剥离出来并存储
|
||||
definitionMap.put(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i)), cloneCollection.getSelectedChart().getFilterDefinition()); |
||||
|
||||
} |
||||
|
||||
CustomDefinition customDefinition = new CustomDefinition(); |
||||
customDefinition.setDefinitionProviderMap(definitionMap); |
||||
collection.getSelectedChart().setFilterDefinition(customDefinition); |
||||
|
||||
}catch (Exception e){ |
||||
return; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 返回绑定的属性事件. |
||||
* @param listener 增加监听 |
||||
*/ |
||||
public void addAttributeChangeListener(AttributeChangeListener listener) { |
||||
for (int i = 0; i < paneList.size(); i++){ |
||||
((ChartDataPane) paneList.get(i)).addAttributeChangeListener(listener); |
||||
} |
||||
} |
||||
} |
@ -1,294 +0,0 @@
|
||||
package com.fr.plugin.chart.custom; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.base.DataSeriesCondition; |
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartglyph.ConditionAttr; |
||||
import com.fr.chart.chartglyph.ConditionCollection; |
||||
import com.fr.design.layout.TableLayout; |
||||
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.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.designer.type.AbstractVanChartTypePane; |
||||
import com.fr.plugin.chart.vanchart.VanChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/2/16. |
||||
*/ |
||||
public class VanChartCustomPlotPane extends AbstractVanChartTypePane { |
||||
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewCustom"); |
||||
|
||||
//是否选择自定义
|
||||
private boolean isCustom = false; |
||||
|
||||
private static final long serialVersionUID = -3481633368542654247L; |
||||
|
||||
//切换到自定义组合图时,显示的版面
|
||||
private JPanel customPane; |
||||
private VanChartCustomPlotSelectPane customSelectPane; |
||||
|
||||
private JPanel autoPane; |
||||
|
||||
//自定义和自动版面的容器,cardLayOut布局
|
||||
private JPanel contentPane; |
||||
|
||||
protected Component[][] getPaneComponents(JPanel typePane) { |
||||
|
||||
initContent(); |
||||
|
||||
return new Component[][]{ |
||||
new Component[]{typePane}, |
||||
new Component[]{stylePane}, |
||||
new Component[]{contentPane} |
||||
}; |
||||
} |
||||
|
||||
|
||||
private void initContent() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
autoPane = new JPanel(); |
||||
|
||||
customSelectPane = new VanChartCustomPlotSelectPane(); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new JSeparator()}, |
||||
new Component[]{customSelectPane} |
||||
}; |
||||
|
||||
double[] columnSize = {p, f}; |
||||
double[] rowSize = {p, p}; |
||||
customPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
|
||||
contentPane = new JPanel(new CardLayout()) { |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (isCustom) { |
||||
return customPane.getPreferredSize(); |
||||
} else { |
||||
return new Dimension(autoPane.getWidth(), 0); |
||||
} |
||||
} |
||||
}; |
||||
contentPane.add(autoPane, "auto"); |
||||
contentPane.add(customPane, "custom"); |
||||
} |
||||
|
||||
private void checkCardPane() { |
||||
CardLayout cardLayout = (CardLayout) contentPane.getLayout(); |
||||
if (isCustom) { |
||||
cardLayout.show(contentPane, "custom"); |
||||
} else { |
||||
cardLayout.show(contentPane, "auto"); |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{"/com/fr/plugin/chart/custom/images/column_line.png", |
||||
"/com/fr/plugin/chart/custom/images/column_area.png", |
||||
"/com/fr/plugin/chart/custom/images/stack_column_line.png", |
||||
"/com/fr/plugin/chart/custom/images/custom.png", |
||||
|
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeTipName() { |
||||
return new String[]{ |
||||
Inter.getLocText("Plugin-ChartF_NewCustom_ColumnLine"), |
||||
Inter.getLocText("Plugin-ChartF_NewCustom_ColumnArea"), |
||||
Inter.getLocText("Plugin-ChartF_NewCustom_StackColumnLine"), |
||||
Inter.getLocText("Plugin-ChartF_NewCustom_Custom") |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
/** |
||||
* 返回界面标题 |
||||
* @return 界面标题 |
||||
*/ |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_NewCustom"); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void updateBean(Chart chart) { |
||||
|
||||
//保存上次选中的值,其会在super中更新
|
||||
int lastState = chart.getPlot().getDetailType(); |
||||
|
||||
super.updateBean(chart); |
||||
|
||||
//如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置
|
||||
if (lastState != chart.getPlot().getDetailType()) { |
||||
chart.setFilterDefinition(null); |
||||
} |
||||
|
||||
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; |
||||
for (int i = 0, len = customChart.length; i < len; i++) { |
||||
if (typeDemo.get(i).isPressing) { |
||||
if (i == customChart.length - 1) { |
||||
isCustom = true; |
||||
|
||||
//先重置自定义组合面板,如果不重置,无法获取选择顺序
|
||||
if (lastState == customChart.length - 1 && samePlot) { |
||||
//更新数据配置,刪除已经不在的图表数据
|
||||
dealCustomDefinition(chart); |
||||
|
||||
customSelectPane.updateBean(chart); |
||||
} else if (samePlot) {//如果是同一个图表切换过来,则重置面板
|
||||
customSelectPane.populateBean(chart); |
||||
} |
||||
} |
||||
} else { |
||||
isCustom = false; |
||||
} |
||||
} |
||||
|
||||
checkCardPane(); |
||||
|
||||
} |
||||
|
||||
private void dealCustomDefinition(Chart chart) { |
||||
CustomDefinition definition = (CustomDefinition) chart.getFilterDefinition(); |
||||
|
||||
if (definition == null) { |
||||
return; |
||||
} |
||||
|
||||
Map<CustomPlotType, TopDefinitionProvider> definitionMap = definition.getDefinitionProviderMap(); |
||||
|
||||
if (definitionMap == null) { |
||||
return; |
||||
} |
||||
|
||||
Map<CustomPlotType, TopDefinitionProvider> newDefinitionMap = new HashMap<CustomPlotType, TopDefinitionProvider>(); |
||||
|
||||
VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot(); |
||||
for (int i = 0; i < customPlot.getCustomPlotList().size(); i++) { |
||||
CustomPlotType plotType = CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i)); |
||||
TopDefinitionProvider definitionProvider = definitionMap.get(plotType); |
||||
|
||||
newDefinitionMap.put(plotType, definitionProvider); |
||||
} |
||||
|
||||
definition.setDefinitionProviderMap(newDefinitionMap); |
||||
} |
||||
|
||||
/** |
||||
* 不同图表切換,重置chart屬性 |
||||
* |
||||
* @param chart |
||||
* @param newPlot |
||||
*/ |
||||
@Override |
||||
protected void resetChartAttr(Chart chart, Plot newPlot) { |
||||
super.resetChartAttr(chart, newPlot); |
||||
//切换图表清空数据配置
|
||||
chart.setFilterDefinition(null); |
||||
//设置默认不排序
|
||||
VanChartTools tools = ((VanChart) chart).getVanChartTools(); |
||||
if (tools != null) { |
||||
tools.setSort(false); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新界面内容 |
||||
*/ |
||||
public void populateBean(Chart chart) { |
||||
for (ChartImagePane imagePane : typeDemo) { |
||||
imagePane.isPressing = false; |
||||
} |
||||
|
||||
//获取上次选中的图标
|
||||
VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot(); |
||||
typeDemo.get(customPlot.getDetailType()).isPressing = true; |
||||
|
||||
isCustom = customPlot.getCustomStyle() == CustomStyle.CUSTOM; |
||||
|
||||
//自定义选择时,更新自定义面板
|
||||
if (isCustom) { |
||||
customSelectPane.populateBean(chart); |
||||
} |
||||
|
||||
checkCardPane(); |
||||
|
||||
checkDemosBackground(); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 获取各图表类型界面ID, 本质是plotID |
||||
* |
||||
* @return 图表类型界面ID |
||||
*/ |
||||
@Override |
||||
protected String getPlotTypeID() { |
||||
return VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID; |
||||
} |
||||
|
||||
protected Plot getSelectedClonedPlot() { |
||||
VanChartCustomPlot newPlot = null; |
||||
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; |
||||
for (int i = 0, len = customChart.length; i < len; i++) { |
||||
if (typeDemo.get(i).isPressing) { |
||||
newPlot = (VanChartCustomPlot) customChart[i].getPlot(); |
||||
} |
||||
} |
||||
Plot cloned = null; |
||||
try { |
||||
cloned = (Plot) newPlot.clone(); |
||||
} catch (CloneNotSupportedException e) { |
||||
FRLogger.getLogger().error("Error In ScatterChart"); |
||||
} |
||||
return cloned; |
||||
} |
||||
|
||||
public Chart getDefaultChart() { |
||||
return CustomIndependentVanChart.CustomVanChartTypes[0]; |
||||
} |
||||
|
||||
@Override |
||||
/** |
||||
*删除配置的条件属性 |
||||
*/ |
||||
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { |
||||
cloneOldDefaultAttrConditionCollection(oldPlot, newPlot); |
||||
} |
||||
|
||||
@Override |
||||
/** |
||||
* 删除线型配置 |
||||
*/ |
||||
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { |
||||
if (oldPlot.getConditionCollection() != null) { |
||||
ConditionCollection newCondition = new ConditionCollection(); |
||||
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); |
||||
newPlot.setConditionCollection(newCondition); |
||||
|
||||
//删除线型设置
|
||||
ConditionAttr attrList = newCondition.getDefaultAttr(); |
||||
DataSeriesCondition attr = attrList.getExisted(VanChartAttrLine.class); |
||||
if (attr != null) { |
||||
attrList.remove(VanChartAttrLine.class); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,27 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/5/18. |
||||
*/ |
||||
public class CategoryCustomPlotTableDataContentPane extends CategoryPlotTableDataContentPane { |
||||
public CategoryCustomPlotTableDataContentPane() { |
||||
super(); |
||||
} |
||||
|
||||
public CategoryCustomPlotTableDataContentPane(ChartDataPane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
/** |
||||
* 检查 某些Box是否可用 |
||||
* 分类不可用 |
||||
* @param hasUse 是否使用 |
||||
*/ |
||||
public void checkBoxUse(boolean hasUse) { |
||||
categoryCombox.setEnabled(false); |
||||
checkSeriseUse(hasUse); |
||||
} |
||||
} |
@ -1,103 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.plugin.chart.custom.CustomPlotFactory; |
||||
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.util.ArrayList; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/19. |
||||
*/ |
||||
public class ChartImageCheckOutPane extends BasicPane implements UIObserver { |
||||
|
||||
private JCheckBox checkBox; |
||||
private CustomPlotType customPlotType; |
||||
private ArrayList<ChangeListener> changeListeners = new ArrayList<ChangeListener>(); |
||||
|
||||
public ChartImageCheckOutPane(CustomPlotType type){ |
||||
this(type, false); |
||||
} |
||||
|
||||
public ChartImageCheckOutPane( CustomPlotType type, boolean isSelected){ |
||||
this.customPlotType = type; |
||||
|
||||
initCheckBox(isSelected); |
||||
|
||||
this.add(checkBox, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public CustomPlotType getCustomPlotType() { |
||||
return customPlotType; |
||||
} |
||||
|
||||
private void initCheckBox(boolean isSelected) { |
||||
this.checkBox = new JCheckBox(); |
||||
this.checkBox.setSelected(isSelected); |
||||
//设置提示
|
||||
this.checkBox.setToolTipText(CustomPlotFactory.getTooltipText(this.customPlotType)); |
||||
//背景
|
||||
checkBox.setIcon(new ImageIcon(getClass().getResource(getIconPath(customPlotType,isSelected)))); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
} |
||||
|
||||
private String getIconPath(CustomPlotType customPlotType, boolean isSelected) { |
||||
return isSelected ? CustomPlotFactory.getTypeIconPath(customPlotType)[0] : CustomPlotFactory.getTypeIconPath(customPlotType)[1]; |
||||
} |
||||
|
||||
|
||||
public JCheckBox getCheckBox() { |
||||
return checkBox; |
||||
} |
||||
|
||||
public void checkIconImage(){ |
||||
checkBox.setIcon(new ImageIcon(getClass().getResource(getIconPath(customPlotType, checkBox.isSelected())))); |
||||
} |
||||
|
||||
public void setPaneBorder(boolean isRightLine, boolean isBottomLine){ |
||||
this.setBorder(BorderFactory.createMatteBorder(1, 1, isBottomLine ? 1 : 0, isRightLine ? 1 : 0, UIConstants.LINE_COLOR)); |
||||
} |
||||
|
||||
public void setSelected(boolean isSelected){ |
||||
checkBox.setSelected(isSelected); |
||||
} |
||||
|
||||
public boolean isSelected(){ |
||||
return checkBox.isSelected(); |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
public void fireStateChange() { |
||||
for (int i = 0; i < changeListeners.size(); i++) { |
||||
changeListeners.get(i).stateChanged(new ChangeEvent(this)); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void registerChangeListener(final UIObserverListener listener) { |
||||
changeListeners.add(new ChangeListener() { |
||||
public void stateChanged(ChangeEvent e) { |
||||
listener.doChange(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
public boolean shouldResponseChangeListener() { |
||||
return false; |
||||
} |
||||
} |
@ -1,84 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.PiePlot4VanChart; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPositionPlot; |
||||
import com.fr.plugin.chart.base.Position; |
||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/26. |
||||
*/ |
||||
public class CustomPlotLocationPane extends BasicBeanPane<Plot>{ |
||||
private UISpinner radius; |
||||
private UISpinner xDirection; |
||||
private UISpinner yDirection; |
||||
private static final double MIN_ANGLE = PiePlot4VanChart.START_ANGLE; |
||||
private static final double MAX_ANGLE = PiePlot4VanChart.END_ANGLE; |
||||
|
||||
public CustomPlotLocationPane(){ |
||||
init(); |
||||
} |
||||
|
||||
private void init() { |
||||
radius = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 50); |
||||
|
||||
xDirection = new UISpinner(0, 100, 1, 20); |
||||
yDirection = new UISpinner(0, 100, 1, 20); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Position") + "(%): " + Inter.getLocText("Plugin-ChartF_X_Direction"), SwingConstants.LEFT),xDirection}, |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Y_Direction"), SwingConstants.RIGHT),yDirection}, |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Radius") + "(px): ",SwingConstants.LEFT),radius} |
||||
|
||||
}; |
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, new double[]{-2, -2, -2}, new double[]{-2, -1}); |
||||
|
||||
this.setLayout(new BorderLayout(0,0)); |
||||
|
||||
this.add(TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Location"), panel), BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Plot plot) { |
||||
if (plot instanceof VanChartPositionPlot) { |
||||
Position position = ((VanChartPositionPlot) plot).getPosition(); |
||||
|
||||
if (position != null) { |
||||
radius.setValue(position.getRadius()); |
||||
xDirection.setValue(position.getX()); |
||||
yDirection.setValue(position.getY()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(Plot plot) { |
||||
if (plot instanceof VanChartPositionPlot) { |
||||
Position position = new Position(); |
||||
position.setRadius(radius.getValue()); |
||||
position.setX(xDirection.getValue()); |
||||
position.setY(yDirection.getValue()); |
||||
|
||||
((VanChartPositionPlot) plot).setPosition(position); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Plot updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -1,36 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.chart.chartdata.MeterReportDefinition; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.MeterPlotReportDataContentPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/5/23. |
||||
*/ |
||||
public class MeterCustomPlotReportDataContentPane extends MeterPlotReportDataContentPane{ |
||||
private UITextField singCateText; |
||||
public MeterCustomPlotReportDataContentPane(ChartDataPane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
@Override |
||||
protected Component getSingCatePane() { |
||||
return singCateText = new UITextField(); |
||||
} |
||||
|
||||
@Override |
||||
protected void populateSingCatePane(String name) { |
||||
singCateText.setText(name); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateSingCatePane(MeterReportDefinition meterDefinition) { |
||||
|
||||
meterDefinition.setName(singCateText.getText()); |
||||
|
||||
} |
||||
} |
@ -1,44 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.base.Utils; |
||||
import com.fr.chart.chartdata.MeterTableDefinition; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.MeterPlotTableDataContentPane; |
||||
import com.fr.plugin.chart.data.VanChartMeterCustomTableDefinition; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/5/18. |
||||
*/ |
||||
public class MeterCustomPlotTableDataContentPane extends MeterPlotTableDataContentPane { |
||||
private static final int TEXT_HT = 20; |
||||
private static final int TEXT_WD = 80; |
||||
private UITextField nameField; |
||||
public MeterCustomPlotTableDataContentPane(ChartDataPane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
@Override |
||||
protected Component getNameComponent() { |
||||
nameField = new UITextField(); |
||||
nameField.setPreferredSize(new Dimension(TEXT_WD, TEXT_HT)); |
||||
return nameField; |
||||
} |
||||
|
||||
@Override |
||||
protected void populateNameComponent(MeterTableDefinition meter) { |
||||
nameField.setText(meter.getName()); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateNameComponent(MeterTableDefinition meter) { |
||||
meter.setName(Utils.objectToString(nameField.getText())); |
||||
} |
||||
|
||||
@Override |
||||
protected MeterTableDefinition getMeterTableDefinition(){ |
||||
return new VanChartMeterCustomTableDefinition(); |
||||
} |
||||
} |
@ -1,19 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||
import com.fr.plugin.chart.custom.style.VanChartCustomAxisAreaPane; |
||||
import com.fr.plugin.chart.designer.style.background.VanChartAreaBackgroundPane; |
||||
import com.fr.plugin.chart.designer.style.background.VanChartAxisAreaPane; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/5/19. |
||||
*/ |
||||
public class VanChartCustomAreaBackgroundPane extends VanChartAreaBackgroundPane { |
||||
public VanChartCustomAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) { |
||||
super(isPlot, parent); |
||||
} |
||||
|
||||
protected VanChartAxisAreaPane initAxisAreaPane() { |
||||
return new VanChartCustomAxisAreaPane(); |
||||
} |
||||
} |
@ -1,43 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
|
||||
import com.fr.general.Inter; |
||||
|
||||
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; |
||||
import com.fr.plugin.chart.column.VanChartCustomStackAndAxisConditionPane; |
||||
|
||||
import java.awt.*; |
||||
/** |
||||
* 自定义坐标轴设置 |
||||
* 散点图和气泡图用到 |
||||
* 堆积和百分比属性为false |
||||
*/ |
||||
public class VanChartCustomAxisConditionPane extends VanChartCustomStackAndAxisConditionPane { |
||||
|
||||
public VanChartCustomAxisConditionPane(){ |
||||
|
||||
} |
||||
|
||||
protected Component[][] getDeployComponents() { |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")),XAxis}, |
||||
new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")),YAxis}, |
||||
}; |
||||
|
||||
return components; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_Custom_Axis"); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) { |
||||
seriesStackAndAxis.setStacked(false); |
||||
seriesStackAndAxis.setPercentStacked(false); |
||||
} |
||||
|
||||
} |
@ -1,55 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.chart.chartglyph.ConditionAttr; |
||||
import com.fr.chart.chartglyph.ConditionCollection; |
||||
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; |
||||
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; |
||||
import com.fr.plugin.chart.custom.CustomPlotDesignerPaneFactory; |
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/5/12. |
||||
*/ |
||||
public class VanChartCustomPlotAxisPane extends VanChartAxisPane { |
||||
|
||||
public VanChartCustomPlotAxisPane(VanChartAxisPlot plot, VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
//删除此坐标轴相关堆积属性的设置
|
||||
protected void removeOthers(int axisIndex, boolean isXAxis){ |
||||
//堆积和坐标轴
|
||||
|
||||
VanChartCustomPlot customPlot = (VanChartCustomPlot)editingPlot; |
||||
List<VanChartPlot> plotList = customPlot.getCustomPlotList(); |
||||
for (int k = 0; k < plotList.size(); k++) { |
||||
if (customPlot.getStandardAxisOrder().contains(k)){ |
||||
VanChartRectanglePlot vanChartPlot = (VanChartRectanglePlot) plotList.get(k); |
||||
if (vanChartPlot.isHaveAxis() && !CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlot)){ |
||||
remove(axisIndex, isXAxis, vanChartPlot); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void remove(int axisIndex, boolean isXAxis, VanChartRectanglePlot vanChartPlot){ |
||||
ConditionCollection stackAndAxisCondition = vanChartPlot.getStackAndAxisCondition(); |
||||
if (stackAndAxisCondition == null) { |
||||
return; |
||||
} |
||||
for (int i = 0, len = stackAndAxisCondition.getConditionAttrSize(); i < len; i++) { |
||||
ConditionAttr conditionAttr = stackAndAxisCondition.getConditionAttr(i); |
||||
AttrSeriesStackAndAxis stackAndAxis = (AttrSeriesStackAndAxis) conditionAttr.getExisted(AttrSeriesStackAndAxis.class); |
||||
int index = isXAxis ? stackAndAxis.getXAxisIndex() : stackAndAxis.getYAxisIndex(); |
||||
if (index == axisIndex) { |
||||
stackAndAxisCondition.removeConditionAttr(conditionAttr); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,396 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.general.ComparatorUtils; |
||||
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 javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/19. |
||||
*/ |
||||
public class VanChartCustomPlotSelectPane extends BasicBeanPane<Chart> { |
||||
|
||||
private static final int NO_DIRTY = -1; |
||||
private static final int NOT_LAST = -1; |
||||
private static final int REC_WIDTH = 58; |
||||
private static final int REC_HEIGHT = 50; |
||||
private static final int CUSTOM_TYPE_NUM = 4; |
||||
|
||||
|
||||
public static final String MASSAGE = Inter.getLocText("Plugin-ChartF_At_Least_One_Chart"); |
||||
|
||||
private List<ChartImageCheckOutPane> customTypeList = new ArrayList<ChartImageCheckOutPane>(); |
||||
|
||||
//该列表记录上次每个checkout的状态
|
||||
private List<Boolean> oldSelectedList; |
||||
|
||||
//保存点击的checkout顺序
|
||||
private List<CustomPlotType> selectedPlotTypeList = new ArrayList<CustomPlotType>(); |
||||
|
||||
//将所有面板排布后的面板
|
||||
private JPanel content; |
||||
|
||||
|
||||
public VanChartCustomPlotSelectPane(){ |
||||
initCustomType(); |
||||
} |
||||
|
||||
private void initCustomType() { |
||||
|
||||
initAllCheckOutPane(); |
||||
|
||||
initContentPane(); |
||||
|
||||
updateOldSelectedList(); |
||||
|
||||
addCheckBoxListener(); |
||||
|
||||
checkoutSelected(); |
||||
} |
||||
|
||||
private void updateOldSelectedList() { |
||||
oldSelectedList = new ArrayList<Boolean>(); |
||||
for (int i = 0; i < customTypeList.size(); i++){ |
||||
oldSelectedList.add(customTypeList.get(i).getCheckBox().isSelected()); |
||||
} |
||||
} |
||||
|
||||
private void checkoutSelected() { |
||||
for (int i = 0; i < customTypeList.size(); i++){ |
||||
//根据是否选中重置背景
|
||||
customTypeList.get(i).checkIconImage(); |
||||
} |
||||
} |
||||
|
||||
private void initContentPane() { |
||||
|
||||
content = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(CUSTOM_TYPE_NUM, 0, 0); |
||||
for (int i = 0; i < customTypeList.size(); i++){ |
||||
customTypeList.get(i).setPreferredSize(new Dimension(REC_WIDTH,REC_HEIGHT)); |
||||
|
||||
//是否画右边线
|
||||
boolean isRightLine = (i == customTypeList.size() - 1) ? true : ((i + 1)%CUSTOM_TYPE_NUM == 0) ? true : false; |
||||
//是否画下边线
|
||||
int row = i / CUSTOM_TYPE_NUM; |
||||
int column = i % CUSTOM_TYPE_NUM; |
||||
boolean isBottomLine = ((row+1)*CUSTOM_TYPE_NUM + column < customTypeList.size()) ? false : true; |
||||
|
||||
customTypeList.get(i).setPaneBorder(isRightLine, isBottomLine); |
||||
|
||||
content.add(customTypeList.get(i)); |
||||
} |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(content, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void addCheckBoxListener() { |
||||
for (int i = 0; i < customTypeList.size(); i++){ |
||||
|
||||
//初始化每个customType的listener
|
||||
|
||||
customTypeList.get(i).getCheckBox().addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
int index = isLastSelected(); |
||||
if (index != NOT_LAST) {//如果是最后一个
|
||||
customTypeList.get(index).getCheckBox().setSelected(true); |
||||
|
||||
//彈出警告框
|
||||
JOptionPane.showMessageDialog(new JPanel(), MASSAGE,"", JOptionPane.WARNING_MESSAGE); |
||||
} |
||||
|
||||
//点击后更新已选顺序
|
||||
checkoutSelectedPlotTypeList(); |
||||
|
||||
//点击后,更新背景
|
||||
checkoutSelected(); |
||||
|
||||
//响应观察者事件,以便更新chart
|
||||
fireDirty(); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据选择更新顺序 |
||||
*/ |
||||
private void checkoutSelectedPlotTypeList() { |
||||
int index = getDirtySelectedIndex(oldSelectedList); |
||||
|
||||
if (index == NO_DIRTY){ |
||||
return; |
||||
} |
||||
|
||||
boolean isAdd = getDirtyState(index); |
||||
|
||||
//获取选中的自定义图表类型
|
||||
CustomPlotType plotType = customTypeList.get(index).getCustomPlotType(); |
||||
|
||||
//根据类型处理增加或者删除
|
||||
dealSelectedPlotTypeList(isAdd, plotType, selectedPlotTypeList); |
||||
} |
||||
|
||||
private void fireDirty() { |
||||
int index = getDirtySelectedIndex(oldSelectedList); |
||||
if (index != NO_DIRTY) { |
||||
customTypeList.get(index).fireStateChange(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Chart chart) { |
||||
|
||||
VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot(); |
||||
|
||||
populateCustomTypeList(customPlot); |
||||
|
||||
populateSelectedPlotTypeList(customPlot); |
||||
|
||||
checkoutSelected(); |
||||
} |
||||
|
||||
private void populateSelectedPlotTypeList(VanChartCustomPlot customPlot) { |
||||
|
||||
selectedPlotTypeList = new ArrayList<CustomPlotType>(); |
||||
|
||||
List<VanChartPlot> customPlotList = customPlot.getCustomPlotList(); |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
selectedPlotTypeList.add(CustomPlotFactory.getCustomType(customPlotList.get(i))); |
||||
} |
||||
} |
||||
|
||||
private void populateCustomTypeList(VanChartCustomPlot customPlot) { |
||||
if (customPlot.getCustomStyle() != CustomStyle.CUSTOM){ |
||||
return; |
||||
} |
||||
|
||||
List<VanChartPlot> customPlotList = customPlot.getCustomPlotList(); |
||||
|
||||
oldSelectedList = new ArrayList<Boolean>(); |
||||
|
||||
for (int i = 0; i < customTypeList.size(); i++){ |
||||
boolean isSelected = false; |
||||
CustomPlotType customPlotType = customTypeList.get(i).getCustomPlotType(); |
||||
//更新选中项
|
||||
if (customPlotTypeContained(customPlotType, customPlotList)) { |
||||
isSelected = true; |
||||
} |
||||
|
||||
customTypeList.get(i).setSelected(isSelected); |
||||
|
||||
//同时设置oldList
|
||||
oldSelectedList.add(isSelected); |
||||
} |
||||
|
||||
} |
||||
|
||||
private boolean customPlotTypeContained(CustomPlotType customPlotType, List<VanChartPlot> customPlotList) { |
||||
boolean contained = false; |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
if (ComparatorUtils.equals(customPlotType, CustomPlotFactory.getCustomType(customPlotList.get(i)))){ |
||||
contained = true; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return contained; |
||||
} |
||||
|
||||
@Override |
||||
public Chart updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(Chart chart) { |
||||
VanChartCustomPlot customPlot = (VanChartCustomPlot)chart.getPlot(); |
||||
|
||||
//根据选择的组合图更新,根据保存的顺序更新组合图
|
||||
updateCustomPlotList(customPlot); |
||||
|
||||
//响应完毕后,更新状态
|
||||
updateOldSelectedList(); |
||||
} |
||||
|
||||
private void updateCustomPlotList(VanChartCustomPlot customPlot) { |
||||
//根据selectedPlotTypeList更新customPlotList
|
||||
//切换之后,给与全新构建的plotList,这回导致其他面板上的设置无效,也是合理的
|
||||
List<VanChartPlot> newCustomPlotList = new ArrayList<VanChartPlot>(); |
||||
List<VanChartPlot> oldCustomPlotList = customPlot.getCustomPlotList(); |
||||
|
||||
//复制已经设置的plot
|
||||
try { |
||||
for (int i = 0; i < oldCustomPlotList.size(); i++){ |
||||
VanChartPlot vanChartPlot = oldCustomPlotList.get(i); |
||||
if (selectedPlotTypeList.contains(CustomPlotFactory.getCustomType(vanChartPlot))){ |
||||
newCustomPlotList.add((VanChartPlot) vanChartPlot.clone()); |
||||
} |
||||
} |
||||
} catch (CloneNotSupportedException e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
|
||||
|
||||
//没有复制到的plot重创
|
||||
for (int i = 0; i < selectedPlotTypeList.size(); i++){ |
||||
CustomPlotType customPlotType = selectedPlotTypeList.get(i); |
||||
if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){ |
||||
VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType); |
||||
vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString()); |
||||
//设置公共属性
|
||||
setCommonAttr(vanChartPlot, customPlot); |
||||
|
||||
newCustomPlotList.add(vanChartPlot); |
||||
} |
||||
} |
||||
|
||||
customPlot.setCustomPlotList(newCustomPlotList); |
||||
} |
||||
|
||||
private void setCommonAttr(VanChartPlot vanChartPlot, VanChartCustomPlot customPlot) { |
||||
//坐标轴公共属性
|
||||
dealAxisAttr(vanChartPlot, customPlot); |
||||
} |
||||
|
||||
private void dealAxisAttr(VanChartPlot vanChartPlot, VanChartCustomPlot customPlot) { |
||||
if (vanChartPlot.isHaveAxis() && !CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlot) && customPlot.isHaveStandardAxis()){ |
||||
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)vanChartPlot; |
||||
|
||||
//指针指向同一个标准坐标轴
|
||||
rectanglePlot.setXAxisList(customPlot.getXAxisList()); |
||||
rectanglePlot.setYAxisList(customPlot.getYAxisList()); |
||||
} |
||||
} |
||||
|
||||
private void dealSelectedPlotTypeList(boolean isAdd, CustomPlotType plotType, List<CustomPlotType> customPlotTypeList) { |
||||
|
||||
//根据isAdd删除或者增加
|
||||
if (isAdd){ |
||||
customPlotTypeList.add(plotType); |
||||
}else { |
||||
//定位选中的是那个plot
|
||||
int index = -1; |
||||
|
||||
for (int i = 0; i < customPlotTypeList.size(); i++){ |
||||
if (ComparatorUtils.equals(plotType, customPlotTypeList.get(i))){ |
||||
index = i; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
if (index == -1){ |
||||
return; |
||||
} |
||||
|
||||
customPlotTypeList.remove(index); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 获取id为index的图表是选中还是删除 |
||||
* 增加则返回true |
||||
* 删除返回false |
||||
* @param index |
||||
* @return |
||||
*/ |
||||
private boolean getDirtyState(int index) { |
||||
boolean isAdd = true; |
||||
|
||||
boolean newState = customTypeList.get(index).getCheckBox().isSelected(); |
||||
boolean oldState = oldSelectedList.get(index); |
||||
|
||||
//true->false为删除;false->true为增加
|
||||
if (oldState == true && newState == false){ |
||||
isAdd = false; |
||||
}else if (oldState == false && newState == true){ |
||||
isAdd = true; |
||||
} |
||||
|
||||
return isAdd; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 如果是最后一个,则返回最后一个checkout的index |
||||
* 否则返回-1 |
||||
* @return |
||||
*/ |
||||
private int isLastSelected() { |
||||
int count = 0; |
||||
int index = NOT_LAST; |
||||
for (int i = 0; i < customTypeList.size(); i++){ |
||||
if (customTypeList.get(i).getCheckBox().isSelected()){ |
||||
count++; |
||||
} |
||||
} |
||||
if (count == 0){ |
||||
//查找是哪一个变化了
|
||||
index = getDirtySelectedIndex(oldSelectedList); |
||||
} |
||||
return index; |
||||
} |
||||
|
||||
/** |
||||
* 获取改变状态的index |
||||
* 如果有两个都改变了,改函数获取的是排在前面的index |
||||
* 如果没找到 |
||||
* @param oldSelectedList |
||||
* @return |
||||
*/ |
||||
private int getDirtySelectedIndex(List<Boolean> oldSelectedList) { |
||||
for (int i = 0; i < oldSelectedList.size(); i++){ |
||||
if ((oldSelectedList.get(i)) != customTypeList.get(i).getCheckBox().isSelected()){ |
||||
return i; |
||||
} |
||||
} |
||||
return NO_DIRTY; |
||||
} |
||||
|
||||
/** |
||||
* 构建所有可用的组合图面板 |
||||
*/ |
||||
private void initAllCheckOutPane() { |
||||
//将所有工厂中的图表都加入到可选面板中
|
||||
|
||||
CustomPlotType[] customPlotTypes = CustomPlotType.getTypes(); |
||||
for(int i = 0; i < customPlotTypes.length; i++){ |
||||
boolean isSelected = false; |
||||
CustomPlotType customPlotType = customPlotTypes[i]; |
||||
//前两个默认选中
|
||||
if (i == 0 || i == 1) { |
||||
isSelected = true; |
||||
selectedPlotTypeList.add(customPlotType); |
||||
} |
||||
ChartImageCheckOutPane checkOutPane = new ChartImageCheckOutPane(customPlotType, isSelected); |
||||
|
||||
customTypeList.add(checkOutPane); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,81 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.gui.style.legend.AutoSelectedPane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.plugin.chart.designer.component.VanChartPlotMultiTabPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/22. |
||||
*/ |
||||
public abstract class VanChartCustomPlotTabPane<E, T> extends VanChartPlotMultiTabPane<E, T> { |
||||
private static final long serialVersionUID = 8633385688766835241L; |
||||
|
||||
public VanChartCustomPlotTabPane(E plot, BasicPane parent) { |
||||
this(plot, parent, null); |
||||
} |
||||
|
||||
public VanChartCustomPlotTabPane(E plot, BasicPane parent, AttributeChangeListener listener) { |
||||
super(plot, parent, listener); |
||||
} |
||||
|
||||
protected abstract void initTabTitle(); |
||||
|
||||
@Override |
||||
protected void initLayout() { |
||||
JPanel tabPanel = new JPanel(new BorderLayout()); |
||||
tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, getBackground())); |
||||
tabPanel.add(tabPane, BorderLayout.CENTER); |
||||
this.setLayout(new BorderLayout(0, 6)); |
||||
this.add(tabPanel, BorderLayout.NORTH); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
/** |
||||
* 设置选中的界面id |
||||
*/ |
||||
public void setSelectedByIds(int level, String... id) { |
||||
tabPane.setSelectedIndex(-1); |
||||
for (int i = 0; i < paneList.size(); i++) { |
||||
if (ComparatorUtils.equals(id[level], NameArray[i])) { |
||||
tabPane.setSelectedIndex(i); |
||||
tabPane.tabChanged(i); |
||||
if (id.length >= level + 2) { |
||||
((AutoSelectedPane)paneList.get(i)).setSelectedIndex(id[level + 1]); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void relayoutWhenListChange() { |
||||
centerPane = new JPanel(cardLayout) { |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (tabPane.getSelectedIndex() == -1) { |
||||
return super.getPreferredSize(); |
||||
} else { |
||||
return paneList.get(tabPane.getSelectedIndex()).getPreferredSize(); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
//获取tab的标题
|
||||
initTabTitle(); |
||||
|
||||
tabPane = new VanChartCustomPlotUITabGroup(NameArray) { |
||||
@Override |
||||
public void tabChanged(int index) { |
||||
dealWithTabChanged(index); |
||||
} |
||||
}; |
||||
tabPane.setSelectedIndex(0); |
||||
tabPane.tabChanged(0); |
||||
initLayout(); |
||||
} |
||||
} |
@ -1,130 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.gui.ibutton.UITabGroup; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.Border; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/21. |
||||
*/ |
||||
public class VanChartCustomPlotUITabGroup extends UITabGroup{ |
||||
|
||||
private static final int WIDTH = 198; |
||||
private static final int BUTTON_HEIGHT = 30; |
||||
private int listNum = 0; |
||||
|
||||
public VanChartCustomPlotUITabGroup(Icon[] iconArray) { |
||||
super(iconArray); |
||||
} |
||||
|
||||
public VanChartCustomPlotUITabGroup(String[] textArray) { |
||||
super(textArray); |
||||
} |
||||
|
||||
@Override |
||||
protected LayoutManager getGridLayout(int number) { |
||||
//这个地方可以顺便获取list个数
|
||||
listNum = number; |
||||
return new GridBagLayout(); |
||||
} |
||||
|
||||
@Override |
||||
protected void paintBorder(Graphics g) { |
||||
Border border = getBorder(); |
||||
if (border != null) { |
||||
border.paintBorder(this, g, 0, 0, getWidth(), getHeight()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected Border getGroupBorder() { |
||||
return BorderFactory.createEmptyBorder(1, 1, 1, 1); |
||||
} |
||||
|
||||
@Override |
||||
protected void initButton(UIToggleButton labelButton) { |
||||
|
||||
int ButtonWidth = WIDTH / 3; |
||||
if (listNum <= 1){ |
||||
return; |
||||
}else if (listNum == 2){ |
||||
ButtonWidth = WIDTH / 2; |
||||
} |
||||
|
||||
//将button加入到pane中,以便可以对边框进行控制
|
||||
labelButton.setRoundBorder(false); |
||||
labelButton.setBorderPainted(false); |
||||
|
||||
|
||||
|
||||
labelButtonList.add(labelButton); |
||||
|
||||
int index = labelButtonList.size() - 1; |
||||
|
||||
JPanel panel = getButtonPanel(labelButton, index); |
||||
|
||||
GridBagConstraints constraints=new GridBagConstraints(); |
||||
|
||||
int end = listNum % 3; |
||||
|
||||
if (end == 1 && index == 0){ |
||||
constraints.gridy = 0; |
||||
constraints.gridx = 0; |
||||
constraints.gridheight = 1; |
||||
constraints.gridwidth = 6; |
||||
ButtonWidth = WIDTH + 2; |
||||
}else if (end == 2 && (index == 0 || index == 1) && listNum != 2){ |
||||
constraints.gridy = 0; |
||||
constraints.gridx = index == 1 ? 4 : 0; |
||||
constraints.gridheight = 1; |
||||
constraints.gridwidth = index == 0 ? 4 : 2; |
||||
ButtonWidth = index == 0 ? ButtonWidth * 2 + 1 : ButtonWidth; |
||||
}else { |
||||
int l = ((index + ((end == 0) ? end : (3 - end))) / 3); |
||||
constraints.gridy = l; |
||||
constraints.gridx = ((index - (l * 3 - (end == 0 ? end : 3 - end))))*2; |
||||
constraints.gridheight = 1; |
||||
constraints.gridwidth = 2; |
||||
} |
||||
labelButton.setPreferredSize(new Dimension(ButtonWidth, BUTTON_HEIGHT)); |
||||
|
||||
this.add(panel, constraints); |
||||
} |
||||
|
||||
private JPanel getButtonPanel(UIToggleButton labelButton, int index) { |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new BorderLayout()); |
||||
panel.add(labelButton,BorderLayout.CENTER); |
||||
|
||||
setPanelBorder(panel, index); |
||||
|
||||
return panel; |
||||
} |
||||
|
||||
public void setPanelBorder(JPanel panel, int index) { |
||||
int end = listNum % 3; |
||||
int num = listNum; |
||||
|
||||
//调整index
|
||||
if (end == 1 && index != 0){ |
||||
index += 2; |
||||
num += 2; |
||||
}else if (end == 2 && index != 0 && index != 1){ |
||||
index += 1; |
||||
num += 1; |
||||
} |
||||
boolean isRightLine = (index+1) % 3 == 0 ? true : false; |
||||
isRightLine = (end == 2 && index == 1) ? true : isRightLine; |
||||
isRightLine = (end == 1 && index == 0) ? true : isRightLine; |
||||
//是否画下边线
|
||||
int row = index / 3; |
||||
int column = index % 3; |
||||
boolean isBottomLine = ((row+1)*3 + column < num) ? false : true; |
||||
|
||||
panel.setBorder(BorderFactory.createMatteBorder(1, 1, isBottomLine ? 1 : 0, isRightLine ? 1 : 0, UIConstants.LINE_COLOR)); |
||||
} |
||||
} |
@ -1,23 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/5/18. |
||||
*/ |
||||
public class VanChartDataPane extends ChartDataPane { |
||||
|
||||
public VanChartDataPane(AttributeChangeListener listener) { |
||||
super(listener); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
contentsPane = new NormalChartDataPane(listener, VanChartDataPane.this); |
||||
return contentsPane; |
||||
} |
||||
} |
@ -1,296 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.component; |
||||
|
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.web.ChartHyperPoplink; |
||||
import com.fr.chart.web.ChartHyperRelateCellLink; |
||||
import com.fr.chart.web.ChartHyperRelateFloatLink; |
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.chart.javascript.ChartEmailPane; |
||||
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; |
||||
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane; |
||||
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; |
||||
import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; |
||||
import com.fr.design.designer.TargetComponent; |
||||
import com.fr.design.fun.HyperlinkProvider; |
||||
import com.fr.design.gui.HyperlinkFilterHelper; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
||||
import com.fr.design.hyperlink.ReportletHyperlinkPane; |
||||
import com.fr.design.hyperlink.WebHyperlinkPane; |
||||
import com.fr.design.javascript.JavaScriptImplPane; |
||||
import com.fr.design.javascript.ParameterJavaScriptPane; |
||||
import com.fr.design.module.DesignModuleFactory; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.js.EmailJavaScript; |
||||
import com.fr.js.FormHyperlinkProvider; |
||||
import com.fr.js.JavaScript; |
||||
import com.fr.js.JavaScriptImpl; |
||||
import com.fr.js.NameJavaScript; |
||||
import com.fr.js.NameJavaScriptGroup; |
||||
import com.fr.js.ParameterJavaScript; |
||||
import com.fr.js.ReportletHyperlink; |
||||
import com.fr.js.WebHyperlink; |
||||
import com.fr.plugin.chart.designer.component.VanChartUIListControlPane; |
||||
import com.fr.stable.ListMap; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/28. |
||||
*/ |
||||
public class VanChartHyperLinkPane extends VanChartUIListControlPane { |
||||
|
||||
public VanChartHyperLinkPane() { |
||||
super(); |
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
|
||||
//面板初始化,需要在populate的时候更新
|
||||
Map<String, NameableCreator> nameCreators = new ListMap<>(); |
||||
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); |
||||
for (NameableCreator creator : creators) { |
||||
nameCreators.put(creator.menuName(), creator); |
||||
} |
||||
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); |
||||
for (HyperlinkProvider provider : providers) { |
||||
NameableCreator nc = provider.createHyperlinkCreator(); |
||||
nameCreators.put(nc.menuName(), nc); |
||||
} |
||||
return nameCreators.values().toArray(new NameableCreator[nameCreators.size()]); |
||||
} |
||||
|
||||
|
||||
protected BasicBeanPane createPaneByCreators(NameableCreator creator) { |
||||
Constructor<? extends BasicBeanPane> constructor = null; |
||||
try { |
||||
constructor = creator.getUpdatePane().getConstructor(HashMap.class, boolean.class); |
||||
return constructor.newInstance(getHyperLinkEditorMap(), false); |
||||
|
||||
} catch (InstantiationException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} catch (IllegalAccessException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} catch (NoSuchMethodException e) { |
||||
return super.createPaneByCreators(creator); |
||||
} catch (InvocationTargetException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
protected Map<String, BaseFormula> getHyperLinkEditorMap() { |
||||
return plot.getHyperLinkEditorMap(); |
||||
} |
||||
|
||||
/** |
||||
* 弹出列表的标题. |
||||
* |
||||
* @return 返回标题字符串. |
||||
*/ |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Designer_Hyperlink"); |
||||
} |
||||
|
||||
@Override |
||||
protected String getAddItemText() { |
||||
return Inter.getLocText("FR-Designer_Add_Hyperlink"); |
||||
} |
||||
|
||||
@Override |
||||
protected AddItemMenuDef getAddItemMenuDef (NameableCreator[] creators) { |
||||
return new AddVanChartItemMenuDef(creators); |
||||
} |
||||
|
||||
public void populate(NameJavaScriptGroup nameHyperlink_array) { |
||||
java.util.List<NameObject> list = new ArrayList<NameObject>(); |
||||
if (nameHyperlink_array != null) { |
||||
for (int i = 0; i < nameHyperlink_array.size(); i++) { |
||||
list.add(new NameObject(nameHyperlink_array.getNameHyperlink(i).getName(), nameHyperlink_array.getNameHyperlink(i).getJavaScript())); |
||||
} |
||||
} |
||||
|
||||
this.populate(list.toArray(new NameObject[list.size()])); |
||||
} |
||||
|
||||
public void populate(TargetComponent elementCasePane) { |
||||
//populate
|
||||
} |
||||
|
||||
/** |
||||
* updateJs的Group |
||||
* |
||||
* @return 返回NameJavaScriptGroup |
||||
*/ |
||||
public NameJavaScriptGroup updateJSGroup() { |
||||
Nameable[] res = this.update(); |
||||
NameJavaScript[] res_array = new NameJavaScript[res.length]; |
||||
for (int i = 0; i < res.length; i++) { |
||||
NameObject no = (NameObject) res[i]; |
||||
res_array[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject()); |
||||
} |
||||
|
||||
return new NameJavaScriptGroup(res_array); |
||||
} |
||||
|
||||
public void populate(Plot plot) { |
||||
this.plot = plot; |
||||
HashMap paneMap = getHyperlinkMap(plot); |
||||
|
||||
//安装平台内打开插件时,添加相应按钮
|
||||
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); |
||||
for (HyperlinkProvider provider : providers) { |
||||
NameableCreator nc = provider.createHyperlinkCreator(); |
||||
paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); |
||||
} |
||||
|
||||
java.util.List<UIMenuNameableCreator> list = refreshList(paneMap); |
||||
NameObjectCreator[] creators = new NameObjectCreator[list.size()]; |
||||
for (int i = 0; list != null && i < list.size(); i++) { |
||||
UIMenuNameableCreator uiMenuNameableCreator = list.get(i); |
||||
creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz()); |
||||
|
||||
} |
||||
|
||||
refreshNameableCreator(creators); |
||||
|
||||
java.util.List<NameObject> nameObjects = new ArrayList<NameObject>(); |
||||
|
||||
NameJavaScriptGroup nameGroup = populateHotHyperLink(plot); |
||||
for (int i = 0; nameGroup != null && i < nameGroup.size(); i++) { |
||||
NameJavaScript javaScript = nameGroup.getNameHyperlink(i); |
||||
if (javaScript != null && javaScript.getJavaScript() != null) { |
||||
JavaScript script = javaScript.getJavaScript(); |
||||
UIMenuNameableCreator uiMenuNameableCreator = new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass())); |
||||
nameObjects.add(new NameObject(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj())); |
||||
|
||||
} |
||||
} |
||||
|
||||
this.populate(nameObjects.toArray(new NameObject[nameObjects.size()])); |
||||
doLayout(); |
||||
} |
||||
|
||||
protected NameJavaScriptGroup populateHotHyperLink(Plot plot) { |
||||
return plot.getHotHyperLink(); |
||||
} |
||||
|
||||
protected HashMap getHyperlinkMap(Plot plot) { |
||||
HashMap<Class, Class> map = new HashMap<Class, Class>(); |
||||
|
||||
map.put(ReportletHyperlink.class, ReportletHyperlinkPane.class); |
||||
map.put(EmailJavaScript.class, ChartEmailPane.class); |
||||
map.put(WebHyperlink.class, WebHyperlinkPane.class); |
||||
map.put(ParameterJavaScript.class, ParameterJavaScriptPane.class); |
||||
|
||||
map.put(JavaScriptImpl.class, JavaScriptImplPane.class); |
||||
map.put(ChartHyperPoplink.class, ChartHyperPoplinkPane.class); |
||||
map.put(ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.class); |
||||
map.put(ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.class); |
||||
|
||||
map.put(FormHyperlinkProvider.class, FormHyperlinkPane.class); |
||||
return map; |
||||
} |
||||
|
||||
public void update(Plot plot) { |
||||
|
||||
NameJavaScriptGroup nameGroup = updateNameGroup(); |
||||
|
||||
updateHotHyperLink(plot, nameGroup); |
||||
} |
||||
|
||||
protected void updateHotHyperLink(Plot plot, NameJavaScriptGroup nameGroup) { |
||||
plot.setHotHyperLink(nameGroup); |
||||
} |
||||
|
||||
private NameJavaScriptGroup updateNameGroup() { |
||||
Nameable[] nameables = update(); |
||||
|
||||
NameJavaScriptGroup nameGroup = new NameJavaScriptGroup(); |
||||
nameGroup.clear(); |
||||
|
||||
for (int i = 0; i < nameables.length; i++) { |
||||
JavaScript javaScript = (JavaScript) ((NameObject) nameables[i]).getObject(); |
||||
String name = nameables[i].getName(); |
||||
NameJavaScript nameJava = new NameJavaScript(name, javaScript); |
||||
nameGroup.addNameHyperlink(nameJava); |
||||
} |
||||
|
||||
return nameGroup; |
||||
} |
||||
|
||||
|
||||
protected java.util.List<UIMenuNameableCreator> refreshList(HashMap map) { |
||||
java.util.List<UIMenuNameableCreator> list = new ArrayList<UIMenuNameableCreator>(); |
||||
|
||||
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Reportlet"), |
||||
new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); |
||||
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), VanChartEmailPane.class)); |
||||
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Web"), |
||||
new WebHyperlink(), getUseMap(map, WebHyperlink.class))); |
||||
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Dynamic_Parameters"), |
||||
new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class))); |
||||
list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); |
||||
|
||||
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Float_Chart"), |
||||
new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class))); |
||||
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Cell"), |
||||
new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class))); |
||||
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Float"), |
||||
new ChartHyperRelateFloatLink(), getUseMap(map, ChartHyperRelateFloatLink.class))); |
||||
|
||||
FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); |
||||
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Form"), |
||||
hyperlink, getUseMap(map, FormHyperlinkProvider.class))); |
||||
|
||||
return list; |
||||
} |
||||
|
||||
protected Class<? extends BasicBeanPane> getUseMap(HashMap map, Object key) { |
||||
if (map.get(key) != null) { |
||||
return (Class<? extends BasicBeanPane>) map.get(key); |
||||
} |
||||
//引擎在这边放了个provider,当前表单对象
|
||||
for (Object tempKey : map.keySet()) { |
||||
if (((Class) tempKey).isAssignableFrom((Class) key)) { |
||||
return (Class<? extends BasicBeanPane>) map.get(tempKey); |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
protected class AddVanChartItemMenuDef extends AddItemMenuDef { |
||||
|
||||
public AddVanChartItemMenuDef(NameableCreator[] creators) { |
||||
super(creators); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean whetherAdd(String itemName) { |
||||
return HyperlinkFilterHelper.whetherAddHyperlink4Chart(itemName); |
||||
} |
||||
} |
||||
|
||||
//邮箱
|
||||
public static class VanChartEmailPane extends ChartEmailPane { |
||||
@Override |
||||
protected boolean needRenamePane() { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -1,71 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.other; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/28. |
||||
*/ |
||||
public class VanChartCustomConditionAttrPane extends BasicScrollPane<Chart> { |
||||
private VanChartCustomPlotConditionAttrTabPane conditionAttrPane; |
||||
private Chart chart; |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
if(chart == null) { |
||||
return contentPane; |
||||
} |
||||
initConditionAttrPane((VanChartCustomPlot) chart.getPlot()); |
||||
if(conditionAttrPane != null) { |
||||
contentPane.add(conditionAttrPane, BorderLayout.CENTER); |
||||
} |
||||
return contentPane; |
||||
} |
||||
|
||||
private void initConditionAttrPane(VanChartCustomPlot plot) { |
||||
conditionAttrPane = new VanChartCustomPlotConditionAttrTabPane(plot, null); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Chart chart) { |
||||
this.chart = chart; |
||||
if(conditionAttrPane == null) { |
||||
this.remove(leftcontentPane); |
||||
layoutContentPane(); |
||||
} |
||||
if(conditionAttrPane != null) { |
||||
conditionAttrPane.populateBean((VanChartCustomPlot)chart.getPlot()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(Chart chart) { |
||||
|
||||
if (chart == null){ |
||||
return; |
||||
} |
||||
|
||||
if (conditionAttrPane != null) { |
||||
conditionAttrPane.updateBean((VanChartCustomPlot) chart.getPlot()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 是否显示滚动条 |
||||
* @return |
||||
*/ |
||||
@Override |
||||
protected boolean isShowScrollBar() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Chart-Condition_Display"); |
||||
} |
||||
} |
@ -1,56 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.other; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
import com.fr.plugin.chart.custom.type.CustomStyle; |
||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||
import com.fr.plugin.chart.designer.other.AutoRefreshPane; |
||||
import com.fr.plugin.chart.designer.other.AutoRefreshPaneWithoutTooltip; |
||||
import com.fr.plugin.chart.designer.other.VanChartInteractivePane; |
||||
import com.fr.plugin.chart.vanchart.VanChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/28. |
||||
*/ |
||||
public class VanChartCustomInteractivePane extends VanChartInteractivePane { |
||||
|
||||
private VanChartCustomPlotHyperlinkPane hyperlinkPane; |
||||
|
||||
/** |
||||
* 组合图无排序按钮 |
||||
* @return |
||||
*/ |
||||
@Override |
||||
protected Component[][] createToolBarComponents() { |
||||
return createToolBarComponentsWithOutSort(); |
||||
} |
||||
|
||||
protected JPanel createHyperlinkPane() { |
||||
hyperlinkPane = new VanChartCustomPlotHyperlinkPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("M_Insert-Hyperlink"), hyperlinkPane); |
||||
} |
||||
|
||||
@Override |
||||
protected void populateHyperlink(Plot plot) { |
||||
hyperlinkPane.populateBean(chart); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateHyperlink(Plot plot){ |
||||
hyperlinkPane.updateBean(chart); |
||||
} |
||||
|
||||
protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { |
||||
boolean isLargeModel = largeModel(plot); |
||||
//自定义组合图不支持自动数据点提示
|
||||
if (((VanChartCustomPlot)plot).getCustomStyle().equals(CustomStyle.CUSTOM)) { |
||||
return new AutoRefreshPaneWithoutTooltip((VanChart) chart, isLargeModel); |
||||
} |
||||
return new AutoRefreshPane((VanChart) chart, isLargeModel); |
||||
} |
||||
} |
@ -1,19 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.other; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.plugin.chart.designer.other.VanChartOtherPane; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/28. |
||||
*/ |
||||
public class VanChartCustomOtherPane extends VanChartOtherPane { |
||||
protected BasicBeanPane<Chart> createInteractivePane() { |
||||
return new VanChartCustomInteractivePane(); |
||||
} |
||||
|
||||
@Override |
||||
protected BasicBeanPane<Chart> createConditionAttrPane() { |
||||
return new VanChartCustomConditionAttrPane(); |
||||
} |
||||
} |
@ -1,112 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.other; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
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.designer.other.VanChartConditionAttrPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/28. |
||||
*/ |
||||
public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> { |
||||
public VanChartCustomPlotConditionAttrTabPane(VanChartCustomPlot plot, BasicPane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected void initTabTitle() { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
NameArray = new String[paneList.size()]; |
||||
for (int i = 0, j = 0 ; i < paneList.size() && j < customPlotList.size(); i++, j++) { |
||||
if (customPlotList.get(j).isSupportDataSeriesCondition()) { |
||||
JPanel pane = paneList.get(i); |
||||
//获取点的tooltip作为标题
|
||||
VanChartPlot vanChartPlot = customPlotList.get(j); |
||||
|
||||
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); |
||||
NameArray[i] = CustomPlotFactory.getTitle(plotType); |
||||
centerPane.add(pane, NameArray[i]); |
||||
}else { |
||||
//如果不支持,则i不动
|
||||
i -- ; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected List<JPanel> initPaneList() { |
||||
List<JPanel> paneList = new ArrayList<JPanel>(); |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
if (customPlotList.get(i).isSupportDataSeriesCondition()) { |
||||
//根据不同的plot创建不同的数据配置界面
|
||||
VanChartConditionAttrPane contentPane = new VanChartConditionAttrPane(); |
||||
|
||||
paneList.add(contentPane); |
||||
} |
||||
} |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(VanChartCustomPlot plot) { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0, j = 0 ; i < paneList.size() && j < customPlotList.size(); i++, j++){ |
||||
if (customPlotList.get(j).isSupportDataSeriesCondition()) { |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(j); |
||||
|
||||
((VanChartConditionAttrPane) paneList.get(i)).populateBean(vanChartPlot); |
||||
}else { |
||||
i -- ; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public VanChartCustomPlot updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(VanChartCustomPlot plot) { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0, j = 0; i < paneList.size() && j < customPlotList.size(); i++, j++){ |
||||
if (customPlotList.get(j).isSupportDataSeriesCondition()) { |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(j); |
||||
|
||||
VanChartConditionAttrPane conditionPane = (VanChartConditionAttrPane) paneList.get(i); |
||||
|
||||
conditionPane.updateBean(vanChartPlot); |
||||
}else { |
||||
i --; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
|
||||
} |
||||
} |
@ -1,66 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.other; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/28. |
||||
*/ |
||||
public class VanChartCustomPlotHyperlinkPane extends BasicScrollPane<Chart> { |
||||
private VanChartCustomPlotHyperlinkTabPane linkPane; |
||||
protected Chart chart; |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
if(chart == null) { |
||||
return contentPane; |
||||
} |
||||
initLinkPane((VanChartCustomPlot) chart.getPlot()); |
||||
if(linkPane != null) { |
||||
contentPane.add(linkPane, BorderLayout.CENTER); |
||||
} |
||||
return contentPane; |
||||
} |
||||
|
||||
private void initLinkPane(VanChartCustomPlot plot) { |
||||
linkPane = new VanChartCustomPlotHyperlinkTabPane(plot, null); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Chart chart) { |
||||
this.chart = chart; |
||||
if(linkPane == null) { |
||||
this.remove(leftcontentPane); |
||||
layoutContentPane(); |
||||
} |
||||
if(linkPane != null) { |
||||
linkPane.populateBean((VanChartCustomPlot)chart.getPlot()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(Chart chart) { |
||||
this.chart = chart; |
||||
|
||||
if(linkPane != null) { |
||||
linkPane.updateBean((VanChartCustomPlot) chart.getPlot()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void layoutContentPane() { |
||||
leftcontentPane = createContentPane(); |
||||
leftcontentPane.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(leftcontentPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -1,93 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.other; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
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.component.VanChartHyperLinkPane; |
||||
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/28. |
||||
*/ |
||||
public class VanChartCustomPlotHyperlinkTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> { |
||||
public VanChartCustomPlotHyperlinkTabPane(VanChartCustomPlot plot, BasicPane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected void initTabTitle() { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; |
||||
for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { |
||||
JPanel pane = paneList.get(i); |
||||
//获取点的tooltip作为标题
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); |
||||
String name = CustomPlotFactory.getTitle(plotType); |
||||
NameArray[i] = name.length() > 3 ? name.substring(0, 3) : name; |
||||
centerPane.add(pane, NameArray[i]); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected List<JPanel> initPaneList() { |
||||
List<JPanel> paneList = new ArrayList<JPanel>(); |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
//根据不同的plot创建不同的数据配置界面
|
||||
VanChartHyperLinkPane contentPane = new VanChartHyperLinkPane(); |
||||
|
||||
paneList.add(contentPane); |
||||
} |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(VanChartCustomPlot plot) { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
((VanChartHyperLinkPane)paneList.get(i)).populate(vanChartPlot); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public VanChartCustomPlot updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(VanChartCustomPlot plot) { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
((VanChartHyperLinkPane)paneList.get(i)).update(vanChartPlot); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
|
||||
} |
||||
} |
@ -1,21 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||
import com.fr.plugin.chart.custom.component.VanChartCustomAreaBackgroundPane; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/5/19. |
||||
*/ |
||||
public class VanChartCustomAreaPane extends VanChartAreaPane { |
||||
public VanChartCustomAreaPane(Plot plot, VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) { |
||||
plotPane = new VanChartCustomAreaBackgroundPane(true, parent); |
||||
} |
||||
} |
@ -1,54 +0,0 @@
|
||||
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.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; |
||||
|
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/5/19. |
||||
*/ |
||||
public class VanChartCustomAxisAreaPane extends VanChartAxisAreaPane { |
||||
|
||||
|
||||
@Override |
||||
public void updateBean(Plot plot){ |
||||
VanChartCustomPlot customPlot = (VanChartCustomPlot)plot; |
||||
|
||||
super.updateBean(customPlot); |
||||
|
||||
List<VanChartPlot> vanChartPlotList = customPlot.getCustomPlotList(); |
||||
|
||||
//更新后同步坐标轴
|
||||
CustomPlotFactory.axisSynchronization(customPlot); |
||||
|
||||
//使用其他坐标轴的图形
|
||||
for (int i = 0; i < vanChartPlotList.size(); i++){ |
||||
if (vanChartPlotList.get(i).isSupportPlotBackground() && CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlotList.get(i))){ |
||||
super.updateBean(vanChartPlotList.get(i)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public void populateBean(Plot plot){ |
||||
VanChartCustomPlot customPlot = (VanChartCustomPlot)plot; |
||||
|
||||
if (customPlot.isHaveStandardAxis()){ |
||||
super.populateBean(customPlot); |
||||
} else { |
||||
List<VanChartPlot> vanChartPlotList = customPlot.getCustomPlotList(); |
||||
//使用其他坐標軸的圖形
|
||||
for (int i = 0; i < vanChartPlotList.size(); i++) { |
||||
if (vanChartPlotList.get(i).isSupportPlotBackground() && CustomPlotDesignerPaneFactory.isUseDiffAxisPane(vanChartPlotList.get(i))) { |
||||
super.populateBean(vanChartPlotList.get(i)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,84 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.mainframe.chart.PaneTitleConstants; |
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.vanchart.VanChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/27. |
||||
*/ |
||||
public class VanChartCustomAxisPane extends BasicScrollPane<Chart> { |
||||
private static final long serialVersionUID = -2974722365840564105L; |
||||
private VanChartCustomAxisTabPane axisPane; |
||||
private Chart chart; |
||||
protected VanChartStylePane parent; |
||||
|
||||
public VanChartCustomAxisPane(VanChartStylePane parent) { |
||||
super(); |
||||
this.parent = parent; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
if(chart == null) { |
||||
return contentPane; |
||||
} |
||||
initAxisPane((VanChartCustomPlot) chart.getPlot()); |
||||
contentPane.add(axisPane, BorderLayout.CENTER); |
||||
return contentPane; |
||||
} |
||||
|
||||
private void initAxisPane(VanChartCustomPlot plot) { |
||||
axisPane = new VanChartCustomAxisTabPane(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Chart chart) { |
||||
this.chart = chart; |
||||
|
||||
if(axisPane == null){ |
||||
this.remove(leftcontentPane); |
||||
layoutContentPane(); |
||||
parent.initAllListeners(); |
||||
} |
||||
|
||||
if(axisPane != null) { |
||||
axisPane.populateBean((VanChartCustomPlot) chart.getPlot()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(Chart chart){ |
||||
if(chart == null){ |
||||
return; |
||||
} |
||||
VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); |
||||
axisPane.updateBean(plot); |
||||
} |
||||
|
||||
@Override |
||||
protected void layoutContentPane() { |
||||
leftcontentPane = createContentPane(); |
||||
leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(leftcontentPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public VanChart updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return PaneTitleConstants.CHART_STYLE_AXIS_TITLE; |
||||
} |
||||
} |
@ -1,156 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
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.component.VanChartCustomPlotAxisPane; |
||||
import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; |
||||
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane; |
||||
import com.fr.plugin.chart.vanchart.VanChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/27. |
||||
*/ |
||||
public class VanChartCustomAxisTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> { |
||||
|
||||
public VanChartCustomAxisTabPane(VanChartCustomPlot plot, BasicPane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected List<JPanel> initPaneList() { |
||||
List<JPanel> paneList = new ArrayList<JPanel>(); |
||||
|
||||
VanChartCustomPlot customPlot = plot; |
||||
|
||||
List<VanChartPlot> customPlotList = customPlot.getCustomPlotList(); |
||||
|
||||
/** |
||||
* 判断是否有使用标准坐标轴的点 |
||||
*/ |
||||
ArrayList<Integer> plotOrder = customPlot.getDiffAxisOrder(); |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
//根据不同的plotOrder创建不同的数据配置界面
|
||||
if (plotOrder.contains(i)) { |
||||
VanChartAxisPane contentPane = CustomPlotDesignerPaneFactory.createAxisPane((VanChartAxisPlot) customPlotList.get(i), (VanChartStylePane) parent); |
||||
paneList.add(contentPane); |
||||
} |
||||
} |
||||
|
||||
//判断是否使用标准坐标轴系,标准坐标系即使用customPlot的坐标轴属性,如果有,放在最后
|
||||
if (customPlot.isHaveStandardAxis()){ |
||||
VanChartAxisPane contentPane = new VanChartCustomPlotAxisPane(customPlot, (VanChartStylePane) parent); |
||||
paneList.add(contentPane); |
||||
} |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
protected void initTabTitle(){ |
||||
VanChartCustomPlot customPlot = plot; |
||||
List<VanChartPlot> customPlotList = customPlot.getCustomPlotList(); |
||||
ArrayList<Integer> plotOrder = customPlot.getDiffAxisOrder(); |
||||
|
||||
NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; |
||||
|
||||
|
||||
for (int i = 0;i < paneList.size() && i < plotOrder.size(); i++) { |
||||
JPanel pane = paneList.get(i); |
||||
|
||||
VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); |
||||
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); |
||||
|
||||
NameArray[i] = CustomPlotFactory.getTitle(plotType); |
||||
centerPane.add(pane, NameArray[i]); |
||||
} |
||||
|
||||
//如果有标准坐标系,则放在最后一个tab按钮上
|
||||
if (customPlot.isHaveStandardAxis()){ |
||||
JPanel pane = paneList.get(paneList.size() - 1); |
||||
|
||||
//获取点的tooltip作为标题
|
||||
NameArray[paneList.size() - 1] = Inter.getLocText("Plugin-ChartF_Rectangular_Coordinate_System"); |
||||
centerPane.add(pane, NameArray[paneList.size() - 1]); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
/** |
||||
* 标准坐标轴属性存在最外层的customPlot的坐标轴变量中 |
||||
* 不使用标准坐标轴的坐标轴属性存在相应的plot中的坐标轴变量中 |
||||
*/ |
||||
public void populateBean(VanChartCustomPlot plot) { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
|
||||
ArrayList<Integer> plotOrder = plot.getDiffAxisOrder(); |
||||
|
||||
for (int i = 0; i < paneList.size() && i < plotOrder.size(); i++){ |
||||
//先更新标准坐标轴界面
|
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); |
||||
((VanChartAxisPane)paneList.get(i)).populateBean(vanChartPlot); |
||||
} |
||||
|
||||
if (plot.isHaveStandardAxis()){ |
||||
((VanChartAxisPane)paneList.get(paneList.size() - 1)).populateBean(plot); |
||||
|
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public VanChartCustomPlot updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(VanChartCustomPlot plot) { |
||||
VanChartCustomPlot customPlot = plot; |
||||
List<VanChartPlot> customPlotList = customPlot.getCustomPlotList(); |
||||
|
||||
ArrayList<Integer> plotOrder = customPlot.getDiffAxisOrder(); |
||||
|
||||
for (int i = 0; i < paneList.size() && i < plotOrder.size(); i++){ |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(plotOrder.get(i)); |
||||
((VanChartAxisPane)paneList.get(i)).updateBean(vanChartPlot); |
||||
} |
||||
|
||||
if (customPlot.isHaveStandardAxis()){ |
||||
//用VanChart包裝plot
|
||||
VanChart chart = new VanChart(); |
||||
chart.setPlot(customPlot); |
||||
((VanChartAxisPane)paneList.get(paneList.size() - 1)).updateBean(chart); |
||||
|
||||
} |
||||
|
||||
//将标准坐标轴属性存入使用标准坐标轴的点的坐标轴变量中
|
||||
CustomPlotFactory.axisSynchronization(plot); |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
|
||||
} |
||||
} |
@ -1,73 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.mainframe.chart.PaneTitleConstants; |
||||
|
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/22. |
||||
*/ |
||||
public class VanChartCustomLabelPane extends BasicScrollPane<Chart> { |
||||
private VanChartCustomPlotLabelTabPane labelPane; |
||||
private Chart chart; |
||||
protected VanChartStylePane parent; |
||||
private static final long serialVersionUID = -5449293740965811991L; |
||||
|
||||
public VanChartCustomLabelPane(VanChartStylePane parent) { |
||||
super(); |
||||
this.parent = parent; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
if(chart == null) { |
||||
return contentPane; |
||||
} |
||||
initLabelPane((VanChartCustomPlot) chart.getPlot()); |
||||
|
||||
contentPane.add(labelPane, BorderLayout.NORTH); |
||||
return contentPane; |
||||
} |
||||
|
||||
private void initLabelPane(VanChartCustomPlot plot) { |
||||
labelPane = new VanChartCustomPlotLabelTabPane(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Chart chart) { |
||||
this.chart = chart; |
||||
|
||||
if(labelPane == null){ |
||||
this.remove(leftcontentPane); |
||||
layoutContentPane(); |
||||
parent.initAllListeners(); |
||||
} |
||||
|
||||
if(labelPane != null) { |
||||
labelPane.populateBean((VanChartCustomPlot)chart.getPlot()); |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void updateBean(Chart chart) { |
||||
if(chart == null) { |
||||
return; |
||||
} |
||||
|
||||
labelPane.updateBean((VanChartCustomPlot)chart.getPlot()); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return PaneTitleConstants.CHART_STYLE_LABEL_TITLE; |
||||
} |
||||
} |
@ -1,115 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.base.DataSeriesCondition; |
||||
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.designer.PlotFactory; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/22. |
||||
*/ |
||||
public class VanChartCustomPlotLabelTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> { |
||||
public VanChartCustomPlotLabelTabPane(VanChartCustomPlot plot, BasicPane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected void initTabTitle() { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; |
||||
for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { |
||||
JPanel pane = paneList.get(i); |
||||
//获取点的tooltip作为标题
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); |
||||
|
||||
NameArray[i] = CustomPlotFactory.getTitle(plotType); |
||||
centerPane.add(pane, NameArray[i]); |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected List<JPanel> initPaneList() { |
||||
List<JPanel> paneList = new ArrayList<JPanel>(); |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
//根据不同的plot创建不同的数据配置界面
|
||||
VanChartPlotLabelPane contentPane = PlotFactory.createPlotLabelPane(customPlotList.get(i), (VanChartStylePane) parent); |
||||
|
||||
paneList.add(contentPane); |
||||
} |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(VanChartCustomPlot plot) { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
DataSeriesCondition attr = vanChartPlot.getAttrLabelFromConditionCollection(); |
||||
((VanChartPlotLabelPane)paneList.get(i)).populate((AttrLabel) attr); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public VanChartCustomPlot updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(VanChartCustomPlot plot) { |
||||
|
||||
if (plot == null){ |
||||
return; |
||||
} |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) { |
||||
ConditionAttr attrList = customPlotList.get(i).getConditionCollection().getDefaultAttr(); |
||||
DataSeriesCondition attr = customPlotList.get(i).getAttrLabelFromConditionCollection(); |
||||
if (attr != null) { |
||||
attrList.remove(attr); |
||||
} |
||||
|
||||
VanChartPlotLabelPane labelPane = (VanChartPlotLabelPane) paneList.get(i); |
||||
AttrLabel attrLabel = labelPane.update(); |
||||
|
||||
if (attrLabel != null) { |
||||
attrList.addDataSeriesCondition(attrLabel); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
|
||||
} |
||||
} |
@ -1,82 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; |
||||
|
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/26. |
||||
*/ |
||||
public class VanChartCustomPlotSeriesPane extends BasicBeanPane<Plot> { |
||||
private static final int WIDTH = 236; |
||||
private static final int DELTA_HEIGHT = 300; |
||||
private BasicBeanPane<Plot> axisPane; |
||||
private AbstractPlotSeriesPane seriesPane; |
||||
public VanChartCustomPlotSeriesPane(BasicBeanPane<Plot> axisPane, AbstractPlotSeriesPane seriesPane) { |
||||
this.axisPane = axisPane; |
||||
this.seriesPane = seriesPane; |
||||
|
||||
initContentPane(); |
||||
} |
||||
|
||||
private void initContentPane() { |
||||
|
||||
seriesPane.setPreferredSize(new Dimension(WIDTH, (int) (seriesPane.getPreferredSize().getHeight() + DELTA_HEIGHT))); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
|
||||
if (axisPane == null) { |
||||
this.add(seriesPane); |
||||
}else { |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{axisPane}, |
||||
new Component[]{seriesPane} |
||||
}; |
||||
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize)); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Plot plot) { |
||||
//获取位置信息
|
||||
if (axisPane != null) { |
||||
axisPane.populateBean(plot); |
||||
} |
||||
//获取界面信息
|
||||
seriesPane.populateBean(plot); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(Plot plot) { |
||||
if(plot == null) { |
||||
return; |
||||
} |
||||
if(seriesPane != null) { |
||||
seriesPane.updateBean(plot); |
||||
} |
||||
if (axisPane != null){ |
||||
axisPane.updateBean(plot); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Plot updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -1,116 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.ChartTypeInterfaceManager; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
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.component.VanChartCustomPlotTabPane; |
||||
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/22. |
||||
*/ |
||||
public class VanChartCustomPlotSeriesTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> { |
||||
public VanChartCustomPlotSeriesTabPane(VanChartCustomPlot plot, BasicPane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected void initTabTitle() { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; |
||||
for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { |
||||
JPanel pane = paneList.get(i); |
||||
//获取点的tooltip作为标题
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); |
||||
|
||||
NameArray[i] = CustomPlotFactory.getTitle(plotType); |
||||
centerPane.add(pane, NameArray[i]); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected List<JPanel> initPaneList() { |
||||
/** |
||||
* 獲取不同plot的系列面板 |
||||
*/ |
||||
List<JPanel> paneList = new ArrayList<JPanel>(); |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
//根据不同的plot创建不同的数据配置界面
|
||||
AbstractPlotSeriesPane seriesPane = (AbstractPlotSeriesPane) ChartTypeInterfaceManager.getInstance().getPlotSeriesPane((VanChartStylePane)parent, customPlotList.get(i)); |
||||
//根据不同的plot获取不同的控制控制位置界面,从Factory中获取
|
||||
BasicBeanPane<Plot> plotPositionPane = CustomPlotDesignerPaneFactory.createCustomPlotPositionPane(customPlotList.get(i)); |
||||
|
||||
VanChartCustomPlotSeriesPane contentPane = new VanChartCustomPlotSeriesPane(plotPositionPane, seriesPane); |
||||
|
||||
paneList.add(contentPane); |
||||
} |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(VanChartCustomPlot plot) { |
||||
/** |
||||
* 更新各个点的系列界面 |
||||
*/ |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
|
||||
((VanChartCustomPlotSeriesPane)paneList.get(i)).populateBean(vanChartPlot); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public VanChartCustomPlot updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(VanChartCustomPlot plot) { |
||||
/** |
||||
* 更新每个图表的数据 |
||||
*/ |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
|
||||
VanChartCustomPlotSeriesPane plotSeriesPane = (VanChartCustomPlotSeriesPane) paneList.get(i); |
||||
|
||||
plotSeriesPane.updateBean(vanChartPlot); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
|
||||
} |
||||
} |
@ -1,118 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.base.DataSeriesCondition; |
||||
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.AttrTooltip; |
||||
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.designer.PlotFactory; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; |
||||
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltip; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/22. |
||||
*/ |
||||
public class VanChartCustomPlotTooltipTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, VanChartCustomPlot> { |
||||
public VanChartCustomPlotTooltipTabPane(VanChartCustomPlot plot, BasicPane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected void initTabTitle() { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; |
||||
for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { |
||||
JPanel pane = paneList.get(i); |
||||
//获取点的tooltip作为标题
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); |
||||
|
||||
NameArray[i] = CustomPlotFactory.getTitle(plotType); |
||||
centerPane.add(pane, NameArray[i]); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected List<JPanel> initPaneList() { |
||||
List<JPanel> paneList = new ArrayList<JPanel>(); |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
|
||||
for (int i = 0; i < customPlotList.size(); i++){ |
||||
//根据不同的plot创建不同的数据配置界面
|
||||
VanChartPlotTooltipPane contentPane = PlotFactory.createPlotTooltipPane(customPlotList.get(i), (VanChartStylePane) parent); |
||||
paneList.add(contentPane); |
||||
} |
||||
|
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(VanChartCustomPlot plot) { |
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
DataSeriesCondition attr = vanChartPlot.getAttrTooltipFromConditionCollection(); |
||||
((VanChartPlotTooltipPane)paneList.get(i)).populate((AttrTooltip) attr); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public VanChartCustomPlot updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(VanChartCustomPlot plot) { |
||||
if(plot == null) { |
||||
return; |
||||
} |
||||
|
||||
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++){ |
||||
//获取相应点的属性,并更新界面
|
||||
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||
|
||||
ConditionAttr attrList = vanChartPlot.getConditionCollection().getDefaultAttr(); |
||||
|
||||
//移除所有数据点提示相关属性
|
||||
if(attrList.getExisted(AttrTooltip.class) != null){ |
||||
attrList.remove(AttrTooltip.class); |
||||
}else if (attrList.getExisted(ScatterAttrTooltip.class) != null){ |
||||
attrList.remove(ScatterAttrTooltip.class); |
||||
} |
||||
|
||||
VanChartPlotTooltipPane tooltipPane = (VanChartPlotTooltipPane) paneList.get(i); |
||||
|
||||
AttrTooltip attrTooltip = tooltipPane.update(); |
||||
if (attrTooltip != null) { |
||||
attrList.addDataSeriesCondition(attrTooltip); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
|
||||
} |
||||
} |
@ -1,147 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; |
||||
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
import com.fr.plugin.chart.designer.component.VanChartBeautyPane; |
||||
import com.fr.plugin.chart.designer.component.VanChartFillStylePane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/22. |
||||
*/ |
||||
public class VanChartCustomSeriesPane extends ChartSeriesPane { |
||||
|
||||
private JPanel seriesPane; |
||||
protected VanChartCustomPlotSeriesTabPane plotSeriesPane; |
||||
private ChartFillStylePane fillStylePane;//配色
|
||||
private VanChartBeautyPane stylePane;//风格
|
||||
|
||||
|
||||
|
||||
public VanChartCustomSeriesPane(ChartStylePane parent) { |
||||
super(parent); |
||||
} |
||||
|
||||
protected JPanel createContentPane() { |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
if(chart == null) { |
||||
return contentPane; |
||||
} |
||||
initSeriesPane((VanChartCustomPlot) chart.getPlot()); |
||||
|
||||
plotSeriesPane.setBorder(BorderFactory.createEmptyBorder()); |
||||
|
||||
//公共使用的部分
|
||||
seriesPane.add(plotSeriesPane, BorderLayout.CENTER); |
||||
|
||||
//每种不同的图表单独的设置部分
|
||||
if(seriesPane != null) { |
||||
contentPane.add(seriesPane, BorderLayout.CENTER); |
||||
} |
||||
return contentPane; |
||||
} |
||||
|
||||
/** |
||||
* 创建組合图系列界面 |
||||
*/ |
||||
private void initSeriesPane(VanChartCustomPlot plot) { |
||||
|
||||
seriesPane = new JPanel(new BorderLayout(0, 10)); |
||||
//获取公共的属性面板
|
||||
seriesPane.add(initCommonPane(), BorderLayout.NORTH); |
||||
|
||||
plotSeriesPane = new VanChartCustomPlotSeriesTabPane(plot, parent); |
||||
} |
||||
|
||||
private JPanel initCommonPane() { |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] row = {p,p}; |
||||
double[] col = {f}; |
||||
|
||||
fillStylePane = new VanChartFillStylePane(); |
||||
|
||||
stylePane = new VanChartBeautyPane(); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{fillStylePane}, //配色
|
||||
new Component[]{stylePane},//风格
|
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); |
||||
return panel; |
||||
} |
||||
|
||||
/** |
||||
* 保存界面属性 |
||||
*/ |
||||
@Override |
||||
public void updateBean(Chart chart) { |
||||
|
||||
if(chart == null) { |
||||
return; |
||||
} |
||||
|
||||
VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); |
||||
|
||||
if (fillStylePane != null){ |
||||
plot.setPlotFillStyle(fillStylePane.updateBean()); |
||||
} |
||||
if(stylePane != null) { |
||||
plot.setPlotStyle(stylePane.updateBean()); |
||||
|
||||
//风格属性传递
|
||||
for (int i = 0; i < plot.getCustomPlotList().size(); i++){ |
||||
VanChartPlot vanChartPlot = plot.getCustomPlotList().get(i); |
||||
vanChartPlot.setPlotStyle(plot.getPlotStyle()); |
||||
} |
||||
|
||||
} |
||||
if (seriesPane != null){ |
||||
plotSeriesPane.updateBean(plot); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新界面 |
||||
*/ |
||||
@Override |
||||
public void populateBean(Chart chart) { |
||||
this.chart = chart; |
||||
if(seriesPane == null) { |
||||
this.remove(leftcontentPane); |
||||
layoutContentPane(); |
||||
parent.initAllListeners(); |
||||
} |
||||
if(seriesPane != null) { |
||||
//更新渐变色和风格
|
||||
VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); |
||||
if(plot == null) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
if(fillStylePane != null) {//配色
|
||||
fillStylePane.populateBean(plot.getPlotFillStyle()); |
||||
} |
||||
if(stylePane != null){//风格
|
||||
stylePane.populateBean(plot.getPlotStyle()); |
||||
} |
||||
|
||||
//更新不同点的系列界面
|
||||
plotSeriesPane.populateBean(plot); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,71 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; |
||||
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; |
||||
import com.fr.plugin.chart.custom.CustomPlotFactory; |
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/22. |
||||
*/ |
||||
public class VanChartCustomStylePane extends VanChartStylePane { |
||||
public VanChartCustomStylePane(AttributeChangeListener listener) { |
||||
super(listener); |
||||
} |
||||
|
||||
/** |
||||
* 根据不同的plot类型创建不同的标签界面 |
||||
* @param paneList |
||||
*/ |
||||
@Override |
||||
protected void createVanChartLabelPane(List<BasicPane> paneList) { |
||||
paneList.add(new VanChartCustomLabelPane(VanChartCustomStylePane.this)); |
||||
} |
||||
|
||||
/** |
||||
* 根据不同的plot类型创建不同的数据点提示界面 |
||||
* @param paneList |
||||
*/ |
||||
@Override |
||||
protected void addVanChartTooltipPane(List<BasicPane> paneList){ |
||||
paneList.add(new VanChartCustomTooltipPane(VanChartCustomStylePane.this)); |
||||
} |
||||
|
||||
/** |
||||
* 组合图以外的新图表类型都是使用ChartSeriesPane然后通过接口创建不同的seriesStyleContentPane |
||||
* 组合图类型不走那个接口,因为需要的系列界面完全是新的,需要像标签界面那样处理 |
||||
* @return |
||||
*/ |
||||
@Override |
||||
protected ChartSeriesPane createChartSeriesPane() { |
||||
return new VanChartCustomSeriesPane(VanChartCustomStylePane.this); |
||||
} |
||||
|
||||
/** |
||||
* 当所有图表都不支持坐标轴时,则无坐标轴选项,否则创建和自定义柱形图一样的坐标轴 |
||||
* @param paneList |
||||
*/ |
||||
@Override |
||||
protected void createVanChartAxisPane(List<BasicPane> paneList, VanChartAxisPlot plot) { |
||||
paneList.add(new VanChartCustomAxisPane(VanChartCustomStylePane.this)); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void addVanChartAreaPane(List<BasicPane> paneList) { |
||||
paneList.add(new VanChartCustomAreaPane(getChart().getPlot(), VanChartCustomStylePane.this)); |
||||
} |
||||
|
||||
@Override |
||||
public void update(ChartCollection collection) { |
||||
super.update(collection); |
||||
CustomPlotFactory.dataSheetSynchronization((VanChartCustomPlot) collection.getSelectedChart().getPlot()); |
||||
} |
||||
|
||||
} |
@ -1,73 +0,0 @@
|
||||
package com.fr.plugin.chart.custom.style; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.custom.VanChartCustomPlot; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/4/22. |
||||
*/ |
||||
public class VanChartCustomTooltipPane extends BasicScrollPane<Chart> { |
||||
|
||||
private static final long serialVersionUID = -2974722365840564105L; |
||||
private VanChartCustomPlotTooltipTabPane tooltipPane; |
||||
private Chart chart; |
||||
protected VanChartStylePane parent; |
||||
|
||||
|
||||
public VanChartCustomTooltipPane(VanChartStylePane parent){ |
||||
super(); |
||||
this.parent = parent; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
if(chart == null) { |
||||
return contentPane; |
||||
} |
||||
initTooltipPane((VanChartCustomPlot) chart.getPlot()); |
||||
contentPane.add(tooltipPane, BorderLayout.NORTH); |
||||
return contentPane; |
||||
} |
||||
|
||||
private void initTooltipPane(VanChartCustomPlot plot) { |
||||
tooltipPane = new VanChartCustomPlotTooltipTabPane(plot, parent); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void populateBean(Chart chart) { |
||||
this.chart = chart; |
||||
|
||||
if(tooltipPane == null){ |
||||
this.remove(leftcontentPane); |
||||
layoutContentPane(); |
||||
parent.initAllListeners(); |
||||
} |
||||
|
||||
if(tooltipPane != null) { |
||||
tooltipPane.populateBean((VanChartCustomPlot) chart.getPlot()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(Chart chart) { |
||||
if(chart == null) { |
||||
return; |
||||
} |
||||
|
||||
tooltipPane.updateBean((VanChartCustomPlot)chart.getPlot()); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-Chart_Tooltip"); |
||||
} |
||||
} |
@ -1,37 +0,0 @@
|
||||
package com.fr.plugin.chart.designer; |
||||
|
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.gui.iscrollbar.UIScrollBar; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/11. |
||||
*/ |
||||
public abstract class AbstractVanChartScrollPane<T> extends BasicScrollPane<T> { |
||||
|
||||
protected void layoutContentPane() { |
||||
leftcontentPane = createContentPane(); |
||||
leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 5, 0, 10, original)); |
||||
this.add(leftcontentPane); |
||||
} |
||||
|
||||
protected void setLeftContentPaneBounds(Container parent, UIScrollBar scrollBar, int beginY, int maxheight) { |
||||
int width = parent.getWidth(); |
||||
int height = parent.getHeight(); |
||||
if (leftcontentPane.getPreferredSize().height > maxheight) { |
||||
scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, 6, height); |
||||
leftcontentPane.setBounds(0, -beginY, width - 6, height + beginY); |
||||
leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 4, 0, 4, original)); |
||||
|
||||
} else { |
||||
leftcontentPane.setBounds(0, 0, width, height); |
||||
leftcontentPane.setBorder(BorderFactory.createMatteBorder(0, 4, 0, 10, original)); |
||||
} |
||||
} |
||||
public void reloaPane(JPanel pane){ |
||||
super.reloaPane(pane); |
||||
leftcontentPane.setBorder(BorderFactory.createEmptyBorder()); |
||||
} |
||||
} |
@ -1,369 +0,0 @@
|
||||
package com.fr.plugin.chart.designer; |
||||
|
||||
import com.fr.base.chart.chartdata.model.LargeDataModel; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.data.core.FormatField; |
||||
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
||||
import com.fr.design.gui.style.FormatPane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.area.VanChartAreaPlot; |
||||
import com.fr.plugin.chart.bubble.VanChartBubblePlot; |
||||
import com.fr.plugin.chart.bubble.force.VanChartBubbleRefreshTooltipPane; |
||||
import com.fr.plugin.chart.column.VanChartColumnPlot; |
||||
import com.fr.plugin.chart.designer.component.VanChartLabelContentPane; |
||||
import com.fr.plugin.chart.designer.component.VanChartRefreshTooltipContentPane; |
||||
import com.fr.plugin.chart.designer.component.VanChartTooltipContentPane; |
||||
import com.fr.plugin.chart.designer.style.HeatMapRangeLegendPane; |
||||
import com.fr.plugin.chart.designer.style.VanChartPlotLegendPane; |
||||
import com.fr.plugin.chart.designer.style.VanChartRangeLegendPane; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
import com.fr.plugin.chart.designer.style.VanLegendPaneWidthOutHighlight; |
||||
import com.fr.plugin.chart.designer.style.label.VanChartGaugePlotLabelPane; |
||||
import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; |
||||
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane; |
||||
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; |
||||
import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; |
||||
import com.fr.plugin.chart.funnel.VanChartFunnelPlot; |
||||
import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelLabelContentPane; |
||||
import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelRefreshTooltipContentPane; |
||||
import com.fr.plugin.chart.funnel.designer.style.VanChartFunnelTooltipContentPane; |
||||
import com.fr.plugin.chart.gantt.VanChartGanttPlot; |
||||
import com.fr.plugin.chart.gantt.designer.style.VanChartGanttLabelContentPane; |
||||
import com.fr.plugin.chart.gantt.designer.style.tooltip.VanChartGanttPlotTooltipPane; |
||||
import com.fr.plugin.chart.gantt.designer.style.tooltip.VanChartGanttTooltipContentPane; |
||||
import com.fr.plugin.chart.gauge.VanChartGaugePlot; |
||||
import com.fr.plugin.chart.gauge.VanChartGaugePlotRefreshTooltipPane; |
||||
import com.fr.plugin.chart.gauge.VanChartGaugePlotTooltipPane; |
||||
import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; |
||||
import com.fr.plugin.chart.line.VanChartLinePlot; |
||||
import com.fr.plugin.chart.map.VanChartMapPlot; |
||||
import com.fr.plugin.chart.map.designer.style.label.VanChartMapLabelContentPane; |
||||
import com.fr.plugin.chart.map.designer.style.tooltip.VanChartMapRefreshTooltipContentPane; |
||||
import com.fr.plugin.chart.map.designer.style.tooltip.VanChartMapTooltipContentPane; |
||||
import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; |
||||
import com.fr.plugin.chart.multilayer.style.VanChartMultiPieLabelContentPane; |
||||
import com.fr.plugin.chart.multilayer.style.VanChartMultiPiePlotTooltipPane; |
||||
import com.fr.plugin.chart.multilayer.style.VanChartMultiPieTooltipContentPane; |
||||
import com.fr.plugin.chart.multilayer.style.VanChartMutiPieRefreshTooltipContentPane; |
||||
import com.fr.plugin.chart.scatter.VanChartScatterPlot; |
||||
import com.fr.plugin.chart.scatter.VanChartScatterPlotTooltipPane; |
||||
import com.fr.plugin.chart.scatter.VanChartScatterRefreshTooltipContentPane; |
||||
import com.fr.plugin.chart.scatter.component.label.VanChartScatterPlotLabelPane; |
||||
import com.fr.plugin.chart.structure.VanChartStructurePlot; |
||||
import com.fr.plugin.chart.structure.desinger.style.VanChartStructureLabelContentPane; |
||||
import com.fr.plugin.chart.structure.desinger.style.VanChartStructureRefreshTooltipContentPane; |
||||
import com.fr.plugin.chart.structure.desinger.style.VanChartStructureTooltipContentPane; |
||||
import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; |
||||
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; |
||||
import com.fr.plugin.chart.wordcloud.designer.style.VanChartWordCloudRefreshTootipContentPane; |
||||
import com.fr.plugin.chart.wordcloud.designer.style.VanChartWordCloudTooltipContentPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.lang.reflect.Constructor; |
||||
import java.util.HashMap; |
||||
import java.util.HashSet; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/1. |
||||
* 图表配置界面的工厂 |
||||
*/ |
||||
public class PlotFactory { |
||||
|
||||
private static Set<Class<? extends Plot>> autoAdjustLabelPlots = new HashSet<Class<? extends Plot>>(); |
||||
|
||||
static { |
||||
autoAdjustLabelPlots.add(VanChartColumnPlot.class); |
||||
autoAdjustLabelPlots.add(VanChartLinePlot.class); |
||||
autoAdjustLabelPlots.add(VanChartAreaPlot.class); |
||||
autoAdjustLabelPlots.add(VanChartStructurePlot.class); |
||||
} |
||||
|
||||
public static boolean plotAutoAdjustLabelPosition(Plot plot){ |
||||
return autoAdjustLabelPlots.contains(plot.getClass()); |
||||
} |
||||
/** |
||||
* |
||||
* 标签Map |
||||
*/ |
||||
private static Map<Class<? extends Plot>, Class<? extends VanChartPlotLabelPane>> labelMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartPlotLabelPane>>(); |
||||
static { |
||||
labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); |
||||
labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class); |
||||
labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class); |
||||
} |
||||
|
||||
/** |
||||
* 图例Map |
||||
*/ |
||||
private static Map<Class<? extends Plot>, Class<? extends VanChartPlotLegendPane>> legendMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartPlotLegendPane>>(); |
||||
static { |
||||
legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutHighlight.class); |
||||
legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class); |
||||
legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class); |
||||
legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class); |
||||
legendMap.put(VanChartMapPlot.class, VanChartRangeLegendPane.class); |
||||
legendMap.put(VanChartDrillMapPlot.class, VanChartRangeLegendPane.class); |
||||
legendMap.put(VanChartHeatMapPlot.class, HeatMapRangeLegendPane.class); |
||||
legendMap.put(VanChartWordCloudPlot.class, VanChartRangeLegendPane.class); |
||||
} |
||||
|
||||
/** |
||||
* 数据点提示Map |
||||
*/ |
||||
private static Map<Class<? extends Plot>, Class<? extends VanChartPlotTooltipPane>> toolTipMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartPlotTooltipPane>>(); |
||||
static { |
||||
toolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotTooltipPane.class); |
||||
toolTipMap.put(VanChartScatterPlot.class, VanChartScatterPlotTooltipPane.class); |
||||
toolTipMap.put(VanChartBubblePlot.class, VanChartScatterPlotTooltipPane.class); |
||||
toolTipMap.put(VanChartMultiPiePlot.class, VanChartMultiPiePlotTooltipPane.class); |
||||
toolTipMap.put(VanChartTreeMapPlot.class, VanChartMultiPiePlotTooltipPane.class); |
||||
toolTipMap.put(VanChartGanttPlot.class, VanChartGanttPlotTooltipPane.class); |
||||
} |
||||
|
||||
private static Map<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>> labelContentMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>>(); |
||||
|
||||
static { |
||||
labelContentMap.put(VanChartMapPlot.class, VanChartMapLabelContentPane.class); |
||||
labelContentMap.put(VanChartDrillMapPlot.class, VanChartMapLabelContentPane.class); |
||||
labelContentMap.put(VanChartMultiPiePlot.class, VanChartMultiPieLabelContentPane.class); |
||||
labelContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieLabelContentPane.class); |
||||
labelContentMap.put(VanChartFunnelPlot.class, VanChartFunnelLabelContentPane.class); |
||||
labelContentMap.put(VanChartHeatMapPlot.class, VanChartMapLabelContentPane.class); |
||||
labelContentMap.put(VanChartGanttPlot.class, VanChartGanttLabelContentPane.class); |
||||
labelContentMap.put(VanChartStructurePlot.class, VanChartStructureLabelContentPane.class); |
||||
} |
||||
|
||||
private static Map<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>> tooltipContentMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>>(); |
||||
|
||||
static { |
||||
tooltipContentMap.put(VanChartMapPlot.class, VanChartMapTooltipContentPane.class); |
||||
tooltipContentMap.put(VanChartDrillMapPlot.class, VanChartMapTooltipContentPane.class); |
||||
tooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMultiPieTooltipContentPane.class); |
||||
tooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMultiPieTooltipContentPane.class); |
||||
tooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelTooltipContentPane.class); |
||||
tooltipContentMap.put(VanChartHeatMapPlot.class, VanChartMapTooltipContentPane.class); |
||||
tooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudTooltipContentPane.class); |
||||
tooltipContentMap.put(VanChartGanttPlot.class, VanChartGanttTooltipContentPane.class); |
||||
tooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureTooltipContentPane.class); |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 监控刷新 自动数据点提示Map |
||||
*/ |
||||
|
||||
|
||||
private static Map<Class<? extends Plot>, Class<? extends VanChartPlotTooltipPane>> refreshToolTipMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartPlotTooltipPane>>(); |
||||
static { |
||||
refreshToolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotRefreshTooltipPane.class); |
||||
refreshToolTipMap.put(VanChartBubblePlot.class, VanChartBubbleRefreshTooltipPane.class); |
||||
|
||||
} |
||||
private static Map<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>> refreshTooltipContentMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartTooltipContentPane>>(); |
||||
|
||||
static { |
||||
refreshTooltipContentMap.put(VanChartMapPlot.class, VanChartMapRefreshTooltipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartHeatMapPlot.class, VanChartMapRefreshTooltipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartDrillMapPlot.class, VanChartMapRefreshTooltipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartScatterPlot.class, VanChartScatterRefreshTooltipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartBubblePlot.class, VanChartScatterRefreshTooltipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartMultiPiePlot.class, VanChartMutiPieRefreshTooltipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartTreeMapPlot.class, VanChartMutiPieRefreshTooltipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartFunnelPlot.class, VanChartFunnelRefreshTooltipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartWordCloudPlot.class, VanChartWordCloudRefreshTootipContentPane.class); |
||||
refreshTooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureRefreshTooltipContentPane.class); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 根据图表类型创建标签界面 |
||||
* @param plot 图表 |
||||
* @param stylePane 样式界面 |
||||
* @return 标签界面 |
||||
*/ |
||||
public static VanChartPlotLabelPane createPlotLabelPane(Plot plot, VanChartStylePane stylePane) { |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(labelMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends VanChartPlotLabelPane> cl = labelMap.get(key); |
||||
Constructor<? extends VanChartPlotLabelPane > constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); |
||||
return constructor.newInstance(plot, stylePane); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new VanChartPlotLabelPane(plot, stylePane); |
||||
} |
||||
|
||||
/** |
||||
* 根据图表类型创建图例界面 |
||||
* @param plot 图表 |
||||
* @param stylePane 样式界面 |
||||
* @return 图例界面 |
||||
*/ |
||||
public static VanChartPlotLegendPane createPlotLegendPane(Plot plot, VanChartStylePane stylePane) { |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(legendMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends VanChartPlotLegendPane> cl = legendMap.get(key); |
||||
Constructor<? extends VanChartPlotLegendPane > constructor = cl.getConstructor(VanChartStylePane.class); |
||||
return constructor.newInstance(stylePane); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new VanChartPlotLegendPane(stylePane); |
||||
} |
||||
|
||||
/** |
||||
* 根据图表类型创建数据点提示界面 |
||||
* @param plot 图表 |
||||
* @param stylePane 样式界面 |
||||
* @return 数据点提示界面 |
||||
*/ |
||||
public static VanChartPlotTooltipPane createPlotTooltipPane(Plot plot, VanChartStylePane stylePane) { |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(toolTipMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends VanChartPlotTooltipPane> cl = toolTipMap.get(key); |
||||
Constructor<? extends VanChartPlotTooltipPane > constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); |
||||
return constructor.newInstance(plot, stylePane); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new VanChartPlotTooltipPane(plot, stylePane); |
||||
} |
||||
|
||||
/** |
||||
* 根据图表类型创建标签的具体内容界面.分类名系列名等 |
||||
* @param plot 图表 |
||||
* @param parent 样式界面 |
||||
* @param showOnPane formatpane用到 |
||||
* @return 标签的具体内容界面 |
||||
*/ |
||||
public static VanChartTooltipContentPane createPlotLabelContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(labelContentMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends VanChartTooltipContentPane> cl = labelContentMap.get(key); |
||||
Constructor<? extends VanChartTooltipContentPane > constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); |
||||
return constructor.newInstance(parent, showOnPane); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new VanChartLabelContentPane(parent, showOnPane); |
||||
} |
||||
|
||||
/** |
||||
* 根据图表类型创建数据点提示的具体内容界面.分类名系列名等 |
||||
* @param plot 图表 |
||||
* @param parent 样式界面 |
||||
* @param showOnPane formatpane用到 |
||||
* @return 数据点提示的具体内容界面 |
||||
*/ |
||||
public static VanChartTooltipContentPane createPlotTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(tooltipContentMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends VanChartTooltipContentPane> cl = tooltipContentMap.get(key); |
||||
Constructor<? extends VanChartTooltipContentPane > constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); |
||||
return constructor.newInstance(parent, showOnPane); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new VanChartTooltipContentPane(parent, showOnPane); |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 根据图表类型创建数据点提示界面 |
||||
* @param plot 图表 |
||||
* @return 数据点提示界面 |
||||
*/ |
||||
public static VanChartPlotTooltipPane createPlotRefreshTooltipPane(Plot plot) { |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(refreshToolTipMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends VanChartPlotTooltipPane> cl = refreshToolTipMap.get(key); |
||||
Constructor<? extends VanChartPlotTooltipPane > constructor = cl.getConstructor(Plot.class); |
||||
return constructor.newInstance(plot); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new VanChartPlotRefreshTooltipPane(plot); |
||||
} |
||||
/** |
||||
* 根据图表类型创建监控刷新中数据点提示的具体内容界面.分类名系列名等 |
||||
* @param plot 图表 |
||||
* @param parent 交互属性界面 |
||||
* @param showOnPane formatpane用到 |
||||
* @return 数据点提示的具体内容界面 |
||||
*/ |
||||
public static VanChartTooltipContentPane createPlotRefreshTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ |
||||
Class<? extends Plot> key = plot.getClass(); |
||||
if(refreshTooltipContentMap.containsKey(key)){ |
||||
try{ |
||||
Class<? extends VanChartTooltipContentPane> cl = refreshTooltipContentMap.get(key); |
||||
Constructor<? extends VanChartTooltipContentPane > constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); |
||||
return constructor.newInstance(parent, showOnPane); |
||||
} catch (Exception e){ |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
return new VanChartRefreshTooltipContentPane(parent, showOnPane); |
||||
} |
||||
|
||||
public static FormatPane createAutoFormatPane(){ |
||||
FormatPane formatPane = new FormatPane(){ |
||||
protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { |
||||
typePane.setBorder(BorderFactory.createEmptyBorder()); |
||||
return new Component[][]{ |
||||
new Component[]{typePane,null}, |
||||
new Component[]{centerPane, null}, |
||||
}; |
||||
} |
||||
protected UIComboBoxRenderer createComBoxRender(){ |
||||
return new UIComboBoxRenderer() { |
||||
@Override |
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||
if (value instanceof Integer) { |
||||
String text = ComparatorUtils.equals(value, FormatField.FormatContents.NULL) |
||||
? Inter.getLocText("Plugin-ChartF_Auto") |
||||
: FormatField.getInstance().getName((Integer) value); |
||||
label.setText(" " + text); |
||||
} |
||||
return label; |
||||
} |
||||
}; |
||||
} |
||||
}; |
||||
|
||||
formatPane.setComboBoxModel(true); |
||||
|
||||
return formatPane; |
||||
} |
||||
|
||||
/** |
||||
* 判断是否为大数据模式 |
||||
*/ |
||||
public static boolean largeDataModel(Plot plot){ |
||||
return plot != null && plot.getDataProcessor().getMark() == LargeDataModel.MARK; |
||||
} |
||||
|
||||
public static boolean lineMapLargeModel(Plot plot){ |
||||
return plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getLineMapDataProcessor().getMark() == LargeDataModel.MARK; |
||||
} |
||||
} |
||||
|
@ -1,162 +0,0 @@
|
||||
package com.fr.plugin.chart.designer; |
||||
|
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.foldablepane.UIExpandablePane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
import javax.swing.border.Border; |
||||
import java.awt.Component; |
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* 布局 标题+组件 |
||||
*/ |
||||
public class TableLayout4VanChartHelper { |
||||
|
||||
private static final int SMALL_GAP = 20; |
||||
public static final int EXPANDABLE_PANE_WIDTH =290; |
||||
public static final int EXPANDABLE_PANE_HIGHT =24; |
||||
public static final double DESCRIPTION_AREA_WIDTH =60; |
||||
public static final double EDIT_AREA_WIDTH =155; |
||||
public static final double SECOND_EDIT_AREA_WIDTH =143; |
||||
public static final int COMPONENT_INTERVAL =12; |
||||
public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0,12,0,0); |
||||
|
||||
public static JPanel createExpandablePaneWithTitleTopGap(String title, JPanel panel) { |
||||
return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) { |
||||
protected void setcontentPanelontentPanelBorder() { |
||||
getContentPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 0)); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
public static JPanel createExpandablePaneWithTitle(String title, Component[][] components) { |
||||
JPanel panel = createGapTableLayoutPane(components); |
||||
return createExpandablePaneWithTitle(title, panel); |
||||
} |
||||
|
||||
public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) { |
||||
return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel){ |
||||
protected void setcontentPanelontentPanelBorder (){ |
||||
getContentPanel().setBorder(BorderFactory.createEmptyBorder(0 ,5, 0, 0)); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
public static JPanel createGapTableLayoutPane(String title, Component component) { |
||||
return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH); |
||||
} |
||||
|
||||
public static JPanel createGapTableLayoutPane(String title, Component component, double componentWidth) { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f, componentWidth}; |
||||
double[] rowSize = {p, p}; |
||||
UILabel label = new UILabel(title); |
||||
label.setVerticalAlignment(SwingConstants.TOP); |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{label, component}, |
||||
}; |
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE); |
||||
} |
||||
|
||||
public static JPanel createGapTableLayoutPane(Component[][] components) { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f, EDIT_AREA_WIDTH}; |
||||
double[] rowSize = new double[components.length]; |
||||
Arrays.fill(rowSize, p); |
||||
|
||||
return createGapTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
public static JPanel createGapTableLayoutPane(Component[][] components, |
||||
double[] rowSize, double[] columnSize) { |
||||
|
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE); |
||||
} |
||||
|
||||
public static JPanel createGapTableLayoutPane(Component[][] components, |
||||
double[] rowSize, double[] columnSize, int[][] rowCount) { |
||||
|
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, |
||||
COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE); |
||||
} |
||||
|
||||
/** |
||||
* 标题布局(二级菜单距左边框46) |
||||
* @param title 标题 |
||||
* @param component 组件 |
||||
* @return 布局好的组件 |
||||
*/ |
||||
public static JPanel createTableLayoutPaneWithTitle(String title, Component component){ |
||||
return TableLayout4VanChartHelper.createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN); |
||||
} |
||||
|
||||
/** |
||||
* 标题布局(二级菜单距左边框46) |
||||
* @param label 标题label |
||||
* @param component 组件 |
||||
* @return 布局好的组件 |
||||
*/ |
||||
public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component){ |
||||
return TableLayout4VanChartHelper.createTitlePaneWithUILabel(label, component, LayoutConstants.CHART_ATTR_TOMARGIN); |
||||
} |
||||
|
||||
/** |
||||
* 标题布局(三级菜单距二级左侧20) |
||||
* @param title 标题 |
||||
* @param component 组件 |
||||
* @return 布局好的组件 |
||||
*/ |
||||
public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component){ |
||||
return TableLayout4VanChartHelper.createTitlePane(title, component, TableLayout4VanChartHelper.SMALL_GAP); |
||||
} |
||||
|
||||
/** |
||||
* 标题布局(指定gap) |
||||
* @param title 标题 |
||||
* @param component 组件 |
||||
* @param gap 距左侧距离 |
||||
* @return 布局好的组件 |
||||
*/ |
||||
public static JPanel createTitlePane(String title, Component component, int gap){ |
||||
return createTitlePaneWithUILabel(new UILabel(title), component, gap); |
||||
} |
||||
|
||||
/** |
||||
* 标题布局(指定gap) |
||||
* @param label 标题label |
||||
* @param component 组件 |
||||
* @param gap 距左侧距离 |
||||
* @return 布局好的组件 |
||||
*/ |
||||
public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){ |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {gap, f}; |
||||
double[] rowSize = {p, p}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{label,null}, |
||||
new Component[]{null,component}, |
||||
}; |
||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
public static JPanel createTableLayoutPane(Component[][] components) { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {p, f}; |
||||
double[] rowSize = new double[components.length]; |
||||
Arrays.fill(rowSize, p); |
||||
|
||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
} |
@ -1,45 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
||||
import com.fr.general.FRLogger; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.util.HashMap; |
||||
|
||||
/** |
||||
* Created by hufan on 2016/11/15. |
||||
*/ |
||||
public class ChartUIMenuNameableCreator extends UIMenuNameableCreator { |
||||
private HashMap hyperLinkEditorMap; |
||||
|
||||
public ChartUIMenuNameableCreator(HashMap hyperLinkEditorMap, String name, Object obj, Class<? extends BasicBeanPane> paneClazz) { |
||||
super(name, obj, paneClazz); |
||||
this.hyperLinkEditorMap = hyperLinkEditorMap; |
||||
} |
||||
|
||||
public UIMenuNameableCreator clone() { |
||||
Object cloneObj = null; |
||||
try { |
||||
cloneObj = obj.getClass().newInstance(); |
||||
} catch (InstantiationException e) { |
||||
FRLogger.getLogger().error("UIMenuNameableCreator InstantiationException"); |
||||
} catch (IllegalAccessException e) { |
||||
FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException"); |
||||
} |
||||
return new ChartUIMenuNameableCreator(hyperLinkEditorMap, name, cloneObj, (Class<? extends BasicBeanPane>) this.paneClazz); |
||||
|
||||
} |
||||
|
||||
public BasicBeanPane getPane() { |
||||
try { |
||||
if (hyperLinkEditorMap != null) { |
||||
Constructor<? extends BasicBeanPane> constructor = paneClazz.getConstructor(HashMap.class, boolean.class); |
||||
return constructor.newInstance(hyperLinkEditorMap, true); |
||||
} |
||||
} catch (Exception e) { |
||||
return super.getPane(); |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -1,73 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.VanChartAttrHelper; |
||||
import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground; |
||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||
import com.fr.plugin.chart.designer.component.background.VanChartMarkerBackgroundPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* 面积图填充色设置界面 |
||||
*/ |
||||
public class VanChartAreaSeriesFillColorPane extends BasicPane { |
||||
private static final long serialVersionUID = 9166866984438854779L; |
||||
private VanChartMarkerBackgroundPane fillColorPane; |
||||
private UINumberDragPane transparent; |
||||
|
||||
public VanChartAreaSeriesFillColorPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] row = {p,p}; |
||||
double[] col = {f}; |
||||
fillColorPane = new VanChartMarkerBackgroundPane(){ |
||||
protected Component[][] getPaneComponents() { |
||||
return new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_FillColor")), typeComboBox}, |
||||
new Component[]{null, centerPane}, |
||||
}; |
||||
} |
||||
}; |
||||
transparent = new UINumberDragPane(0, 100); |
||||
|
||||
JPanel transparentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-Chart_Alpha"), transparent); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(fillColorPane, BorderLayout.NORTH); |
||||
this.add(transparentPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
protected String title4PopupWindow(){ |
||||
return Inter.getLocText("Plugin-ChartF_FillColor"); |
||||
} |
||||
|
||||
public void populate(AttrAreaSeriesFillColorBackground fillColorBackground) { |
||||
if(fillColorBackground == null){ |
||||
fillColorBackground = new AttrAreaSeriesFillColorBackground(); |
||||
} |
||||
fillColorPane.populate(fillColorBackground.getColorBackground()); |
||||
transparent.populateBean(fillColorBackground.getAlpha() * VanChartAttrHelper.PERCENT); |
||||
} |
||||
|
||||
public AttrAreaSeriesFillColorBackground update() { |
||||
AttrAreaSeriesFillColorBackground fillColorBackground = new AttrAreaSeriesFillColorBackground(); |
||||
fillColorBackground.setColorBackground(fillColorPane.update()); |
||||
fillColorBackground.setAlpha(transparent.updateBean()/VanChartAttrHelper.PERCENT); |
||||
return fillColorBackground; |
||||
} |
||||
|
||||
/** |
||||
* 检查透明的设置是否有效 |
||||
* @param enable |
||||
*/ |
||||
public void checkoutAlpha(boolean enable) { |
||||
transparent.setEnabled(enable); |
||||
} |
||||
} |
@ -1,70 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by Mitisky on 15/9/8. |
||||
*/ |
||||
//系列-风格
|
||||
public class VanChartBeautyPane extends BasicBeanPane<Integer> { |
||||
private UIButtonGroup styleBox; |
||||
|
||||
public VanChartBeautyPane() { |
||||
styleBox = new UIButtonGroup(getNameArray()); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||
double[] columnSize = {f, e}; |
||||
double[] rowSize = {p}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("Plugin-Chart_Style")), styleBox}, |
||||
} ; |
||||
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(panel,BorderLayout.CENTER); |
||||
} |
||||
|
||||
protected String[] getNameArray(){ |
||||
return new String[]{Inter.getLocText("Chart-Default_Name"), |
||||
Inter.getLocText("Plugin-Chart_TopDownShade") |
||||
}; |
||||
} |
||||
@Override |
||||
public void populateBean(Integer ob) { |
||||
int finalIndex; |
||||
switch (ob){ |
||||
case ChartConstants.STYLE_NONE: finalIndex = 0; break; |
||||
case ChartConstants.STYLE_SHADE: finalIndex = 1; break; |
||||
default: finalIndex = 0; |
||||
} |
||||
styleBox.setSelectedIndex(finalIndex); |
||||
} |
||||
|
||||
@Override |
||||
public Integer updateBean() { |
||||
int index = styleBox.getSelectedIndex(); |
||||
int style; |
||||
switch (index){ |
||||
case 0: style = ChartConstants.STYLE_NONE; break; |
||||
case 1: style = ChartConstants.STYLE_SHADE; break; |
||||
default: style = ChartConstants.STYLE_NONE; |
||||
} |
||||
return style; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return ""; |
||||
} |
||||
|
||||
} |
@ -1,40 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/17. |
||||
*/ |
||||
public class VanChartFillStylePane extends ChartFillStylePane { |
||||
|
||||
@Override |
||||
protected JPanel getContentPane () { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||
double[] columnSize = {f, e}; |
||||
double[] rowSize = {p, p}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("ColorMatch")),styleSelectBox}, |
||||
new Component[]{null,customPane}, |
||||
|
||||
}; |
||||
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5,5,0,0)); |
||||
return panel; |
||||
} |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if(styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { |
||||
return new Dimension(styleSelectBox.getPreferredSize().width, 30); |
||||
} |
||||
return super.getPreferredSize(); |
||||
} |
||||
} |
@ -1,41 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* 配色 只有下拉框控件无配色title。 条件属性 配色中用到 |
||||
*/ |
||||
public class VanChartFillStylePane4Condition extends ChartFillStylePane { |
||||
private static final long serialVersionUID = 2470094484790112401L; |
||||
|
||||
@Override |
||||
protected void initLayout() { |
||||
customPane.setPreferredSize(new Dimension(200, 130)); |
||||
colorGradient.setPreferredSize(new Dimension(120, 30)); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = { f }; |
||||
double[] rowSize = { p, p}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{styleSelectBox}, |
||||
new Component[]{customPane} |
||||
} ; |
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(panel,BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if(styleSelectBox.getSelectedIndex() != styleSelectBox.getItemCount() - 1) { |
||||
return new Dimension(styleSelectBox.getPreferredSize().width, 20); |
||||
} |
||||
return super.getPreferredSize(); |
||||
} |
||||
} |
@ -1,81 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* 悬浮位置 标题和图例用到 |
||||
*/ |
||||
public class VanChartFloatPositionPane extends BasicBeanPane<Chart> { |
||||
private static final long serialVersionUID = -4773313488161065678L; |
||||
private UISpinner floatPosition_x; |
||||
private UISpinner floatPosition_y; |
||||
|
||||
public VanChartFloatPositionPane(){ |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
this.add(new UILabel(Inter.getLocText("plugin-ChartF_XYFromTheUpLeft")), BorderLayout.CENTER); |
||||
|
||||
this.add(createCustomFloatPositionPane(), BorderLayout.SOUTH); |
||||
} |
||||
|
||||
private JPanel createCustomFloatPositionPane(){ |
||||
floatPosition_x = new UISpinner(0,100,1,0); |
||||
floatPosition_y = new UISpinner(0,100,1,0); |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {p, f}; |
||||
double[] rowSize = {p,p}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_positionX")+": "),floatPosition_x}, |
||||
new Component[]{new UILabel(Inter.getLocText("plugin-ChartF_positionY")+": "),floatPosition_y} |
||||
}; |
||||
|
||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
public void setFloatPosition_x(double floatPosition_x) { |
||||
this.floatPosition_x.setValue(floatPosition_x); |
||||
} |
||||
|
||||
public void setFloatPosition_y(double floatPosition_y) { |
||||
this.floatPosition_y.setValue(floatPosition_y); |
||||
} |
||||
|
||||
public double getFloatPosition_x() { |
||||
return floatPosition_x.getValue(); |
||||
} |
||||
|
||||
public double getFloatPosition_y() { |
||||
return floatPosition_y.getValue(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 弹出框标题 |
||||
* @return 标题 |
||||
*/ |
||||
public String title4PopupWindow() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public Chart updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Chart ob) { |
||||
|
||||
} |
||||
} |
@ -1,199 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.constants.KeyWords; |
||||
import com.fr.design.gui.autocomplete.AutoCompletion; |
||||
import com.fr.design.gui.autocomplete.BasicCompletion; |
||||
import com.fr.design.gui.autocomplete.DefaultCompletionProvider; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; |
||||
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.base.VanChartHtmlLabel; |
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.DocumentEvent; |
||||
import javax.swing.event.DocumentListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/2/19. |
||||
*/ |
||||
public class VanChartHtmlLabelPane extends JPanel{ |
||||
|
||||
private static final long serialVersionUID = -5512128966013558611L; |
||||
private static final int JS_HEIGHT = 100; |
||||
|
||||
private RSyntaxTextArea contentTextArea; |
||||
private UIToggleButton useHtml; |
||||
|
||||
private UICheckBox isCustomWidth; |
||||
private UITextField customWidth; |
||||
private UICheckBox isCustomHeight; |
||||
private UITextField customHeight; |
||||
|
||||
private VanChartStylePane parent; |
||||
|
||||
public void setCustomFormatterText(String text){ |
||||
contentTextArea.setText(text); |
||||
} |
||||
|
||||
public void setParent(VanChartStylePane parent) { |
||||
this.parent = parent; |
||||
} |
||||
|
||||
public VanChartHtmlLabelPane() { |
||||
useHtml = new UIToggleButton(Inter.getLocText("Plugin-ChartF_Html")); |
||||
JPanel widthAndHeightPane = createWidthAndHeightPane(); |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{createJSContentPane()}, |
||||
new Component[]{useHtml}, |
||||
new Component[]{widthAndHeightPane} |
||||
}; |
||||
|
||||
JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(contentPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private JComponent createJSContentPane() { |
||||
contentTextArea = new RSyntaxTextArea(); |
||||
contentTextArea.setCloseCurlyBraces(true); |
||||
contentTextArea.setLineWrap(true); |
||||
contentTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT); |
||||
contentTextArea.setCodeFoldingEnabled(true); |
||||
contentTextArea.setAntiAliasingEnabled(true); |
||||
contentTextArea.getDocument().addDocumentListener(new DocumentListener() { |
||||
@Override |
||||
public void insertUpdate(DocumentEvent e) { |
||||
fireJSChange(); |
||||
} |
||||
|
||||
@Override |
||||
public void removeUpdate(DocumentEvent e) { |
||||
fireJSChange(); |
||||
} |
||||
|
||||
@Override |
||||
public void changedUpdate(DocumentEvent e) { |
||||
fireJSChange(); |
||||
} |
||||
}); |
||||
|
||||
DefaultCompletionProvider provider = new DefaultCompletionProvider(); |
||||
|
||||
for (String key : KeyWords.JAVASCRIPT) { |
||||
provider.addCompletion(new BasicCompletion(provider, key)); |
||||
} |
||||
|
||||
AutoCompletion ac = new AutoCompletion(provider); |
||||
String shortCuts = DesignerEnvManager.getEnvManager().getAutoCompleteShortcuts(); |
||||
|
||||
ac.setTriggerKey(KeyStroke.getKeyStroke(shortCuts.replace("+", "pressed"))); |
||||
ac.install(contentTextArea); |
||||
|
||||
return new UIScrollPane(contentTextArea){ |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
return new Dimension(super.getPreferredSize().width, JS_HEIGHT); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
private void fireJSChange() { |
||||
if(parent != null){ |
||||
parent.attributeChanged(); |
||||
} |
||||
} |
||||
|
||||
protected JPanel createWidthAndHeightPane() { |
||||
isCustomWidth = new UICheckBox(Inter.getLocText("Plugin-ChartF_Custom_Width")); |
||||
customWidth = new UITextField(6); |
||||
isCustomHeight = new UICheckBox(Inter.getLocText("Plugin-ChartF_Custom_Height")); |
||||
customHeight = new UITextField(6); |
||||
|
||||
isCustomWidth.addActionListener(new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkWidth(); |
||||
} |
||||
}); |
||||
isCustomHeight.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkHeight(); |
||||
} |
||||
}); |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = { p, f }; |
||||
double[] rowSize = { p, p}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{isCustomWidth, customWidth}, |
||||
new Component[]{isCustomHeight, customHeight}, |
||||
}; |
||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
private void checkWidth() { |
||||
customWidth.setEnabled(isCustomWidth.isSelected()); |
||||
} |
||||
|
||||
private void checkHeight() { |
||||
customHeight.setEnabled(isCustomHeight.isSelected()); |
||||
} |
||||
|
||||
private void checkBoxUse() { |
||||
checkHeight(); |
||||
checkWidth(); |
||||
} |
||||
|
||||
public void populate(VanChartHtmlLabel htmlLabel){ |
||||
if(htmlLabel == null){ |
||||
return; |
||||
} |
||||
setCustomFormatterText(htmlLabel.getCustomText()); |
||||
useHtml.setSelected(htmlLabel.isUseHtml()); |
||||
populateWidthAndHeight(htmlLabel); |
||||
} |
||||
|
||||
protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) { |
||||
isCustomWidth.setSelected(htmlLabel.isCustomWidth()); |
||||
customWidth.setText(htmlLabel.getWidth()); |
||||
isCustomHeight.setSelected(htmlLabel.isCustomHeight()); |
||||
customHeight.setText(htmlLabel.getHeight()); |
||||
checkBoxUse(); |
||||
} |
||||
|
||||
public void update(VanChartHtmlLabel htmlLabel) { |
||||
if(htmlLabel == null){ |
||||
return; |
||||
} |
||||
htmlLabel.setCustomText(contentTextArea.getText()); |
||||
htmlLabel.setUseHtml(useHtml.isSelected()); |
||||
updateWidthAndHeight(htmlLabel); |
||||
} |
||||
|
||||
protected void updateWidthAndHeight(VanChartHtmlLabel htmlLabel) { |
||||
htmlLabel.setCustomWidth(isCustomWidth.isSelected()); |
||||
htmlLabel.setWidth(customWidth.getText()); |
||||
htmlLabel.setCustomHeight(isCustomHeight.isSelected()); |
||||
htmlLabel.setHeight(customHeight.getText()); |
||||
} |
||||
} |
@ -1,23 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.plugin.chart.base.VanChartHtmlLabel; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/2/19. |
||||
* 不能设置宽高 |
||||
*/ |
||||
public class VanChartHtmlLabelPaneWithOutWidthAndHeight extends VanChartHtmlLabelPane { |
||||
private static final long serialVersionUID = -9213286452724939880L; |
||||
|
||||
protected JPanel createWidthAndHeightPane() { |
||||
return new JPanel(); |
||||
} |
||||
|
||||
protected void populateWidthAndHeight(VanChartHtmlLabel htmlLabel) { |
||||
} |
||||
protected void updateWidthAndHeight(VanChartHtmlLabel htmlLabel) { |
||||
} |
||||
|
||||
} |
@ -1,18 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.component; |
||||
|
||||
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
public class VanChartLabelContentPane extends VanChartTooltipContentPane { |
||||
|
||||
private static final long serialVersionUID = 5630276526789839288L; |
||||
|
||||
public VanChartLabelContentPane(VanChartStylePane parent, JPanel showOnPane) { |
||||
super(parent, showOnPane); |
||||
} |
||||
|
||||
protected VanChartHtmlLabelPane createHtmlLabelPane() { |
||||
return new VanChartHtmlLabelPane(); |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue