Browse Source

处理超链和条件显示的todo,修改警戒线和间隔背景

master
mengao 7 years ago
parent
commit
21c24a4c6e
  1. 23
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java
  2. 84
      designer_chart/src/com/fr/plugin/chart/designer/other/ChartConditionNameObjectCreator.java
  3. 84
      designer_chart/src/com/fr/plugin/chart/designer/other/ChartHyperlinkNameObjectCreartor.java
  4. 12
      designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrContentPane.java
  5. 12
      designer_chart/src/com/fr/plugin/chart/designer/other/VanChartListControlPane.java
  6. 116
      designer_chart/src/com/fr/plugin/chart/designer/style/background/AlertLineListControlPane.java
  7. 121
      designer_chart/src/com/fr/plugin/chart/designer/style/background/BackgroundListControlPane.java
  8. 47
      designer_chart/src/com/fr/plugin/chart/designer/style/background/BackgroundNameObjectCreator.java
  9. 52
      designer_chart/src/com/fr/plugin/chart/designer/style/background/ChartNameObjectCreator.java
  10. 12
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAlertValuePane.java
  11. 182
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAxisAreaPane.java
  12. 13
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java

23
designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java

@ -9,6 +9,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.javascript.ChartEmailPane; import com.fr.design.chart.javascript.ChartEmailPane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.fun.HyperlinkProvider; import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.imenutable.UIMenuNameableCreator;
@ -25,7 +26,6 @@ import com.fr.js.ParameterJavaScript;
import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink; import com.fr.js.WebHyperlink;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.designer.other.ChartHyperlinkNameObjectCreartor;
import com.fr.plugin.chart.designer.other.HyperlinkMapFactory; import com.fr.plugin.chart.designer.other.HyperlinkMapFactory;
import com.fr.stable.ListMap; import com.fr.stable.ListMap;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
@ -89,7 +89,6 @@ public class VanChartHyperLinkPane extends UIListControlPane {
} }
public void populate(TargetComponent elementCasePane) { public void populate(TargetComponent elementCasePane) {
// hyperlinkGroupPaneActionProvider.populate(this, elementCasePane);
} }
/** /**
@ -128,12 +127,11 @@ public class VanChartHyperLinkPane extends UIListControlPane {
// paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); // paneMap.put(nc.getHyperlink(), nc.getUpdatePane());
} }
//todo@mengao 去掉UIMenuNameableCreator
java.util.List<UIMenuNameableCreator> list = refreshList(paneMap); java.util.List<UIMenuNameableCreator> list = refreshList(paneMap);
ChartHyperlinkNameObjectCreartor[] creators= new ChartHyperlinkNameObjectCreartor[list.size()]; NameObjectCreator[] creators= new NameObjectCreator[list.size()];
for(int i = 0; list != null && i < list.size(); i++) { for(int i = 0; list != null && i < list.size(); i++) {
UIMenuNameableCreator uiMenuNameableCreator = list.get(i); UIMenuNameableCreator uiMenuNameableCreator = list.get(i);
creators[i] = new ChartHyperlinkNameObjectCreartor(uiMenuNameableCreator.getObj(),uiMenuNameableCreator.getName(), uiMenuNameableCreator.getClass(), uiMenuNameableCreator.getPaneClazz()); creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz());
} }
@ -147,7 +145,7 @@ public class VanChartHyperLinkPane extends UIListControlPane {
if(javaScript != null && javaScript.getJavaScript() != null) { if(javaScript != null && javaScript.getJavaScript() != null) {
JavaScript script = javaScript.getJavaScript(); JavaScript script = javaScript.getJavaScript();
UIMenuNameableCreator uiMenuNameableCreator= new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass())); UIMenuNameableCreator uiMenuNameableCreator= new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass()));
nameObjects.add(new NameObject(uiMenuNameableCreator.getName(), uiMenuNameableCreator)); nameObjects.add(new NameObject(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj()));
} }
} }
@ -182,9 +180,9 @@ public class VanChartHyperLinkPane extends UIListControlPane {
nameGroup.clear(); nameGroup.clear();
for(int i = 0; i < nameables.length; i++) { for(int i = 0; i < nameables.length; i++) {
UIMenuNameableCreator menu = (UIMenuNameableCreator)((NameObject)nameables[i]).getObject(); JavaScript javaScript = (JavaScript)((NameObject)nameables[i]).getObject();
NameJavaScript nameJava = new NameJavaScript(menu.getName(), (JavaScript)menu.getObj()); String name = nameables[i].getName();
nameJava.setName(nameables[i].getName()); NameJavaScript nameJava = new NameJavaScript(name,javaScript);
nameGroup.addNameHyperlink(nameJava); nameGroup.addNameHyperlink(nameJava);
} }
@ -231,11 +229,4 @@ public class VanChartHyperLinkPane extends UIListControlPane {
return null; return null;
} }
protected Object getob2Populate (Object ob2Populate) {
if (ob2Populate == null) {
return ob2Populate;
}
return ((UIMenuNameableCreator)ob2Populate).getObj();
}
} }

84
designer_chart/src/com/fr/plugin/chart/designer/other/ChartConditionNameObjectCreator.java

@ -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);
}
}

84
designer_chart/src/com/fr/plugin/chart/designer/other/ChartHyperlinkNameObjectCreartor.java

@ -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);
}
}

12
designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrContentPane.java

@ -6,14 +6,10 @@ import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.plugin.chart.designer.component.ConditionUIMenuNameableCreator;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import java.awt.*; import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by Mitisky on 16/5/20. * Created by Mitisky on 16/5/20.
@ -41,17 +37,11 @@ public class VanChartConditionAttrContentPane extends AbstractConditionAttrConte
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(conditionPane, BorderLayout.CENTER); this.add(conditionPane, BorderLayout.CENTER);
//todo@mango
List<UIMenuNameableCreator> list = new ArrayList<UIMenuNameableCreator>();
list.add(new ConditionUIMenuNameableCreator(plot, Inter.getLocText("Chart-Condition_Attributes"), new ConditionAttr(), showPane));
NameObject[] nameables = new NameObject[collection.getConditionAttrSize()]; NameObject[] nameables = new NameObject[collection.getConditionAttrSize()];
for(int i = 0; i < collection.getConditionAttrSize(); i++) { for(int i = 0; i < collection.getConditionAttrSize(); i++) {
ConditionUIMenuNameableCreator c =new ConditionUIMenuNameableCreator(plot, collection.getConditionAttr(i).getName(), collection.getConditionAttr(i), showPane); nameables[i]=(new NameObject(collection.getConditionAttr(i).getName(),collection.getConditionAttr(i)));
nameables[i]=(new NameObject(c.getName(),c));
} }
conditionPane.populate(nameables); conditionPane.populate(nameables);

12
designer_chart/src/com/fr/plugin/chart/designer/other/VanChartListControlPane.java

@ -6,14 +6,13 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.designer.component.ConditionUIMenuNameableCreator;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -36,7 +35,7 @@ public class VanChartListControlPane extends UIListControlPane {
@Override @Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
return new ChartConditionNameObjectCreator[]{new ChartConditionNameObjectCreator(this.plot, Inter.getLocText("Condition_Attributes"), ConditionUIMenuNameableCreator.class, ChartTypeInterfaceManager.getInstance().getPlotConditionPane((Plot) plot).getClass())}; return new NameObjectCreator[]{new NameObjectCreator(Inter.getLocText("Condition_Attributes"), ConditionAttr.class, ChartTypeInterfaceManager.getInstance().getPlotConditionPane((Plot) plot).getClass())};
} }
@ -77,10 +76,6 @@ public class VanChartListControlPane extends UIListControlPane {
return Inter.getLocText("Condition_Attributes"); return Inter.getLocText("Condition_Attributes");
} }
protected Object getob2Populate(Object ob2Populate) {
return ((ConditionUIMenuNameableCreator) ob2Populate).getObj();
}
/** /**
* Update. * Update.
@ -91,8 +86,7 @@ public class VanChartListControlPane extends UIListControlPane {
cc.clearConditionAttr(); cc.clearConditionAttr();
for (int i = 0; i < nameables.length; i++) { for (int i = 0; i < nameables.length; i++) {
UIMenuNameableCreator uiMenuNameableCreator = (UIMenuNameableCreator) ((NameObject) nameables[i]).getObject(); ConditionAttr ca = (ConditionAttr) ((NameObject) nameables[i]).getObject();
ConditionAttr ca = (ConditionAttr) uiMenuNameableCreator.getObj();
ca.setName(nameables[i].getName()); ca.setName(nameables[i].getName());
cc.addConditionAttr(ca); cc.addConditionAttr(ca);

116
designer_chart/src/com/fr/plugin/chart/designer/style/background/AlertLineListControlPane.java

@ -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);
}
}
}

121
designer_chart/src/com/fr/plugin/chart/designer/style/background/BackgroundListControlPane.java

@ -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);
}
}
}

47
designer_chart/src/com/fr/plugin/chart/designer/style/background/BackgroundNameObjectCreator.java

@ -0,0 +1,47 @@
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.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) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return null;
}
}

52
designer_chart/src/com/fr/plugin/chart/designer/style/background/ChartNameObjectCreator.java

@ -0,0 +1,52 @@
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.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) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return null;
}
}

12
designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAlertValuePane.java

@ -46,6 +46,8 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private UIComboBox fontName; private UIComboBox fontName;
private ColorSelectBox fontColor; private ColorSelectBox fontColor;
private VanChartAlertValue chartAlertValue;
public VanChartAlertValuePane(){ public VanChartAlertValuePane(){
initComponents(); initComponents();
} }
@ -134,6 +136,7 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
} }
public void populateBean(VanChartAlertValue chartAlertValue){ public void populateBean(VanChartAlertValue chartAlertValue){
this.chartAlertValue =chartAlertValue;
alertAxis = new UIButtonGroup(chartAlertValue.getAxisNamesArray(), chartAlertValue.getAxisNamesArray()); alertAxis = new UIButtonGroup(chartAlertValue.getAxisNamesArray(), chartAlertValue.getAxisNamesArray());
alertAxis.setSelectedItem(chartAlertValue.getAxisName()); alertAxis.setSelectedItem(chartAlertValue.getAxisName());
alertAxis.addChangeListener(new ChangeListener() { alertAxis.addChangeListener(new ChangeListener() {
@ -166,7 +169,9 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
} }
@Override @Override
public void updateBean(VanChartAlertValue chartAlertValue) { public void updateBean(VanChartAlertValue chartAlertValue) {}
public VanChartAlertValue updateBean(){
chartAlertValue.setAxisName(alertAxis.getSelectedItem().toString()); chartAlertValue.setAxisName(alertAxis.getSelectedItem().toString());
chartAlertValue.setAlertValueFormula(new Formula(alertValue.updateBean())); chartAlertValue.setAlertValueFormula(new Formula(alertValue.updateBean()));
@ -191,9 +196,6 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
} else { } else {
chartAlertValue.setAlertPosition(alertTextPosition.getSelectedIndex() == 0 ? Constants.LEFT : Constants.RIGHT); chartAlertValue.setAlertPosition(alertTextPosition.getSelectedIndex() == 0 ? Constants.LEFT : Constants.RIGHT);
} }
} return chartAlertValue;
public VanChartAlertValue updateBean(){
return null;
} }
} }

182
designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAxisAreaPane.java

@ -2,30 +2,21 @@ package com.fr.plugin.chart.designer.style.background;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.frpane.UICorrelationComboBoxPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
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.VanChartRectanglePlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.base.VanChartCustomIntervalBackground;
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; import com.fr.plugin.chart.designer.TableLayout4VanChartHelper;
import com.fr.plugin.chart.designer.component.VanChartUIMenuNameableCreator;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* 样式-背景-绘图区背景-坐标轴图表特有间隔背景网格线警戒线 * 样式-背景-绘图区背景-坐标轴图表特有间隔背景网格线警戒线
@ -36,14 +27,14 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
protected ColorSelectBox horizontalGridLine; protected ColorSelectBox horizontalGridLine;
protected ColorSelectBox verticalGridLine; protected ColorSelectBox verticalGridLine;
protected UICorrelationComboBoxPane alertLine; protected AlertLineListControlPane alertLine;
private UIButtonGroup isDefaultIntervalBackground; private UIButtonGroup isDefaultIntervalBackground;
private JPanel centerPane; private JPanel centerPane;
private CardLayout cardLayout; private CardLayout cardLayout;
protected ColorSelectBox horizontalColorBackground; protected ColorSelectBox horizontalColorBackground;
private ColorSelectBox verticalColorBackground; private ColorSelectBox verticalColorBackground;
protected UICorrelationComboBoxPane customIntervalBackground; protected BackgroundListControlPane customIntervalBackground;
public VanChartAxisAreaPane(){ public VanChartAxisAreaPane(){
initComponents(); initComponents();
@ -82,8 +73,10 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
} }
protected JPanel createAlertLinePane(){ protected JPanel createAlertLinePane(){
alertLine = new UICorrelationComboBoxPane(); alertLine = new AlertLineListControlPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_AlertLine"),alertLine); JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_AlertLine"),alertLine);
alertLine.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
return panel;
} }
protected JPanel createIntervalPane(double[] row, double[] col){ protected JPanel createIntervalPane(double[] row, double[] col){
@ -92,7 +85,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
verticalColorBackground = new ColorSelectBox(100); verticalColorBackground = new ColorSelectBox(100);
Component[][] components = getIntervalPaneComponents(); Component[][] components = getIntervalPaneComponents();
JPanel defaultPane = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel defaultPane = TableLayoutHelper.createTableLayoutPane(components, row, col);
customIntervalBackground = new UICorrelationComboBoxPane(); customIntervalBackground = new BackgroundListControlPane();
cardLayout = new CardLayout(); cardLayout = new CardLayout();
centerPane = new JPanel(cardLayout); centerPane = new JPanel(cardLayout);
@ -107,7 +100,9 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
JPanel intervalPane = new JPanel(new BorderLayout(0, 6)); JPanel intervalPane = new JPanel(new BorderLayout(0, 6));
intervalPane.add(isDefaultIntervalBackground, BorderLayout.NORTH); intervalPane.add(isDefaultIntervalBackground, BorderLayout.NORTH);
intervalPane.add(centerPane, BorderLayout.CENTER); intervalPane.add(centerPane, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_IntervalBackground"),intervalPane); JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_IntervalBackground"),intervalPane);
intervalPane.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
return panel;
} }
protected Component[][] getIntervalPaneComponents() { protected Component[][] getIntervalPaneComponents() {
@ -132,18 +127,16 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
public void populateBean(Plot plot){ public void populateBean(Plot plot){
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot; VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot;
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList();
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList();
String[] axisNames = DefaultAxisHelper.getAllAxisNames(xAxisList, yAxisList);
populateGridLine(rectanglePlot); populateGridLine(rectanglePlot);
populateAlert(xAxisList, yAxisList, axisNames); alertLine.populate(plot);
isDefaultIntervalBackground.setSelectedIndex(rectanglePlot.isDefaultIntervalBackground() ? 0 : 1); isDefaultIntervalBackground.setSelectedIndex(rectanglePlot.isDefaultIntervalBackground() ? 0 : 1);
horizontalColorBackground.setSelectObject(rectanglePlot.getDefaultYAxis().getDefaultIntervalBackgroundColor()); horizontalColorBackground.setSelectObject(rectanglePlot.getDefaultYAxis().getDefaultIntervalBackgroundColor());
verticalColorBackground.setSelectObject(rectanglePlot.getDefaultXAxis().getDefaultIntervalBackgroundColor()); verticalColorBackground.setSelectObject(rectanglePlot.getDefaultXAxis().getDefaultIntervalBackgroundColor());
populateCustomIntervalBackground(xAxisList, yAxisList, axisNames); customIntervalBackground.populate(plot);
checkCardPane(); checkCardPane();
} }
@ -152,97 +145,13 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
verticalGridLine.setSelectObject(rectanglePlot.getDefaultXAxis().getMainGridColor()); verticalGridLine.setSelectObject(rectanglePlot.getDefaultXAxis().getMainGridColor());
} }
protected Class<? extends BasicBeanPane> getAlertPaneClass() {
return VanChartAlertValuePane.class;
}
protected void setAlertDemoAxisName(VanChartAlertValue demo, String[] axisNames) {
demo.setAxisName(axisNames[0]);
}
private void populateAlert(List<VanChartAxis> xAxisList, List<VanChartAxis> yAxisList, String[] axisNames){
List<UIMenuNameableCreator> menuList = new ArrayList<UIMenuNameableCreator>();
VanChartAlertValue demo = new VanChartAlertValue();
demo.setAxisNamesArray(axisNames);
setAlertDemoAxisName(demo, axisNames);
menuList.add(new VanChartUIMenuNameableCreator(Inter.getLocText("Plugin-ChartF_AlertLine"), demo, getAlertPaneClass()));
alertLine.refreshMenuAndAddMenuAction(menuList);
List<UIMenuNameableCreator> list = new ArrayList<UIMenuNameableCreator>();
for(VanChartAxis axis: xAxisList){
List<VanChartAlertValue> values = axis.getAlertValues();
for(VanChartAlertValue alertValue : values) {
alertValue.setAxisNamesArray(axisNames);
alertValue.setAxisName(axis.getAxisName());
list.add(new VanChartUIMenuNameableCreator(alertValue.getAlertPaneSelectName(), alertValue, getAlertPaneClass()));
}
}
for(VanChartAxis axis: yAxisList){
List<VanChartAlertValue> values = axis.getAlertValues();
for(VanChartAlertValue alertValue : values) {
alertValue.setAxisNamesArray(axisNames);
alertValue.setAxisName(axis.getAxisName());
list.add(new VanChartUIMenuNameableCreator(alertValue.getAlertPaneSelectName(), alertValue, getAlertPaneClass()));
}
}
alertLine.populateBean(list);
alertLine.doLayout();
}
protected Class<? extends BasicBeanPane> getIntervalPaneClass() {
return VanChartCustomIntervalBackgroundPane.class;
}
protected void setCustomIntervalBackgroundDemoAxisName(VanChartCustomIntervalBackground demo, String[] axisNames) {
demo.setAxisName(axisNames[0]);
}
private void populateCustomIntervalBackground(List<VanChartAxis> xAxisList, List<VanChartAxis> yAxisList, String[] axisNames){
List<UIMenuNameableCreator> menuList = new ArrayList<UIMenuNameableCreator>();
VanChartCustomIntervalBackground demo = new VanChartCustomIntervalBackground();
demo.setAxisNamesArray(axisNames);
setCustomIntervalBackgroundDemoAxisName(demo, axisNames);
menuList.add(new VanChartUIMenuNameableCreator(Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"), demo, getIntervalPaneClass()));
customIntervalBackground.refreshMenuAndAddMenuAction(menuList);
List<UIMenuNameableCreator> list = new ArrayList<UIMenuNameableCreator>();
for(VanChartAxis axis: xAxisList){
List<VanChartCustomIntervalBackground> customIntervalBackgrounds = axis.getCustomIntervalBackgroundArray();
for(VanChartCustomIntervalBackground background : customIntervalBackgrounds){
background.setAxisNamesArray(axisNames);
background.setAxisName(axis.getAxisName());
list.add(new VanChartUIMenuNameableCreator(background.getCustomIntervalBackgroundSelectName(), background, getIntervalPaneClass()));
}
}
for(VanChartAxis axis: yAxisList){
List<VanChartCustomIntervalBackground> customIntervalBackgrounds = axis.getCustomIntervalBackgroundArray();
for(VanChartCustomIntervalBackground background : customIntervalBackgrounds){
background.setAxisNamesArray(axisNames);
background.setAxisName(axis.getAxisName());
list.add(new VanChartUIMenuNameableCreator(background.getCustomIntervalBackgroundSelectName(), background, getIntervalPaneClass()));
}
}
customIntervalBackground.populateBean(list);
customIntervalBackground.doLayout();
}
public void updateBean(Plot plot){ public void updateBean(Plot plot){
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot; VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot;
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList();
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList();
updateGirdLine(rectanglePlot); updateGirdLine(rectanglePlot);
updateAlert(xAxisList, yAxisList); alertLine.update(plot);
rectanglePlot.setIsDefaultIntervalBackground(isDefaultIntervalBackground.getSelectedIndex() == 0); rectanglePlot.setIsDefaultIntervalBackground(isDefaultIntervalBackground.getSelectedIndex() == 0);
if(rectanglePlot.isDefaultIntervalBackground()){ if(rectanglePlot.isDefaultIntervalBackground()){
@ -252,7 +161,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
rectanglePlot.getDefaultYAxis().setDefaultIntervalBackgroundColor(null); rectanglePlot.getDefaultYAxis().setDefaultIntervalBackgroundColor(null);
rectanglePlot.getDefaultXAxis().setDefaultIntervalBackgroundColor(null); rectanglePlot.getDefaultXAxis().setDefaultIntervalBackgroundColor(null);
} }
updateCustomIntervalBackground(xAxisList, yAxisList); customIntervalBackground.update(plot,isDefaultIntervalBackground.getSelectedIndex() == 0);
} }
protected void updateGirdLine(VanChartRectanglePlot rectanglePlot) { protected void updateGirdLine(VanChartRectanglePlot rectanglePlot) {
@ -260,34 +169,6 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
rectanglePlot.getDefaultXAxis().setMainGridColor(verticalGridLine.getSelectObject()); rectanglePlot.getDefaultXAxis().setMainGridColor(verticalGridLine.getSelectObject());
} }
private void updateAlert(List<VanChartAxis> xAxisList, List<VanChartAxis> yAxisList){
List<UIMenuNameableCreator> alertList = alertLine.updateBean();
for(VanChartAxis axis : xAxisList){
List<VanChartAlertValue> axisAlerts = new ArrayList<VanChartAlertValue>();
for(UIMenuNameableCreator creator : alertList) {
VanChartAlertValue value = (VanChartAlertValue)creator.getObj();
if(ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())){
value.setAlertPaneSelectName(creator.getName());
axisAlerts.add(value);
}
}
axis.setAlertValues(axisAlerts);
}
for(VanChartAxis axis : yAxisList){
List<VanChartAlertValue> axisAlerts = new ArrayList<VanChartAlertValue>();
for(UIMenuNameableCreator creator : alertList) {
VanChartAlertValue value = (VanChartAlertValue)creator.getObj();
if(ComparatorUtils.equals(value.getAxisName(), axis.getAxisName()) || yAxisEquals(value.getAxisName(), axis.getAxisName())){
value.setAlertPaneSelectName(creator.getName());
axisAlerts.add(value);
}
}
axis.setAlertValues(axisAlerts);
}
}
/** /**
* Y軸和雷達圖的極軸也是相等的 * Y軸和雷達圖的極軸也是相等的
* @param axisName * @param axisName
@ -299,39 +180,6 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
ComparatorUtils.equals(VanChartAttrHelper.RADAR_Y_AXIS_PREFIX, axisName); ComparatorUtils.equals(VanChartAttrHelper.RADAR_Y_AXIS_PREFIX, axisName);
} }
private void updateCustomIntervalBackground(List<VanChartAxis> xAxisList, List<VanChartAxis> yAxisList){
List<UIMenuNameableCreator> customList = customIntervalBackground.updateBean();
for(VanChartAxis axis : xAxisList){
List<VanChartCustomIntervalBackground> axisCustomBackground = new ArrayList<VanChartCustomIntervalBackground>();
if(isDefaultIntervalBackground.getSelectedIndex() == 1){//tab选中间隔背景,则置所有自定义间隔背景为空数组
for(UIMenuNameableCreator creator : customList) {
VanChartCustomIntervalBackground value = (VanChartCustomIntervalBackground)creator.getObj();
if(ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())){
value.setCustomIntervalBackgroundSelectName(creator.getName());
axisCustomBackground.add(value);
}
}
}
axis.setCustomIntervalBackgroundArray(axisCustomBackground);
}
for(VanChartAxis axis : yAxisList){
List<VanChartCustomIntervalBackground> axisCustomBackground = new ArrayList<VanChartCustomIntervalBackground>();
if(isDefaultIntervalBackground.getSelectedIndex() == 1){//tab选中间隔背景,则置所有自定义间隔背景为空数组
for(UIMenuNameableCreator creator : customList) {
VanChartCustomIntervalBackground value = (VanChartCustomIntervalBackground)creator.getObj();
if(ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())){
value.setCustomIntervalBackgroundSelectName(creator.getName());
axisCustomBackground.add(value);
}
}
}
axis.setCustomIntervalBackgroundArray(axisCustomBackground);
}
}
public Plot updateBean(){ public Plot updateBean(){
return null; return null;
} }

13
designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java

@ -32,6 +32,8 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane<VanChart
private ColorSelectBox color; private ColorSelectBox color;
private UINumberDragPane transparent; private UINumberDragPane transparent;
private VanChartCustomIntervalBackground customIntervalBackground;
public VanChartCustomIntervalBackgroundPane(){ public VanChartCustomIntervalBackgroundPane(){
} }
@ -90,6 +92,7 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane<VanChart
} }
public void populateBean(VanChartCustomIntervalBackground customIntervalBackground){ public void populateBean(VanChartCustomIntervalBackground customIntervalBackground){
this.customIntervalBackground = customIntervalBackground;
backgroundAxis = new UIButtonGroup(customIntervalBackground.getAxisNamesArray(), customIntervalBackground.getAxisNamesArray()); backgroundAxis = new UIButtonGroup(customIntervalBackground.getAxisNamesArray(), customIntervalBackground.getAxisNamesArray());
backgroundAxis.setSelectedItem(customIntervalBackground.getAxisName()); backgroundAxis.setSelectedItem(customIntervalBackground.getAxisName());
@ -99,20 +102,18 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane<VanChart
topValue.populateBean(Utils.objectToString(customIntervalBackground.getToFormula())); topValue.populateBean(Utils.objectToString(customIntervalBackground.getToFormula()));
color.setSelectObject(customIntervalBackground.getBackgroundColor()); color.setSelectObject(customIntervalBackground.getBackgroundColor());
transparent.populateBean(customIntervalBackground.getAlpha() * VanChartAttrHelper.PERCENT); transparent.populateBean(customIntervalBackground.getAlpha() * VanChartAttrHelper.PERCENT);
}
public void updateBean(VanChartCustomIntervalBackground customIntervalBackground){}
} public VanChartCustomIntervalBackground updateBean(){
public void updateBean(VanChartCustomIntervalBackground customIntervalBackground){
customIntervalBackground.setAxisName(backgroundAxis.getSelectedItem().toString()); customIntervalBackground.setAxisName(backgroundAxis.getSelectedItem().toString());
customIntervalBackground.setFromFormula(new Formula(bottomValue.updateBean())); customIntervalBackground.setFromFormula(new Formula(bottomValue.updateBean()));
customIntervalBackground.setToFormula(new Formula(topValue.updateBean())); customIntervalBackground.setToFormula(new Formula(topValue.updateBean()));
customIntervalBackground.setBackgroundColor(color.getSelectObject()); customIntervalBackground.setBackgroundColor(color.getSelectObject());
customIntervalBackground.setAlpha(transparent.updateBean() / VanChartAttrHelper.PERCENT); customIntervalBackground.setAlpha(transparent.updateBean() / VanChartAttrHelper.PERCENT);
} return customIntervalBackground;
public VanChartCustomIntervalBackground updateBean(){
return null;
} }
} }
Loading…
Cancel
Save