Browse Source

Merge pull request #1018 in BA/design from ~MANGO/design:release to release

* commit '2369145cbfeff4cf9830093c92e2b7190e5c785e':
  合并代码:将图表dev中修改合并到release
master
superman 7 years ago
parent
commit
9339b4dd52
  1. 18
      designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java
  2. 27
      designer_base/src/com/fr/design/gui/controlpane/AbstractNameableCreator.java
  3. 17
      designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java
  4. 485
      designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java
  5. 29
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java
  6. 161
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java
  7. 177
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java
  8. 347
      designer_chart/src/com/fr/design/mainframe/chart/gui/other/ChartInteractivePane.java
  9. 2
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java

18
designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java

@ -1,7 +1,7 @@
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.SimpleDSColumn; import com.fr.data.SimpleDSColumn;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -36,9 +36,13 @@ public class ColumnSelectedEditor extends Editor<SimpleDSColumn> {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
//这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 TableDataWrapper tableDataWrapper = tableDataComboBox.getSelectedItem();
List<String> nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList(); if (tableDataWrapper == null) {
columnNames = new String[nameList.size()]; return;
}
//这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。
List<String> nameList = tableDataWrapper.calculateColumnNameList();
columnNames = new String[nameList.size()];
columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames); columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames);
columnNameComboBox.removeAllItems(); columnNameComboBox.removeAllItems();
for (int i = 0; i < columnNames.length; i++) { for (int i = 0; i < columnNames.length; i++) {
@ -64,7 +68,7 @@ public class ColumnSelectedEditor extends Editor<SimpleDSColumn> {
dsColumn.setDsName(tableDataWrappe.getTableDataName()); dsColumn.setDsName(tableDataWrappe.getTableDataName());
TableDataColumn column; TableDataColumn column;
String columnExp = (String) this.columnNameComboBox.getSelectedItem(); String columnExp = (String) this.columnNameComboBox.getSelectedItem();
if (StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#")) { if (StringUtils.isNotBlank(columnExp) && checkColumnExp(columnExp)) {
String number = columnExp.substring(1); String number = columnExp.substring(1);
Pattern pattern = Pattern.compile("[^\\d]"); Pattern pattern = Pattern.compile("[^\\d]");
if (pattern.matcher(number).find()) { if (pattern.matcher(number).find()) {
@ -80,6 +84,10 @@ public class ColumnSelectedEditor extends Editor<SimpleDSColumn> {
return dsColumn; return dsColumn;
} }
private boolean checkColumnExp (String columnExp) {
return (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#");
}
public String getIconName() { public String getIconName() {
return "ds_column"; return "ds_column";
} }

27
designer_base/src/com/fr/design/gui/controlpane/AbstractNameableCreator.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.js.JavaScript;
import javax.swing.*; import javax.swing.*;
@ -14,7 +15,7 @@ public abstract class AbstractNameableCreator implements NameableCreator {
protected Class clazzOfObject; protected Class clazzOfObject;
protected Class clazzOfInitCase; protected Class clazzOfInitCase;
protected Class<? extends BasicBeanPane> clazzOfEditor; protected Class<? extends BasicBeanPane> clazzOfEditor;
public AbstractNameableCreator(String menuName, Class clazz, Class<? extends BasicBeanPane> clazzOfEditor) { public AbstractNameableCreator(String menuName, Class clazz, Class<? extends BasicBeanPane> clazzOfEditor) {
this.menuName = menuName; this.menuName = menuName;
this.clazzOfObject = clazz; this.clazzOfObject = clazz;
@ -28,7 +29,7 @@ public abstract class AbstractNameableCreator implements NameableCreator {
this.clazzOfObject = clazz; this.clazzOfObject = clazz;
this.clazzOfInitCase = clazz; this.clazzOfInitCase = clazz;
} }
public AbstractNameableCreator(String menuName, String iconPath, Class clazz, Class<? extends BasicBeanPane> clazzOfEditor) { public AbstractNameableCreator(String menuName, String iconPath, Class clazz, Class<? extends BasicBeanPane> clazzOfEditor) {
this.menuName = menuName; this.menuName = menuName;
this.menuIcon = BaseUtils.readIcon(iconPath); this.menuIcon = BaseUtils.readIcon(iconPath);
@ -36,7 +37,7 @@ public abstract class AbstractNameableCreator implements NameableCreator {
this.clazzOfEditor = clazzOfEditor; this.clazzOfEditor = clazzOfEditor;
this.clazzOfInitCase = clazz; this.clazzOfInitCase = clazz;
} }
public AbstractNameableCreator(String menuName, String iconPath, Class clazz, Class clazz4Init, Class<? extends BasicBeanPane> clazzOfEditor) { public AbstractNameableCreator(String menuName, String iconPath, Class clazz, Class clazz4Init, Class<? extends BasicBeanPane> clazzOfEditor) {
this.menuName = menuName; this.menuName = menuName;
this.menuIcon = BaseUtils.readIcon(iconPath); this.menuIcon = BaseUtils.readIcon(iconPath);
@ -50,7 +51,7 @@ public abstract class AbstractNameableCreator implements NameableCreator {
* get menuName * get menuName
* @return * @return
*/ */
public String menuName() { public String menuName() {
return this.menuName; return this.menuName;
} }
@ -70,6 +71,14 @@ public abstract class AbstractNameableCreator implements NameableCreator {
return this.clazzOfEditor; return this.clazzOfEditor;
} }
/**
* get clazzOfObject
* @return clazzOfObject
*/
public Class <? extends JavaScript> getHyperlink() {
return this.clazzOfObject;
}
/** /**
* *
* @param ob * @param ob
@ -83,12 +92,12 @@ public abstract class AbstractNameableCreator implements NameableCreator {
doSthChanged4Icon(ob); doSthChanged4Icon(ob);
return ob; return ob;
} }
return null; return null;
} }
protected void doSthChanged4Icon(Object ob){ protected void doSthChanged4Icon(Object ob){
} }
/** /**
@ -99,9 +108,9 @@ public abstract class AbstractNameableCreator implements NameableCreator {
return null; return null;
} }
public boolean isNeedParameterWhenPopulateJControlPane(){ public boolean isNeedParameterWhenPopulateJControlPane(){
return false; return false;
} }
public boolean equals(Object obj) { public boolean equals(Object obj) {
return obj instanceof AbstractNameableCreator return obj instanceof AbstractNameableCreator

17
designer_base/src/com/fr/design/gui/controlpane/NameableCreator.java

@ -2,24 +2,27 @@ package com.fr.design.gui.controlpane;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.js.JavaScript;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import javax.swing.*; import javax.swing.*;
public interface NameableCreator { public interface NameableCreator {
public String menuName(); public String menuName();
public Icon menuIcon(); public Icon menuIcon();
public String createTooltip(); public String createTooltip();
public Nameable createNameable(UnrepeatedNameHelper helper); public Nameable createNameable(UnrepeatedNameHelper helper);
public Class<? extends BasicBeanPane> getUpdatePane(); public Class<? extends BasicBeanPane> getUpdatePane();
public Class <? extends JavaScript> getHyperlink();
public Object acceptObject2Populate(Object ob); public Object acceptObject2Populate(Object ob);
public void saveUpdatedBean(ListModelElement wrapper, Object bean); public void saveUpdatedBean(ListModelElement wrapper, Object bean);
public boolean isNeedParameterWhenPopulateJControlPane(); public boolean isNeedParameterWhenPopulateJControlPane();
} }

485
designer_chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java

File diff suppressed because one or more lines are too long

29
designer_chart/src/com/fr/design/chart/series/SeriesCondition/dlp/DataLabelPane.java

@ -96,7 +96,7 @@ public class DataLabelPane extends TooltipContentsPane {
} }
delimiterBox.setPreferredSize(new Dimension(70, 20)); delimiterBox.setPreferredSize(new Dimension(70, 20));
JPanel boxPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); JPanel boxPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
boxPane.add(new UILabel(Inter.getLocText("Form-Delimiter") + ":")); boxPane.add(new UILabel(Inter.getLocText("FR-Designer_Dismenber") + ":"));
boxPane.add(delimiterBox); boxPane.add(delimiterBox);
return boxPane; return boxPane;
} }
@ -111,34 +111,9 @@ public class DataLabelPane extends TooltipContentsPane {
} }
protected JPanel createJPanel4Position() { protected JPanel createJPanel4Position() {
// 标签位置:上下左右中. return null;
bottomButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Bottom"));
leftButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Left"));
rigtButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Right"));
topButton = new UIRadioButton(Inter.getLocText("StyleAlignment-Top"));
centerButton = new UIRadioButton(Inter.getLocText("Center"));
ButtonGroup bg = new ButtonGroup();
bg.add(bottomButton);
bg.add(leftButton);
bg.add(rigtButton);
bg.add(topButton);
bg.add(centerButton);
topButton.setSelected(true);
JPanel buttonPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
buttonPane.add(new UILabel(Inter.getLocText(new String[]{"Label", "Layout"}) + ":"));
buttonPane.add(bottomButton);
buttonPane.add(leftButton);
buttonPane.add(rigtButton);
buttonPane.add(topButton);
buttonPane.add(centerButton);
return buttonPane;
} }
public void populate(AttrContents seriesAttrContents) { public void populate(AttrContents seriesAttrContents) {
super.populate(seriesAttrContents); super.populate(seriesAttrContents);
String dataLabel = seriesAttrContents.getSeriesLabel(); String dataLabel = seriesAttrContents.getSeriesLabel();

161
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java

@ -5,6 +5,7 @@ import com.fr.base.Utils;
import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.NormalReportDataDefinition; import com.fr.chart.chartdata.NormalReportDataDefinition;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -21,6 +22,7 @@ import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
@ -30,125 +32,133 @@ import java.util.ArrayList;
*/ */
public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotReportDataContentPane implements UIObserver{ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotReportDataContentPane implements UIObserver{
private static final long serialVersionUID = -1122313353777460534L; private static final long serialVersionUID = -1122313353777460534L;
private JPanel boxPane; private JPanel boxPane;
private UIButton addButton; private UIButton addButton;
private ArrayList<TinyFormulaPane> formualList = new ArrayList<TinyFormulaPane>(); private ArrayList<TinyFormulaPane> formualList = new ArrayList<TinyFormulaPane>();
private UIObserverListener uiobListener = null; private UIObserverListener uiobListener = null;
public List<TinyFormulaPane> getFormualList() {
return formualList;
}
public CategoryPlotMoreCateReportDataContentPane() { public CategoryPlotMoreCateReportDataContentPane() {
} }
public CategoryPlotMoreCateReportDataContentPane(ChartDataPane parent) { public CategoryPlotMoreCateReportDataContentPane(ChartDataPane parent) {
initEveryPane(); initEveryPane();
categoryName = initCategoryBox(Inter.getLocText("FR-Chart-Category_Name") + ":"); categoryName = initCategoryBox(Inter.getLocText("FR-Chart-Category_Name") + ":");
JPanel catePane = new JPanel(); JPanel catePane = new JPanel();
catePane.setLayout(new BorderLayout(2, 2)); catePane.setLayout(new BorderLayout(2, 2));
catePane.add(categoryName); catePane.add(categoryName);
addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
addButton.setPreferredSize(new Dimension(20, 20)); addButton.setPreferredSize(new Dimension(20, 20));
catePane.add(addButton, BorderLayout.EAST); catePane.add(addButton, BorderLayout.EAST);
boxPane = new JPanel(); boxPane = new JPanel();
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS));
boxPane.setBackground(Color.red); boxPane.setBackground(Color.red);
catePane.add(boxPane, BorderLayout.SOUTH); catePane.add(boxPane, BorderLayout.SOUTH);
this.add(catePane, "0,0,2,0"); this.add(catePane, "0,0,2,0");
this.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Filter")), "0,4,2,4"); this.add(new BoldFontTextLabel(Inter.getLocText("FR-Chart-Data_Filter")), "0,4,2,4");
this.add(filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent), "0,6,2,4"); this.add(filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent), "0,6,2,4");
addButton.addActionListener(new ActionListener() { addButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
addNewCatePane(); addNewCatePane();
} }
}); });
}
/**
* 检查box 是否应该可用状态.
*/
public void checkBoxUse() {
super.checkBoxUse();
String text = categoryName.getUITextField().getText();
addButton.setEnabled(StringUtils.isNotEmpty(text));
} }
/**
* 检查box 是否应该可用状态.
*/
public void checkBoxUse() {
super.checkBoxUse();
String text = categoryName.getUITextField().getText();
addButton.setEnabled(StringUtils.isNotEmpty(text));
}
private TinyFormulaPane addNewCatePane() { private TinyFormulaPane addNewCatePane() {
final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY); final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY);
pane.setPreferredSize(new Dimension(122, 16)); pane.setPreferredSize(new Dimension(122, 16));
pane.registerChangeListener(uiobListener); pane.registerChangeListener(uiobListener);
formualList.add(pane); formualList.add(pane);
final JPanel newButtonPane = new JPanel(); final JPanel newButtonPane = new JPanel();
newButtonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); newButtonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
newButtonPane.add(pane); newButtonPane.add(pane);
UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png"));
newButtonPane.add(delButton); newButtonPane.add(delButton);
boxPane.add(newButtonPane); boxPane.add(newButtonPane);
delButton.addActionListener(new ActionListener() { delButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
boxPane.remove(newButtonPane); boxPane.remove(newButtonPane);
formualList.remove(pane); formualList.remove(pane);
checkAddButton(); checkComponent();
relayoutPane(); relayoutPane();
} }
}); });
delButton.registerChangeListener(uiobListener); delButton.registerChangeListener(uiobListener);
checkAddButton(); checkComponent();
relayoutPane(); relayoutPane();
return pane; return pane;
} }
private void checkAddButton() { private void checkAddButton() {
int size = formualList.size(); int size = formualList.size();
addButton.setEnabled(size < 2); addButton.setEnabled(size < 2);
} }
protected void checkComponent() {
checkAddButton();
}
private void relayoutPane() { private void relayoutPane() {
this.revalidate(); this.revalidate();
} }
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
uiobListener = listener; uiobListener = listener;
} }
/** /**
* 组件是否需要响应添加的观察者事件 * 组件是否需要响应添加的观察者事件
* *
* @return 如果需要响应观察者事件则返回true否则返回false * @return 如果需要响应观察者事件则返回true否则返回false
*/ */
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
public void populateBean(ChartCollection collection) { public void populateBean(ChartCollection collection) {
super.populateBean(collection); super.populateBean(collection);
formualList.clear(); formualList.clear();
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
if (definition instanceof NormalReportDataDefinition) { if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
@ -160,23 +170,28 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor
} }
} }
} }
checkAddButton(); checkAddButton();
} }
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
super.updateBean(collection); super.updateBean(collection);
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition();
Plot plot = collection.getSelectedChart().getPlot();
if (definition instanceof NormalReportDataDefinition) { if (definition instanceof NormalReportDataDefinition) {
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition;
reportDefinition.clearMoreCate(); reportDefinition.clearMoreCate();
updateMoreCate(reportDefinition, plot);
for(int i = 0, size = formualList.size(); i < size; i++) {
TinyFormulaPane pane = formualList.get(i); }
reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); }
}
protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Plot plot) {
for (int i = 0, size = formualList.size(); i < size; i++) {
TinyFormulaPane pane = formualList.get(i);
reportDefinition.addMoreCate(canBeFormula(pane.updateBean()));
} }
} }
} }

177
designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.NormalTableDataDefinition; import com.fr.chart.chartdata.NormalTableDataDefinition;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -36,40 +37,44 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
private static final int COMBOX_HEIGHT = 20; private static final int COMBOX_HEIGHT = 20;
private JPanel boxPane; private JPanel boxPane;
private ArrayList<UIComboBox> boxList = new ArrayList<UIComboBox>(); private ArrayList<UIComboBox> boxList = new ArrayList<UIComboBox>();
private UIButton addButton; private UIButton addButton;
private UIObserverListener uiobListener = null; private UIObserverListener uiobListener = null;
public List<UIComboBox> getBoxList() {
return boxList;
}
public CategoryPlotMoreCateTableDataContentPane() { public CategoryPlotMoreCateTableDataContentPane() {
// do nothing // do nothing
} }
public CategoryPlotMoreCateTableDataContentPane(ChartDataPane parent) { public CategoryPlotMoreCateTableDataContentPane(ChartDataPane parent) {
categoryCombox = new UIComboBox(); categoryCombox = new UIComboBox();
categoryCombox.setPreferredSize(new Dimension(100,20)); categoryCombox.setPreferredSize(new Dimension(100,20));
JPanel categoryPane = new JPanel(new BorderLayout(4,0)); JPanel categoryPane = new JPanel(new BorderLayout(4,0));
categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel categoryLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ; UILabel categoryLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ;
categoryLabel.setPreferredSize(new Dimension(75,20)); categoryLabel.setPreferredSize(new Dimension(75,20));
addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
addButton.setPreferredSize(new Dimension(20, 20)); addButton.setPreferredSize(new Dimension(20, 20));
categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton,null,categoryLabel,null})); categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton,null,categoryLabel,null}));
boxPane = new JPanel(); boxPane = new JPanel();
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS));
categoryPane.add(boxPane, BorderLayout.SOUTH); categoryPane.add(boxPane, BorderLayout.SOUTH);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(categoryPane, BorderLayout.NORTH); this.add(categoryPane, BorderLayout.NORTH);
seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot()); seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot());
this.add(seriesTypeComboxPane, BorderLayout.SOUTH); this.add(seriesTypeComboxPane, BorderLayout.SOUTH);
addButton.addActionListener(new ActionListener() { addButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -77,81 +82,85 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
addNewCombox(); addNewCombox();
relayoutPane(); relayoutPane();
} }
checkSeriseUse(categoryCombox.getSelectedItem() != null); checkSeriseUse(categoryCombox.getSelectedItem() != null);
} }
}); });
categoryCombox.addItemListener(new ItemListener() { categoryCombox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
checkSeriseUse(categoryCombox.getSelectedItem() != null); checkSeriseUse(categoryCombox.getSelectedItem() != null);
makeToolTipUse(categoryCombox); makeToolTipUse(categoryCombox);
checkAddButton(); checkComponent();
} }
}); });
} }
protected void checkSeriseUse(boolean hasUse) { protected void checkSeriseUse(boolean hasUse) {
super.checkSeriseUse(hasUse); super.checkSeriseUse(hasUse);
addButton.setEnabled(hasUse); addButton.setEnabled(hasUse);
} }
private UIComboBox addNewCombox() { private UIComboBox addNewCombox() {
final JPanel buttonPane = new JPanel(); final JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2));
final UIComboBox combox = new UIComboBox(); final UIComboBox combox = new UIComboBox();
combox.setPreferredSize(new Dimension(COMBOX_WIDTH, COMBOX_HEIGHT)); combox.setPreferredSize(new Dimension(COMBOX_WIDTH, COMBOX_HEIGHT));
int count = categoryCombox.getItemCount(); int count = categoryCombox.getItemCount();
for(int i = 0; i < count; i++) { for(int i = 0; i < count; i++) {
combox.addItem(categoryCombox.getItemAt(i)); combox.addItem(categoryCombox.getItemAt(i));
} }
combox.registerChangeListener(uiobListener); combox.registerChangeListener(uiobListener);
combox.addItemListener(new ItemListener() { combox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
makeToolTipUse(combox); makeToolTipUse(combox);
} }
}); });
combox.setSelectedItem(categoryCombox.getItemAt(0)); combox.setSelectedItem(categoryCombox.getItemAt(0));
makeToolTipUse(combox); makeToolTipUse(combox);
buttonPane.add(combox); buttonPane.add(combox);
UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png"));
buttonPane.add(delButton); buttonPane.add(delButton);
boxPane.add(buttonPane); boxPane.add(buttonPane);
boxList.add(combox); boxList.add(combox);
checkAddButton(); checkComponent();
delButton.addActionListener(new ActionListener() { delButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
boxPane.remove(buttonPane); boxPane.remove(buttonPane);
boxList.remove(combox); boxList.remove(combox);
checkAddButton(); checkComponent();
relayoutPane(); relayoutPane();
} }
}); });
delButton.registerChangeListener(uiobListener); delButton.registerChangeListener(uiobListener);
return combox; return combox;
} }
private void checkAddButton() { private void checkAddButton() {
int size = boxList.size(); int size = boxList.size();
addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null); addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null);
} }
protected void checkComponent() {
checkAddButton();
}
private void relayoutPane() { private void relayoutPane() {
this.revalidate(); this.revalidate();
} }
/** /**
*检查 某些Box是否可用 *检查 某些Box是否可用
@ -159,17 +168,17 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
*/ */
public void checkBoxUse(boolean hasUse) { public void checkBoxUse(boolean hasUse) {
super.checkBoxUse(hasUse); super.checkBoxUse(hasUse);
checkAddButton(); checkComponent();
}
protected void refreshBoxListWithSelectTableData(List list) {
super.refreshBoxListWithSelectTableData(list);
for(int i = 0, size = boxList.size(); i < size; i++) {
refreshBoxItems(boxList.get(i), list);
}
} }
protected void refreshBoxListWithSelectTableData(List list) {
super.refreshBoxListWithSelectTableData(list);
for(int i = 0, size = boxList.size(); i < size; i++) {
refreshBoxItems(boxList.get(i), list);
}
}
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
@ -195,9 +204,9 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
*/ */
public void populateBean(ChartCollection collection) { public void populateBean(ChartCollection collection) {
super.populateBean(collection); super.populateBean(collection);
boxList.clear(); boxList.clear();
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition();
if(top instanceof NormalTableDataDefinition) { if(top instanceof NormalTableDataDefinition) {
NormalTableDataDefinition normal = (NormalTableDataDefinition)top; NormalTableDataDefinition normal = (NormalTableDataDefinition)top;
@ -207,28 +216,34 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
box.setSelectedItem(normal.getMoreCateWithIndex(i)); box.setSelectedItem(normal.getMoreCateWithIndex(i));
} }
} }
checkAddButton(); checkAddButton();
checkSeriseUse(categoryCombox.getSelectedItem() != null); checkSeriseUse(categoryCombox.getSelectedItem() != null);
} }
/** /**
* 保存多分类界面到collection * 保存多分类界面到collection
* @param collection * @param collection
*/ */
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
super.updateBean(collection); super.updateBean(collection);
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition();
if(top instanceof NormalTableDataDefinition) { Plot plot = collection.getSelectedChart().getPlot();
NormalTableDataDefinition normal = (NormalTableDataDefinition)top; if (top instanceof NormalTableDataDefinition) {
NormalTableDataDefinition normal = (NormalTableDataDefinition) top;
normal.clearMoreCate(); normal.clearMoreCate();
for(int i = 0, size = boxList.size(); i < size; i++) { updateMoreCate(normal, plot);
UIComboBox box = boxList.get(i); }
if(box.getSelectedItem() != null) { }
normal.addMoreCate(box.getSelectedItem().toString());
} protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) {
for (int i = 0, size = boxList.size(); i < size; i++) {
UIComboBox box = boxList.get(i);
if (box.getSelectedItem() != null) {
normal.addMoreCate(box.getSelectedItem().toString());
} }
} }
} }
} }

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

@ -12,6 +12,7 @@ import com.fr.chart.chartdata.GisMapTableDefinition;
import com.fr.chart.web.ChartHyperPoplink; import com.fr.chart.web.ChartHyperPoplink;
import com.fr.chart.web.ChartHyperRelateCellLink; import com.fr.chart.web.ChartHyperRelateCellLink;
import com.fr.chart.web.ChartHyperRelateFloatLink; import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.javascript.ChartEmailPane; import com.fr.design.chart.javascript.ChartEmailPane;
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane;
@ -21,6 +22,8 @@ import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.frpane.UIBubbleFloatPane;
import com.fr.design.gui.frpane.UICorrelationComboBoxPane; import com.fr.design.gui.frpane.UICorrelationComboBoxPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -53,9 +56,10 @@ import java.text.DecimalFormat;
import java.text.Format; import java.text.Format;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
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 HashMap gisMap = new HashMap(); private static HashMap gisMap = new HashMap();
private static HashMap mapMap = new HashMap(); private static HashMap mapMap = new HashMap();
@ -69,16 +73,16 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
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;
@ -90,55 +94,55 @@ 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;
private JPanel timeSwitchContainer; private JPanel timeSwitchContainer;
private TimeSwitchPane timeSwitchPane; private TimeSwitchPane timeSwitchPane;
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) { public ChartInteractivePane(ChartOtherPane parent) {
super(); super();
this.parent = parent; 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")});
@ -148,13 +152,13 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
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();
@ -162,9 +166,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() {
@ -240,19 +244,19 @@ 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() { private JPanel initPaneWithListener() {
initDataPointToolTipPane(); initDataPointToolTipPane();
initAxisShowPane(); initAxisShowPane();
initAutoRefreshPane(); initAutoRefreshPane();
initSuperlinkPane(); initSuperlinkPane();
initTimeSwitchPane(); initTimeSwitchPane();
@ -271,7 +275,7 @@ 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());
@ -283,11 +287,11 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
/** /**
* 全部初始化, 对所有的界面 都加入, 然后会加载事件响应. 后续再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},
@ -298,7 +302,7 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
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;
@ -333,8 +337,8 @@ 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()
}; };
} }
@ -370,49 +374,49 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
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};
@ -427,7 +431,7 @@ 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) {
@ -455,9 +459,9 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
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},
}; };
@ -523,15 +527,15 @@ 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();
relayoutWithGis(chart, plot); relayoutWithGis(chart, plot);
relayoutWithPlot(plot); relayoutWithPlot(plot);
populateChartAnimate(chart, plot); populateChartAnimate(chart, plot);
populateChartScale(plot); populateChartScale(plot);
@ -540,8 +544,8 @@ 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()) {
@ -579,7 +583,7 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
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()){
@ -655,6 +659,13 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
private void populateHyperlink(Plot plot) { private void populateHyperlink(Plot plot) {
HashMap paneMap = renewMapWithPlot(plot); HashMap paneMap = renewMapWithPlot(plot);
//安装平台内打开插件时,添加相应按钮
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG);
for (HyperlinkProvider provider : providers) {
NameableCreator nc = provider.createHyperlinkCreator();
paneMap.put(nc.getHyperlink(), nc.getUpdatePane());
}
List<UIMenuNameableCreator> list = refreshList(paneMap); List<UIMenuNameableCreator> list = refreshList(paneMap);
superLink.refreshMenuAndAddMenuAction(list); superLink.refreshMenuAndAddMenuAction(list);
@ -672,13 +683,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);
@ -686,7 +697,7 @@ 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()) {
@ -818,7 +829,7 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
} }
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);
} }
@ -832,33 +843,33 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
} }
} }
return null; return null;
} }
protected List<UIMenuNameableCreator> refreshList(HashMap map) {
List<UIMenuNameableCreator> list = new ArrayList<UIMenuNameableCreator>();
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Reportlet"), protected List<UIMenuNameableCreator> refreshList(HashMap map) {
List<UIMenuNameableCreator> list = new ArrayList<UIMenuNameableCreator>();
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Reportlet"),
new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class)));
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), ChartEmailPane.class)); list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Mail"), new EmailJavaScript(), ChartEmailPane.class));
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Web"), list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Web"),
new WebHyperlink(), getUseMap(map, WebHyperlink.class))); new WebHyperlink(), getUseMap(map, WebHyperlink.class)));
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Dynamic_Parameters"), list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Dynamic_Parameters"),
new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class))); new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class)));
list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class)));
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Float_Chart"), list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Float_Chart"),
new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class))); new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class)));
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Cell"), list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Cell"),
new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class))); new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class)));
list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Float"), list.add(new UIMenuNameableCreator(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 UIMenuNameableCreator(Inter.getLocText("Chart-Link_Form"), list.add(new UIMenuNameableCreator(Inter.getLocText("Chart-Link_Form"),
hyperlink, getUseMap(map, FormHyperlinkProvider.class))); hyperlink, getUseMap(map, FormHyperlinkProvider.class)));
return list; return list;
} }
private HashMap renewMapWithPlot(Plot plot) { private HashMap renewMapWithPlot(Plot plot) {
if(plot instanceof PiePlot) { if(plot instanceof PiePlot) {
@ -1021,8 +1032,8 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
private HashMap getNormalPlotHyperMap() { private HashMap getNormalPlotHyperMap() {
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.CHART.class); normalMap.put(ReportletHyperlink.class, ReportletHyperlinkPane.CHART.class);
normalMap.put(EmailJavaScript.class, ChartEmailPane.class); normalMap.put(EmailJavaScript.class, ChartEmailPane.class);
normalMap.put(WebHyperlink.class, WebHyperlinkPane.CHART.class); normalMap.put(WebHyperlink.class, WebHyperlinkPane.CHART.class);
@ -1041,27 +1052,27 @@ public class ChartInteractivePane extends BasicScrollPane<Chart> implements UIOb
} }
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;
} }

2
designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java

@ -133,7 +133,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
} }
//子类覆盖 //子类覆盖
protected Plot getSelectedClonedPlot(){ protected <T extends Plot> T getSelectedClonedPlot(){
return null; return null;
} }

Loading…
Cancel
Save