* commit 'b2e1f08dc093b0ddb5e23960185cd615be17ba62': (54 commits) REPORT-4115 参数面板各控件属性面板添加标签属性 NumberDragBar labelString 9.0界面修改 代码规范 update 拼错 build failed REPORT-3457 有几个报错没截取到日志. REPORT-2354 不从后台自动登录,切换环境进行登录 PMD 处理超链和条件显示的todo,修改警戒线和间隔背景 根据交互要求,增加缩放条输入框条件限制0-400的数字 REPORT-3815 [9.0一轮回归]单元格属性样式缩进等输入数字每次只能输入一位 REPORT-4025 [9.0一轮回归]其他属性分页中默认勾选项无法取消勾线 REPORT-4022 [9.0一轮回归]选中一片单元格时对齐方式设置异常如附件图片 根据交互要求,增加缩放条输入框条件限制0-400的数字 pmd pmd pmd rt tmp 图标 update ...master
After Width: | Height: | Size: 14 KiB |
@ -1,47 +0,0 @@
|
||||
package com.fr.design.gui.itextfield; |
||||
|
||||
import java.awt.event.FocusEvent; |
||||
import java.awt.event.FocusListener; |
||||
import javax.swing.text.Document; |
||||
|
||||
|
||||
/** |
||||
* Created by ibm on 2017/8/16. |
||||
*/ |
||||
public class UIPropertyTextField extends UITextField{ |
||||
|
||||
public UIPropertyTextField() { |
||||
super(); |
||||
} |
||||
|
||||
public UIPropertyTextField(int columns) { |
||||
super(columns); |
||||
} |
||||
|
||||
public UIPropertyTextField(String text, int columns) { |
||||
super(text, columns); |
||||
} |
||||
|
||||
public UIPropertyTextField(String text) { |
||||
super(text); |
||||
} |
||||
|
||||
public UIPropertyTextField(Document doc, String text, int columns) { |
||||
super(doc, text, columns); |
||||
} |
||||
|
||||
protected void initListener() { |
||||
if (shouldResponseChangeListener()) { |
||||
addFocusListener(new FocusListener() { |
||||
@Override |
||||
public void focusGained(FocusEvent e) { |
||||
} |
||||
|
||||
@Override |
||||
public void focusLost(FocusEvent e) { |
||||
attributeChange(); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
} |
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 942 B |
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 214 B |
@ -0,0 +1,231 @@
|
||||
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(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; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
|
After Width: | Height: | Size: 105 KiB |
@ -1,84 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.other; |
||||
|
||||
import com.fr.base.chart.BasePlot; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartglyph.ConditionAttr; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||
import com.fr.design.gui.ilist.ListModelElement; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.plugin.chart.designer.component.ConditionUIMenuNameableCreator; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/18. |
||||
*/ |
||||
public class ChartConditionNameObjectCreator extends NameObjectCreator { |
||||
private BasePlot plot; |
||||
private ConditionUIMenuNameableCreator conditionUIMenuNameableCreator; |
||||
|
||||
public ChartConditionNameObjectCreator(BasePlot plot, String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
||||
super(menuName, clazz, updatePane); |
||||
this.plot = plot; |
||||
} |
||||
|
||||
/** |
||||
* create Nameable |
||||
* |
||||
* @param helper |
||||
* @return |
||||
*/ |
||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||
Constructor<? extends ConditionUIMenuNameableCreator> constructor = null; |
||||
try { |
||||
constructor = clazzOfInitCase.getConstructor(Plot.class, String.class, Object.class, Class.class); |
||||
ConditionUIMenuNameableCreator conditionUIMenuNameableCreator = constructor.newInstance(plot, Inter.getLocText("Chart-Condition_Attributes"), new ConditionAttr(), getUpdatePane()); |
||||
return new NameObject(helper.createUnrepeatedName(this.menuName()), conditionUIMenuNameableCreator); |
||||
|
||||
} catch (NoSuchMethodException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (InstantiationException e) { |
||||
e.printStackTrace(); |
||||
} catch (InvocationTargetException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* @param ob |
||||
* @return |
||||
*/ |
||||
public Object acceptObject2Populate(Object ob) { |
||||
if (ob instanceof NameObject) { |
||||
ob = ((NameObject) ob).getObject(); |
||||
} |
||||
if (clazzOfObject != null && clazzOfObject.isInstance(ob)) { |
||||
doSthChanged4Icon(ob); |
||||
conditionUIMenuNameableCreator = (ConditionUIMenuNameableCreator) ((ConditionUIMenuNameableCreator) ob).clone(); |
||||
return ob; |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* save update bean |
||||
* |
||||
* @param wrapper |
||||
* @param bean |
||||
*/ |
||||
public void saveUpdatedBean(ListModelElement wrapper, Object bean) { |
||||
conditionUIMenuNameableCreator.setObj(bean); |
||||
((NameObject) wrapper.wrapper).setObject(conditionUIMenuNameableCreator); |
||||
} |
||||
|
||||
|
||||
} |
@ -1,84 +0,0 @@
|
||||
package com.fr.plugin.chart.designer.other; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||
import com.fr.design.gui.ilist.ListModelElement; |
||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/21. |
||||
*/ |
||||
public class ChartHyperlinkNameObjectCreartor extends NameObjectCreator { |
||||
private Object object; |
||||
private UIMenuNameableCreator uIMenuNameableCreator; |
||||
|
||||
|
||||
public ChartHyperlinkNameObjectCreartor(Object object, String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
||||
super(menuName, clazz, updatePane); |
||||
this.object = object; |
||||
|
||||
} |
||||
|
||||
/** |
||||
* create Nameable |
||||
* |
||||
* @param helper |
||||
* @return |
||||
*/ |
||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||
Constructor<? extends UIMenuNameableCreator> constructor = null; |
||||
try { |
||||
constructor = clazzOfInitCase.getConstructor(String.class, Object.class, Class.class); |
||||
UIMenuNameableCreator uIMenuNameableCreator = constructor.newInstance(menuName, object, getUpdatePane()); |
||||
return new NameObject(helper.createUnrepeatedName(this.menuName()), uIMenuNameableCreator); |
||||
|
||||
} catch (NoSuchMethodException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} catch (InstantiationException e) { |
||||
e.printStackTrace(); |
||||
} catch (InvocationTargetException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* @param ob |
||||
* @return |
||||
*/ |
||||
public Object acceptObject2Populate(Object ob) { |
||||
if (ob instanceof NameObject) { |
||||
ob = ((NameObject) ob).getObject(); |
||||
} |
||||
if (clazzOfObject != null && clazzOfObject.isInstance(ob)) { |
||||
doSthChanged4Icon(ob); |
||||
uIMenuNameableCreator = ((UIMenuNameableCreator) ob).clone(); |
||||
if (uIMenuNameableCreator.getObj() != null && object.getClass().isInstance(uIMenuNameableCreator.getObj())) { |
||||
return ob; |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* save update bean |
||||
* |
||||
* @param wrapper |
||||
* @param bean |
||||
*/ |
||||
public void saveUpdatedBean(ListModelElement wrapper, Object bean) { |
||||
uIMenuNameableCreator.setObj(bean); |
||||
((NameObject) wrapper.wrapper).setObject(uIMenuNameableCreator); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,116 @@
|
||||
package com.fr.plugin.chart.designer.style.background; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.controlpane.UIListControlPane; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.plugin.chart.attr.DefaultAxisHelper; |
||||
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; |
||||
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/22. |
||||
*/ |
||||
public class AlertLineListControlPane extends UIListControlPane { |
||||
|
||||
|
||||
@Override |
||||
public void saveSettings() { |
||||
if (isPopulating) { |
||||
return; |
||||
} |
||||
update((VanChartPlot) plot); |
||||
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
return new ChartNameObjectCreator[]{new ChartNameObjectCreator(new String[]{Inter.getLocText("ChartF-X_Axis"), Inter.getLocText("ChartF-Y_Axis")}, |
||||
Inter.getLocText("Plugin-ChartF_AlertLine"), VanChartAlertValue.class, VanChartAlertValuePane.class)}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_AlertLine"); |
||||
} |
||||
|
||||
protected String getAddItemText() { |
||||
return Inter.getLocText("Plugin-ChartF_AlertLine"); |
||||
} |
||||
|
||||
public void populate(Plot plot) { |
||||
this.plot = plot; |
||||
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; |
||||
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList(); |
||||
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList(); |
||||
String[] axisNames = DefaultAxisHelper.getAllAxisNames(xAxisList, yAxisList); |
||||
|
||||
ChartNameObjectCreator[] creators = {new ChartNameObjectCreator(axisNames, Inter.getLocText("Plugin-ChartF_AlertLine"), VanChartAlertValue.class, VanChartAlertValuePane.class)}; |
||||
|
||||
refreshNameableCreator(creators); |
||||
|
||||
java.util.List<NameObject> nameObjects = new ArrayList<NameObject>(); |
||||
|
||||
for (VanChartAxis axis : xAxisList) { |
||||
List<VanChartAlertValue> values = axis.getAlertValues(); |
||||
for (VanChartAlertValue alertValue : values) { |
||||
alertValue.setAxisNamesArray(axisNames); |
||||
alertValue.setAxisName(axis.getAxisName()); |
||||
nameObjects.add(new NameObject(alertValue.getAlertPaneSelectName(), alertValue)); |
||||
} |
||||
} |
||||
|
||||
for (VanChartAxis axis : yAxisList) { |
||||
List<VanChartAlertValue> values = axis.getAlertValues(); |
||||
for (VanChartAlertValue alertValue : values) { |
||||
alertValue.setAxisNamesArray(axisNames); |
||||
alertValue.setAxisName(axis.getAxisName()); |
||||
nameObjects.add(new NameObject(alertValue.getAlertPaneSelectName(), alertValue)); |
||||
} |
||||
} |
||||
|
||||
populate(nameObjects.toArray(new NameObject[nameObjects.size()])); |
||||
doLayout(); |
||||
} |
||||
|
||||
public void update(Plot plot) { |
||||
|
||||
Nameable[] nameables = this.update(); |
||||
|
||||
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; |
||||
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList(); |
||||
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList(); |
||||
|
||||
for (VanChartAxis axis : xAxisList) { |
||||
List<VanChartAlertValue> axisAlerts = new ArrayList<VanChartAlertValue>(); |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
VanChartAlertValue value = (VanChartAlertValue) ((NameObject) nameables[i]).getObject(); |
||||
if (ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())) { |
||||
value.setAlertPaneSelectName(nameables[i].getName()); |
||||
axisAlerts.add(value); |
||||
} |
||||
} |
||||
axis.setAlertValues(axisAlerts); |
||||
} |
||||
for (VanChartAxis axis : yAxisList) { |
||||
List<VanChartAlertValue> axisAlerts = new ArrayList<VanChartAlertValue>(); |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
VanChartAlertValue value = (VanChartAlertValue) ((NameObject) nameables[i]).getObject(); |
||||
if (ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())) { |
||||
value.setAlertPaneSelectName(nameables[i].getName()); |
||||
axisAlerts.add(value); |
||||
} |
||||
} |
||||
axis.setAlertValues(axisAlerts); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,121 @@
|
||||
package com.fr.plugin.chart.designer.style.background; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.controlpane.UIListControlPane; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.plugin.chart.attr.DefaultAxisHelper; |
||||
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; |
||||
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; |
||||
import com.fr.plugin.chart.base.VanChartCustomIntervalBackground; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/22. |
||||
*/ |
||||
public class BackgroundListControlPane extends UIListControlPane { |
||||
|
||||
@Override |
||||
public void saveSettings() { |
||||
if (isPopulating) { |
||||
return; |
||||
} |
||||
update((VanChartPlot) plot, false); |
||||
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
return new BackgroundNameObjectCreator[]{new BackgroundNameObjectCreator(new String[]{Inter.getLocText("ChartF-X_Axis"), Inter.getLocText("ChartF-Y_Axis")}, |
||||
Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"), VanChartAlertValue.class, VanChartAlertValuePane.class)}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"); |
||||
} |
||||
|
||||
@Override |
||||
public String getAddItemText() { |
||||
return Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"); |
||||
} |
||||
|
||||
public void populate(Plot plot) { |
||||
this.plot = plot; |
||||
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; |
||||
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList(); |
||||
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList(); |
||||
String[] axisNames = DefaultAxisHelper.getAllAxisNames(xAxisList, yAxisList); |
||||
|
||||
BackgroundNameObjectCreator[] creators = {new BackgroundNameObjectCreator(axisNames, Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"), VanChartCustomIntervalBackground.class, VanChartCustomIntervalBackgroundPane.class)}; |
||||
|
||||
refreshNameableCreator(creators); |
||||
|
||||
java.util.List<NameObject> nameObjects = new ArrayList<NameObject>(); |
||||
|
||||
|
||||
for (VanChartAxis axis : xAxisList) { |
||||
List<VanChartCustomIntervalBackground> customIntervalBackgrounds = axis.getCustomIntervalBackgroundArray(); |
||||
for (VanChartCustomIntervalBackground background : customIntervalBackgrounds) { |
||||
background.setAxisNamesArray(axisNames); |
||||
background.setAxisName(axis.getAxisName()); |
||||
nameObjects.add(new NameObject(background.getCustomIntervalBackgroundSelectName(), background)); |
||||
} |
||||
|
||||
} |
||||
for (VanChartAxis axis : yAxisList) { |
||||
List<VanChartCustomIntervalBackground> customIntervalBackgrounds = axis.getCustomIntervalBackgroundArray(); |
||||
for (VanChartCustomIntervalBackground background : customIntervalBackgrounds) { |
||||
background.setAxisNamesArray(axisNames); |
||||
background.setAxisName(axis.getAxisName()); |
||||
nameObjects.add(new NameObject(background.getCustomIntervalBackgroundSelectName(), background)); |
||||
} |
||||
} |
||||
populate(nameObjects.toArray(new NameObject[nameObjects.size()])); |
||||
doLayout(); |
||||
} |
||||
|
||||
public void update(Plot plot, boolean isDefaultIntervalBackground) { |
||||
|
||||
Nameable[] nameables = this.update(); |
||||
|
||||
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; |
||||
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList(); |
||||
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList(); |
||||
|
||||
for (VanChartAxis axis : xAxisList) { |
||||
List<VanChartCustomIntervalBackground> axisCustomBackground = new ArrayList<VanChartCustomIntervalBackground>(); |
||||
if (!isDefaultIntervalBackground) { |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
VanChartCustomIntervalBackground value = (VanChartCustomIntervalBackground) ((NameObject) nameables[i]).getObject(); |
||||
if (ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())) { |
||||
value.setCustomIntervalBackgroundSelectName(nameables[i].getName()); |
||||
axisCustomBackground.add(value); |
||||
} |
||||
} |
||||
} |
||||
axis.setCustomIntervalBackgroundArray(axisCustomBackground); |
||||
} |
||||
for (VanChartAxis axis : yAxisList) { |
||||
List<VanChartCustomIntervalBackground> axisCustomBackground = new ArrayList<VanChartCustomIntervalBackground>(); |
||||
if (!isDefaultIntervalBackground) { |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
VanChartCustomIntervalBackground value = (VanChartCustomIntervalBackground) ((NameObject) nameables[i]).getObject(); |
||||
if (ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())) { |
||||
value.setCustomIntervalBackgroundSelectName(nameables[i].getName()); |
||||
axisCustomBackground.add(value); |
||||
} |
||||
} |
||||
} |
||||
axis.setCustomIntervalBackgroundArray(axisCustomBackground); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fr.plugin.chart.designer.style.background; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.plugin.chart.base.VanChartCustomIntervalBackground; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/23. |
||||
*/ |
||||
public class BackgroundNameObjectCreator extends ChartNameObjectCreator { |
||||
public BackgroundNameObjectCreator(Object object, String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
||||
super(object, menuName, clazz, updatePane); |
||||
} |
||||
|
||||
/** |
||||
* create Nameable |
||||
* |
||||
* @param helper |
||||
* @return |
||||
*/ |
||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||
Constructor<? extends VanChartCustomIntervalBackground> constructor = null; |
||||
try { |
||||
constructor = clazzOfInitCase.getConstructor(); |
||||
VanChartCustomIntervalBackground vanChartCustomIntervalBackground = constructor.newInstance(); |
||||
vanChartCustomIntervalBackground.setAxisNamesArray((String[]) object); |
||||
vanChartCustomIntervalBackground.setAxisName(((String[]) object)[0]); |
||||
return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartCustomIntervalBackground); |
||||
|
||||
} catch (NoSuchMethodException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} catch (IllegalAccessException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} catch (InstantiationException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} catch (InvocationTargetException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,53 @@
|
||||
package com.fr.plugin.chart.designer.style.background; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/8/21. |
||||
*/ |
||||
public class ChartNameObjectCreator extends NameObjectCreator { |
||||
protected Object object; |
||||
|
||||
|
||||
public ChartNameObjectCreator(Object object, String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
||||
super(menuName, clazz, updatePane); |
||||
this.object = object; |
||||
|
||||
} |
||||
|
||||
/** |
||||
* create Nameable |
||||
* |
||||
* @param helper |
||||
* @return |
||||
*/ |
||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||
Constructor<? extends VanChartAlertValue> constructor = null; |
||||
try { |
||||
constructor = clazzOfInitCase.getConstructor(); |
||||
VanChartAlertValue vanChartAlertValue = constructor.newInstance(); |
||||
vanChartAlertValue.setAxisNamesArray((String[]) object); |
||||
vanChartAlertValue.setAxisName(((String[]) object)[0]); |
||||
return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartAlertValue); |
||||
|
||||
} catch (NoSuchMethodException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} catch (IllegalAccessException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} catch (InstantiationException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} catch (InvocationTargetException e) { |
||||
FRLogger.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return null; |
||||
} |
||||
} |