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 |
@ -1,41 +1,41 @@ |
|||||||
package com.fr.design.mainframe.widget.accessibles; |
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
import javax.swing.SwingUtilities; |
import javax.swing.SwingUtilities; |
||||||
|
|
||||||
import com.fr.design.mainframe.widget.wrappers.TreeModelWrapper; |
import com.fr.design.mainframe.widget.wrappers.TreeModelWrapper; |
||||||
import com.fr.design.dialog.BasicDialog; |
import com.fr.design.dialog.BasicDialog; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.gui.frpane.TreeSettingPane; |
import com.fr.design.gui.frpane.TreeSettingPane; |
||||||
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* 用于TreeEdito和TreeComboBox的数据格式设置 |
* 用于TreeEdito和TreeComboBox的数据格式设置 |
||||||
* @since 6.5.3 |
* @since 6.5.3 |
||||||
*/ |
*/ |
||||||
public class AccessibleTreeModelEditor extends UneditableAccessibleEditor { |
public class AccessibleTreeModelEditor extends UneditableAccessibleEditor { |
||||||
|
|
||||||
private TreeSettingPane treeSettingPane; |
private TreeSettingPane treeSettingPane; |
||||||
|
|
||||||
public AccessibleTreeModelEditor() { |
public AccessibleTreeModelEditor() { |
||||||
super(new TreeModelWrapper()); |
super(new TreeModelWrapper()); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void showEditorPane() { |
protected void showEditorPane() { |
||||||
if (treeSettingPane == null) { |
if (treeSettingPane == null) { |
||||||
treeSettingPane = new TreeSettingPane(false); |
treeSettingPane = new TreeSettingPane(false); |
||||||
} |
} |
||||||
BasicDialog dlg = treeSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
BasicDialog dlg = treeSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||||
treeSettingPane.populate(getValue()); |
treeSettingPane.populate(getValue()); |
||||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void doOk() { |
public void doOk() { |
||||||
Object nodeOrDict = treeSettingPane.updateTreeNodeAttrs(); |
Object nodeOrDict = treeSettingPane.updateTreeNodeAttrs(); |
||||||
setValue(nodeOrDict); |
setValue(nodeOrDict); |
||||||
fireStateChanged(); |
fireStateChanged(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
dlg.setVisible(true); |
dlg.setVisible(true); |
||||||
} |
} |
||||||
} |
} |
@ -1,40 +1,40 @@ |
|||||||
package com.fr.design.mainframe.widget.wrappers; |
package com.fr.design.mainframe.widget.wrappers; |
||||||
|
|
||||||
import com.fr.base.TemplateUtils; |
import com.fr.base.TemplateUtils; |
||||||
import com.fr.data.impl.TreeNodeAttr; |
import com.fr.data.impl.TreeNodeAttr; |
||||||
import com.fr.data.impl.TreeNodeWrapper; |
import com.fr.data.impl.TreeNodeWrapper; |
||||||
import com.fr.design.Exception.ValidationException; |
import com.fr.design.Exception.ValidationException; |
||||||
import com.fr.design.designer.properties.Decoder; |
import com.fr.design.designer.properties.Decoder; |
||||||
import com.fr.design.designer.properties.Encoder; |
import com.fr.design.designer.properties.Encoder; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.general.NameObject; |
import com.fr.general.NameObject; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
public class TreeModelWrapper implements Encoder, Decoder { |
public class TreeModelWrapper implements Encoder, Decoder { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String encode(Object v) { |
public String encode(Object v) { |
||||||
if (v == null) { |
if (v == null) { |
||||||
return StringUtils.EMPTY; |
return StringUtils.EMPTY; |
||||||
} |
} |
||||||
if (v instanceof TreeNodeAttr[]) { |
if (v instanceof TreeNodeAttr[]) { |
||||||
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{((TreeNodeAttr[]) v).length + ""}); |
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{((TreeNodeAttr[]) v).length + ""}); |
||||||
} else if (v instanceof TreeNodeWrapper) { |
} else if (v instanceof TreeNodeWrapper) { |
||||||
TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs(); |
TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs(); |
||||||
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""}); |
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""}); |
||||||
} else if (v instanceof NameObject) { |
} else if (v instanceof NameObject) { |
||||||
return Inter.getLocText("FR-Designer_DataTable-Build"); |
return Inter.getLocText("FR-Designer_DataTable-Build"); |
||||||
} else { |
} else { |
||||||
return Inter.getLocText("FR-Designer_Auto-Build"); |
return Inter.getLocText("FR-Designer_Auto-Build"); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public Object decode(String txt) { |
public Object decode(String txt) { |
||||||
return null; |
return null; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void validate(String txt) throws ValidationException { |
public void validate(String txt) throws ValidationException { |
||||||
} |
} |
||||||
} |
} |
Before Width: | Height: | Size: 105 KiB 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; |
||||||
|
} |
||||||
|
} |