Browse Source

Merge pull request #1352 in BA/design from ~MANGO/m_design:release/9.0 to release/9.0

* commit '91a1c17f85f1f762a7aa3bc0bb38aead0cf8b533':
  修改代码质量
  修改代码质量
  修改代码质量
  修改代码质量
  修改代码质量
  修改代码质量
  修改代码格式
  修改代码格式
  增加参数
  去掉多余import
  添加参数
  抽象出抽象类
  抽象出抽象类
  抽象出抽象类
  修改方法名称
master
superman 7 years ago
parent
commit
b43a84f633
  1. 33
      designer_base/src/com/fr/design/editor/ValueEditorPaneFactory.java
  2. 56
      designer_base/src/com/fr/design/hyperlink/AbstractHyperLinkPane.java
  3. 145
      designer_base/src/com/fr/design/hyperlink/AbstractHyperNorthPane.java
  4. 144
      designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java
  5. 47
      designer_base/src/com/fr/design/hyperlink/ReporletHyperNorthPane.java
  6. 44
      designer_base/src/com/fr/design/hyperlink/ReportletHyperlinkPane.java
  7. 119
      designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java
  8. 203
      designer_base/src/com/fr/design/hyperlink/WebHyperlinkPane.java
  9. 351
      designer_base/src/com/fr/design/javascript/JavaScriptImplPane.java
  10. 92
      designer_base/src/com/fr/design/javascript/ParameterJavaScriptPane.java
  11. 108
      designer_base/src/com/fr/design/module/DesignModule.java
  12. 180
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  13. 193
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java
  14. 209
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java
  15. 57
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java
  16. 24
      designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerInteractivePane.java
  17. 540
      designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java
  18. 32
      designer_chart/src/com/fr/design/module/ChartHyperlinkGroup.java
  19. 4
      designer_chart/src/com/fr/design/module/FormHyperlinkGroup.java
  20. 12
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java
  21. 16
      designer_chart/src/com/fr/plugin/chart/designer/component/ChartUIMenuNameableCreator.java

33
designer_base/src/com/fr/design/editor/ValueEditorPaneFactory.java

@ -1,7 +1,6 @@
package com.fr.design.editor; package com.fr.design.editor;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.chart.BasePlot;
import com.fr.design.editor.editor.BooleanEditor; import com.fr.design.editor.editor.BooleanEditor;
import com.fr.design.editor.editor.ColumnRowEditor; import com.fr.design.editor.editor.ColumnRowEditor;
import com.fr.design.editor.editor.ColumnRowGroupEditor; import com.fr.design.editor.editor.ColumnRowGroupEditor;
@ -202,24 +201,24 @@ public class ValueEditorPaneFactory {
return createVallueEditorPaneWithUseType(paraUseType, null); return createVallueEditorPaneWithUseType(paraUseType, null);
} }
public static ValueEditorPane createVallueEditorPaneWithUseType(int paraUseType, BasePlot plot) { public static ValueEditorPane createVallueEditorPaneWithUseType(int paraUseType, HashMap hyperLinkEditorMap) {
if (paraUseType == ParameterTableModel.NO_CHART_USE) { if (paraUseType == ParameterTableModel.NO_CHART_USE) {
return createBasicValueEditorPane(); return createBasicValueEditorPane();
} else if (paraUseType == ParameterTableModel.FORM_NORMAL_USE) { } else if (paraUseType == ParameterTableModel.FORM_NORMAL_USE) {
return createFormEditorPane(); return createFormEditorPane();
} else { } else {
return createChartHotValueEditorPane(plot); return createChartHotValueEditorPane(hyperLinkEditorMap);
} }
} }
/** /**
* 图表用的参数编辑器的ValueEditorPane * 图表用的参数编辑器的ValueEditorPane
* *
* @param plot plot类型 * @param hyperLinkEditorMap 超链下拉参数类型
* @return 值编辑器 * @return 值编辑器
*/ */
public static ValueEditorPane createChartHotValueEditorPane(BasePlot plot) { public static ValueEditorPane createChartHotValueEditorPane(HashMap hyperLinkEditorMap) {
return createValueEditorPane(chartHotEditors(plot), StringUtils.EMPTY, StringUtils.EMPTY); return createValueEditorPane(chartHotEditors(hyperLinkEditorMap), StringUtils.EMPTY, StringUtils.EMPTY);
} }
/** /**
@ -253,7 +252,7 @@ public class ValueEditorPaneFactory {
new DateEditor(true, Inter.getLocText("FR-Designer_Date")), new DateEditor(true, Inter.getLocText("FR-Designer_Date")),
new BooleanEditor(), new BooleanEditor(),
formulaEditor, formulaEditor,
new WidgetNameEditor(Inter.getLocText("Widget")) new WidgetNameEditor(Inter.getLocText("FR-Designer_Widget"))
}; };
} }
@ -317,7 +316,7 @@ public class ValueEditorPaneFactory {
*/ */
public static Editor<?>[] URLEditors(String popupName, String textEditorValue) { public static Editor<?>[] URLEditors(String popupName, String textEditorValue) {
return new Editor[]{ return new Editor[]{
new NoneEditor(textEditorValue, StringUtils.isEmpty(popupName) ? Inter.getLocText("None") : popupName), new NoneEditor(textEditorValue, StringUtils.isEmpty(popupName) ? Inter.getLocText("FR-Designer_None") : popupName),
new TextEditor() new TextEditor()
}; };
} }
@ -331,7 +330,7 @@ public class ValueEditorPaneFactory {
*/ */
public static Editor<?>[] dateEditors(String popupName, String textEditorValue) { public static Editor<?>[] dateEditors(String popupName, String textEditorValue) {
return new Editor[]{ return new Editor[]{
new NoneEditor(textEditorValue, StringUtils.isEmpty(popupName) ? Inter.getLocText("None") : popupName), new NoneEditor(textEditorValue, StringUtils.isEmpty(popupName) ? Inter.getLocText("FR-Designer_None") : popupName),
new DateEditor(true, Inter.getLocText("FR-Designer_Date")), new DateEditor(true, Inter.getLocText("FR-Designer_Date")),
new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")) new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula"))
}; };
@ -446,8 +445,8 @@ public class ValueEditorPaneFactory {
* *
* @return 值编辑器 * @return 值编辑器
*/ */
public static Editor[] chartHotEditors(BasePlot plot) { public static Editor[] chartHotEditors(HashMap hyperLinkEditorMap) {
List<Editor> list = createEditors4Chart(plot); List<Editor> list = createEditors4Chart(hyperLinkEditorMap);
list.add(new TextEditor()); list.add(new TextEditor());
list.add(new IntegerEditor()); list.add(new IntegerEditor());
@ -467,14 +466,12 @@ public class ValueEditorPaneFactory {
* *
* @return 值编辑器 * @return 值编辑器
*/ */
private static List<Editor> createEditors4Chart(BasePlot plot) { private static List<Editor> createEditors4Chart(HashMap hyperLinkEditorMap) {
List<Editor> lists = new ArrayList<Editor>(); List<Editor> lists = new ArrayList<Editor>();
if (plot == null) { if (hyperLinkEditorMap == null) {
return lists; return lists;
} }
HashMap<String, Formula> map = plot.getHyperLinkEditorMap(); Iterator<Map.Entry<String, Formula>> entries = hyperLinkEditorMap.entrySet().iterator();
Iterator<Map.Entry<String, Formula>> entries = map.entrySet().iterator();
while (entries.hasNext()) { while (entries.hasNext()) {
Map.Entry<String, Formula> entry = entries.next(); Map.Entry<String, Formula> entry = entries.next();
ConstantsEditor editor = new ConstantsEditor(entry.getKey(), entry.getValue()); ConstantsEditor editor = new ConstantsEditor(entry.getKey(), entry.getValue());
@ -496,12 +493,12 @@ public class ValueEditorPaneFactory {
JPanel paneLeft = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel paneLeft = FRGUIPaneFactory.createBorderLayout_S_Pane();
pane.add(paneLeft); pane.add(paneLeft);
paneLeft.add(new UILabel(" " + Inter.getLocText("Actual_Value") + ":"), BorderLayout.NORTH); paneLeft.add(new UILabel(" " + Inter.getLocText("FR-Designer_Actual_Value") + ":"), BorderLayout.NORTH);
paneLeft.add(keyColumnPane, BorderLayout.CENTER); paneLeft.add(keyColumnPane, BorderLayout.CENTER);
JPanel paneRight = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel paneRight = FRGUIPaneFactory.createBorderLayout_S_Pane();
pane.add(paneRight); pane.add(paneRight);
paneRight.add(new UILabel(" " + Inter.getLocText("Display_Value") + ":"), BorderLayout.NORTH); paneRight.add(new UILabel(" " + Inter.getLocText("FR-Designer_Display_Value") + ":"), BorderLayout.NORTH);
paneRight.add(valueDictPane, BorderLayout.CENTER); paneRight.add(valueDictPane, BorderLayout.CENTER);

56
designer_base/src/com/fr/design/hyperlink/AbstractHyperLinkPane.java

@ -0,0 +1,56 @@
package com.fr.design.hyperlink;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.js.JavaScript;
import java.util.HashMap;
/**
* Created by mengao on 2017/10/12.
*/
public abstract class AbstractHyperLinkPane<T> extends FurtherBasicBeanPane<T> {
private HashMap hyperLinkEditorMap;
private boolean needRenamePane = false;
protected ReportletParameterViewPane parameterViewPane;
public AbstractHyperLinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
this.hyperLinkEditorMap = hyperLinkEditorMap;
this.needRenamePane = needRenamePane;
}
public AbstractHyperLinkPane() {
}
public ReportletParameterViewPane getParameterViewPane() {
return parameterViewPane;
}
public void setParameterViewPane(ReportletParameterViewPane parameterViewPane) {
this.parameterViewPane = parameterViewPane;
}
public boolean accept(Object ob) {
return ob instanceof JavaScript;
}
public void reset() {
}
protected int getChartParaType() {
return hyperLinkEditorMap != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE;
}
protected ValueEditorPane getValueEditorPane() {
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), hyperLinkEditorMap);
}
protected boolean needRenamePane() {
return needRenamePane;
}
}

145
designer_base/src/com/fr/design/hyperlink/AbstractHyperNorthPane.java

@ -0,0 +1,145 @@
package com.fr.design.hyperlink;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.js.Hyperlink;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public abstract class AbstractHyperNorthPane<T extends Hyperlink> extends BasicBeanPane<T> {
public static final int NEW_WINDOW = 0;
public static final int DIALOG = 1;
public static final int SELF = 2;
public static final int DEFAULT_H_VALUE = 400;
public static final int DEFAULT_V_VALUE = 600;
private JPanel headerPane;
private UIComboBox targetFrameComboBox;
private UINumberField heightTextFiled;
private UINumberField widthTextFiled;
public AbstractHyperNorthPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
headerPane = this.setHeaderPanel();
this.add(headerPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
targetFrameComboBox = new UIComboBox(getTargetFrames());
targetFrameComboBox.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
return this;
}
});
JPanel targetFramePanel = new JPanel();
targetFramePanel.add(new UILabel(Inter.getLocText("Hyperlink-Link_Opened_in")));
targetFramePanel.add(targetFrameComboBox);
targetFrameComboBox.setEditable(true);
targetFrameComboBox.setPreferredSize(new Dimension(100, 20));
final JPanel newWindowConfPane = new JPanel();
newWindowConfPane.add(new UILabel(Inter.getLocText("FR-Designer_Height") + ": "));
heightTextFiled = new UINumberField();
heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE));
heightTextFiled.setPreferredSize(new Dimension(40, 20));
newWindowConfPane.add(heightTextFiled);
newWindowConfPane.add(new UILabel(" " + Inter.getLocText("FR-Designer_Width") + ": "));
widthTextFiled = new UINumberField();
widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE));
widthTextFiled.setPreferredSize(new Dimension(40, 20));
newWindowConfPane.add(widthTextFiled);
JPanel centerPanel = new JPanel(new BorderLayout());
centerPanel.add(targetFramePanel, BorderLayout.WEST);
centerPanel.add(newWindowConfPane, BorderLayout.EAST);
newWindowConfPane.setVisible(false);
centerPane.add(centerPanel);
targetFrameComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
newWindowConfPane.setVisible(DIALOG == targetFrameComboBox.getSelectedIndex());
}
});
this.add(this.setFootPanel(), BorderLayout.SOUTH);
}
protected String[] getTargetFrames() {
return new String[]{Inter.getLocText("Hyperlink-New_Window"), Inter.getLocText("FR-Hyperlink_Dialog"), Inter.getLocText("Hyperlink-Self_Window")};
}
protected abstract JPanel setHeaderPanel();
protected abstract JPanel setFootPanel();
protected abstract void populateSubHyperlinkBean(T link);
public UIComboBox getTargetFrameComboBox() {
return targetFrameComboBox;
}
public void setTargetFrameComboBox(UIComboBox targetFrameComboBox) {
this.targetFrameComboBox = targetFrameComboBox;
}
public UINumberField getHeightTextFiled() {
return heightTextFiled;
}
public void setHeightTextFiled(UINumberField heightTextFiled) {
this.heightTextFiled = heightTextFiled;
}
public UINumberField getWidthTextFiled() {
return widthTextFiled;
}
public void setWidthTextFiled(UINumberField widthTextFiled) {
this.widthTextFiled = widthTextFiled;
}
@Override
public void populateBean(T link) {
String name = link.getTargetFrame();
targetFrameComboBox.setSelectedIndex(HyperlinkTargetFrame.convert(name));
heightTextFiled.setText(String.valueOf(link.getHeight() == 0 ? DEFAULT_H_VALUE : link.getHeight()));
widthTextFiled.setText(String.valueOf(link.getWidth() == 0 ? DEFAULT_V_VALUE : link.getWidth()));
populateSubHyperlinkBean(link);
}
protected abstract T updateSubHyperlinkBean();
protected abstract void updateSubHyperlinkBean(T t);
@Override
public T updateBean() {
T link = updateSubHyperlinkBean();
updateBean(link);
return link;
}
public void updateBean(T link) {
updateSubHyperlinkBean(link);
link.setTargetFrame(HyperlinkTargetFrame.parse(targetFrameComboBox.getSelectedIndex()).getName());
link.setHeight(Utils.objectToNumber(heightTextFiled.getText(), false).intValue());
link.setWidth(Utils.objectToNumber(widthTextFiled.getText(), false).intValue());
}
}

144
designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java

@ -1,144 +0,0 @@
package com.fr.design.hyperlink;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.js.Hyperlink;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public abstract class AbstractHyperlinkPane<T extends Hyperlink> extends BasicBeanPane<T> {
public static final int NEW_WINDOW = 0;
public static final int DIALOG = 1;
public static final int SELF = 2;
public static final int DEFAULT_H_VALUE = 400;
public static final int DEFAULT_V_VALUE = 600;
private JPanel headerPane;
private UIComboBox targetFrameComboBox;
private UINumberField heightTextFiled;
private UINumberField widthTextFiled;
public AbstractHyperlinkPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
headerPane = this.setHeaderPanel();
this.add(headerPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
targetFrameComboBox = new UIComboBox(getTargetFrames());
targetFrameComboBox.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
return this;
}
});
JPanel targetFramePanel = new JPanel();
targetFramePanel.add(new UILabel(Inter.getLocText("Hyperlink-Link_Opened_in")));
targetFramePanel.add(targetFrameComboBox);
targetFrameComboBox.setEditable(true);
targetFrameComboBox.setPreferredSize(new Dimension(100, 20));
final JPanel newWindowConfPane = new JPanel();
newWindowConfPane.add(new UILabel(Inter.getLocText("FR-Designer_Height") + ": "));
heightTextFiled = new UINumberField();
heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE));
heightTextFiled.setPreferredSize(new Dimension(40, 20));
newWindowConfPane.add(heightTextFiled);
newWindowConfPane.add(new UILabel(" " + Inter.getLocText("FR-Designer_Width") + ": "));
widthTextFiled = new UINumberField();
widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE));
widthTextFiled.setPreferredSize(new Dimension(40, 20));
newWindowConfPane.add(widthTextFiled);
JPanel centerPanel = new JPanel(new BorderLayout());
centerPanel.add(targetFramePanel, BorderLayout.WEST);
centerPanel.add(newWindowConfPane, BorderLayout.EAST);
newWindowConfPane.setVisible(false);
centerPane.add(centerPanel);
targetFrameComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
newWindowConfPane.setVisible(DIALOG == targetFrameComboBox.getSelectedIndex());
}
});
this.add(this.setFootPanel(), BorderLayout.SOUTH);
}
protected String[] getTargetFrames(){
return new String[]{Inter.getLocText("Hyperlink-New_Window"), Inter.getLocText("FR-Hyperlink_Dialog"), Inter.getLocText("Hyperlink-Self_Window")};
}
protected abstract JPanel setHeaderPanel();
protected abstract JPanel setFootPanel();
protected abstract void populateSubHyperlinkBean(T link);
public UIComboBox getTargetFrameComboBox() {
return targetFrameComboBox;
}
public void setTargetFrameComboBox(UIComboBox targetFrameComboBox) {
this.targetFrameComboBox = targetFrameComboBox;
}
public UINumberField getHeightTextFiled() {
return heightTextFiled;
}
public void setHeightTextFiled(UINumberField heightTextFiled) {
this.heightTextFiled = heightTextFiled;
}
public UINumberField getWidthTextFiled() {
return widthTextFiled;
}
public void setWidthTextFiled(UINumberField widthTextFiled) {
this.widthTextFiled = widthTextFiled;
}
@Override
public void populateBean(T link) {
String name = link.getTargetFrame();
targetFrameComboBox.setSelectedIndex(HyperlinkTargetFrame.convert(name));
heightTextFiled.setText(String.valueOf(link.getHeight() == 0 ? DEFAULT_H_VALUE : link.getHeight()));
widthTextFiled.setText(String.valueOf(link.getWidth() == 0 ? DEFAULT_V_VALUE : link.getWidth()));
populateSubHyperlinkBean(link);
}
protected abstract T updateSubHyperlinkBean();
protected abstract void updateSubHyperlinkBean(T t);
@Override
public T updateBean() {
T link = updateSubHyperlinkBean();
updateBean(link);
return link;
}
public void updateBean(T link) {
updateSubHyperlinkBean(link);
link.setTargetFrame(HyperlinkTargetFrame.parse(targetFrameComboBox.getSelectedIndex()).getName());
link.setHeight(Utils.objectToNumber(heightTextFiled.getText(), false).intValue());
link.setWidth(Utils.objectToNumber(widthTextFiled.getText(), false).intValue());
}
}

47
designer_base/src/com/fr/design/hyperlink/ReporletHyperNorthPane.java

@ -1,38 +1,33 @@
package com.fr.design.hyperlink; package com.fr.design.hyperlink;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.itree.filetree.ReportletPane; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.filetree.ReportletPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
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.dialog.BasicDialog; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.js.ReportletHyperlink; import com.fr.js.ReportletHyperlink;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* 热点链接部分 上方 定义特征 样式 报表 等属性的界面. * 热点链接部分 上方 定义特征 样式 报表 等属性的界面.
* *
* @author kunsnat * @author kunsnat
*/ */
public class ReporletHyperNorthPane extends AbstractHyperlinkPane<ReportletHyperlink> { public class ReporletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyperlink> {
private UITextField itemNameTextField; private UITextField itemNameTextField;
private boolean needRenamePane = false; private boolean needRenamePane = false;
private UITextField reportPathTextField; private UITextField reportPathTextField;
@ -70,7 +65,7 @@ public class ReporletHyperNorthPane extends AbstractHyperlinkPane<ReportletHyper
reportPathTextField = new UITextField(20); reportPathTextField = new UITextField(20);
reportletNamePane.add(reportPathTextField, BorderLayout.CENTER); reportletNamePane.add(reportPathTextField, BorderLayout.CENTER);
browserButton = new UIButton(Inter.getLocText("Select")); browserButton = new UIButton(Inter.getLocText("FR-Designer_Select"));
browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20)); browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, 20));
reportletNamePane.add(browserButton, BorderLayout.EAST); reportletNamePane.add(browserButton, BorderLayout.EAST);
browserButton.addActionListener(new ActionListener() { browserButton.addActionListener(new ActionListener() {
@ -89,15 +84,15 @@ public class ReporletHyperNorthPane extends AbstractHyperlinkPane<ReportletHyper
}); });
Component[][] components; Component[][] components;
if(!this.needRenamePane){ if (!this.needRenamePane) {
components = new Component[][]{ components = new Component[][]{
{new UILabel(" " + Inter.getLocText("Reportlet") + ":"), reportletNamePane}, {new UILabel(" " + Inter.getLocText("FR-Hyperlink_Reportlet") + ":"), reportletNamePane},
}; };
}else{ } else {
itemNameTextField = new UITextField(); itemNameTextField = new UITextField();
components = new Component[][]{ components = new Component[][]{
{new UILabel(" " + Inter.getLocText("Name") + ":"), itemNameTextField}, {new UILabel(" " + Inter.getLocText("FR-Designer-Hyperlink_Name") + ":"), itemNameTextField},
{new UILabel(" " + Inter.getLocText("Reportlet") + ":"), reportletNamePane}, {new UILabel(" " + Inter.getLocText("FR-Hyperlink_Reportlet") + ":"), reportletNamePane},
}; };
} }
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -112,7 +107,7 @@ public class ReporletHyperNorthPane extends AbstractHyperlinkPane<ReportletHyper
@Override @Override
protected void populateSubHyperlinkBean(ReportletHyperlink link) { protected void populateSubHyperlinkBean(ReportletHyperlink link) {
if(itemNameTextField != null){ if (itemNameTextField != null) {
this.itemNameTextField.setText(link.getItemName()); this.itemNameTextField.setText(link.getItemName());
} }
this.reportPathTextField.setText(link.getReportletPath()); this.reportPathTextField.setText(link.getReportletPath());
@ -130,7 +125,7 @@ public class ReporletHyperNorthPane extends AbstractHyperlinkPane<ReportletHyper
@Override @Override
protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) { protected void updateSubHyperlinkBean(ReportletHyperlink reportletHyperlink) {
if(itemNameTextField != null){ if (itemNameTextField != null) {
reportletHyperlink.setItemName(this.itemNameTextField.getText()); reportletHyperlink.setItemName(this.itemNameTextField.getText());
} }
reportletHyperlink.setReportletPath(this.reportPathTextField.getText()); reportletHyperlink.setReportletPath(this.reportPathTextField.getText());
@ -139,7 +134,7 @@ public class ReporletHyperNorthPane extends AbstractHyperlinkPane<ReportletHyper
} }
public String getReportletName() { public String getReportletName() {
return StringUtils.isBlank(this.reportPathTextField.getText()) ? "" : this.reportPathTextField.getText().substring(1); return StringUtils.isBlank(this.reportPathTextField.getText()) ? StringUtils.EMPTY : this.reportPathTextField.getText().substring(1);
} }
/** /**
@ -160,7 +155,7 @@ public class ReporletHyperNorthPane extends AbstractHyperlinkPane<ReportletHyper
} }
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
//do nothing
} }
} }

44
designer_base/src/com/fr/design/hyperlink/ReportletHyperlinkPane.java

@ -2,10 +2,6 @@ package com.fr.design.hyperlink;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.chart.BasePlot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
@ -22,21 +18,15 @@ import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.List; import java.util.List;
public class ReportletHyperlinkPane extends BasicBeanPane<ReportletHyperlink> { public class ReportletHyperlinkPane extends AbstractHyperLinkPane<ReportletHyperlink> {
private BasePlot plot;
private ReporletHyperNorthPane northPane; private ReporletHyperNorthPane northPane;
private ReportletParameterViewPane parameterViewPane = null;
private UICheckBox extendParametersCheckBox; private UICheckBox extendParametersCheckBox;
protected BasePlot getPlot() { public ReportletHyperlinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
return plot; super(hyperLinkEditorMap, needRenamePane);
}
public ReportletHyperlinkPane(BasePlot plot) {
super();
this.plot = plot;
this.initComponents(); this.initComponents();
} }
@ -62,22 +52,10 @@ public class ReportletHyperlinkPane extends BasicBeanPane<ReportletHyperlink> {
} }
@Override @Override
protected String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("FR-Hyperlink_Reportlet"); return Inter.getLocText("FR-Hyperlink_Reportlet");
} }
protected int getChartParaType() {
return plot != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE;
}
protected ValueEditorPane getValueEditorPane() {
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), plot);
}
protected boolean needRenamePane(){
return plot != null && plot.isNeedRenameHyperLinkPane();
}
@Override @Override
public void populateBean(ReportletHyperlink ob) { public void populateBean(ReportletHyperlink ob) {
northPane.populateBean(ob); northPane.populateBean(ob);
@ -146,11 +124,11 @@ public class ReportletHyperlinkPane extends BasicBeanPane<ReportletHyperlink> {
@Override @Override
public void checkEnabled() { public void checkEnabled() {
//do nothing
} }
} }
public static class CHART_NO_RENAME extends ReportletHyperlinkPane { public static class ChartNoRename extends ReportletHyperlinkPane {
protected int getChartParaType() { protected int getChartParaType() {
return ParameterTableModel.CHART_NORMAL_USE; return ParameterTableModel.CHART_NORMAL_USE;
} }
@ -168,14 +146,6 @@ public class ReportletHyperlinkPane extends BasicBeanPane<ReportletHyperlink> {
this.northPane = northPane; this.northPane = northPane;
} }
public ReportletParameterViewPane getParameterViewPane() {
return parameterViewPane;
}
public void setParameterViewPane(ReportletParameterViewPane parameterViewPane) {
this.parameterViewPane = parameterViewPane;
}
public UICheckBox getExtendParametersCheckBox() { public UICheckBox getExtendParametersCheckBox() {
return extendParametersCheckBox; return extendParametersCheckBox;
} }

119
designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java

@ -2,7 +2,6 @@ package com.fr.design.hyperlink;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -16,35 +15,35 @@ import java.awt.*;
/** /**
* chart 网页链接 定义属性 target url 特征的 界面 * chart 网页链接 定义属性 target url 特征的 界面
* *
* @author kunsnat * @author kunsnat
*/ */
public class WebHyperNorthPane extends AbstractHyperlinkPane<WebHyperlink> { public class WebHyperNorthPane extends AbstractHyperNorthPane<WebHyperlink> {
private UITextField itemNameTextField; private UITextField itemNameTextField;
private boolean needRenamePane = false; private boolean needRenamePane = false;
private UITextField urlTextField; private UITextField urlTextField;
public WebHyperNorthPane(boolean needRenamePane){ public WebHyperNorthPane(boolean needRenamePane) {
this.needRenamePane = needRenamePane; this.needRenamePane = needRenamePane;
this.inits(); this.inits();
} }
public WebHyperNorthPane() { public WebHyperNorthPane() {
this.inits(); this.inits();
} }
/** /**
* 初始化 * 初始化
* *
* @date 2014-4-11 * @date 2014-4-11
*/ */
public void inits() { public void inits() {
super.initComponents(); super.initComponents();
} }
@Override @Override
protected JPanel setHeaderPanel() { protected JPanel setHeaderPanel() {
JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel headerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel urlPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); JPanel urlPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
urlTextField = new UITextField(24); urlTextField = new UITextField(24);
@ -56,57 +55,57 @@ public class WebHyperNorthPane extends AbstractHyperlinkPane<WebHyperlink> {
urlWithHelp.add(GUICoreUtils.createNamedPane(urlPane, "URL:")); urlWithHelp.add(GUICoreUtils.createNamedPane(urlPane, "URL:"));
//urlWithHelp.add(label); //urlWithHelp.add(label);
if(this.needRenamePane){ if (this.needRenamePane) {
headerPane.setLayout(new BorderLayout(LayoutConstants.VGAP_LARGE,LayoutConstants.VGAP_SMALL)); headerPane.setLayout(new BorderLayout(LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_SMALL));
itemNameTextField = new UITextField(); itemNameTextField = new UITextField();
headerPane.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Designer_Name") + ":"), BorderLayout.NORTH); headerPane.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Designer_Name") + ":"), BorderLayout.NORTH);
headerPane.add(urlWithHelp, BorderLayout.CENTER); headerPane.add(urlWithHelp, BorderLayout.CENTER);
}else{ } else {
headerPane.add(urlWithHelp, BorderLayout.NORTH); headerPane.add(urlWithHelp, BorderLayout.NORTH);
} }
return headerPane; return headerPane;
} }
public String getURL() { public String getURL() {
return this.urlTextField.getText(); return this.urlTextField.getText();
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "web"; return "web";
} }
@Override @Override
protected void populateSubHyperlinkBean(WebHyperlink link) { protected void populateSubHyperlinkBean(WebHyperlink link) {
String url = link.getURL(); String url = link.getURL();
if (StringUtils.isBlank(url)) { if (StringUtils.isBlank(url)) {
url = ConfigManager.getProviderInstance().getHyperlinkAddress(); url = ConfigManager.getProviderInstance().getHyperlinkAddress();
} }
this.urlTextField.setText(url); this.urlTextField.setText(url);
if(itemNameTextField != null){ if (itemNameTextField != null) {
this.itemNameTextField.setText(link.getItemName()); this.itemNameTextField.setText(link.getItemName());
} }
} }
@Override @Override
protected WebHyperlink updateSubHyperlinkBean() { protected WebHyperlink updateSubHyperlinkBean() {
WebHyperlink webHyperlink = new WebHyperlink(); WebHyperlink webHyperlink = new WebHyperlink();
updateSubHyperlinkBean(webHyperlink); updateSubHyperlinkBean(webHyperlink);
return webHyperlink; return webHyperlink;
} }
protected void updateSubHyperlinkBean(WebHyperlink webHyperlink) { protected void updateSubHyperlinkBean(WebHyperlink webHyperlink) {
webHyperlink.setURL(this.urlTextField.getText()); webHyperlink.setURL(this.urlTextField.getText());
if(itemNameTextField != null){ if (itemNameTextField != null) {
webHyperlink.setItemName(this.itemNameTextField.getText()); webHyperlink.setItemName(this.itemNameTextField.getText());
} }
} }
@Override @Override
protected JPanel setFootPanel() { protected JPanel setFootPanel() {
return new JPanel(); return new JPanel();
} }
} }

203
designer_base/src/com/fr/design/hyperlink/WebHyperlinkPane.java

@ -1,10 +1,6 @@
package com.fr.design.hyperlink; package com.fr.design.hyperlink;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.chart.BasePlot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
@ -16,142 +12,117 @@ import com.fr.stable.ParameterProvider;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
public class WebHyperlinkPane extends BasicBeanPane<WebHyperlink> { public class WebHyperlinkPane extends AbstractHyperLinkPane<WebHyperlink> {
private BasePlot plot; private static final int BORDER_WIDTH = 4;
private WebHyperNorthPane northPane; private WebHyperNorthPane northPane;
private ReportletParameterViewPane parameterViewPane;
private UICheckBox useCJKCheckBox; private UICheckBox useCJKCheckBox;
private UICheckBox extendParametersCheckBox; private UICheckBox extendParametersCheckBox;
protected BasePlot getPlot() { public WebHyperlinkPane() {
return plot; super();
} this.initComponents();
}
public WebHyperlinkPane() {
super(); public WebHyperlinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
this.initComponents(); super(hyperLinkEditorMap, needRenamePane);
} this.initComponents();
}
public WebHyperlinkPane(BasePlot plot) {
super(); protected void initComponents() {
this.plot = plot; this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.initComponents(); this.setBorder(BorderFactory.createEmptyBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH));
}
northPane = new WebHyperNorthPane(needRenamePane());
protected void initComponents() { this.add(northPane, BorderLayout.NORTH);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
this.add(parameterViewPane, BorderLayout.CENTER);
northPane = new WebHyperNorthPane(needRenamePane()); parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Parameters"), null));
this.add(northPane, BorderLayout.NORTH);
useCJKCheckBox = new UICheckBox(Inter.getLocText("Hyperlink-Use_CJK_to_encode_parameter"));
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
this.add(parameterViewPane, BorderLayout.CENTER);
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Parameters"), null));
useCJKCheckBox = new UICheckBox(Inter.getLocText("Hyperlink-Use_CJK_to_encode_parameter"));
extendParametersCheckBox = new UICheckBox(Inter.getLocText("Hyperlink-Extends_Report_Parameters")); extendParametersCheckBox = new UICheckBox(Inter.getLocText("Hyperlink-Extends_Report_Parameters"));
this.add(GUICoreUtils.createFlowPane(new Component[] {useCJKCheckBox, extendParametersCheckBox}, FlowLayout.LEFT), BorderLayout.SOUTH); this.add(GUICoreUtils.createFlowPane(new Component[]{useCJKCheckBox, extendParametersCheckBox}, FlowLayout.LEFT), BorderLayout.SOUTH);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Hyperlink-Web_link");
}
protected int getChartParaType() {
return plot != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE;
}
protected ValueEditorPane getValueEditorPane() {
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), plot);
}
protected boolean needRenamePane(){
return plot != null && plot.isNeedRenameHyperLinkPane();
} }
@Override @Override
public void populateBean(WebHyperlink ob) { public String title4PopupWindow() {
northPane.populateBean(ob); return Inter.getLocText("Hyperlink-Web_link");
//parameter }
List<ParameterProvider> parameterList = this.parameterViewPane.update();
parameterList.clear();
ParameterProvider[] parameters = ob.getParameters();
parameterViewPane.populate(parameters);
useCJKCheckBox.setSelected(ob.isUseCJK());
extendParametersCheckBox.setSelected(ob.isExtendParameters());
}
@Override @Override
public WebHyperlink updateBean() { public void populateBean(WebHyperlink ob) {
WebHyperlink webHyperlink = new WebHyperlink(); northPane.populateBean(ob);
//parameter
updateBean(webHyperlink); List<ParameterProvider> parameterList = this.parameterViewPane.update();
parameterList.clear();
return webHyperlink;
} ParameterProvider[] parameters = ob.getParameters();
parameterViewPane.populate(parameters);
useCJKCheckBox.setSelected(ob.isUseCJK());
extendParametersCheckBox.setSelected(ob.isExtendParameters());
}
@Override
public WebHyperlink updateBean() {
WebHyperlink webHyperlink = new WebHyperlink();
updateBean(webHyperlink);
return webHyperlink;
}
public void updateBean(WebHyperlink webHyperlink) { public void updateBean(WebHyperlink webHyperlink) {
northPane.updateBean(webHyperlink); northPane.updateBean(webHyperlink);
//Parameter. //Parameter.
List<ParameterProvider> parameterList = this.parameterViewPane.update(); List<ParameterProvider> parameterList = this.parameterViewPane.update();
if (!parameterList.isEmpty()) { if (!parameterList.isEmpty()) {
Parameter[] parameters = new Parameter[parameterList.size()]; Parameter[] parameters = new Parameter[parameterList.size()];
parameterList.toArray(parameters); parameterList.toArray(parameters);
webHyperlink.setParameters(parameters); webHyperlink.setParameters(parameters);
} else { } else {
webHyperlink.setParameters(null); webHyperlink.setParameters(null);
} }
webHyperlink.setUseCJK(this.useCJKCheckBox.isSelected()); webHyperlink.setUseCJK(this.useCJKCheckBox.isSelected());
webHyperlink.setExtendParameters(this.extendParametersCheckBox.isSelected()); webHyperlink.setExtendParameters(this.extendParametersCheckBox.isSelected());
} }
public static class CHART_NO_RENAME extends WebHyperlinkPane{ public static class ChartNoRename extends WebHyperlinkPane {
protected boolean needRenamePane(){ protected boolean needRenamePane() {
return false; return false;
} }
protected int getChartParaType() { protected int getChartParaType() {
return ParameterTableModel.CHART_NORMAL_USE; return ParameterTableModel.CHART_NORMAL_USE;
} }
} }
public WebHyperNorthPane getNorthPane() { public WebHyperNorthPane getNorthPane() {
return northPane; return northPane;
} }
public void setNorthPane(WebHyperNorthPane northPane) {
this.northPane = northPane;
}
public ReportletParameterViewPane getParameterViewPane() {
return parameterViewPane;
}
public void setParameterViewPane(ReportletParameterViewPane parameterViewPane) { public void setNorthPane(WebHyperNorthPane northPane) {
this.parameterViewPane = parameterViewPane; this.northPane = northPane;
} }
public UICheckBox getUseCJKCheckBox() { public UICheckBox getUseCJKCheckBox() {
return useCJKCheckBox; return useCJKCheckBox;
} }
public void setUseCJKCheckBox(UICheckBox useCJKCheckBox) { public void setUseCJKCheckBox(UICheckBox useCJKCheckBox) {
this.useCJKCheckBox = useCJKCheckBox; this.useCJKCheckBox = useCJKCheckBox;
} }
public UICheckBox getExtendParametersCheckBox() { public UICheckBox getExtendParametersCheckBox() {
return extendParametersCheckBox; return extendParametersCheckBox;
} }
public void setExtendParametersCheckBox(UICheckBox extendParametersCheckBox) { public void setExtendParametersCheckBox(UICheckBox extendParametersCheckBox) {
this.extendParametersCheckBox = extendParametersCheckBox; this.extendParametersCheckBox = extendParametersCheckBox;
} }
} }

351
designer_base/src/com/fr/design/javascript/JavaScriptImplPane.java

@ -1,16 +1,13 @@
package com.fr.design.javascript; package com.fr.design.javascript;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.chart.BasePlot;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.data.tabledata.tabledatapane.OneListTableModel; import com.fr.design.data.tabledata.tabledatapane.OneListTableModel;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction; import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -23,222 +20,212 @@ import javax.swing.*;
import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener; import javax.swing.event.TableModelListener;
import java.awt.*; import java.awt.*;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
public class JavaScriptImplPane extends FurtherBasicBeanPane<JavaScriptImpl> { public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
private BasePlot plot; private static final int BOTTOM_BORDER = 12;
private UITextField itemNameTextField; private UITextField itemNameTextField;
private JSContentPane jsPane; private JSContentPane jsPane;
private UITableEditorPane<String> importedJsPane; private UITableEditorPane<String> importedJsPane;
private ReportletParameterViewPane parameterPane; private ReportletParameterViewPane parameterPane;
private String[] defaultArgs; private String[] defaultArgs;
protected BasePlot getPlot() {
return plot; public JavaScriptImplPane() {
} this(new String[0]);
}
public JavaScriptImplPane() {
this(new String[0]); public JavaScriptImplPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
} super(hyperLinkEditorMap, needRenamePane);
this.defaultArgs = new String[0];
public JavaScriptImplPane(BasePlot plot) { initComponents();
this.plot = plot; }
this.defaultArgs = new String[0];
initComponents();
} public JavaScriptImplPane(String[] args) {
this.defaultArgs = args;
initComponents();
public JavaScriptImplPane(String[] args) { }
this.defaultArgs = args;
initComponents(); protected void initComponents() {
} parameterPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Designer_Parameter")));
protected void initComponents() { parameterPane.addTableEditorListener(new TableModelListener() {
parameterPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); public void tableChanged(TableModelEvent e) {
parameterPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Designer_Parameter"))); List<ParameterProvider> list = parameterPane.update();
parameterPane.addTableEditorListener(new TableModelListener() { HashSet tempSet = new HashSet();
public void tableChanged(TableModelEvent e) { for (int i = 0; i < list.size(); i++) {
List<ParameterProvider> list = parameterPane.update(); if (StringUtils.isEmpty(list.get(i).getName())) {
HashSet tempSet = new HashSet(); continue;
for (int i = 0; i < list.size(); i++) { }
if (StringUtils.isEmpty(list.get(i).getName())) { if (tempSet.contains(list.get(i).toString())) {
continue; list.remove(i);
} JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Repeat", "Parameter_Name"}) + "!");
if (tempSet.contains(list.get(i).toString())) { parameterChanger(list);
list.remove(i); return;
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Repeat", "Parameter_Name"}) + "!"); }
parameterChanger(list); tempSet.add(list.get(i).toString());
return; }
} parameterChanger(list);
tempSet.add(list.get(i).toString()); }
} });
parameterChanger(list);
} OneListTableModel<String> model = new OneListTableModel<String>(Inter.getLocText("ReportServerP-Import_JavaScript"), this) {
});
public UITableEditAction[] createAction() {
OneListTableModel<String> model = new OneListTableModel<String>(Inter.getLocText("ReportServerP-Import_JavaScript"), this) { return new UITableEditAction[]{getAddAction(), new DeleteAction(this.component), new MoveUpAction(), new MoveDownAction()};
}
public UITableEditAction[] createAction() {
return new UITableEditAction[] { getAddAction(),new DeleteAction(this.component), new MoveUpAction(), new MoveDownAction() }; @Override
} public UITableEditAction getAddAction() {
return new AddJsAction();
@Override }
public UITableEditAction getAddAction() { };
return new AddJsAction(); importedJsPane = new UITableEditorPane<String>(model);
} importedJsPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("ReportServerP-Import_JavaScript")));
}; importedJsPane.setPreferredSize(new Dimension(265, 150));
importedJsPane = new UITableEditorPane<String>(model); jsPane = new JSContentPane(defaultArgs);
importedJsPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("ReportServerP-Import_JavaScript"))); jsPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Designer_JavaScript")));
importedJsPane.setPreferredSize(new Dimension(265, 150));
jsPane = new JSContentPane(defaultArgs); parameterPane.setPreferredSize(new Dimension(265, 150));
jsPane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Designer_JavaScript"))); JPanel topPane = GUICoreUtils.createBorderLayoutPane(
importedJsPane, BorderLayout.CENTER,
parameterPane.setPreferredSize(new Dimension(265, 150)); parameterPane, BorderLayout.EAST
JPanel topPane = GUICoreUtils.createBorderLayoutPane( );
importedJsPane, BorderLayout.CENTER, topPane.setPreferredSize(new Dimension(300, 150));
parameterPane, BorderLayout.EAST topPane.setBorder(BorderFactory.createEmptyBorder(0, 0, BOTTOM_BORDER, 0));
);
topPane.setPreferredSize(new Dimension(300, 150)); this.setLayout(new BorderLayout());
topPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 12, 0)); this.add(topPane, BorderLayout.NORTH);
this.add(jsPane, BorderLayout.CENTER);
this.setLayout(new BorderLayout());
this.add(topPane,BorderLayout.NORTH) ; this.reLayoutForChart();
this.add(jsPane,BorderLayout.CENTER); }
this.reLayoutForChart(); /**
} * 参数改变
*
protected int getChartParaType() { * @param list 参数列表.
return plot != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE; */
} public void parameterChanger(List<ParameterProvider> list) {
String[] name = new String[list.size()];
protected ValueEditorPane getValueEditorPane() { for (int i = 0; i < list.size(); i++) {
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), plot); if (list.get(i) instanceof Parameter) {
} name[i] = list.get(i).getName();
}
protected boolean needRenamePane(){ }
return plot != null && plot.isNeedRenameHyperLinkPane(); jsPane.setFunctionTitle(name, defaultArgs);
} }
/** /**
*参数改变 * title for popup window 弹出界面标题
* @param list 参数列表. *
*/ * @return 标题.
public void parameterChanger(List<ParameterProvider> list) { */
String[] name = new String[list.size()]; public String title4PopupWindow() {
for (int i = 0; i < list.size(); i++) { return Inter.getLocText("FR-Designer_JavaScript");
if (list.get(i) instanceof Parameter) { }
name[i] = list.get(i).getName();
}
}
jsPane.setFunctionTitle(name, defaultArgs);
}
/**
* title for popup window 弹出界面标题
* @return 标题.
*/
public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_JavaScript");
}
/** /**
* 重置 * 重置
*/ */
public void reset() { public void reset() {
populateBean(null); populateBean(null);
} }
public void populateBean(JavaScriptImpl javaScriptImpl) { public void populateBean(JavaScriptImpl javaScriptImpl) {
if (javaScriptImpl == null) { if (javaScriptImpl == null) {
javaScriptImpl = new JavaScriptImpl(); javaScriptImpl = new JavaScriptImpl();
} }
int rowCount = javaScriptImpl.getJSImportSize(); int rowCount = javaScriptImpl.getJSImportSize();
String[] value = new String[rowCount]; String[] value = new String[rowCount];
for (int i = 0; i < rowCount; i++) { for (int i = 0; i < rowCount; i++) {
value[i] = javaScriptImpl.getJSImport(i); value[i] = javaScriptImpl.getJSImport(i);
} }
importedJsPane.populate(value); importedJsPane.populate(value);
parameterPane.populate(javaScriptImpl.getParameters()); parameterPane.populate(javaScriptImpl.getParameters());
jsPane.populate(javaScriptImpl.getContent()); jsPane.populate(javaScriptImpl.getContent());
if(itemNameTextField != null){ if (itemNameTextField != null) {
itemNameTextField.setText(javaScriptImpl.getItemName()); itemNameTextField.setText(javaScriptImpl.getItemName());
} }
} }
public JavaScriptImpl updateBean() { public JavaScriptImpl updateBean() {
JavaScriptImpl javaScript = new JavaScriptImpl(); JavaScriptImpl javaScript = new JavaScriptImpl();
updateBean(javaScript); updateBean(javaScript);
return javaScript; return javaScript;
} }
public void updateBean(JavaScriptImpl javaScript) { public void updateBean(JavaScriptImpl javaScript) {
List<String> list = importedJsPane.update(); List<String> list = importedJsPane.update();
javaScript.clearJSImports(); javaScript.clearJSImports();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
String a = list.get(i); String a = list.get(i);
javaScript.addJSImort(a); javaScript.addJSImort(a);
} }
List<ParameterProvider> parameterList = parameterPane.update(); List<ParameterProvider> parameterList = parameterPane.update();
javaScript.setParameters(parameterList.toArray(new Parameter[parameterList.size()])); javaScript.setParameters(parameterList.toArray(new Parameter[parameterList.size()]));
javaScript.setContent(jsPane.update()); javaScript.setContent(jsPane.update());
if(this.itemNameTextField != null){ if (this.itemNameTextField != null) {
javaScript.setItemName(itemNameTextField.getText()); javaScript.setItemName(itemNameTextField.getText());
} }
} }
private GridBagConstraints setConstraints(int x, int y, int w, int h, double wx, double wy, GridBagConstraints c) { private GridBagConstraints setConstraints(int x, int y, int w, int h, double wx, double wy, GridBagConstraints c) {
if (c == null) { if (c == null) {
return null; return null;
} }
c.gridx = x; c.gridx = x;
c.gridy = y; c.gridy = y;
c.gridheight = h; c.gridheight = h;
c.gridwidth = w; c.gridwidth = w;
c.weightx = wx; c.weightx = wx;
c.weighty = wy; c.weighty = wy;
return c; return c;
} }
protected void reLayoutForChart(){ protected void reLayoutForChart() {
if(needRenamePane()){ if (needRenamePane()) {
this.removeAll(); this.removeAll();
itemNameTextField = new UITextField(); itemNameTextField = new UITextField();
JPanel topPane = GUICoreUtils.createBorderLayoutPane( JPanel topPane = GUICoreUtils.createBorderLayoutPane(
GUICoreUtils.createNamedPane(itemNameTextField,Inter.getLocText("FR-Chart-Use_Name") + ":"), BorderLayout.NORTH, GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Chart-Use_Name") + ":"), BorderLayout.NORTH,
importedJsPane, BorderLayout.CENTER, importedJsPane, BorderLayout.CENTER,
parameterPane, BorderLayout.EAST parameterPane, BorderLayout.EAST
); );
topPane.setPreferredSize(new Dimension(300, 150)); topPane.setPreferredSize(new Dimension(300, 150));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(topPane,BorderLayout.NORTH) ; this.add(topPane, BorderLayout.NORTH);
this.add(jsPane,BorderLayout.CENTER); this.add(jsPane, BorderLayout.CENTER);
this.repaint(); this.repaint();
} }
} }
public static class CHART_NO_RENAME extends JavaScriptImplPane{ public static class ChartNoRename extends JavaScriptImplPane {
protected int getChartParaType() { protected int getChartParaType() {
return ParameterTableModel.CHART_NORMAL_USE; return ParameterTableModel.CHART_NORMAL_USE;
} }
protected boolean needRenamePane(){
protected boolean needRenamePane() {
return false; return false;
} }
} }
/** /**
* 判断类型 * 判断类型
* @param ob 判断目标 *
* @param ob 判断目标
* @return 返回是否符合类型. * @return 返回是否符合类型.
*/ */
public boolean accept(Object ob) { public boolean accept(Object ob) {
return ob instanceof JavaScriptImpl; return ob instanceof JavaScriptImpl;
} }
} }

92
designer_base/src/com/fr/design/javascript/ParameterJavaScriptPane.java

@ -1,99 +1,81 @@
package com.fr.design.javascript; package com.fr.design.javascript;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.chart.BasePlot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.js.ParameterJavaScript; import com.fr.js.ParameterJavaScript;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import java.awt.*; import java.awt.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
public class ParameterJavaScriptPane extends BasicBeanPane<ParameterJavaScript> { public class ParameterJavaScriptPane extends AbstractHyperLinkPane<ParameterJavaScript> {
private BasePlot plot;
private UITextField itemNameTextField; private UITextField itemNameTextField;
private ReportletParameterViewPane parameterViewPane;
protected BasePlot getPlot() {
return plot;
}
public ParameterJavaScriptPane(){ public ParameterJavaScriptPane() {
this(null); this(null, false);
} }
public ParameterJavaScriptPane(BasePlot plot){ public ParameterJavaScriptPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
this.plot = plot; super(hyperLinkEditorMap, needRenamePane);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
this.add(parameterViewPane, BorderLayout.CENTER); this.add(parameterViewPane, BorderLayout.CENTER);
if(needRenamePane()){ if (needRenamePane()) {
itemNameTextField = new UITextField(); itemNameTextField = new UITextField();
this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("Name") + ":"), BorderLayout.NORTH); this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Designer-Hyperlink_Name") + ":"), BorderLayout.NORTH);
} }
}
protected int getChartParaType() {
return plot != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE;
}
protected ValueEditorPane getValueEditorPane() {
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), plot);
} }
protected boolean needRenamePane(){ @Override
return plot != null && plot.isNeedRenameHyperLinkPane(); public String title4PopupWindow() {
return Inter.getLocText("JavaScript-Dynamic_Parameters");
} }
@Override
protected String title4PopupWindow() {
return Inter.getLocText("JavaScript-Dynamic_Parameters");
}
@Override @Override
public void populateBean(ParameterJavaScript ob){ public void populateBean(ParameterJavaScript ob) {
ParameterProvider[] parameters = ob.getParameters(); ParameterProvider[] parameters = ob.getParameters();
if (parameters.length == 0){ if (parameters.length == 0) {
// TODO ALEX_SEP // TODO ALEX_SEP
// parameters = DesignUtils.getEditingTemplateReport().getTemplateWorkBook().getParameters(); // parameters = DesignUtils.getEditingTemplateReport().getTemplateWorkBook().getParameters();
} }
parameterViewPane.populate(parameters); parameterViewPane.populate(parameters);
if(itemNameTextField != null){ if (itemNameTextField != null) {
itemNameTextField.setText(ob.getItemName()); itemNameTextField.setText(ob.getItemName());
} }
} }
@Override @Override
public ParameterJavaScript updateBean(){ public ParameterJavaScript updateBean() {
ParameterJavaScript js = new ParameterJavaScript(); ParameterJavaScript js = new ParameterJavaScript();
updateBean(js); updateBean(js);
if(this.itemNameTextField != null){ if (this.itemNameTextField != null) {
js.setItemName(itemNameTextField.getText()); js.setItemName(itemNameTextField.getText());
} }
return js; return js;
} }
public void updateBean(ParameterJavaScript parameter) { public void updateBean(ParameterJavaScript parameter) {
List<ParameterProvider> parameterList = parameterViewPane.update(); List<ParameterProvider> parameterList = parameterViewPane.update();
parameter.setParameters(parameterList.toArray(new Parameter[parameterList.size()])); parameter.setParameters(parameterList.toArray(new Parameter[parameterList.size()]));
if(this.itemNameTextField != null){ if (this.itemNameTextField != null) {
parameter.setItemName(itemNameTextField.getText()); parameter.setItemName(itemNameTextField.getText());
} }
} }
public static class CHART_NO_RENAME extends ParameterJavaScriptPane{ public static class ChartNoRename extends ParameterJavaScriptPane {
protected int getChartParaType() { protected int getChartParaType() {
return ParameterTableModel.CHART_NORMAL_USE; return ParameterTableModel.CHART_NORMAL_USE;
} }
protected boolean needRenamePane(){
protected boolean needRenamePane() {
return false; return false;
} }
} }

108
designer_base/src/com/fr/design/module/DesignModule.java

@ -14,7 +14,11 @@ import com.fr.design.mainframe.App;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.ModuleContext; import com.fr.general.ModuleContext;
import com.fr.js.*; import com.fr.js.EmailJavaScript;
import com.fr.js.JavaScriptImpl;
import com.fr.js.ParameterJavaScript;
import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import com.fr.module.TopModule; import com.fr.module.TopModule;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
@ -32,65 +36,67 @@ import java.util.Set;
* 所有设计器模块的父类 * 所有设计器模块的父类
*/ */
public abstract class DesignModule extends TopModule { public abstract class DesignModule extends TopModule {
public static final String LOCALE_FILE_PATH = "com/fr/design/locale/designer"; public static final String LOCALE_FILE_PATH = "com/fr/design/locale/designer";
public void start() {
super.start(); public void start() {
App<?>[] apps = apps4TemplateOpener(); super.start();
for (App<?> app : apps) { App<?>[] apps = apps4TemplateOpener();
DesignerFrame.registApp(app); for (App<?> app : apps) {
} DesignerFrame.registApp(app);
}
ModuleContext.registerStartedModule(DesignModule.class.getName(), this); ModuleContext.registerStartedModule(DesignModule.class.getName(), this);
StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class); StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class);
ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement()); ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement());
ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement()); ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement());
DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes()); DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes());
} }
public boolean isStarted() { public boolean isStarted() {
return ModuleContext.isModuleStarted(DesignModule.class.getName()); return ModuleContext.isModuleStarted(DesignModule.class.getName());
} }
/** /**
* 返回设计器能打开的模板类型的一个数组列表 * 返回设计器能打开的模板类型的一个数组列表
* *
* @return 可以打开的模板类型的数组 * @return 可以打开的模板类型的数组
*/ */
public abstract App<?>[] apps4TemplateOpener(); public abstract App<?>[] apps4TemplateOpener();
/** /**
* 国际化文件路径 * 国际化文件路径
* @return 国际化文件路径 *
*/ * @return 国际化文件路径
public String[] getLocaleFile() { */
return new String[]{LOCALE_FILE_PATH}; public String[] getLocaleFile() {
} return new String[]{LOCALE_FILE_PATH};
}
public Class<?>[] actionsForInsertCellElement() { public Class<?>[] actionsForInsertCellElement() {
List<Class<?>> classes = new ArrayList<>(); List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) { for (ElementUIProvider provider : providers) {
classes.add(provider.actionForInsertCellElement()); classes.add(provider.actionForInsertCellElement());
} }
return classes.toArray(new Class<?>[classes.size()]); return classes.toArray(new Class<?>[classes.size()]);
} }
public Class<?>[] actionsForInsertFloatElement() { public Class<?>[] actionsForInsertFloatElement() {
List<Class<?>> classes = new ArrayList<>(); List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) { for (ElementUIProvider provider : providers) {
classes.add(provider.actionForInsertFloatElement()); classes.add(provider.actionForInsertFloatElement());
} }
return classes.toArray(new Class<?>[classes.size()]); return classes.toArray(new Class<?>[classes.size()]);
} }
public NameableCreator[] hyperlinkTypes() { public NameableCreator[] hyperlinkTypes() {
return new NameableCreator[]{ return new NameableCreator[]{
new NameObjectCreator(Inter.getLocText("FR-Hyperlink_Reportlet"), ReportletHyperlink.class, ReportletHyperlinkPane.CHART_NO_RENAME.class), new NameObjectCreator(Inter.getLocText("FR-Hyperlink_Reportlet"), ReportletHyperlink.class, ReportletHyperlinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_Email"), EmailJavaScript.class, EmailPane.class), new NameObjectCreator(Inter.getLocText("FR-Designer_Email"), EmailJavaScript.class, EmailPane.class),
new NameObjectCreator(Inter.getLocText("Hyperlink-Web_link"), WebHyperlink.class, WebHyperlinkPane.CHART_NO_RENAME.class), new NameObjectCreator(Inter.getLocText("Hyperlink-Web_link"), WebHyperlink.class, WebHyperlinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("JavaScript-Dynamic_Parameters"), ParameterJavaScript.class, ParameterJavaScriptPane.CHART_NO_RENAME.class), new NameObjectCreator(Inter.getLocText("JavaScript-Dynamic_Parameters"), ParameterJavaScript.class, ParameterJavaScriptPane.ChartNoRename.class),
new NameObjectCreator("JavaScript", JavaScriptImpl.class, JavaScriptImplPane.CHART_NO_RENAME.class) new NameObjectCreator("FR-Designer_JavaScript", JavaScriptImpl.class, JavaScriptImplPane.ChartNoRename.class)
}; };
} }
} }

180
designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -1,18 +1,14 @@
package com.fr.design.chart.series.SeriesCondition.impl; package com.fr.design.chart.series.SeriesCondition.impl;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BasePlot;
import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chart.web.ChartHyperPoplink; import com.fr.chart.web.ChartHyperPoplink;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.ChartHyperEditPane; import com.fr.design.mainframe.chart.ChartHyperEditPane;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
@ -21,133 +17,119 @@ import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import java.awt.*; import java.awt.*;
import java.util.HashMap;
/** /**
* 类说明: 图表超链 -- 弹出 悬浮窗. * 类说明: 图表超链 -- 弹出 悬浮窗.
*
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2011-12-28 上午10:41:39 * @version 创建时间2011-12-28 上午10:41:39
*/ */
public class ChartHyperPoplinkPane extends BasicBeanPane<ChartHyperPoplink> { public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPoplink> {
private static final long serialVersionUID = 2469115951510144738L; private static final long serialVersionUID = 2469115951510144738L;
private static final int EDIT_PANE_WIDTH = 248; private static final int EDIT_PANE_WIDTH = 248;
private UITextField itemNameTextField; private UITextField itemNameTextField;
private ChartHyperEditPane hyperEditPane; private ChartHyperEditPane hyperEditPane;
private ChartComponent chartComponent; private ChartComponent chartComponent;
private BasePlot plot;
public ChartHyperPoplinkPane() {
protected BasePlot getPlot() { this(null, false);
return plot; }
}
public ChartHyperPoplinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
public ChartHyperPoplinkPane() { super(hyperLinkEditorMap, needRenamePane);
this(null); this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
}
if (this.needRenamePane()) {
public ChartHyperPoplinkPane(BasePlot plot) {
this.plot = plot;
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
if(this.needRenamePane()){
itemNameTextField = new UITextField(); itemNameTextField = new UITextField();
this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Chart-Use_Name") + ":"), BorderLayout.NORTH); this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Chart-Use_Name") + ":"), BorderLayout.NORTH);
} }
hyperEditPane = new ChartHyperEditPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); hyperEditPane = new ChartHyperEditPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
hyperEditPane.setPreferredSize(new Dimension(EDIT_PANE_WIDTH, (int)hyperEditPane.getPreferredSize().getHeight()));// 固定属性配置面板大小,灵活调整图表显示面板. hyperEditPane.setPreferredSize(new Dimension(EDIT_PANE_WIDTH, (int) hyperEditPane.getPreferredSize().getHeight()));// 固定属性配置面板大小,灵活调整图表显示面板.
this.add(hyperEditPane, BorderLayout.WEST); this.add(hyperEditPane, BorderLayout.WEST);
ChartCollection cc = createChartCollection(); ChartCollection cc = createChartCollection();
chartComponent = new ChartComponent(); chartComponent = new ChartComponent();
chartComponent.setPreferredSize(new Dimension((int)this.getPreferredSize().getWidth()-EDIT_PANE_WIDTH, 170));// 在单元格弹出时 需要调整保证属性表的大小. chartComponent.setPreferredSize(new Dimension((int) this.getPreferredSize().getWidth() - EDIT_PANE_WIDTH, 170));// 在单元格弹出时 需要调整保证属性表的大小.
chartComponent.setSupportEdit(false); chartComponent.setSupportEdit(false);
chartComponent.populate(cc); chartComponent.populate(cc);
this.add(chartComponent, BorderLayout.CENTER); this.add(chartComponent, BorderLayout.CENTER);
hyperEditPane.populate(cc); hyperEditPane.populate(cc);
hyperEditPane.useChartComponent(chartComponent); hyperEditPane.useChartComponent(chartComponent);
} }
private ChartCollection createChartCollection() { private ChartCollection createChartCollection() {
ChartCollection cc = new ChartCollection(); ChartCollection cc = new ChartCollection();
Chart chart = ChartTypeManager.getFirstChart(); Chart chart = ChartTypeManager.getFirstChart();
if (chart != null){ if (chart != null) {
try { try {
cc.addChart((Chart)chart.clone()); cc.addChart((Chart) chart.clone());
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRLogger.getLogger().error(e.getMessage(), e); FRLogger.getLogger().error(e.getMessage(), e);
} }
}else { } else {
cc.addChart(new Chart(new Bar2DPlot())); cc.addChart(new Chart(new Bar2DPlot()));
} }
return cc; return cc;
} }
protected int getChartParaType() { @Override
return plot != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE; public String title4PopupWindow() {
} return Inter.getLocText("FR-Chart-Pop_Chart");
}
protected ValueEditorPane getValueEditorPane() {
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), plot); @Override
} public void populateBean(ChartHyperPoplink chartHyperlink) {
if (itemNameTextField != null) {
protected boolean needRenamePane(){
return plot != null && plot.isNeedRenameHyperLinkPane();
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Chart-Pop_Chart");
}
@Override
public void populateBean(ChartHyperPoplink chartHyperlink) {
if(itemNameTextField != null){
this.itemNameTextField.setText(chartHyperlink.getItemName()); this.itemNameTextField.setText(chartHyperlink.getItemName());
} }
BaseChartCollection cc = chartHyperlink.getChartCollection(); BaseChartCollection cc = chartHyperlink.getChartCollection();
if (cc == null || cc.getChartCount() < 1) { if (cc == null || cc.getChartCount() < 1) {
cc = createChartCollection(); cc = createChartCollection();
chartHyperlink.setChartCollection(cc); chartHyperlink.setChartCollection(cc);
} }
hyperEditPane.populateHyperLink(chartHyperlink); hyperEditPane.populateHyperLink(chartHyperlink);
chartComponent.populate(cc); chartComponent.populate(cc);
} }
/** /**
* 超链数组HyperlinkGoup切换时 updateBean. * 超链数组HyperlinkGoup切换时 updateBean.
* @return 返回的弹出超链. *
*/ * @return 返回的弹出超链.
public ChartHyperPoplink updateBean() { */
ChartHyperPoplink chartLink = new ChartHyperPoplink(); public ChartHyperPoplink updateBean() {
updateBean(chartLink); ChartHyperPoplink chartLink = new ChartHyperPoplink();
if(itemNameTextField != null){ updateBean(chartLink);
if (itemNameTextField != null) {
chartLink.setItemName(this.itemNameTextField.getText()); chartLink.setItemName(this.itemNameTextField.getText());
} }
return chartLink; return chartLink;
} }
/** /**
* 属性表 对应update * 属性表 对应update
*/ */
public void updateBean(ChartHyperPoplink chartHyperlink) { public void updateBean(ChartHyperPoplink chartHyperlink) {
hyperEditPane.updateHyperLink(chartHyperlink); hyperEditPane.updateHyperLink(chartHyperlink);
chartHyperlink.setChartCollection(chartComponent.update()); chartHyperlink.setChartCollection(chartComponent.update());
DesignModuleFactory.getChartPropertyPane().getChartEditPane().fire();// 响应整个图表保存事件等. DesignModuleFactory.getChartPropertyPane().getChartEditPane().fire();// 响应整个图表保存事件等.
if(itemNameTextField != null){ if (itemNameTextField != null) {
chartHyperlink.setItemName(this.itemNameTextField.getText()); chartHyperlink.setItemName(this.itemNameTextField.getText());
} }
} }
public static class CHART_NO_RENAME extends ChartHyperPoplinkPane{ public static class ChartNoRename extends ChartHyperPoplinkPane {
protected boolean needRenamePane(){ protected boolean needRenamePane() {
return false; return false;
} }
} }

193
designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateCellLinkPane.java

@ -1,15 +1,11 @@
package com.fr.design.chart.series.SeriesCondition.impl; package com.fr.design.chart.series.SeriesCondition.impl;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.chart.BasePlot;
import com.fr.chart.web.ChartHyperRelateCellLink; import com.fr.chart.web.ChartHyperRelateCellLink;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.columnrow.ColumnRowVerticalPane; import com.fr.design.gui.columnrow.ColumnRowVerticalPane;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -18,127 +14,110 @@ import com.fr.stable.ParameterProvider;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2011-12-28 下午02:51:10 * @version 创建时间2011-12-28 下午02:51:10
* 类说明: 图表超链 -- 关联单元格图表. * 类说明: 图表超链 -- 关联单元格图表.
*/ */
public class ChartHyperRelateCellLinkPane extends BasicBeanPane<ChartHyperRelateCellLink>{ public class ChartHyperRelateCellLinkPane extends AbstractHyperLinkPane<ChartHyperRelateCellLink> {
private static final long serialVersionUID = 7874948047886548990L; private static final long serialVersionUID = 7874948047886548990L;
private UITextField itemNameTextField; private UITextField itemNameTextField;
private ColumnRowVerticalPane colRowPane; private ColumnRowVerticalPane colRowPane;
private ReportletParameterViewPane parameterViewPane; private ReportletParameterViewPane parameterViewPane;
private BasePlot plot; public ChartHyperRelateCellLinkPane() {
this.initComponent();
protected BasePlot getPlot() { }
return plot;
} public ChartHyperRelateCellLinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
super(hyperLinkEditorMap, needRenamePane);
public ChartHyperRelateCellLinkPane() { this.initComponent();
this.initComponent(); }
}
private void initComponent() {
public ChartHyperRelateCellLinkPane(BasePlot plot) { this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
this.plot = plot; if (needRenamePane()) {
this.initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
if(needRenamePane()){
itemNameTextField = new UITextField(); itemNameTextField = new UITextField();
this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("Name") + ":"), BorderLayout.NORTH); this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Designer_Name") + ":"), BorderLayout.NORTH);
} }
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
centerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Related", "Cell"}))); centerPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText(new String[]{"Related", "FR-Designer_Cell"})));
colRowPane = new ColumnRowVerticalPane(); colRowPane = new ColumnRowVerticalPane();
centerPane.add(colRowPane, BorderLayout.NORTH); centerPane.add(colRowPane, BorderLayout.NORTH);
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane()); parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Parameters"))); parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Parameter")));
parameterViewPane.setPreferredSize(new Dimension(500, 200)); parameterViewPane.setPreferredSize(new Dimension(500, 200));
this.add(parameterViewPane, BorderLayout.SOUTH); this.add(parameterViewPane, BorderLayout.SOUTH);
} }
protected int getChartParaType() { @Override
return plot != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE; public void populateBean(ChartHyperRelateCellLink ob) {
} if (ob == null) {
return;
protected ValueEditorPane getValueEditorPane() { }
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), plot); if (itemNameTextField != null) {
}
protected boolean needRenamePane(){
return plot != null && plot.isNeedRenameHyperLinkPane();
}
@Override
public void populateBean(ChartHyperRelateCellLink ob) {
if(ob == null) {
return;
}
if(itemNameTextField != null){
itemNameTextField.setText(ob.getItemName()); itemNameTextField.setText(ob.getItemName());
} }
if(ob.getRelateCCName() != null) { if (ob.getRelateCCName() != null) {
ColumnRow colRow = ColumnRow.valueOf(ob.getRelateCCName()); ColumnRow colRow = ColumnRow.valueOf(ob.getRelateCCName());
colRowPane.populate(colRow); colRowPane.populate(colRow);
} else { } else {
colRowPane.populate(ColumnRow.valueOf("A1")); colRowPane.populate(ColumnRow.valueOf("A1"));
} }
List parameterList = this.parameterViewPane.update(); List parameterList = this.parameterViewPane.update();
parameterList.clear(); parameterList.clear();
ParameterProvider[] parameters = ob.getParameters(); ParameterProvider[] parameters = ob.getParameters();
parameterViewPane.populate(parameters); parameterViewPane.populate(parameters);
} }
@Override @Override
public ChartHyperRelateCellLink updateBean() { public ChartHyperRelateCellLink updateBean() {
ChartHyperRelateCellLink chartLink = new ChartHyperRelateCellLink(); ChartHyperRelateCellLink chartLink = new ChartHyperRelateCellLink();
updateBean(chartLink); updateBean(chartLink);
if(itemNameTextField != null){ if (itemNameTextField != null) {
chartLink.setItemName(this.itemNameTextField.getText()); chartLink.setItemName(this.itemNameTextField.getText());
} }
return chartLink; return chartLink;
} }
/** /**
* 属性表 对应update * 属性表 对应update
*/ */
public void updateBean(ChartHyperRelateCellLink chartLink) { public void updateBean(ChartHyperRelateCellLink chartLink) {
chartLink.setRelateCCName(Utils.objectToString(colRowPane.update())); chartLink.setRelateCCName(Utils.objectToString(colRowPane.update()));
List parameterList = this.parameterViewPane.update(); List parameterList = this.parameterViewPane.update();
if (parameterList != null && !parameterList.isEmpty()) { if (parameterList != null && !parameterList.isEmpty()) {
ParameterProvider[] parameters = new ParameterProvider[parameterList.size()]; ParameterProvider[] parameters = new ParameterProvider[parameterList.size()];
parameterList.toArray(parameters); parameterList.toArray(parameters);
chartLink.setParameters(parameters); chartLink.setParameters(parameters);
} else { } else {
chartLink.setParameters(null); chartLink.setParameters(null);
} }
if(itemNameTextField != null){ if (itemNameTextField != null) {
chartLink.setItemName(this.itemNameTextField.getText()); chartLink.setItemName(this.itemNameTextField.getText());
} }
} }
@Override @Override
protected String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText(new String[]{"Related", "Cell"}); return Inter.getLocText(new String[]{"Related", "Cell"});
} }
public static class CHART_NO_RENAME extends ChartHyperRelateCellLinkPane{ public static class ChartNoRename extends ChartHyperRelateCellLinkPane {
protected boolean needRenamePane(){ protected boolean needRenamePane() {
return false; return false;
} }
} }

209
designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java

@ -1,18 +1,14 @@
package com.fr.design.chart.series.SeriesCondition.impl; package com.fr.design.chart.series.SeriesCondition.impl;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.chart.BasePlot;
import com.fr.chart.web.ChartHyperRelateFloatLink; import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -23,145 +19,126 @@ import javax.swing.border.Border;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import java.awt.*; import java.awt.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2011-12-28 下午03:02:43 * @version 创建时间2011-12-28 下午03:02:43
* 类说明: 图表超链 关联悬浮元素 * 类说明: 图表超链 关联悬浮元素
*/ */
public class ChartHyperRelateFloatLinkPane extends BasicBeanPane<ChartHyperRelateFloatLink> { public class ChartHyperRelateFloatLinkPane extends AbstractHyperLinkPane<ChartHyperRelateFloatLink> {
private static final long serialVersionUID = -3308412003405587689L; private static final long serialVersionUID = -3308412003405587689L;
private UITextField itemNameTextField; private UITextField itemNameTextField;
private UIComboBox floatNameBox; private UIComboBox floatNameBox;
private ReportletParameterViewPane parameterViewPane;
private BasePlot plot; public ChartHyperRelateFloatLinkPane() {
this.initComponent();
}
protected BasePlot getPlot() { public ChartHyperRelateFloatLinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
return plot; super(hyperLinkEditorMap, needRenamePane);
} this.initComponent();
}
public ChartHyperRelateFloatLinkPane() {
this.initComponent();
}
public ChartHyperRelateFloatLinkPane(BasePlot plot) { private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.plot = plot; JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
if(needRenamePane()){ if (needRenamePane()) {
itemNameTextField = new UITextField(); itemNameTextField = new UITextField();
this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("Name") + ":"), BorderLayout.NORTH); this.add(GUICoreUtils.createNamedPane(itemNameTextField, Inter.getLocText("FR-Designer-Hyperlink_Name") + ":"), BorderLayout.NORTH);
}
this.add(centerPane, BorderLayout.CENTER);
floatNameBox = new UIComboBox(getFloatNames());
floatNameBox.setPreferredSize(new Dimension(90, 20));
JPanel pane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
pane.add(new UILabel(Inter.getLocText("M_Insert-Float") + ":"));
pane.add(floatNameBox);
Border boder = new LineBorder(UIConstants.TITLED_BORDER_COLOR);
Font font = null;
TitledBorder border = new TitledBorder(boder, Inter.getLocText(new String[]{"Related", "M_Insert-Float"}), 4, 2, font, new Color(1, 159, 222));
// 圆角不行
centerPane.setBorder(border);
centerPane.add(pane, BorderLayout.NORTH);
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Parameter")));
parameterViewPane.setPreferredSize(new Dimension(500, 200));
this.add(parameterViewPane, BorderLayout.SOUTH);
}
private String[] getFloatNames() {
DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter();
if (adapter != null) {
return adapter.getFloatNames();
}
return new String[0];
}
@Override
public void populateBean(ChartHyperRelateFloatLink ob) {
if (ob == null) {
return;
} }
this.add(centerPane, BorderLayout.CENTER); if (itemNameTextField != null) {
floatNameBox = new UIComboBox(getFloatNames());
floatNameBox.setPreferredSize(new Dimension(90, 20));
JPanel pane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
pane.add(new UILabel(Inter.getLocText("M_Insert-Float") + ":"));
pane.add(floatNameBox);
Border boder = new LineBorder(UIConstants.TITLED_BORDER_COLOR);
Font font = null;
TitledBorder border = new TitledBorder(boder, Inter.getLocText(new String[]{"Related", "M_Insert-Float"}), 4, 2, font, new Color(1, 159, 222));
// 圆角不行
centerPane.setBorder(border);
centerPane.add(pane, BorderLayout.NORTH);
parameterViewPane = new ReportletParameterViewPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
parameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Parameters")));
parameterViewPane.setPreferredSize(new Dimension(500, 200));
this.add(parameterViewPane, BorderLayout.SOUTH);
}
protected int getChartParaType() {
return plot != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE;
}
protected ValueEditorPane getValueEditorPane() {
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), plot);
}
protected boolean needRenamePane(){
return plot != null && plot.isNeedRenameHyperLinkPane();
}
private String[] getFloatNames() {
DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter();
if(adapter != null ) {
return adapter.getFloatNames();
}
return new String[0];
}
@Override
public void populateBean(ChartHyperRelateFloatLink ob) {
if(ob == null) {
return ;
}
if(itemNameTextField != null){
itemNameTextField.setText(ob.getItemName()); itemNameTextField.setText(ob.getItemName());
} }
floatNameBox.setSelectedItem(ob.getRelateCCName()); floatNameBox.setSelectedItem(ob.getRelateCCName());
List parameterList = this.parameterViewPane.update(); List parameterList = this.parameterViewPane.update();
parameterList.clear(); parameterList.clear();
ParameterProvider[] parameters = ob.getParameters(); ParameterProvider[] parameters = ob.getParameters();
parameterViewPane.populate(parameters); parameterViewPane.populate(parameters);
} }
@Override @Override
public ChartHyperRelateFloatLink updateBean() { public ChartHyperRelateFloatLink updateBean() {
ChartHyperRelateFloatLink chartLink = new ChartHyperRelateFloatLink(); ChartHyperRelateFloatLink chartLink = new ChartHyperRelateFloatLink();
updateBean(chartLink); updateBean(chartLink);
if(itemNameTextField != null){ if (itemNameTextField != null) {
chartLink.setItemName(this.itemNameTextField.getText()); chartLink.setItemName(this.itemNameTextField.getText());
} }
return chartLink; return chartLink;
} }
public void updateBean(ChartHyperRelateFloatLink chartLink) { public void updateBean(ChartHyperRelateFloatLink chartLink) {
if(floatNameBox.getSelectedItem() != null) { if (floatNameBox.getSelectedItem() != null) {
chartLink.setRelateCCName(Utils.objectToString(floatNameBox.getSelectedItem())); chartLink.setRelateCCName(Utils.objectToString(floatNameBox.getSelectedItem()));
} }
List parameterList = this.parameterViewPane.update(); List parameterList = this.parameterViewPane.update();
if (parameterList != null && !parameterList.isEmpty()) { if (parameterList != null && !parameterList.isEmpty()) {
ParameterProvider[] parameters = new ParameterProvider[parameterList.size()]; ParameterProvider[] parameters = new ParameterProvider[parameterList.size()];
parameterList.toArray(parameters); parameterList.toArray(parameters);
chartLink.setParameters(parameters); chartLink.setParameters(parameters);
} else { } else {
chartLink.setParameters(null); chartLink.setParameters(null);
} }
if(itemNameTextField != null){ if (itemNameTextField != null) {
chartLink.setItemName(this.itemNameTextField.getText()); chartLink.setItemName(this.itemNameTextField.getText());
} }
} }
@Override @Override
protected String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText(new String[]{"Related", "M_Insert-Float"}); return Inter.getLocText(new String[]{"Related", "M_Insert-Float"});
} }
public static class CHART_NO_RENAME extends ChartHyperRelateFloatLinkPane{ public static class ChartNoRename extends ChartHyperRelateFloatLinkPane {
protected boolean needRenamePane(){ protected boolean needRenamePane() {
return false; return false;
} }
} }

57
designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java

@ -1,12 +1,9 @@
package com.fr.design.chart.series.SeriesCondition.impl; package com.fr.design.chart.series.SeriesCondition.impl;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.chart.BasePlot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.ElementCaseEditorProvider; import com.fr.form.ui.ElementCaseEditorProvider;
@ -17,20 +14,15 @@ import com.fr.stable.bridge.StableFactory;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.HashMap;
public class FormHyperlinkPane extends BasicBeanPane<FormHyperlinkProvider> { public class FormHyperlinkPane extends AbstractHyperLinkPane<FormHyperlinkProvider> {
private BasePlot plot; private static final int BORDER_WIDTH = 4;
private ReportletParameterViewPane parameterViewPane;
private FormHyperlinkNorthPane northPane; private FormHyperlinkNorthPane northPane;
protected BasePlot getPlot() {
return plot;
}
public FormHyperlinkPane(BasePlot plot) { public FormHyperlinkPane(HashMap hyperLinkEditorMap, boolean needRenamePane) {
super(); super(hyperLinkEditorMap, needRenamePane);
this.plot = plot;
this.initComponents(); this.initComponents();
} }
@ -41,7 +33,7 @@ public class FormHyperlinkPane extends BasicBeanPane<FormHyperlinkProvider> {
protected void initComponents() { protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.setBorder(BorderFactory.createEmptyBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH));
northPane = new FormHyperlinkNorthPane(needRenamePane()); northPane = new FormHyperlinkNorthPane(needRenamePane());
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
@ -51,29 +43,15 @@ public class FormHyperlinkPane extends BasicBeanPane<FormHyperlinkProvider> {
} }
@Override @Override
protected String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Hyperlink-Form_link"); return Inter.getLocText("Hyperlink-Form_link");
} }
protected int getChartParaType() {
return plot != null ? ParameterTableModel.CHART_NORMAL_USE : ParameterTableModel.NO_CHART_USE;
}
protected ValueEditorPane getValueEditorPane() {
return ValueEditorPaneFactory.createVallueEditorPaneWithUseType(getChartParaType(), plot);
}
protected boolean needRenamePane(){
return plot != null && plot.isNeedRenameHyperLinkPane();
}
protected int getHyperlinkType() { protected int getHyperlinkType() {
if (northPane.getEditingEditor() != null){ if (northPane.getEditingEditor() != null && northPane.getEditingEditor().acceptType(ElementCaseEditorProvider.class)) {
if (northPane.getEditingEditor().acceptType(ElementCaseEditorProvider.class)) { return FormHyperlinkProvider.ELEMENTCASE;
return FormHyperlinkProvider.ELEMENTCASE; }
} return FormHyperlinkProvider.CHART;
}
return FormHyperlinkProvider.CHART;
} }
@Override @Override
@ -89,7 +67,7 @@ public class FormHyperlinkPane extends BasicBeanPane<FormHyperlinkProvider> {
@Override @Override
public FormHyperlinkProvider updateBean() { public FormHyperlinkProvider updateBean() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
formHyperlink.setType(getHyperlinkType()); formHyperlink.setType(getHyperlinkType());
updateBean(formHyperlink); updateBean(formHyperlink);
@ -97,8 +75,8 @@ public class FormHyperlinkPane extends BasicBeanPane<FormHyperlinkProvider> {
} }
public void updateBean(FormHyperlinkProvider formHyperlink) { public void updateBean(FormHyperlinkProvider formHyperlink) {
formHyperlink.setType(getHyperlinkType()); formHyperlink.setType(getHyperlinkType());
northPane.updateBean(formHyperlink); northPane.updateBean(formHyperlink);
//Parameter. //Parameter.
java.util.List<ParameterProvider> parameterList = this.parameterViewPane.update(); java.util.List<ParameterProvider> parameterList = this.parameterViewPane.update();
@ -112,10 +90,11 @@ public class FormHyperlinkPane extends BasicBeanPane<FormHyperlinkProvider> {
} }
} }
public static class CHART_NO_RENAME extends FormHyperlinkPane{ public static class ChartNoRename extends FormHyperlinkPane {
protected boolean needRenamePane(){ protected boolean needRenamePane() {
return false; return false;
} }
protected int getChartParaType() { protected int getChartParaType() {
return ParameterTableModel.CHART_NORMAL_USE; return ParameterTableModel.CHART_NORMAL_USE;
} }

24
designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartDesignerInteractivePane.java

@ -4,6 +4,7 @@
package com.fr.design.mainframe.chart.gui.other; package com.fr.design.mainframe.chart.gui.other;
import com.fr.base.Formula;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartdata.TopDefinition; import com.fr.chart.chartdata.TopDefinition;
import com.fr.design.mainframe.chart.gui.ChartOtherPane; import com.fr.design.mainframe.chart.gui.ChartOtherPane;
@ -29,22 +30,23 @@ public class ChartDesignerInteractivePane extends ChartInteractivePane {
} }
protected List<ChartUIMenuNameableCreator> refreshList(HashMap map) { protected List<ChartUIMenuNameableCreator> refreshList(HashMap map) {
List<ChartUIMenuNameableCreator> list = new ArrayList<ChartUIMenuNameableCreator>(); List<ChartUIMenuNameableCreator> list = new ArrayList<ChartUIMenuNameableCreator>();
java.util.HashMap<String, Formula> hyperLinkEditorMap = plot.getHyperLinkEditorMap();
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Hyperlink-Web_link"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Hyperlink-Web_link"),
new WebHyperlink(), getUseMap(map, WebHyperlink.class))); new WebHyperlink(), getUseMap(map, WebHyperlink.class)));
list.add(new ChartUIMenuNameableCreator(plot,"JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, "FR-Designer_JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class)));
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("RelatedChart"),null,null)); list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("FR-Engine_Interactive-chart"), null, null));
return list; return list;
} }
protected void populateAutoRefresh(Chart chart){ protected void populateAutoRefresh(Chart chart) {
super.populateAutoRefresh(chart); super.populateAutoRefresh(chart);
if(chart.getFilterDefinition() != null){ if (chart.getFilterDefinition() != null) {
TopDefinition definition = (TopDefinition)chart.getFilterDefinition(); TopDefinition definition = (TopDefinition) chart.getFilterDefinition();
isAutoRefresh.setEnabled(definition.isSupportAutoRefresh()); isAutoRefresh.setEnabled(definition.isSupportAutoRefresh());
if(!isAutoRefresh.isEnabled()){ if (!isAutoRefresh.isEnabled()) {
isAutoRefresh.setSelected(false); isAutoRefresh.setSelected(false);
} }
autoRefreshTime.setEnabled(definition.isSupportAutoRefresh()); autoRefreshTime.setEnabled(definition.isSupportAutoRefresh());

540
designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.chart.gui.other; package com.fr.design.mainframe.chart.gui.other;
import com.fr.base.CoreDecimalFormat; import com.fr.base.CoreDecimalFormat;
import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.base.AttrContents; import com.fr.chart.base.AttrContents;
@ -74,22 +75,22 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIObserver{ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIObserver {
private static final long serialVersionUID = 3477409806918835992L; private static final long serialVersionUID = 3477409806918835992L;
private static HashMap normalMap = new HashMap(); private static HashMap normalMap = new HashMap();
private static final int TIME_SWITCH_GAP = 40; private static final int TIME_SWITCH_GAP = 40;
private UICheckBox isChartAnimation;// 动态 private UICheckBox isChartAnimation;// 动态
private UICheckBox isSeriesDragEnable; //系列拖拽 private UICheckBox isSeriesDragEnable; //系列拖拽
private UICheckBox isAxisZoom;// 缩放 private UICheckBox isAxisZoom;// 缩放
private UICheckBox isDatapointValue;// 数据点提示 private UICheckBox isDatapointValue;// 数据点提示
private UIButton dataPointValueFormat; private UIButton dataPointValueFormat;
private UICheckBox isDatapointPercent; private UICheckBox isDatapointPercent;
private UIButton dataPointPercentFormat; private UIButton dataPointPercentFormat;
private UILabel tooltipStyleLabel; private UILabel tooltipStyleLabel;
private UIComboBox tooltipStyle; private UIComboBox tooltipStyle;
@ -101,24 +102,24 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
private UICheckBox isAddress; private UICheckBox isAddress;
private UICheckBox isAddressName; private UICheckBox isAddressName;
private UICheckBox isAxisShowToolTip;// 坐标轴提示 private UICheckBox isAxisShowToolTip;// 坐标轴提示
protected UICheckBox isAutoRefresh;// 自动刷新 protected UICheckBox isAutoRefresh;// 自动刷新
protected UISpinner autoRefreshTime; protected UISpinner autoRefreshTime;
private UICorrelationComboBoxPane superLink;// 超链 private UICorrelationComboBoxPane superLink;// 超链
private FormatPane valueFormatPane; private FormatPane valueFormatPane;
private FormatPane percentFormatPane; private FormatPane percentFormatPane;
private Format valueFormat; private Format valueFormat;
private Format percentFormat; private Format percentFormat;
private JPanel tooltipPane; private JPanel tooltipPane;
private JPanel axisShowPane; private JPanel axisShowPane;
private JPanel autoRefreshPane; private JPanel autoRefreshPane;
private JPanel superlinkPane; private JPanel superlinkPane;
private ChartOtherPane parent; private ChartOtherPane parent;
private UICheckBox timeSwitch; private UICheckBox timeSwitch;
@ -127,47 +128,49 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
protected Plot plot; protected Plot plot;
private static final int SIZEX = 258; private static final int SIZEX = 258;
private static final int SIZEY = 209; private static final int SIZEY = 209;
private static final int DET = 20; private static final int DET = 20;
public ChartInteractivePane(ChartOtherPane parent) {
super();
this.parent = parent;
}
/** public ChartInteractivePane(ChartOtherPane parent) {
* 界面标题. super();
this.parent = parent;
}
/**
* 界面标题.
*
* @return 返回标题. * @return 返回标题.
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Chart-Interactive_Tab"); return Inter.getLocText("Chart-Interactive_Tab");
} }
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
isChartAnimation = new UICheckBox(Inter.getLocText("Chart-Animation_JSShow")); isChartAnimation = new UICheckBox(Inter.getLocText("Chart-Animation_JSShow"));
isSeriesDragEnable = new UICheckBox(Inter.getLocText("Chart-Series_Drag")); isSeriesDragEnable = new UICheckBox(Inter.getLocText("Chart-Series_Drag"));
isDatapointValue = new UICheckBox(Inter.getLocText("Chart-Use_Value")); isDatapointValue = new UICheckBox(Inter.getLocText("Chart-Use_Value"));
dataPointValueFormat = new UIButton(Inter.getLocText("Chart-Use_Format")); dataPointValueFormat = new UIButton(Inter.getLocText("Chart-Use_Format"));
isDatapointPercent = new UICheckBox(Inter.getLocText("Chart-Value_Percent")); isDatapointPercent = new UICheckBox(Inter.getLocText("Chart-Value_Percent"));
dataPointPercentFormat = new UIButton(Inter.getLocText("Chart-Use_Format")); dataPointPercentFormat = new UIButton(Inter.getLocText("Chart-Use_Format"));
tooltipStyle = new UIComboBox(new String []{Inter.getLocText("Chart-White_Black"), Inter.getLocText("Chart-Black_White")}); tooltipStyle = new UIComboBox(new String[]{Inter.getLocText("Chart-White_Black"), Inter.getLocText("Chart-Black_White")});
tooltipStyleLabel = new UILabel(Inter.getLocText("Chart-Style_Name")); tooltipStyleLabel = new UILabel(Inter.getLocText("Chart-Style_Name"));
tooltipShowType = new UIComboBox(new String []{Inter.getLocText("Chart-Series_SingleData"), Inter.getLocText("Chart-Series_AllData")}); tooltipShowType = new UIComboBox(new String[]{Inter.getLocText("Chart-Series_SingleData"), Inter.getLocText("Chart-Series_AllData")});
tooltipShowTypeLabel = new UILabel(Inter.getLocText("Chart-Use_Show")); tooltipShowTypeLabel = new UILabel(Inter.getLocText("Chart-Use_Show"));
isAddressTittle = new UICheckBox(Inter.getLocText("Chart-Area_Title")); isAddressTittle = new UICheckBox(Inter.getLocText("Chart-Area_Title"));
isAddress = new UICheckBox(Inter.getLocText("Chart-Gis_Address")); isAddress = new UICheckBox(Inter.getLocText("Chart-Gis_Address"));
isAddressName = new UICheckBox(Inter.getLocText("Chart-Address_Name")); isAddressName = new UICheckBox(Inter.getLocText("Chart-Address_Name"));
isAxisShowToolTip = new UICheckBox(Inter.getLocText("Chart-Interactive_AxisTooltip")); isAxisShowToolTip = new UICheckBox(Inter.getLocText("Chart-Interactive_AxisTooltip"));
isAxisZoom = new UICheckBox(Inter.getLocText("Chart-Use_Zoom")); isAxisZoom = new UICheckBox(Inter.getLocText("Chart-Use_Zoom"));
isAutoRefresh = new UICheckBox(Inter.getLocText(new String[]{"Chart-Use_Auto", "Chart-Use_Refresh"})); isAutoRefresh = new UICheckBox(Inter.getLocText(new String[]{"Chart-Use_Auto", "Chart-Use_Refresh"}));
autoRefreshTime = new UISpinner(1, Integer.MAX_VALUE, 1); autoRefreshTime = new UISpinner(1, Integer.MAX_VALUE, 1);
superLink = new UICorrelationComboBoxPane(); superLink = new UICorrelationComboBoxPane();
isAutoRefresh.addActionListener(new ActionListener() { isAutoRefresh.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkAutoRefresh(); checkAutoRefresh();
@ -175,9 +178,9 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
}); });
timeSwitch = new UICheckBox(Inter.getLocText("FR-Chart-Interactive_timeSwitch")); timeSwitch = new UICheckBox(Inter.getLocText("FR-Chart-Interactive_timeSwitch"));
timeSwitchPane = new TimeSwitchPane(); timeSwitchPane = new TimeSwitchPane();
initFormatListener(); initFormatListener();
return initPaneWithListener(); return initPaneWithListener();
} }
private void initFormatListener() { private void initFormatListener() {
@ -187,7 +190,7 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
timeSwitch.setEnabled(isAxisZoom.isSelected()); timeSwitch.setEnabled(isAxisZoom.isSelected());
if(!isAxisZoom.isSelected()){ if (!isAxisZoom.isSelected()) {
timeSwitch.setSelected(false); timeSwitch.setSelected(false);
} }
} }
@ -253,19 +256,20 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
}); });
} }
private void checkAutoRefresh() { private void checkAutoRefresh() {
GUICoreUtils.setEnabled(autoRefreshTime, isAutoRefresh.isSelected()); GUICoreUtils.setEnabled(autoRefreshTime, isAutoRefresh.isSelected());
} }
/** /**
* 反正后面还有relayout,这边init一下就好了 保证所有的init 加入界面 并且加载入事件. * 反正后面还有relayout,这边init一下就好了 保证所有的init 加入界面 并且加载入事件.
* @return *
*/ * @return
private JPanel initPaneWithListener() { */
initDataPointToolTipPane(); private JPanel initPaneWithListener() {
initAxisShowPane(); initDataPointToolTipPane();
initAutoRefreshPane(); initAxisShowPane();
initSuperlinkPane(); initAutoRefreshPane();
initSuperlinkPane();
initTimeSwitchPane(); initTimeSwitchPane();
@ -284,34 +288,33 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
}; };
//初始化界面时 加载事件 //初始化界面时 加载事件
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
private void initTimeSwitchPane(){ private void initTimeSwitchPane() {
timeSwitchContainer = new JPanel(new BorderLayout()); timeSwitchContainer = new JPanel(new BorderLayout());
timeSwitchContainer.add(timeSwitch, BorderLayout.CENTER); timeSwitchContainer.add(timeSwitch, BorderLayout.CENTER);
} }
/** /**
* 全部初始化, 对所有的界面 都加入, 然后会加载事件响应. 后续再relayout. * 全部初始化, 对所有的界面 都加入, 然后会加载事件响应. 后续再relayout.
*/ */
private void initDataPointToolTipPane() { private void initDataPointToolTipPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = new double[]{p, f}; double[] columnSize = new double[]{p, f};
double[] rowSize = new double[]{p, p, p, p, p, p, p}; double[] rowSize = new double[]{p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isDatapointValue, dataPointValueFormat}, new Component[]{isDatapointValue, dataPointValueFormat},
new Component[]{isDatapointPercent, dataPointPercentFormat}, new Component[]{isDatapointPercent, dataPointPercentFormat},
new Component[]{isAddress, null}, new Component[]{isAddress, null},
new Component[]{isAddressName,null}, new Component[]{isAddressName, null},
new Component[]{isAddressTittle, null}, new Component[]{isAddressTittle, null},
new Component[]{tooltipShowTypeLabel, tooltipShowType}, new Component[]{tooltipShowTypeLabel, tooltipShowType},
new Component[]{tooltipStyleLabel, tooltipStyle} new Component[]{tooltipStyleLabel, tooltipStyle}
}; };
tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"},components, rowSize, columnSize); tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"}, components, rowSize, columnSize);
} }
private void relayoutDataPointToolTipPane(Plot plot) { private void relayoutDataPointToolTipPane(Plot plot) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -319,21 +322,21 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
double[] columnSize = new double[]{p, f}; double[] columnSize = new double[]{p, f};
double[] rowSize = new double[]{p, p}; double[] rowSize = new double[]{p, p};
if(plot.isShowAllDataPointLabel()) { if (plot.isShowAllDataPointLabel()) {
isDatapointPercent.setText(Inter.getLocText("Chart-Value_Conversion")); isDatapointPercent.setText(Inter.getLocText("Chart-Value_Conversion"));
} }
if(plot.isSupportAddress4Gis()) { if (plot.isSupportAddress4Gis()) {
UIButton tmpButton = new UIButton(); //用来调整对齐 UIButton tmpButton = new UIButton(); //用来调整对齐
tmpButton.setVisible(false); tmpButton.setVisible(false);
rowSize = new double[]{p, p, p, p, p}; rowSize = new double[]{p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isAddress, null}, new Component[]{isAddress, null},
new Component[]{isAddressName,null}, new Component[]{isAddressName, null},
new Component[]{isAddressTittle, tmpButton}, new Component[]{isAddressTittle, tmpButton},
new Component[]{isDatapointValue, dataPointValueFormat}, new Component[]{isDatapointValue, dataPointValueFormat},
}; };
tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"},components, rowSize, columnSize); tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"}, components, rowSize, columnSize);
} else if(plot.isSupportValuePercent()) { } else if (plot.isSupportValuePercent()) {
Component[][] components; Component[][] components;
if (plot.isSupportTooltipSeriesType()) { if (plot.isSupportTooltipSeriesType()) {
rowSize = new double[]{p, p, p, p}; rowSize = new double[]{p, p, p, p};
@ -346,18 +349,18 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
} else { } else {
rowSize = new double[]{p, p, p}; rowSize = new double[]{p, p, p};
components = new Component[][]{ components = new Component[][]{
new Component[]{isDatapointValue, dataPointValueFormat}, new Component[]{isDatapointValue, dataPointValueFormat},
new Component[]{isDatapointPercent, dataPointPercentFormat}, new Component[]{isDatapointPercent, dataPointPercentFormat},
getTooltipStyleComponent() getTooltipStyleComponent()
}; };
} }
tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"},components, rowSize, columnSize); tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"}, components, rowSize, columnSize);
} else { } else {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isDatapointValue, dataPointValueFormat}, new Component[]{isDatapointValue, dataPointValueFormat},
getTooltipStyleComponent() getTooltipStyleComponent()
}; };
tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"},components, rowSize, columnSize); tooltipPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartData-Tooltip"}, components, rowSize, columnSize);
} }
} }
@ -368,8 +371,8 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
new Component[]{tooltipShowTypeLabel, tooltipShowType} new Component[]{tooltipShowTypeLabel, tooltipShowType}
}; };
double[] newColumnSize = new double[]{f, p}; double[] newColumnSize = new double[]{f, p};
double []newRowSize = new double[]{p}; double[] newRowSize = new double[]{p};
return new Component[] {TableLayoutHelper.createTableLayoutPane(newComponents, newRowSize, newColumnSize), null}; return new Component[]{TableLayoutHelper.createTableLayoutPane(newComponents, newRowSize, newColumnSize), null};
} }
private Component[] getTooltipStyleComponent() { private Component[] getTooltipStyleComponent() {
@ -379,53 +382,53 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
new Component[]{tooltipStyleLabel, tooltipStyle} new Component[]{tooltipStyleLabel, tooltipStyle}
}; };
double[] newColumnSize = new double[]{f, p}; double[] newColumnSize = new double[]{f, p};
double []newRowSize = new double[]{p}; double[] newRowSize = new double[]{p};
return new Component[] {TableLayoutHelper.createTableLayoutPane(newComponents, newRowSize, newColumnSize), null}; return new Component[]{TableLayoutHelper.createTableLayoutPane(newComponents, newRowSize, newColumnSize), null};
} }
private void initAxisShowPane() { private void initAxisShowPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = new double[]{p}; double[] columnSize = new double[]{p};
double[] rowSize = new double[]{p}; double[] rowSize = new double[]{p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isAxisShowToolTip}, new Component[]{isAxisShowToolTip},
}; };
axisShowPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartF-Axis", "Chart-Interactive"},components, rowSize, columnSize); axisShowPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"ChartF-Axis", "Chart-Interactive"}, components, rowSize, columnSize);
} }
private void initAutoRefreshPane() { private void initAutoRefreshPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = new double[]{p, f}; double[] columnSize = new double[]{p, f};
double[] rowSize = new double[]{p, p, p,p}; double[] rowSize = new double[]{p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isAutoRefresh,null}, new Component[]{isAutoRefresh, null},
new Component[]{GUICoreUtils.createFlowPane(new Component[]{ new Component[]{GUICoreUtils.createFlowPane(new Component[]{
new UILabel(Inter.getLocText("Chart-Time_Interval")), new UILabel(Inter.getLocText("Chart-Time_Interval")),
autoRefreshTime, autoRefreshTime,
new UILabel(Inter.getLocText("Chart-Time_Seconds")) new UILabel(Inter.getLocText("Chart-Time_Seconds"))
}, 1)}, }, 1)},
new Component[]{new UILabel("<html><font size='2' face='Microsoft Yahei' color='red'>" + Inter.getLocText("FR-Chart-AutoRefresh_NotSupportIMGAndReportData") + "</font></html>"), null}, new Component[]{new UILabel("<html><font size='2' face='Microsoft Yahei' color='red'>" + Inter.getLocText("FR-Chart-AutoRefresh_NotSupportIMGAndReportData") + "</font></html>"), null},
}; };
autoRefreshPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Data-Check"},components, rowSize, columnSize); autoRefreshPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Data-Check"}, components, rowSize, columnSize);
} }
private void initSuperlinkPane() { private void initSuperlinkPane() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = new double[]{p, f}; double[] columnSize = new double[]{p, f};
double[] rowSize = new double[]{p}; double[] rowSize = new double[]{p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{superLink, null}, new Component[]{superLink, null},
}; };
superlinkPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Hyperlink"},components, rowSize, columnSize); superlinkPane = TableLayoutHelper.createTableLayoutPane4Chart(new String[]{"Hyperlink"}, components, rowSize, columnSize);
} }
private void relayoutWithPlot(Plot plot) { private void relayoutWithPlot(Plot plot) {
this.removeAll(); this.removeAll();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = new double[]{TableLayout.FILL}; double[] columnSize = new double[]{TableLayout.FILL};
double[] rowSize = new double[]{p, p, p}; double[] rowSize = new double[]{p, p, p};
@ -440,90 +443,85 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
double[] row = new double[]{p, p, p, p, p, p}; double[] row = new double[]{p, p, p, p, p, p};
reloaPane(TableLayoutHelper.createTableLayoutPane(components, row, columnSize)); reloaPane(TableLayoutHelper.createTableLayoutPane(components, row, columnSize));
} }
private Component[] getChartAnimatePane(Plot plot, double[] row, double[] col) { private Component[] getChartAnimatePane(Plot plot, double[] row, double[] col) {
if(plot.isSupportAnimate() && plot.isSupportSeriesDrag()) { if (plot.isSupportAnimate() && plot.isSupportSeriesDrag()) {
return new Component[]{TableLayoutHelper.createTableLayoutPane( return new Component[]{TableLayoutHelper.createTableLayoutPane(
new Component[][]{ new Component[][]{new Component[]{isChartAnimation},
new Component[]{isChartAnimation},
new Component[]{isSeriesDragEnable}, new Component[]{isSeriesDragEnable},
new Component[]{new JSeparator()} new Component[]{new JSeparator()}
}, row, col) }, row, col)
}; };
}else if(plot.isSupportAnimate() && !plot.isSupportSeriesDrag()){ } else if (plot.isSupportAnimate() && !plot.isSupportSeriesDrag()) {
return new Component[]{TableLayoutHelper.createTableLayoutPane( return new Component[]{TableLayoutHelper.createTableLayoutPane(
new Component[][]{ new Component[][]{new Component[]{isChartAnimation},
new Component[]{isChartAnimation},
new Component[]{new JSeparator()} new Component[]{new JSeparator()}
}, row, col) }, row, col)
}; };
} }
return new Component[]{null}; return new Component[]{null};
} }
private void relayoutTimeSwitchPane(){ private void relayoutTimeSwitchPane() {
timeSwitchContainer.removeAll(); timeSwitchContainer.removeAll();
timeSwitchContainer.add(timeSwitch, BorderLayout.CENTER); timeSwitchContainer.add(timeSwitch, BorderLayout.CENTER);
if(timeSwitch.isSelected()){ if (timeSwitch.isSelected()) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = new double[]{TIME_SWITCH_GAP,f}; double[] columnSize = new double[]{TIME_SWITCH_GAP, f};
double[] rowSize = new double[]{p}; double[] rowSize = new double[]{p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, timeSwitchPane}, new Component[]{null, timeSwitchPane},
}; };
JPanel panel= TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
timeSwitchContainer.add(panel, BorderLayout.SOUTH); timeSwitchContainer.add(panel, BorderLayout.SOUTH);
} }
timeSwitchContainer.revalidate(); timeSwitchContainer.revalidate();
} }
private Component[] getChartScalePane(Plot plot, double[] row, double[] col) { private Component[] getChartScalePane(Plot plot, double[] row, double[] col) {
boolean isNeedTimeSwitch = plot.getxAxis()!=null && plot.getxAxis().isDate(); boolean isNeedTimeSwitch = plot.getxAxis() != null && plot.getxAxis().isDate();
if(plot.isSupportZoomCategoryAxis() && !isNeedTimeSwitch) { if (plot.isSupportZoomCategoryAxis() && !isNeedTimeSwitch) {
return new Component[]{TableLayoutHelper.createTableLayoutPane( return new Component[]{TableLayoutHelper.createTableLayoutPane(
new Component[][]{ new Component[][]{new Component[]{isAxisZoom},
new Component[]{isAxisZoom},
new Component[]{new JSeparator()} new Component[]{new JSeparator()}
}, row, col) }, row, col)
}; };
}else if(plot.isSupportZoomCategoryAxis() && isNeedTimeSwitch){ } else if (plot.isSupportZoomCategoryAxis() && isNeedTimeSwitch) {
return new Component[]{TableLayoutHelper.createTableLayoutPane( return new Component[]{TableLayoutHelper.createTableLayoutPane(
new Component[][]{ new Component[][]{new Component[]{isAxisZoom},
new Component[]{isAxisZoom},
new Component[]{timeSwitchContainer}, new Component[]{timeSwitchContainer},
new Component[]{new JSeparator()} new Component[]{new JSeparator()}
}, row, col) }, row, col)
}; };
} }
return new Component[]{null}; return new Component[]{null};
} }
private Component[] getDataTooltipPane(Plot plot, double[] row, double[] col) { private Component[] getDataTooltipPane(Plot plot, double[] row, double[] col) {
relayoutDataPointToolTipPane(plot); relayoutDataPointToolTipPane(plot);
if(plot.isSupportTooltipInInteractivePane()) { if (plot.isSupportTooltipInInteractivePane()) {
return new Component[]{TableLayoutHelper.createTableLayoutPane(new Component[][]{ return new Component[]{TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{tooltipPane}, new Component[]{new JSeparator()}}, row, col)}; new Component[]{tooltipPane}, new Component[]{new JSeparator()}}, row, col)};
} }
return new Component[]{null}; return new Component[]{null};
} }
private Component[] getAxisTipPane(Plot plot, double[] row, double[] col) { private Component[] getAxisTipPane(Plot plot, double[] row, double[] col) {
if(plot.isSupportAxisTip()) { if (plot.isSupportAxisTip()) {
return new Component[]{TableLayoutHelper.createTableLayoutPane(new Component[][]{ return new Component[]{TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{axisShowPane}, new Component[]{new JSeparator()}}, row, col)}; new Component[]{axisShowPane}, new Component[]{new JSeparator()}}, row, col)};
} }
return new Component[]{null}; return new Component[]{null};
} }
private Component[] getAutoRefreshPane(Plot plot, double[] row, double[] col) { private Component[] getAutoRefreshPane(Plot plot, double[] row, double[] col) {
if(plot.isSupportAutoRefresh()) { if (plot.isSupportAutoRefresh()) {
return new Component[]{TableLayoutHelper.createTableLayoutPane( return new Component[]{TableLayoutHelper.createTableLayoutPane(
new Component[][]{ new Component[][]{new Component[]{autoRefreshPane},
new Component[]{autoRefreshPane},
new Component[]{new JSeparator()} new Component[]{new JSeparator()}
}, row, col) }, row, col)
}; };
@ -536,16 +534,16 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
return new Component[]{superlinkPane}; return new Component[]{superlinkPane};
} }
@Override @Override
public void populateBean(Chart chart) { public void populateBean(Chart chart) {
if (chart == null || chart.getPlot() == null) { if (chart == null || chart.getPlot() == null) {
return; return;
} }
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
this.plot =plot; this.plot = plot;
relayoutWithGis(chart, plot); relayoutWithGis(chart, plot);
relayoutWithPlot(plot); relayoutWithPlot(plot);
populateChartAnimate(chart, plot); populateChartAnimate(chart, plot);
populateChartScale(plot); populateChartScale(plot);
@ -554,63 +552,63 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
populateAutoRefresh(chart); populateAutoRefresh(chart);
populateHyperlink(plot); populateHyperlink(plot);
checkAutoRefresh(); checkAutoRefresh();
} }
private void relayoutWithGis(Chart chart, Plot plot) { private void relayoutWithGis(Chart chart, Plot plot) {
if(plot.isSupportAddress4Gis()) { if (plot.isSupportAddress4Gis()) {
TopDefinitionProvider definition = chart.getFilterDefinition(); TopDefinitionProvider definition = chart.getFilterDefinition();
boolean addressType = true; boolean addressType = true;
if(definition instanceof GisMapTableDefinition){ if (definition instanceof GisMapTableDefinition) {
addressType = ((GisMapTableDefinition)definition).isAddress(); addressType = ((GisMapTableDefinition) definition).isAddress();
}else if(definition instanceof GisMapReportDefinition){ } else if (definition instanceof GisMapReportDefinition) {
addressType = ((GisMapReportDefinition)definition).isAddress(); addressType = ((GisMapReportDefinition) definition).isAddress();
} }
if(addressType){ if (addressType) {
this.isAddress.setText(Inter.getLocText("Chart-Use_Address")); this.isAddress.setText(Inter.getLocText("Chart-Use_Address"));
}else{ } else {
this.isAddress.setText(Inter.getLocText("Chart-Use_LatLng")); this.isAddress.setText(Inter.getLocText("Chart-Use_LatLng"));
} }
} }
} }
private void populateChartAnimate(Chart chart, Plot plot) { private void populateChartAnimate(Chart chart, Plot plot) {
if(plot.isSupportAnimate()) { if (plot.isSupportAnimate()) {
isChartAnimation.setSelected(chart.isJSDraw()); isChartAnimation.setSelected(chart.isJSDraw());
} }
if(plot.isSupportSeriesDrag()){ if (plot.isSupportSeriesDrag()) {
isSeriesDragEnable.setSelected(plot.isSeriesDragEnable()); isSeriesDragEnable.setSelected(plot.isSeriesDragEnable());
} }
} }
private void populateChartScale(Plot plot) { private void populateChartScale(Plot plot) {
if(plot.isSupportZoomCategoryAxis()) { if (plot.isSupportZoomCategoryAxis()) {
isAxisZoom.setSelected(plot.getxAxis() != null && plot.getxAxis().isZoom()); isAxisZoom.setSelected(plot.getxAxis() != null && plot.getxAxis().isZoom());
} }
timeSwitch.setSelected(false); timeSwitch.setSelected(false);
timeSwitch.setEnabled(false); timeSwitch.setEnabled(false);
//只有坐标轴为时间坐标轴,并且勾选了图表缩放的时候,才支持时间切换 //只有坐标轴为时间坐标轴,并且勾选了图表缩放的时候,才支持时间切换
if(!plot.isSupportZoomCategoryAxis() || !isAxisZoom.isSelected()){ if (!plot.isSupportZoomCategoryAxis() || !isAxisZoom.isSelected()) {
return; return;
} }
if(plot.getxAxis() ==null && !plot.getxAxis().isDate()){ if (plot.getxAxis() == null && !plot.getxAxis().isDate()) {
return; return;
} }
timeSwitch.setEnabled(true); timeSwitch.setEnabled(true);
ArrayList<TimeSwitchAttr> timeMap=plot.getxAxis().getTimeSwitchMap(); ArrayList<TimeSwitchAttr> timeMap = plot.getxAxis().getTimeSwitchMap();
timeSwitch.setSelected(timeMap != null && !timeMap.isEmpty()); timeSwitch.setSelected(timeMap != null && !timeMap.isEmpty());
if(timeSwitch.isSelected()){ if (timeSwitch.isSelected()) {
timeSwitchPane.populate(plot); timeSwitchPane.populate(plot);
} }
} }
private void populateDataTooltip(Plot plot) { private void populateDataTooltip(Plot plot) {
if(plot.isSupportTooltipInInteractivePane()) { if (plot.isSupportTooltipInInteractivePane()) {
AttrContents contents = plot.getHotTooltipStyle(); AttrContents contents = plot.getHotTooltipStyle();
if (contents == null) { if (contents == null) {
return; return;
@ -626,12 +624,12 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
} else { } else {
tooltipStyle.setSelectedIndex(1); tooltipStyle.setSelectedIndex(1);
} }
if(plot.isSupportValuePercent()) { if (plot.isSupportValuePercent()) {
percentFormat = contents.getPercentFormat(); percentFormat = contents.getPercentFormat();
isDatapointPercent.setSelected(dataLabel.contains(ChartConstants.PERCENT_PARA)); isDatapointPercent.setSelected(dataLabel.contains(ChartConstants.PERCENT_PARA));
} }
if(plot.isSupportAddress4Gis()) { if (plot.isSupportAddress4Gis()) {
isAddressTittle.setSelected(dataLabel.contains(ChartConstants.AREA_TITTLE_PARA)); isAddressTittle.setSelected(dataLabel.contains(ChartConstants.AREA_TITTLE_PARA));
isAddress.setSelected(dataLabel.contains(ChartConstants.ADDRESS_PARA)); isAddress.setSelected(dataLabel.contains(ChartConstants.ADDRESS_PARA));
isAddressName.setSelected(dataLabel.contains(ChartConstants.ADDRESS_NAME_PARA)); isAddressName.setSelected(dataLabel.contains(ChartConstants.ADDRESS_NAME_PARA));
@ -648,14 +646,14 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
} }
private void populateAxisTip(Plot plot) { private void populateAxisTip(Plot plot) {
if(plot.isSupportAxisTip()) { if (plot.isSupportAxisTip()) {
isAxisShowToolTip.setSelected(plot.isInteractiveAxisTooltip()); isAxisShowToolTip.setSelected(plot.isInteractiveAxisTooltip());
} }
} }
protected void populateAutoRefresh(Chart chart) { protected void populateAutoRefresh(Chart chart) {
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if(plot.isSupportAutoRefresh()) { if (plot.isSupportAutoRefresh()) {
if (plot.getAutoRefreshPerSecond() < 1) { if (plot.getAutoRefreshPerSecond() < 1) {
isAutoRefresh.setSelected(false); isAutoRefresh.setSelected(false);
autoRefreshTime.setValue(2); autoRefreshTime.setValue(2);
@ -681,11 +679,11 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
List<ChartUIMenuNameableCreator> hyperList = new ArrayList<ChartUIMenuNameableCreator>(); List<ChartUIMenuNameableCreator> hyperList = new ArrayList<ChartUIMenuNameableCreator>();
NameJavaScriptGroup nameGroup = plot.getHotHyperLink(); NameJavaScriptGroup nameGroup = plot.getHotHyperLink();
for(int i = 0; nameGroup != null && i < nameGroup.size(); i++) { for (int i = 0; nameGroup != null && i < nameGroup.size(); i++) {
NameJavaScript javaScript = nameGroup.getNameHyperlink(i); NameJavaScript javaScript = nameGroup.getNameHyperlink(i);
if(javaScript != null && javaScript.getJavaScript() != null) { if (javaScript != null && javaScript.getJavaScript() != null) {
JavaScript script = javaScript.getJavaScript(); JavaScript script = javaScript.getJavaScript();
hyperList.add(new ChartUIMenuNameableCreator(plot, javaScript.getName(), script, getUseMap(paneMap, script.getClass()))); hyperList.add(new ChartUIMenuNameableCreator(plot.getHyperLinkEditorMap(), javaScript.getName(), script, getUseMap(paneMap, script.getClass())));
} }
} }
@ -693,13 +691,13 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
superLink.doLayout(); superLink.doLayout();
} }
@Override @Override
public void updateBean(Chart chart) { public void updateBean(Chart chart) {
if (chart == null || chart.getPlot() == null) { if (chart == null || chart.getPlot() == null) {
return; return;
} }
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
updateChartAnimate(chart, plot); updateChartAnimate(chart, plot);
updateChartScale(plot); updateChartScale(plot);
@ -707,38 +705,38 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
updateAxisTip(plot); updateAxisTip(plot);
updateAutoRefresh(plot); updateAutoRefresh(plot);
updateHyperlink(plot); updateHyperlink(plot);
} }
private void updateChartAnimate(Chart chart, Plot plot) { private void updateChartAnimate(Chart chart, Plot plot) {
if(plot.isSupportAnimate()) { if (plot.isSupportAnimate()) {
chart.setJSDraw(isChartAnimation.isSelected()); chart.setJSDraw(isChartAnimation.isSelected());
} }
if(plot.isSupportSeriesDrag()){ if (plot.isSupportSeriesDrag()) {
plot.setSeriesDragEnable(isSeriesDragEnable.isSelected()); plot.setSeriesDragEnable(isSeriesDragEnable.isSelected());
} }
} }
private void updateChartScale(Plot plot) { private void updateChartScale(Plot plot) {
if(plot.isSupportZoomCategoryAxis() && plot.getxAxis() != null) { if (plot.isSupportZoomCategoryAxis() && plot.getxAxis() != null) {
plot.getxAxis().setZoom(isAxisZoom.isSelected()); plot.getxAxis().setZoom(isAxisZoom.isSelected());
} }
if(plot.getxAxis() == null){ if (plot.getxAxis() == null) {
return; return;
} }
boolean isNeedTimeSwitch = plot.getxAxis()!=null && plot.getxAxis().isDate(); boolean isNeedTimeSwitch = plot.getxAxis() != null && plot.getxAxis().isDate();
boolean isClear = !isNeedTimeSwitch || !timeSwitch.isSelected(); boolean isClear = !isNeedTimeSwitch || !timeSwitch.isSelected();
if(isClear && plot.getxAxis().getTimeSwitchMap() != null){ if (isClear && plot.getxAxis().getTimeSwitchMap() != null) {
plot.getxAxis().getTimeSwitchMap().clear(); plot.getxAxis().getTimeSwitchMap().clear();
return; return;
} }
if(plot.getxAxis().isDate() && timeSwitch.isSelected()){ if (plot.getxAxis().isDate() && timeSwitch.isSelected()) {
timeSwitchPane.update(plot); timeSwitchPane.update(plot);
} }
} }
private void updateDataTooltip(Plot plot) { private void updateDataTooltip(Plot plot) {
if(plot.isSupportTooltipInInteractivePane()) { if (plot.isSupportTooltipInInteractivePane()) {
AttrContents seriesAttrContents = plot.getHotTooltipStyle(); AttrContents seriesAttrContents = plot.getHotTooltipStyle();
if (seriesAttrContents == null) { if (seriesAttrContents == null) {
seriesAttrContents = new AttrContents(); seriesAttrContents = new AttrContents();
@ -746,21 +744,19 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
String contents = plot.isSupportAddress4Gis() ? getGisTooltipContent() : getTooltipContent(plot); String contents = plot.isSupportAddress4Gis() ? getGisTooltipContent() : getTooltipContent(plot);
seriesAttrContents.setSeriesLabel(contents); seriesAttrContents.setSeriesLabel(contents);
if(tooltipStyle != null){ if (tooltipStyle != null) {
boolean isWhiteBackground = tooltipStyle.getSelectedIndex() == 0; boolean isWhiteBackground = tooltipStyle.getSelectedIndex() == 0;
seriesAttrContents.setWhiteBackground(isWhiteBackground); seriesAttrContents.setWhiteBackground(isWhiteBackground);
} }
if(tooltipShowType != null){ if (tooltipShowType != null) {
boolean isShowMutiSeries = plot.isSupportTooltipSeriesType() && tooltipShowType.getSelectedIndex() == 1; boolean isShowMutiSeries = plot.isSupportTooltipSeriesType() && tooltipShowType.getSelectedIndex() == 1;
seriesAttrContents.setShowMutiSeries(isShowMutiSeries); seriesAttrContents.setShowMutiSeries(isShowMutiSeries);
} }
seriesAttrContents.setFormat(valueFormat); seriesAttrContents.setFormat(valueFormat);
if(plot.isSupportValuePercent()) { if (plot.isSupportValuePercent() && percentFormat != null) {
if (percentFormat != null) { seriesAttrContents.setPercentFormat(percentFormat);
seriesAttrContents.setPercentFormat(percentFormat);
}
} }
} }
} }
@ -785,23 +781,24 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
String contents = StringUtils.EMPTY; String contents = StringUtils.EMPTY;
contents += ChartConstants.SERIES_PARA + ChartConstants.BREAKLINE_PARA + ChartConstants.CATEGORY_PARA; contents += ChartConstants.SERIES_PARA + ChartConstants.BREAKLINE_PARA + ChartConstants.CATEGORY_PARA;
boolean noPara = true; boolean noPara = true;
if(isDatapointValue.isSelected()){ if (isDatapointValue.isSelected()) {
contents += ChartConstants.BREAKLINE_PARA + ChartConstants.VALUE_PARA; contents += ChartConstants.BREAKLINE_PARA + ChartConstants.VALUE_PARA;
noPara = false; noPara = false;
} }
if(isAddressTittle.isSelected()){ if (isAddressTittle.isSelected()) {
contents += ChartConstants.BREAKLINE_PARA + ChartConstants.AREA_TITTLE_PARA; contents += ChartConstants.BREAKLINE_PARA + ChartConstants.AREA_TITTLE_PARA;
noPara = false; noPara = false;
} }
if(isAddress.isSelected()){ if (isAddress.isSelected()) {
contents += ChartConstants.BREAKLINE_PARA + ChartConstants.ADDRESS_PARA; contents += ChartConstants.BREAKLINE_PARA + ChartConstants.ADDRESS_PARA;
noPara = false; noPara = false;
} }
if(isAddressName.isSelected()){ if (isAddressName.isSelected()) {
contents += ChartConstants.BREAKLINE_PARA + ChartConstants.ADDRESS_NAME_PARA;; contents += ChartConstants.BREAKLINE_PARA + ChartConstants.ADDRESS_NAME_PARA;
;
noPara = false; noPara = false;
} }
if(noPara){ if (noPara) {
contents = null; contents = null;
} }
@ -815,8 +812,8 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
} }
private void updateAutoRefresh(Plot plot) { private void updateAutoRefresh(Plot plot) {
if(plot.isSupportAutoRefresh()) { if (plot.isSupportAutoRefresh()) {
if(isAutoRefresh.isSelected() && autoRefreshTime.getValue() >= 2) { if (isAutoRefresh.isSelected() && autoRefreshTime.getValue() >= 2) {
plot.setAutoRefreshPerSecond((int) autoRefreshTime.getValue()); plot.setAutoRefreshPerSecond((int) autoRefreshTime.getValue());
} else { } else {
plot.setAutoRefreshPerSecond(0); plot.setAutoRefreshPerSecond(0);
@ -830,61 +827,62 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
superLink.resetItemName(); superLink.resetItemName();
List list = superLink.updateBean(); List list = superLink.updateBean();
for(int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
UIMenuNameableCreator menu = (UIMenuNameableCreator)list.get(i); UIMenuNameableCreator menu = (UIMenuNameableCreator) list.get(i);
NameJavaScript nameJava = new NameJavaScript(menu.getName(), (JavaScript)menu.getObj()); NameJavaScript nameJava = new NameJavaScript(menu.getName(), (JavaScript) menu.getObj());
nameGroup.addNameHyperlink(nameJava); nameGroup.addNameHyperlink(nameJava);
} }
plot.setHotHyperLink(nameGroup); plot.setHotHyperLink(nameGroup);
} }
protected Class<? extends BasicBeanPane> getUseMap(HashMap map, Object key) { protected Class<? extends BasicBeanPane> getUseMap(HashMap map, Object key) {
if(map.get(key) != null){ if (map.get(key) != null) {
return (Class<? extends BasicBeanPane>)map.get(key); return (Class<? extends BasicBeanPane>) map.get(key);
} }
//引擎在这边放了个provider。。 //引擎在这边放了个provider。。
Iterator iterator = map.keySet().iterator(); Iterator iterator = map.keySet().iterator();
while (iterator.hasNext()){ while (iterator.hasNext()) {
Class clz = (Class)iterator.next(); Class clz = (Class) iterator.next();
if(clz.isAssignableFrom((Class)key)){ if (clz.isAssignableFrom((Class) key)) {
return (Class<? extends BasicBeanPane>)map.get(clz); return (Class<? extends BasicBeanPane>) map.get(clz);
} }
} }
return null; return null;
} }
protected List<ChartUIMenuNameableCreator> refreshList(HashMap map) { protected List<ChartUIMenuNameableCreator> refreshList(HashMap map) {
List<ChartUIMenuNameableCreator> list = new ArrayList<ChartUIMenuNameableCreator>(); List<ChartUIMenuNameableCreator> list = new ArrayList<ChartUIMenuNameableCreator>();
java.util.HashMap<String, Formula> hyperLinkEditorMap = plot.getHyperLinkEditorMap();
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Chart-Link_Reportlet"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Reportlet"),
new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class)));
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), ChartEmailPane.class)); list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), ChartEmailPane.class));
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Chart-Link_Web"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Web"),
new WebHyperlink(), getUseMap(map, WebHyperlink.class))); new WebHyperlink(), getUseMap(map, WebHyperlink.class)));
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Chart-Link_Dynamic_Parameters"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Dynamic_Parameters"),
new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class))); new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class)));
list.add(new ChartUIMenuNameableCreator(plot, "JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, "JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class)));
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Chart-Float_Chart"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Float_Chart"),
new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class))); new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class)));
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Chart-Link_Cell"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Cell"),
new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class))); new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class)));
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Chart-Link_Float"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Float"),
new ChartHyperRelateFloatLink(), getUseMap(map, ChartHyperRelateFloatLink.class))); new ChartHyperRelateFloatLink(), getUseMap(map, ChartHyperRelateFloatLink.class)));
FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
list.add(new ChartUIMenuNameableCreator(plot, Inter.getLocText("Chart-Link_Form"), list.add(new ChartUIMenuNameableCreator(hyperLinkEditorMap, Inter.getLocText("Chart-Link_Form"),
hyperlink, getUseMap(map, FormHyperlinkProvider.class))); hyperlink, getUseMap(map, FormHyperlinkProvider.class)));
return list; return list;
} }
private HashMap getPlotHyperMap() { private HashMap getPlotHyperMap() {
if(normalMap.isEmpty()) { if (normalMap.isEmpty()) {
FormHyperlinkProvider fp = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider fp = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
normalMap.put(ReportletHyperlink.class, ReportletHyperlinkPane.class); normalMap.put(ReportletHyperlink.class, ReportletHyperlinkPane.class);
normalMap.put(EmailJavaScript.class, ChartEmailPane.class); normalMap.put(EmailJavaScript.class, ChartEmailPane.class);
normalMap.put(WebHyperlink.class, WebHyperlinkPane.class); normalMap.put(WebHyperlink.class, WebHyperlinkPane.class);
@ -897,33 +895,33 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
normalMap.put(FormHyperlinkProvider.class, FormHyperlinkPane.class); normalMap.put(FormHyperlinkProvider.class, FormHyperlinkPane.class);
//兼容老的FormHyperlink.class //兼容老的FormHyperlink.class
if(fp != null){ if (fp != null) {
normalMap.put(fp.getClass(), FormHyperlinkPane.class); normalMap.put(fp.getClass(), FormHyperlinkPane.class);
} }
} }
return normalMap; return normalMap;
} }
@Override @Override
public Chart updateBean() { public Chart updateBean() {
return null; return null;
} }
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
timeSwitch.registerChangeListener(listener); timeSwitch.registerChangeListener(listener);
timeSwitchPane.registerChangeListener(listener); timeSwitchPane.registerChangeListener(listener);
} }
/** /**
* 组件是否需要响应添加的观察者事件 * 组件是否需要响应添加的观察者事件
* *
* @return 如果需要响应观察者事件则返回true否则返回false * @return 如果需要响应观察者事件则返回true否则返回false
*/ */
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }

32
designer_chart/src/com/fr/design/module/ChartHyperlinkGroup.java

@ -16,25 +16,27 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
/** /**
* 图表的超级链接界面. 比一般的HyperlinkGroupPane多了图表的相关超级链接 * 图表的超级链接界面. 比一般的HyperlinkGroupPane多了图表的相关超级链接
*
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-6-26 下午04:55:10 * @version 创建时间2013-6-26 下午04:55:10
*/ */
public class ChartHyperlinkGroup extends BaseHyperlinkGroup { public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
/** /**
* 返回支持的超级链接类型 * 返回支持的超级链接类型
* @return NameableCreator[] *
*/ * @return NameableCreator[]
public NameableCreator[] getHyperlinkCreators() { */
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
NameableCreator[] realted4CharthyperUse = {
new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Float_chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.CHART_NO_RENAME.class), NameableCreator[] realted4CharthyperUse = {
new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.CHART_NO_RENAME.class), new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Float_chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Float"), ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.CHART_NO_RENAME.class), new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Float"), ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_Hyperlink-Form_link"), formHyperlink.getClass(), FormHyperlinkPane.class)}; new NameObjectCreator(Inter.getLocText("FR-Designer_Hyperlink-Form_link"), formHyperlink.getClass(), FormHyperlinkPane.class)};
return (NameableCreator[])ArrayUtils.addAll(super.getHyperlinkCreators(), realted4CharthyperUse); return (NameableCreator[]) ArrayUtils.addAll(super.getHyperlinkCreators(), realted4CharthyperUse);
} }
} }

4
designer_chart/src/com/fr/design/module/FormHyperlinkGroup.java

@ -28,8 +28,8 @@ public class FormHyperlinkGroup extends BaseHyperlinkGroup {
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
NameableCreator[] realted4CharthyperUse = { NameableCreator[] realted4CharthyperUse = {
new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Float_chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.CHART_NO_RENAME.class), new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Float_chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.CHART_NO_RENAME.class), new NameObjectCreator(Inter.getLocText("FR-Designer_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class),
new NameObjectCreator(Inter.getLocText("FR-Designer_Hyperlink-Form_link"), formHyperlink.getClass(), FormHyperlinkPane.class)}; new NameObjectCreator(Inter.getLocText("FR-Designer_Hyperlink-Form_link"), formHyperlink.getClass(), FormHyperlinkPane.class)};
return (NameableCreator[]) ArrayUtils.addAll(super.getHyperlinkCreators(), realted4CharthyperUse); return (NameableCreator[]) ArrayUtils.addAll(super.getHyperlinkCreators(), realted4CharthyperUse);

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

@ -22,6 +22,7 @@ import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.JavaScriptImplPane; import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane; import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
@ -75,17 +76,17 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
protected BasicBeanPane createPaneByCreators(NameableCreator creator) { protected BasicBeanPane createPaneByCreators(NameableCreator creator) {
Constructor<? extends BasicBeanPane> constructor = null; Constructor<? extends BasicBeanPane> constructor = null;
try { try {
constructor = creator.getUpdatePane().getConstructor(Plot.class); constructor = creator.getUpdatePane().getConstructor(HashMap.class, boolean.class);
return constructor.newInstance(plot); return constructor.newInstance(plot.getHyperLinkEditorMap(), false);
} catch (InstantiationException e) { } catch (InstantiationException e) {
throw new RuntimeException(e); FRLogger.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new RuntimeException(e); FRLogger.getLogger().error(e.getMessage(), e);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
return super.createPaneByCreators(creator); return super.createPaneByCreators(creator);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
e.printStackTrace(); FRLogger.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }
@ -122,6 +123,7 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
} }
public void populate(TargetComponent elementCasePane) { public void populate(TargetComponent elementCasePane) {
//populate
} }
/** /**

16
designer_chart/src/com/fr/plugin/chart/designer/component/ChartUIMenuNameableCreator.java

@ -1,21 +1,21 @@
package com.fr.plugin.chart.designer.component; package com.fr.plugin.chart.designer.component;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.HashMap;
/** /**
* Created by hufan on 2016/11/15. * Created by hufan on 2016/11/15.
*/ */
public class ChartUIMenuNameableCreator extends UIMenuNameableCreator { public class ChartUIMenuNameableCreator extends UIMenuNameableCreator {
private Plot plot; private HashMap hyperLinkEditorMap;
public ChartUIMenuNameableCreator(Plot plot, String name, Object obj, Class<? extends BasicBeanPane> paneClazz) { public ChartUIMenuNameableCreator(HashMap hyperLinkEditorMap, String name, Object obj, Class<? extends BasicBeanPane> paneClazz) {
super(name, obj, paneClazz); super(name, obj, paneClazz);
this.plot = plot; this.hyperLinkEditorMap = hyperLinkEditorMap;
} }
public UIMenuNameableCreator clone() { public UIMenuNameableCreator clone() {
@ -27,15 +27,15 @@ public class ChartUIMenuNameableCreator extends UIMenuNameableCreator {
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException"); FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException");
} }
return new ChartUIMenuNameableCreator(plot, name, cloneObj, (Class<? extends BasicBeanPane>) this.paneClazz); return new ChartUIMenuNameableCreator(hyperLinkEditorMap, name, cloneObj, (Class<? extends BasicBeanPane>) this.paneClazz);
} }
public BasicBeanPane getPane() { public BasicBeanPane getPane() {
try { try {
if (plot != null) { if (hyperLinkEditorMap != null) {
Constructor<? extends BasicBeanPane> constructor = paneClazz.getConstructor(Plot.class); Constructor<? extends BasicBeanPane> constructor = paneClazz.getConstructor(HashMap.class, boolean.class);
return constructor.newInstance(plot); return constructor.newInstance(hyperLinkEditorMap, true);
} }
} catch (Exception e) { } catch (Exception e) {
return super.getPane(); return super.getPane();

Loading…
Cancel
Save