mengao
7 years ago
16 changed files with 547 additions and 118 deletions
@ -0,0 +1,84 @@
|
||||
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); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,84 @@
|
||||
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,102 @@
|
||||
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.chart.chartglyph.ConditionCollection; |
||||
import com.fr.design.ChartTypeInterfaceManager; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.controlpane.UIListControlPane; |
||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
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 VanChartListControlPane extends UIListControlPane { |
||||
|
||||
public VanChartListControlPane(BasePlot plot) { |
||||
super(plot); |
||||
} |
||||
|
||||
@Override |
||||
public void populate(Nameable[] nameableArray) { |
||||
initComponentPane(); |
||||
super.populate(nameableArray); |
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
return new ChartConditionNameObjectCreator[]{new ChartConditionNameObjectCreator(this.plot, Inter.getLocText("Condition_Attributes"), ConditionUIMenuNameableCreator.class, ChartTypeInterfaceManager.getInstance().getPlotConditionPane((Plot) plot).getClass())}; |
||||
} |
||||
|
||||
|
||||
protected BasicBeanPane createPaneByCreators(NameableCreator creator) { |
||||
Constructor<? extends BasicBeanPane> constructor = null; |
||||
try { |
||||
constructor = creator.getUpdatePane().getConstructor(Plot.class); |
||||
return constructor.newInstance(plot); |
||||
|
||||
} catch (InstantiationException e) { |
||||
throw new RuntimeException(e); |
||||
} catch (IllegalAccessException e) { |
||||
throw new RuntimeException(e); |
||||
} catch (NoSuchMethodException e) { |
||||
e.printStackTrace(); |
||||
} catch (InvocationTargetException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void saveSettings() { |
||||
if (isPopulating) { |
||||
return; |
||||
} |
||||
updateConditionCollection(((VanChartPlot) plot).getConditionCollection()); |
||||
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||
} |
||||
|
||||
@Override |
||||
public String getAddItemText() { |
||||
return Inter.getLocText("FR-Designer_Add_Condition"); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("Condition_Attributes"); |
||||
} |
||||
|
||||
protected Object getob2Populate(Object ob2Populate) { |
||||
return ((ConditionUIMenuNameableCreator) ob2Populate).getObj(); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* Update. |
||||
*/ |
||||
public void updateConditionCollection(ConditionCollection cc) { |
||||
Nameable[] nameables = this.update(); |
||||
|
||||
cc.clearConditionAttr(); |
||||
|
||||
for (int i = 0; i < nameables.length; i++) { |
||||
UIMenuNameableCreator uiMenuNameableCreator = (UIMenuNameableCreator) ((NameObject) nameables[i]).getObject(); |
||||
ConditionAttr ca = (ConditionAttr) uiMenuNameableCreator.getObj(); |
||||
ca.setName(nameables[i].getName()); |
||||
cc.addConditionAttr(ca); |
||||
|
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue