diff --git a/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java b/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java index 2c4fa4056..924415aea 100644 --- a/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java +++ b/designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java @@ -20,6 +20,9 @@ public class UIExpandablePane extends JPanel { private int headWidth; private int headHeight; + public JPanel getContentPanel() { + return contentPanel; + } public UIExpandablePane(String title, int headWidth, int headHeight, JPanel contentPanel) { super(); @@ -43,12 +46,17 @@ public class UIExpandablePane extends JPanel { headerPanel = new HeaderPane(color, title, headHeight); headerPanel.addMouseListener(new PanelAction()); - contentPanel.setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, 0)); + setcontentPanelontentPanelBorder (); this.add(headerPanel, BorderLayout.NORTH); this.add(contentPanel, BorderLayout.CENTER); setOpaque(false); } + protected void setcontentPanelontentPanelBorder (){ + contentPanel.setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, 0)); + + } + class PanelAction extends MouseAdapter { public void mousePressed(MouseEvent e) { HeaderPane hp = (HeaderPane) e.getSource(); diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index 74c64de32..ba793a596 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -1,5 +1,6 @@ package com.fr.design.gui.controlpane; +import com.fr.base.chart.BasePlot; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; @@ -16,7 +17,8 @@ import com.fr.stable.Nameable; import javax.swing.*; import java.awt.*; -import java.awt.event.*; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; /** * Created by plough on 2017/7/21. @@ -37,10 +39,18 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH protected JPanel cardPane; + protected BasePlot plot; + + public UIControlPane() { this.initComponentPane(); } + public UIControlPane(BasePlot plot) { + this.plot =plot; + this.initComponentPane(); + } + /** * 生成添加按钮的NameableCreator * diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java index 986f29651..bc4969130 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -2,6 +2,7 @@ package com.fr.design.gui.controlpane; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.chart.BasePlot; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.beans.BasicBeanPane; @@ -12,9 +13,9 @@ import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ModNameActionListener; +import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -40,8 +41,6 @@ import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -61,10 +60,15 @@ public abstract class UIListControlPane extends UIControlPane { private boolean isNameRepeated = false; protected boolean isPopulating = false; + public UIListControlPane() { this.initComponentPane(); } + public UIListControlPane(BasePlot plot) { + super(plot); + } + @Override protected JPanel createControlUpdatePane() { return new JControlUpdatePane(); @@ -890,6 +894,11 @@ public abstract class UIListControlPane extends UIControlPane { } + + protected Object getob2Populate (Object ob2Populate) { + return ob2Populate; + } + private class JControlUpdatePane extends JPanel { private CardLayout card; private JPanel cardPane; @@ -926,6 +935,7 @@ public abstract class UIListControlPane extends UIControlPane { for (int i = 0, len = updatePanes.length; i < len; i++) { Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper); + ob2Populate = getob2Populate(ob2Populate); if (ob2Populate != null) { if (updatePanes[i] == null) { if (isMulti(creators[i].getUpdatePane()) || isTree(creators[i].getUpdatePane())) { @@ -944,6 +954,7 @@ public abstract class UIListControlPane extends UIControlPane { } } + public boolean isMulti(Class _class) { return ComparatorUtils.equals(_class, GlobalMultiTDTableDataPane.class) || ComparatorUtils.equals(_class, MultiTDTableDataPane.class); } diff --git a/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java b/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java index 5b6f8606d..0638ce87e 100644 --- a/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java +++ b/designer_base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java @@ -33,7 +33,11 @@ public class UIMenuNameableCreator implements Nameable{ public void setObj(Object obj) { this.obj = obj; } - + + public Class getPaneClazz() { + return paneClazz; + } + /** * 覆盖的clone方法 */ diff --git a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java index 9f41e7b86..f533aa6a7 100644 --- a/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java +++ b/designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java @@ -7,29 +7,117 @@ import com.fr.chart.web.ChartHyperRelateFloatLink; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.javascript.ChartEmailPane; +import com.fr.design.designer.TargetComponent; import com.fr.design.fun.HyperlinkProvider; import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.design.gui.frpane.UICorrelationComboBoxPane; +import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; -import com.fr.js.*; +import com.fr.general.NameObject; +import com.fr.js.EmailJavaScript; +import com.fr.js.FormHyperlinkProvider; +import com.fr.js.JavaScript; +import com.fr.js.JavaScriptImpl; +import com.fr.js.NameJavaScript; +import com.fr.js.NameJavaScriptGroup; +import com.fr.js.ParameterJavaScript; +import com.fr.js.ReportletHyperlink; +import com.fr.js.WebHyperlink; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.designer.other.ChartHyperlinkNameObjectCreartor; import com.fr.plugin.chart.designer.other.HyperlinkMapFactory; +import com.fr.stable.ListMap; +import com.fr.stable.Nameable; import com.fr.stable.bridge.StableFactory; import java.util.ArrayList; import java.util.HashMap; +import java.util.Map; import java.util.Set; /** * Created by Fangjie on 2016/4/28. */ -public class VanChartHyperLinkPane extends UICorrelationComboBoxPane { +public class VanChartHyperLinkPane extends UIListControlPane { public VanChartHyperLinkPane() { super(); } + @Override + public NameableCreator[] createNameableCreators() { + + //面板初始化,需要在populate的时候更新 + Map nameCreators = new ListMap<>(); + NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); + for (NameableCreator creator : creators) { + nameCreators.put(creator.menuName(), creator); + } + Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); + for (HyperlinkProvider provider : providers) { + NameableCreator nc = provider.createHyperlinkCreator(); + nameCreators.put(nc.menuName(), nc); + } + return nameCreators.values().toArray(new NameableCreator[nameCreators.size()]); + } + + + /** + * 弹出列表的标题. + * + * @return 返回标题字符串. + */ + public String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Hyperlink"); + } + + @Override + protected String getAddItemText() { + return Inter.getLocText("FR-Designer_Add_Hyperlink"); + } + + public void populate(NameJavaScriptGroup nameHyperlink_array) { + java.util.List list = new ArrayList(); + if (nameHyperlink_array != null) { + for (int i = 0; i < nameHyperlink_array.size(); i++) { + list.add(new NameObject(nameHyperlink_array.getNameHyperlink(i).getName(), nameHyperlink_array.getNameHyperlink(i).getJavaScript())); + } + } + + this.populate(list.toArray(new NameObject[list.size()])); + } + + public void populate(TargetComponent elementCasePane) { +// hyperlinkGroupPaneActionProvider.populate(this, elementCasePane); + } + + /** + * updateJs的Group + * + * @return 返回NameJavaScriptGroup + */ + public NameJavaScriptGroup updateJSGroup() { + Nameable[] res = this.update(); + NameJavaScript[] res_array = new NameJavaScript[res.length]; + for (int i = 0; i < res.length; i++) { + NameObject no = (NameObject) res[i]; + res_array[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject()); + } + + return new NameJavaScriptGroup(res_array); + } + + @Override + public void saveSettings() { + if (isPopulating) { + return; + } + update((VanChartPlot)plot); + } + public void populate(Plot plot) { + this.plot = plot; HashMap paneMap = getHyperlinkMap(plot); //安装平台内打开插件时,添加相应按钮 @@ -40,20 +128,31 @@ public class VanChartHyperLinkPane extends UICorrelationComboBoxPane { // paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); } + //todo@mengao 去掉UIMenuNameableCreator java.util.List list = refreshList(paneMap); - refreshMenuAndAddMenuAction(list); + ChartHyperlinkNameObjectCreartor[] creators= new ChartHyperlinkNameObjectCreartor[list.size()]; + for(int i = 0; list != null && i < list.size(); i++) { + UIMenuNameableCreator uiMenuNameableCreator = list.get(i); + creators[i] = new ChartHyperlinkNameObjectCreartor(uiMenuNameableCreator.getObj(),uiMenuNameableCreator.getName(), uiMenuNameableCreator.getClass(), uiMenuNameableCreator.getPaneClazz()); + + } + + refreshNameableCreator(creators); + + java.util.List nameObjects = new ArrayList(); - java.util.List hyperList = new ArrayList(); NameJavaScriptGroup nameGroup = populateHotHyperLink(plot); for(int i = 0; nameGroup != null && i < nameGroup.size(); i++) { NameJavaScript javaScript = nameGroup.getNameHyperlink(i); if(javaScript != null && javaScript.getJavaScript() != null) { JavaScript script = javaScript.getJavaScript(); - hyperList.add(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)); + } } - populateBean(hyperList); + this.populate(nameObjects.toArray(new NameObject[nameObjects.size()])); doLayout(); } @@ -77,14 +176,15 @@ public class VanChartHyperLinkPane extends UICorrelationComboBoxPane { } private NameJavaScriptGroup updateNameGroup() { + Nameable[] nameables = update(); + NameJavaScriptGroup nameGroup = new NameJavaScriptGroup(); nameGroup.clear(); - resetItemName(); - java.util.List list = updateBean(); - for(int i = 0; i < list.size(); i++) { - UIMenuNameableCreator menu = (UIMenuNameableCreator)list.get(i); + for(int i = 0; i < nameables.length; i++) { + UIMenuNameableCreator menu = (UIMenuNameableCreator)((NameObject)nameables[i]).getObject(); NameJavaScript nameJava = new NameJavaScript(menu.getName(), (JavaScript)menu.getObj()); + nameJava.setName(nameables[i].getName()); nameGroup.addNameHyperlink(nameJava); } @@ -130,4 +230,12 @@ public class VanChartHyperLinkPane extends UICorrelationComboBoxPane { } return null; } + + protected Object getob2Populate (Object ob2Populate) { + if (ob2Populate == null) { + return ob2Populate; + } + return ((UIMenuNameableCreator)ob2Populate).getObj(); + + } } diff --git a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java index c4ed1ec2d..0802d8196 100644 --- a/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java +++ b/designer_chart/src/com/fr/plugin/chart/custom/other/VanChartCustomInteractivePane.java @@ -32,7 +32,7 @@ public class VanChartCustomInteractivePane extends VanChartInteractivePane { protected JPanel createHyperlinkPane() { hyperlinkPane = new VanChartCustomPlotHyperlinkPane(); - return TableLayout4VanChartHelper.createTitlePane(Inter.getLocText("M_Insert-Hyperlink"), hyperlinkPane, 0); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("M_Insert-Hyperlink"), hyperlinkPane); } @Override diff --git a/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java b/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java index cda309aaa..e85ccdc6c 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/TableLayout4VanChartHelper.java @@ -21,7 +21,11 @@ public class TableLayout4VanChartHelper { public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) { - return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel); + return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel){ + protected void setcontentPanelontentPanelBorder (){ + getContentPanel().setBorder(BorderFactory.createEmptyBorder(0 ,10, 0, 15)); + } + }; } public static JPanel createGapTableLayoutPane(String title, Component component) { diff --git a/designer_chart/src/com/fr/plugin/chart/designer/other/AutoRefreshPane.java b/designer_chart/src/com/fr/plugin/chart/designer/other/AutoRefreshPane.java index c9fa3a319..26772f45b 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/other/AutoRefreshPane.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/other/AutoRefreshPane.java @@ -6,14 +6,16 @@ import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.Inter; -import com.fr.plugin.chart.base.RefreshMoreLabel; import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.base.RefreshMoreLabel; import com.fr.plugin.chart.designer.PlotFactory; +import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; import com.fr.plugin.chart.vanchart.VanChart; @@ -35,15 +37,12 @@ public class AutoRefreshPane extends BasicScrollPane { private VanChart chart; private UIButtonGroup moreLabel; private UISpinner autoRefreshTime; - private UIButtonGroup autoTooltip; + private UICheckBox autoTooltip; private UIButton tooltipSet; + private JPanel contentPane; private boolean isLargeModel; - public UIButtonGroup getMoreLabel() { - return moreLabel; - } - public UISpinner getAutoRefreshTime() { return autoRefreshTime; } @@ -66,7 +65,7 @@ public class AutoRefreshPane extends BasicScrollPane { autoRefreshTime = new UISpinner(0, Integer.MAX_VALUE, 1, 0); - autoTooltip = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")}); + autoTooltip = new UICheckBox(Inter.getLocText("Plugin-ChartF_Auto_Tooltip")); autoTooltip.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -80,24 +79,26 @@ public class AutoRefreshPane extends BasicScrollPane { jPanel.add(autoTooltip, BorderLayout.CENTER); jPanel.add(tooltipSet, BorderLayout.EAST); + JPanel moreLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-ChartF_More_Label"), moreLabel); + double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {p, f}; - double[] rowSize = {p, p, p}; + double[] rowSize = {p, p}; Component[][] components = initComponent(jPanel); - JPanel temp = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - - content.add(temp, BorderLayout.CENTER); + contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + contentPane.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); + content.add(moreLabelPane, BorderLayout.NORTH); + content.add(contentPane, BorderLayout.CENTER); return content; } protected Component[][] initComponent(JPanel autoTooltipPane){ return new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_More_Label")), moreLabel}, new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Time_Interval")), autoRefreshTime}, - new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Auto_Tooltip")), autoTooltipPane}, + new Component[]{autoTooltip, tooltipSet}, }; } @@ -131,19 +132,19 @@ public class AutoRefreshPane extends BasicScrollPane { protected void layoutContentPane() { leftcontentPane = createContentPane(); - leftcontentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + leftcontentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0)); this.add(leftcontentPane); } public void checkRefreshEnable() { Boolean enable = moreLabel.getSelectedIndex() == 0; - autoRefreshTime.setEnabled(enable); + contentPane.setVisible(enable); autoTooltip.setEnabled(enable && !isLargeModel); checkTooltipEnable(); } public void checkTooltipEnable() { - Boolean enable = moreLabel.getSelectedIndex() == 0 && autoTooltip.getSelectedIndex() == 0; + Boolean enable = moreLabel.getSelectedIndex() == 0 && autoTooltip.isSelected(); tooltipSet.setEnabled(enable && !isLargeModel); } @@ -152,7 +153,7 @@ public class AutoRefreshPane extends BasicScrollPane { public void populateBean(RefreshMoreLabel refreshMoreLabel) { moreLabel.setSelectedIndex(refreshMoreLabel.isMoreLabel() ? 0 : 1); populateAutoRefreshTime(); - autoTooltip.setSelectedIndex(refreshMoreLabel.isAutoTooltip() ? 0 : 1); + autoTooltip.setSelected(refreshMoreLabel.isAutoTooltip()); checkRefreshEnable(); @@ -173,7 +174,7 @@ public class AutoRefreshPane extends BasicScrollPane { } protected void updateAutoTooltip(RefreshMoreLabel refreshMoreLabel) { - refreshMoreLabel.setAutoTooltip(autoTooltip.getSelectedIndex() == 0); + refreshMoreLabel.setAutoTooltip(autoTooltip.isSelected()); } diff --git a/designer_chart/src/com/fr/plugin/chart/designer/other/AutoRefreshPaneWithoutTooltip.java b/designer_chart/src/com/fr/plugin/chart/designer/other/AutoRefreshPaneWithoutTooltip.java index 0656bb3f7..40d8e74c8 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/other/AutoRefreshPaneWithoutTooltip.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/other/AutoRefreshPaneWithoutTooltip.java @@ -19,7 +19,6 @@ public class AutoRefreshPaneWithoutTooltip extends AutoRefreshPane { protected Component[][] initComponent(JPanel autoTooltipPane){ return new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_More_Label")), getMoreLabel()}, new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Time_Interval")), getAutoRefreshTime()} }; } diff --git a/designer_chart/src/com/fr/plugin/chart/designer/other/ChartConditionNameObjectCreator.java b/designer_chart/src/com/fr/plugin/chart/designer/other/ChartConditionNameObjectCreator.java new file mode 100644 index 000000000..caa06d596 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/other/ChartConditionNameObjectCreator.java @@ -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 updatePane) { + super(menuName, clazz, updatePane); + this.plot = plot; + } + + /** + * create Nameable + * + * @param helper + * @return + */ + public Nameable createNameable(UnrepeatedNameHelper helper) { + Constructor 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); + } + + +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/other/ChartHyperlinkNameObjectCreartor.java b/designer_chart/src/com/fr/plugin/chart/designer/other/ChartHyperlinkNameObjectCreartor.java new file mode 100644 index 000000000..bc8ea431e --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/other/ChartHyperlinkNameObjectCreartor.java @@ -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 updatePane) { + super(menuName, clazz, updatePane); + this.object = object; + + } + + /** + * create Nameable + * + * @param helper + * @return + */ + public Nameable createNameable(UnrepeatedNameHelper helper) { + Constructor 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); + } + + +} diff --git a/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrContentPane.java b/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrContentPane.java index 1819c291d..5f80ae17e 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrContentPane.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrContentPane.java @@ -4,10 +4,12 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.design.condition.ConditionAttributesPane; -import com.fr.design.gui.frpane.UICorrelationComboBoxPane; +import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.imenutable.UIMenuNameableCreator; 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.awt.*; import java.util.ArrayList; @@ -20,18 +22,8 @@ import java.util.List; public class VanChartConditionAttrContentPane extends AbstractConditionAttrContentPane{ private static final Dimension DIALOG_SIZE = new Dimension(500, 600); - private UICorrelationComboBoxPane conditionPane; + private UIListControlPane conditionPane; public VanChartConditionAttrContentPane() { - if (conditionPane == null) { - conditionPane = new UICorrelationComboBoxPane(){ - protected Dimension getDialogSize() { - return DIALOG_SIZE; - } - }; - } - - this.setLayout(new BorderLayout()); - this.add(conditionPane, BorderLayout.CENTER); } public void populateBean(Plot plot, Class showPane) { @@ -41,19 +33,28 @@ public class VanChartConditionAttrContentPane extends AbstractConditionAttrConte } public void populateBean(Plot plot, ConditionCollection collection, Class showPane){ + + if (conditionPane == null) { + conditionPane = new VanChartListControlPane(plot); + } + + this.setLayout(new BorderLayout()); + this.add(conditionPane, BorderLayout.CENTER); + + //todo@mango List list = new ArrayList(); list.add(new ConditionUIMenuNameableCreator(plot, Inter.getLocText("Chart-Condition_Attributes"), new ConditionAttr(), showPane)); - conditionPane.refreshMenuAndAddMenuAction(list); - List valueList = new ArrayList(); + NameObject[] nameables = new NameObject[collection.getConditionAttrSize()]; for(int i = 0; i < collection.getConditionAttrSize(); i++) { - valueList.add(new ConditionUIMenuNameableCreator(plot, collection.getConditionAttr(i).getName(), collection.getConditionAttr(i), showPane)); + ConditionUIMenuNameableCreator c =new ConditionUIMenuNameableCreator(plot, collection.getConditionAttr(i).getName(), collection.getConditionAttr(i), showPane); + nameables[i]=(new NameObject(c.getName(),c)); } - conditionPane.populateBean(valueList); + conditionPane.populate(nameables); conditionPane.doLayout(); } @@ -62,14 +63,17 @@ public class VanChartConditionAttrContentPane extends AbstractConditionAttrConte update(cc); } - public void update(ConditionCollection cc){ - List list = conditionPane.updateBean(); + public void update(ConditionCollection cc) { + Nameable[] nameables = conditionPane.update(); cc.clearConditionAttr(); - for(UIMenuNameableCreator creator : list){ - ConditionAttr ca = (ConditionAttr)creator.getObj(); - ca.setName(creator.getName()); - cc.addConditionAttr(ca); + for (int i = 0; i < nameables.length; i++) { + if (nameables[i] instanceof UIMenuNameableCreator) { + UIMenuNameableCreator uiMenuNameableCreator = (UIMenuNameableCreator) nameables[i]; + ConditionAttr ca = (ConditionAttr) uiMenuNameableCreator.getObj(); + ca.setName(uiMenuNameableCreator.getName()); + cc.addConditionAttr(ca); + } } } } diff --git a/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrPane.java b/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrPane.java index 20ad534de..97a2a5bcb 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrPane.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionAttrPane.java @@ -4,15 +4,15 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.condition.ConditionAttributesPane; -import com.fr.design.dialog.BasicScrollPane; import com.fr.general.Inter; +import com.fr.plugin.chart.designer.AbstractVanChartScrollPane; import javax.swing.*; //条件属性 -public class VanChartConditionAttrPane extends BasicScrollPane { +public class VanChartConditionAttrPane extends AbstractVanChartScrollPane { private static final long serialVersionUID = 5725969986029470291L; - private AbstractConditionAttrContentPane conditionAttrContentPane; + private VanChartConditionAttrContentPane conditionAttrContentPane; public VanChartConditionAttrPane() { super(); @@ -27,7 +27,7 @@ public class VanChartConditionAttrPane extends BasicScrollPane { return conditionAttrContentPane; } - protected AbstractConditionAttrContentPane createConditionAttrContentPane() { + protected VanChartConditionAttrContentPane createConditionAttrContentPane() { return new VanChartConditionAttrContentPane(); } diff --git a/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartInteractivePane.java b/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartInteractivePane.java index 130d26c0f..2a1146996 100644 --- a/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartInteractivePane.java +++ b/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartInteractivePane.java @@ -4,7 +4,6 @@ import com.fr.base.Formula; import com.fr.base.Utils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; -import com.fr.design.dialog.BasicScrollPane; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; @@ -12,7 +11,6 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; @@ -23,6 +21,7 @@ import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.custom.component.VanChartHyperLinkPane; +import com.fr.plugin.chart.designer.AbstractVanChartScrollPane; import com.fr.plugin.chart.designer.PlotFactory; import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; import com.fr.plugin.chart.vanchart.VanChart; @@ -33,7 +32,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class VanChartInteractivePane extends BasicScrollPane { +public class VanChartInteractivePane extends AbstractVanChartScrollPane { private static final long serialVersionUID = 8135452818502145597L; private static final int AUTO_REFRESH_LEFT_GAP = 18; @@ -43,7 +42,7 @@ public class VanChartInteractivePane extends BasicScrollPane { protected UICheckBox fullScreenDisplay; protected UIToggleButton collapse; - protected UIToggleButton isChartAnimation; + protected UIButtonGroup isChartAnimation; //坐标轴翻转属性 private UIButtonGroup axisRotation; @@ -56,6 +55,8 @@ public class VanChartInteractivePane extends BasicScrollPane { private TinyFormulaPane from; private TinyFormulaPane to; private UIButtonGroup zoomType; + private JPanel changeEnablePane; + private JPanel zoomTypePane; protected VanChartHyperLinkPane superLink; @@ -89,22 +90,15 @@ public class VanChartInteractivePane extends BasicScrollPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {p, f}; - double[] rowSize = {p,p,p,p,p,p,p,p,p,p,p}; + double[] rowSize = {p,p,p,p,p,p}; - JSeparator jSeparator4Zoom = plot.isSupportZoomDirection() ? new JSeparator() : null; - JSeparator jSeparator4AxisRotation = plot.getAxisPlotType() == AxisPlotType.RECTANGLE ? new JSeparator() : null; Component[][] components = new Component[][]{ new Component[]{createToolBarPane(new double[]{p,p,p,p,p}, columnSize),null}, - new Component[]{new JSeparator(),null}, new Component[]{createAnimationPane(),null}, - new Component[]{new JSeparator(),null}, - new Component[]{createAxisRotationPane(new double[]{p}, columnSize, plot),null}, - new Component[]{jSeparator4AxisRotation,null}, + new Component[]{createAxisRotationPane(new double[]{p,p}, columnSize, plot),null}, new Component[]{createZoomPane(new double[]{p,p,p}, columnSize, plot),null}, - new Component[]{jSeparator4Zoom,null}, new Component[]{createAutoRefreshPane(plot),null}, - new Component[]{new JSeparator(),null}, new Component[]{createHyperlinkPane(),null} }; @@ -122,18 +116,18 @@ public class VanChartInteractivePane extends BasicScrollPane { zoomType = new UIButtonGroup(getNameArray(), getValueArray()); zoomGesture = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")}); - JPanel zoomWidgetPane = TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(Inter.getLocText("Plugin-ChartF_ZoomWidget"), zoomWidget); - JPanel zoomGesturePane = TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(Inter.getLocText("Plugin-ChartF_ZoomGesture"), zoomGesture); + JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-ChartF_ZoomWidget"), zoomWidget); + JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-ChartF_ZoomGesture"), zoomGesture); Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change")), zoomResize}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_WidgetBoundary")), zoomResize}, new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_From")), from}, new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_To")), to}, }; - JPanel temp = TableLayoutHelper.createTableLayoutPane(components, row, col); - JPanel changeEnablePane = TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(Inter.getLocText("Plugin-ChartF_WidgetBoundary"), temp); - - JPanel zoomTypePane = TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(Inter.getLocText("Plugin-ChartF_ZoomType"), zoomType); + changeEnablePane = TableLayoutHelper.createTableLayoutPane(components, row, col); + changeEnablePane.setBorder(BorderFactory.createEmptyBorder(10,15,0,0)); + zoomTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-ChartF_ZoomType"), zoomType); + zoomTypePane.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, changeEnablePane, zoomTypePane, plot); zoomWidget.addActionListener(new ActionListener() { @Override @@ -141,7 +135,7 @@ public class VanChartInteractivePane extends BasicScrollPane { checkZoomPane(); } }); - return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Chart-Use_Zoom"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Chart-Use_Zoom"), panel); } protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { @@ -161,10 +155,11 @@ public class VanChartInteractivePane extends BasicScrollPane { axisRotation = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")}); Component[][] components = new Component[][]{ - new Component[]{new UILabel("", SwingConstants.RIGHT),axisRotation} + new Component[]{null,null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Reversal")),axisRotation} }; - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Axis_Rotation") + ":", panel); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_Axis"), panel); } protected String[] getNameArray() { @@ -186,16 +181,16 @@ public class VanChartInteractivePane extends BasicScrollPane { Component[][] components = createToolBarComponents(); - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_ToolBar"), panel); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_ToolBar"), panel); } protected Component[][] createToolBarComponents() { return new Component[][]{ - new Component[]{isSort, null}, - new Component[]{exportImages, null}, - new Component[]{fullScreenDisplay, null}, - new Component[]{collapse, null}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Content")),isSort}, + new Component[]{null, exportImages}, + new Component[]{null, fullScreenDisplay}, + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_layout")),collapse}, }; } @@ -209,15 +204,16 @@ public class VanChartInteractivePane extends BasicScrollPane { protected JPanel createAnimationPane(){ - isChartAnimation = new UIToggleButton(Inter.getLocText("Plugin-ChartF_OpenAnimation")); - return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Animation"), isChartAnimation); + isChartAnimation = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")}); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("Plugin-ChartF_Animation_Effects"), isChartAnimation); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_Animation"), panel); } protected JPanel createAutoRefreshPane(VanChartPlot plot){ autoRefreshPane = getMoreLabelPane(plot); - return TableLayout4VanChartHelper.createTitlePane(Inter.getLocText("Plugin-ChartF_Moniter_refresh"), autoRefreshPane, AUTO_REFRESH_LEFT_GAP); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_Moniter_refresh"), autoRefreshPane); } protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { @@ -227,16 +223,14 @@ public class VanChartInteractivePane extends BasicScrollPane { protected JPanel createHyperlinkPane() { superLink = new VanChartHyperLinkPane(); - return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("M_Insert-Hyperlink"), superLink); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("M_Insert-Hyperlink"), superLink); } private void checkZoomPane() { boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0; - zoomResize.setEnabled(zoomWidgetEnabled); - GUICoreUtils.setEnabled(from, zoomWidgetEnabled); - GUICoreUtils.setEnabled(to, zoomWidgetEnabled); - zoomType.setEnabled(!zoomWidgetEnabled); + changeEnablePane.setVisible(zoomWidgetEnabled); + zoomTypePane.setVisible(!zoomWidgetEnabled); } @Override @@ -307,7 +301,7 @@ public class VanChartInteractivePane extends BasicScrollPane { private void populateChartAnimate(Chart chart, Plot plot) { if(plot.isSupportAnimate()) { - isChartAnimation.setSelected(chart.isJSDraw()); + isChartAnimation.setSelectedIndex(chart.isJSDraw() ? 0 : 1); isChartAnimation.setEnabled(!largeModel(plot)); } } @@ -410,7 +404,7 @@ public class VanChartInteractivePane extends BasicScrollPane { private void updateChartAnimate(Chart chart, Plot plot) { if(plot.isSupportAnimate()) { - chart.setJSDraw(isChartAnimation.isSelected()); + chart.setJSDraw(isChartAnimation.getSelectedIndex()==0); } } diff --git a/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartListControlPane.java b/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartListControlPane.java new file mode 100644 index 000000000..6ab1078e5 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/designer/other/VanChartListControlPane.java @@ -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 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); + + } + } + +} diff --git a/designer_chart/src/com/fr/plugin/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer_chart/src/com/fr/plugin/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index 1cab9bad2..f5c214e9b 100644 --- a/designer_chart/src/com/fr/plugin/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer_chart/src/com/fr/plugin/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -1,5 +1,6 @@ package com.fr.plugin.chart.drillmap.designer.other; +import com.fr.chart.base.DrillMapTools; import com.fr.chart.chartattr.Chart; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.TableLayout; @@ -11,7 +12,6 @@ import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; import com.fr.plugin.chart.designer.component.background.VanChartBackgroundPaneWithOutImageAndShadow; import com.fr.plugin.chart.designer.other.VanChartInteractivePaneWithMapZoom; -import com.fr.chart.base.DrillMapTools; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import javax.swing.*; @@ -36,16 +36,11 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith double[] columnSize = {p, f}; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; Component[][] components = new Component[][]{ - new Component[]{createToolBarPane(rowSize, columnSize),null}, - new Component[]{new JSeparator(),null}, + new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize),null}, new Component[]{createAnimationPane(),null}, - new Component[]{new JSeparator(),null}, new Component[]{createZoomPane(new double[]{p,p,p}, columnSize, plot),null}, - new Component[]{new JSeparator(),null}, new Component[]{createDrillToolsPane(), null}, - new Component[]{new JSeparator(), null}, new Component[]{createAutoRefreshPane(plot),null}, - new Component[]{new JSeparator(),null}, new Component[]{createHyperlinkPane(),null} }; @@ -54,18 +49,27 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith private JPanel createDrillToolsPane() { openOrClose = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")}); - textAttrPane = new ChartTextAttrPane(); - backgroundPane = new VanChartBackgroundPaneWithOutImageAndShadow(); - selectBackgroundPane = new VanChartBackgroundPaneWithOutImageAndShadow(); + textAttrPane = new ChartTextAttrPane(){ + protected Component[][] getComponents(JPanel buttonPane) { + return new Component[][]{ + new Component[]{null}, + new Component[]{fontNameComboBox}, + new Component[]{buttonPane} + }; + } + }; + backgroundPane = new VanChartBackgroundPane4DrillMap(); + selectBackgroundPane = new VanChartBackgroundPane4DrillMap(); catalogSuperLink = new VanChartCatalogHyperLinkPane(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f}; - double[] rowSize = {p,p,p,p,p}; + double[] rowSize = {p,p,p,p,p,p}; Component[][] components = new Component[][]{ + new Component[]{null,null}, new Component[]{openOrClose}, - new Component[]{createTitlePane(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane)}, + new Component[]{createTitlePane(Inter.getLocText("Plugin-Chart_Character"), textAttrPane)}, new Component[]{createTitlePane(Inter.getLocText("Plugin-ChartF_Background"), backgroundPane)}, new Component[]{createTitlePane(Inter.getLocText("Plugin-ChartF_Select_Color"), selectBackgroundPane)}, new Component[]{createTitlePane(Inter.getLocText("M_Insert-Hyperlink"), catalogSuperLink)} @@ -79,11 +83,11 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith } }); - return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Drill_Dir"), drillPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_Drill_Dir"), drillPane); } private JPanel createTitlePane(String title, Component component) { - return TableLayout4VanChartHelper.createTitlePane(title, component, 20); + return TableLayout4VanChartHelper.createGapTableLayoutPane(title, component); } private void checkEnable() { @@ -133,4 +137,16 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith catalogSuperLink.update(plot); } } + + public class VanChartBackgroundPane4DrillMap extends VanChartBackgroundPaneWithOutImageAndShadow{ + @Override + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{null}, + new Component[]{typeComboBox}, + new Component[]{centerPane}, + new Component[]{transparent}, + }; + } + } } \ No newline at end of file