|
|
@ -9,9 +9,7 @@ import com.fr.design.dialog.BasicScrollPane; |
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
import com.fr.design.gui.chart.MiddleChartDialog; |
|
|
|
import com.fr.design.gui.chart.MiddleChartDialog; |
|
|
|
import com.fr.design.gui.frpane.UIComboBoxPane; |
|
|
|
import com.fr.design.gui.frpane.UIComboBoxPane; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.chart.AbstractChartAttrPane; |
|
|
|
import com.fr.design.mainframe.chart.AbstractChartAttrPane; |
|
|
|
import com.fr.design.mainframe.chart.ChartEditPane; |
|
|
|
import com.fr.design.mainframe.chart.ChartEditPane; |
|
|
@ -39,364 +37,366 @@ import java.awt.event.ItemListener; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 图表 属性表, 类型选择 界面. |
|
|
|
* 图表 属性表, 类型选择 界面. |
|
|
|
* @author kunsnat E-mail:kunsnat@gmail.com |
|
|
|
* |
|
|
|
* @version 创建时间:2012-12-26 上午10:56:51 |
|
|
|
* @author kunsnat E-mail:kunsnat@gmail.com |
|
|
|
|
|
|
|
* @version 创建时间:2012-12-26 上午10:56:51 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class ChartTypePane extends AbstractChartAttrPane{ |
|
|
|
public class ChartTypePane extends AbstractChartAttrPane { |
|
|
|
private ComboBoxPane chartTypeComBox; |
|
|
|
private ComboBoxPane chartTypeComBox; |
|
|
|
private ChartTypeButtonPane buttonPane; |
|
|
|
private ChartTypeButtonPane buttonPane; |
|
|
|
private ChartEditPane editPane; |
|
|
|
private ChartEditPane editPane; |
|
|
|
private ChartCollection editingCollection; |
|
|
|
private ChartCollection editingCollection; |
|
|
|
private UIButton autoButton; |
|
|
|
private ActionListener autoButtonListener; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected JPanel createContentPane() { |
|
|
|
protected JPanel createContentPane() { |
|
|
|
JPanel content = new JPanel(new BorderLayout()); |
|
|
|
initButtonListener(); |
|
|
|
|
|
|
|
JPanel content = new JPanel(new BorderLayout()); |
|
|
|
buttonPane = new ChartTypeButtonPane(this); |
|
|
|
|
|
|
|
content.add(buttonPane, BorderLayout.NORTH); |
|
|
|
buttonPane = new ChartTypeButtonPane(this); |
|
|
|
|
|
|
|
content.add(buttonPane, BorderLayout.NORTH); |
|
|
|
if (editingCollection != null) { |
|
|
|
|
|
|
|
relayoutChartTypePane(editingCollection); |
|
|
|
if (editingCollection != null) { |
|
|
|
}else { |
|
|
|
relayoutChartTypePane(editingCollection); |
|
|
|
chartTypeComBox = new ComboBoxPane(); |
|
|
|
} else { |
|
|
|
} |
|
|
|
chartTypeComBox = new ComboBoxPane(); |
|
|
|
|
|
|
|
} |
|
|
|
BasicScrollPane scrollPane = new BasicScrollPane() { |
|
|
|
|
|
|
|
@Override |
|
|
|
BasicScrollPane scrollPane = new BasicScrollPane() { |
|
|
|
protected JPanel createContentPane() { |
|
|
|
@Override |
|
|
|
return chartTypeComBox; |
|
|
|
protected JPanel createContentPane() { |
|
|
|
} |
|
|
|
return chartTypeComBox; |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
protected void layoutContentPane() { |
|
|
|
@Override |
|
|
|
|
|
|
|
protected void layoutContentPane() { |
|
|
|
leftcontentPane = createContentPane(); |
|
|
|
|
|
|
|
this.add(leftcontentPane); |
|
|
|
leftcontentPane = createContentPane(); |
|
|
|
} |
|
|
|
this.add(leftcontentPane); |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
public void populateBean(Object ob) { |
|
|
|
@Override |
|
|
|
} |
|
|
|
public void populateBean(Object ob) { |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
@Override |
|
|
|
return null; |
|
|
|
protected String title4PopupWindow() { |
|
|
|
} |
|
|
|
return null; |
|
|
|
}; |
|
|
|
} |
|
|
|
content.add(scrollPane, BorderLayout.CENTER); |
|
|
|
}; |
|
|
|
|
|
|
|
content.add(scrollPane, BorderLayout.CENTER); |
|
|
|
buttonPane.setEditingChartPane(chartTypeComBox); |
|
|
|
|
|
|
|
|
|
|
|
buttonPane.setEditingChartPane(chartTypeComBox); |
|
|
|
if(ChartTypeManager.AUTO_CHART) { |
|
|
|
|
|
|
|
initAutoButton(); |
|
|
|
return content; |
|
|
|
content.add(autoButton, BorderLayout.SOUTH); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
return content; |
|
|
|
* 界面做为按钮时的图片位置. design_base |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public String getIconPath() { |
|
|
|
/** |
|
|
|
return "com/fr/design/images/chart/ChartType.png"; |
|
|
|
* 界面做为按钮时的图片位置. design_base |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public String getIconPath() { |
|
|
|
/** |
|
|
|
return "com/fr/design/images/chart/ChartType.png"; |
|
|
|
* 界面标题 |
|
|
|
} |
|
|
|
* |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 界面标题 |
|
|
|
|
|
|
|
* @return 界面标题 |
|
|
|
* @return 界面标题 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public String title4PopupWindow() { |
|
|
|
public String title4PopupWindow() { |
|
|
|
return PaneTitleConstants.CHART_TYPE_TITLE; |
|
|
|
return PaneTitleConstants.CHART_TYPE_TITLE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initAutoButton(){ |
|
|
|
public void initButtonListener() { |
|
|
|
//TODO @Bjorn 视觉样式优化
|
|
|
|
autoButtonListener = new ActionListener() { |
|
|
|
autoButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_M_Popup_Auto_Chart_Type")); |
|
|
|
@Override |
|
|
|
autoButton.addActionListener(new ActionListener() { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
@Override |
|
|
|
final MiddleChartDialog autoChartDialog = DesignModuleFactory.getAutoChartDialog(DesignerContext.getDesignerFrame()); |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
autoChartDialog.populate(editingCollection); |
|
|
|
final MiddleChartDialog autoChartDialog = DesignModuleFactory.getAutoChartDialog(DesignerContext.getDesignerFrame()); |
|
|
|
autoChartDialog.addDialogActionListener(new DialogActionAdapter() { |
|
|
|
autoChartDialog.populate(editingCollection); |
|
|
|
@Override |
|
|
|
autoChartDialog.addDialogActionListener(new DialogActionAdapter() { |
|
|
|
public void doOk() { |
|
|
|
@Override |
|
|
|
populate(editingCollection); |
|
|
|
public void doOk() { |
|
|
|
} |
|
|
|
populate(editingCollection); |
|
|
|
}); |
|
|
|
} |
|
|
|
autoChartDialog.setVisible(true); |
|
|
|
}); |
|
|
|
} |
|
|
|
autoChartDialog.setVisible(true); |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
class ComboBoxPane extends UIComboBoxPane<ChartProvider> { |
|
|
|
|
|
|
|
private Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane; |
|
|
|
class ComboBoxPane extends UIComboBoxPane<ChartProvider> { |
|
|
|
|
|
|
|
private Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane; |
|
|
|
@Override |
|
|
|
|
|
|
|
protected List<FurtherBasicBeanPane<? extends ChartProvider>> initPaneList() { |
|
|
|
@Override |
|
|
|
List<FurtherBasicBeanPane<? extends ChartProvider>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartProvider>>(); |
|
|
|
protected List<FurtherBasicBeanPane<? extends ChartProvider>> initPaneList() { |
|
|
|
allChartTypePane = new LinkedHashMap<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>>(); |
|
|
|
List<FurtherBasicBeanPane<? extends ChartProvider>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartProvider>>(); |
|
|
|
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane, autoButtonListener); |
|
|
|
allChartTypePane = new LinkedHashMap<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>>(); |
|
|
|
return paneList; |
|
|
|
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane); |
|
|
|
} |
|
|
|
return paneList; |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
@Override |
|
|
|
return null; |
|
|
|
protected String title4PopupWindow() { |
|
|
|
} |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* 不同图表切换分同一个selected的不同图表切换和不同selected的不同图表切换 |
|
|
|
/** |
|
|
|
* 如果是切换图表的某个图表发生变化,则collection的选择下标不会变 |
|
|
|
* 不同图表切换分同一个selected的不同图表切换和不同selected的不同图表切换 |
|
|
|
* 如果是切换图表的不同图表之间切换,则collection的选择下标会改变 |
|
|
|
* 如果是切换图表的某个图表发生变化,则collection的选择下标不会变 |
|
|
|
* |
|
|
|
* 如果是切换图表的不同图表之间切换,则collection的选择下标会改变 |
|
|
|
* @param chart |
|
|
|
* @param chart |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void updateBean(ChartProvider chart) { |
|
|
|
public void updateBean(ChartProvider chart) { |
|
|
|
|
|
|
|
|
|
|
|
String lastPlotID = chart.getID(); |
|
|
|
String lastPlotID = chart.getID(); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try{ |
|
|
|
AbstractChartTypePane selectedPane = (AbstractChartTypePane) getSelectedPane(); |
|
|
|
AbstractChartTypePane selectedPane = (AbstractChartTypePane) getSelectedPane(); |
|
|
|
ChartProvider newDefaultChart = (ChartProvider) ChartTypeManager.getInstanceWithCheck().getCharts(selectedPane.getPlotID())[0].clone(); |
|
|
|
ChartProvider newDefaultChart =(ChartProvider) ChartTypeManager.getInstanceWithCheck().getCharts(selectedPane.getPlotID())[0].clone(); |
|
|
|
if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) { |
|
|
|
if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) { |
|
|
|
//vanChart 和 chart 之间切换
|
|
|
|
//vanChart 和 chart 之间切换
|
|
|
|
//不同chart之间切换
|
|
|
|
//不同chart之间切换
|
|
|
|
|
|
|
|
editingCollection.removeNameObject(editingCollection.getSelectedIndex()); |
|
|
|
editingCollection.removeNameObject(editingCollection.getSelectedIndex()); |
|
|
|
editingCollection.addChart(newDefaultChart); |
|
|
|
editingCollection.addChart(newDefaultChart); |
|
|
|
chart = newDefaultChart; |
|
|
|
chart = newDefaultChart; |
|
|
|
} |
|
|
|
} |
|
|
|
}catch (CloneNotSupportedException e){ |
|
|
|
} catch (CloneNotSupportedException e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
//这一步会替换plot
|
|
|
|
//这一步会替换plot
|
|
|
|
((AbstractChartTypePane)getSelectedPane()).updateBean(chart); |
|
|
|
((AbstractChartTypePane) getSelectedPane()).updateBean(chart); |
|
|
|
|
|
|
|
|
|
|
|
String chartID = chart.getID(); |
|
|
|
String chartID = chart.getID(); |
|
|
|
|
|
|
|
|
|
|
|
//chartID改变的话图表类型就算改变了
|
|
|
|
//chartID改变的话图表类型就算改变了
|
|
|
|
if (StringUtils.isNotEmpty(chartID)) { |
|
|
|
if (StringUtils.isNotEmpty(chartID)) { |
|
|
|
|
|
|
|
|
|
|
|
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); |
|
|
|
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); |
|
|
|
|
|
|
|
|
|
|
|
if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, chartID))) { |
|
|
|
if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, chartID))) { |
|
|
|
editPane.reLayout(chart); |
|
|
|
editPane.reLayout(chart); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected UIComboBox createComboBox() { |
|
|
|
protected UIComboBox createComboBox() { |
|
|
|
return new FlexibleComboBox(); |
|
|
|
return new FlexibleComboBox(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void addItemChangeEvent() { |
|
|
|
protected void addItemChangeEvent() { |
|
|
|
jcb.addItemListener(new ItemListener() { |
|
|
|
jcb.addItemListener(new ItemListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
FlexibleComboBox fcb = (FlexibleComboBox)jcb; |
|
|
|
FlexibleComboBox fcb = (FlexibleComboBox) jcb; |
|
|
|
if (fcb.isReactor()){ |
|
|
|
if (fcb.isReactor()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
comboBoxItemStateChanged(); |
|
|
|
comboBoxItemStateChanged(); |
|
|
|
CardLayout cl = (CardLayout)cardPane.getLayout(); |
|
|
|
CardLayout cl = (CardLayout) cardPane.getLayout(); |
|
|
|
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); |
|
|
|
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void addAllCards() { |
|
|
|
private void addAllCards() { |
|
|
|
Iterator<String> iterator = allChartTypePane.keySet().iterator(); |
|
|
|
Iterator<String> iterator = allChartTypePane.keySet().iterator(); |
|
|
|
|
|
|
|
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
while (iterator.hasNext()) { |
|
|
|
addOnePriorityCards(iterator.next(), false); |
|
|
|
addOnePriorityCards(iterator.next(), false); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void addOnePriorityCards(String priority) { |
|
|
|
private void addOnePriorityCards(String priority) { |
|
|
|
addOnePriorityCards(priority, true); |
|
|
|
addOnePriorityCards(priority, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void addOnePriorityCards(String priority, boolean ignore) { |
|
|
|
private void addOnePriorityCards(String priority, boolean ignore) { |
|
|
|
|
|
|
|
|
|
|
|
Map<String, FurtherBasicBeanPane<? extends ChartProvider>> map = allChartTypePane.get(priority); |
|
|
|
Map<String, FurtherBasicBeanPane<? extends ChartProvider>> map = allChartTypePane.get(priority); |
|
|
|
|
|
|
|
|
|
|
|
Iterator<Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>>> iterator = map.entrySet().iterator(); |
|
|
|
Iterator<Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>>> iterator = map.entrySet().iterator(); |
|
|
|
|
|
|
|
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
while (iterator.hasNext()) { |
|
|
|
Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>> entry = iterator.next(); |
|
|
|
Map.Entry<String, FurtherBasicBeanPane<? extends ChartProvider>> entry = iterator.next(); |
|
|
|
String plotID = entry.getKey(); |
|
|
|
String plotID = entry.getKey(); |
|
|
|
if (ignore || ChartTypeManager.enabledChart(plotID)) { |
|
|
|
if (ignore || ChartTypeManager.enabledChart(plotID)) { |
|
|
|
cards.add(entry.getValue()); |
|
|
|
cards.add(entry.getValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void addOnePlotIDCards(String priority, String plotID) { |
|
|
|
private void addOnePlotIDCards(String priority, String plotID) { |
|
|
|
cards.add(allChartTypePane.get(priority).get(plotID)); |
|
|
|
cards.add(allChartTypePane.get(priority).get(plotID)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//因为饼图(新特性)把(新特性)去掉了,和老的饼图同名,下拉框选项和typePane不能一一对应了
|
|
|
|
//因为饼图(新特性)把(新特性)去掉了,和老的饼图同名,下拉框选项和typePane不能一一对应了
|
|
|
|
//处理办法:这边除了重构 下拉项选项和cardNames 还需要把cards重构下(不需要init pane,只需要我需要的拿出来就好了)
|
|
|
|
//处理办法:这边除了重构 下拉项选项和cardNames 还需要把cards重构下(不需要init pane,只需要我需要的拿出来就好了)
|
|
|
|
private void relayout(ChartCollection collection){ |
|
|
|
private void relayout(ChartCollection collection) { |
|
|
|
//重构需要重构下拉框选项和cardNames
|
|
|
|
//重构需要重构下拉框选项和cardNames
|
|
|
|
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); |
|
|
|
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); |
|
|
|
String chartID = chart.getID(); |
|
|
|
String chartID = chart.getID(); |
|
|
|
String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); |
|
|
|
String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); |
|
|
|
boolean enabledChart = ChartTypeManager.enabledChart(chartID); |
|
|
|
boolean enabledChart = ChartTypeManager.enabledChart(chartID); |
|
|
|
String item = ChartTypeInterfaceManager.getInstance().getName(chartID); |
|
|
|
String item = ChartTypeInterfaceManager.getInstance().getName(chartID); |
|
|
|
|
|
|
|
|
|
|
|
//第一步就是重构cards
|
|
|
|
//第一步就是重构cards
|
|
|
|
cards.clear(); |
|
|
|
cards.clear(); |
|
|
|
if (enabledChart) { |
|
|
|
if (enabledChart) { |
|
|
|
if (collection.getChartCount() == 1) { |
|
|
|
if (collection.getChartCount() == 1) { |
|
|
|
addAllCards(); |
|
|
|
addAllCards(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
addOnePriorityCards(priority); |
|
|
|
addOnePriorityCards(priority); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
addOnePlotIDCards(priority, chartID); |
|
|
|
addOnePlotIDCards(priority, chartID); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//下拉框重构开始。为了防止重构是触发update
|
|
|
|
//下拉框重构开始。为了防止重构是触发update
|
|
|
|
((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.REACTOR); |
|
|
|
((FlexibleComboBox) jcb).setItemEvenType(ItemEventType.REACTOR); |
|
|
|
//重构下拉框选项
|
|
|
|
//重构下拉框选项
|
|
|
|
cardNames = new String[cards.size()]; |
|
|
|
cardNames = new String[cards.size()]; |
|
|
|
cardPane.removeAll(); |
|
|
|
cardPane.removeAll(); |
|
|
|
jcb.removeAllItems(); |
|
|
|
jcb.removeAllItems(); |
|
|
|
for (int i = 0; i < this.cards.size(); i++) { |
|
|
|
for (int i = 0; i < this.cards.size(); i++) { |
|
|
|
String name = this.cards.get(i).title4PopupWindow();// Name从各自的pane里面获取
|
|
|
|
String name = this.cards.get(i).title4PopupWindow();// Name从各自的pane里面获取
|
|
|
|
cardNames[i] = name; |
|
|
|
cardNames[i] = name; |
|
|
|
cardPane.add(this.cards.get(i), cardNames[i]); |
|
|
|
cardPane.add(this.cards.get(i), cardNames[i]); |
|
|
|
addComboBoxItem(cards, i); |
|
|
|
addComboBoxItem(cards, i); |
|
|
|
} |
|
|
|
} |
|
|
|
//重新选择选中的下拉项
|
|
|
|
//重新选择选中的下拉项
|
|
|
|
jcb.setSelectedItem(item); |
|
|
|
jcb.setSelectedItem(item); |
|
|
|
jcb.setEnabled(enabledChart); |
|
|
|
jcb.setEnabled(enabledChart); |
|
|
|
//下拉框重构结束
|
|
|
|
//下拉框重构结束
|
|
|
|
((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.DEFAULT); |
|
|
|
((FlexibleComboBox) jcb).setItemEvenType(ItemEventType.DEFAULT); |
|
|
|
//重新选中
|
|
|
|
//重新选中
|
|
|
|
checkPlotPane(); |
|
|
|
checkPlotPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void checkPlotPane() { |
|
|
|
private void checkPlotPane() { |
|
|
|
CardLayout cl = (CardLayout)cardPane.getLayout(); |
|
|
|
CardLayout cl = (CardLayout) cardPane.getLayout(); |
|
|
|
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); |
|
|
|
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void populateBean(ChartProvider ob) { |
|
|
|
public void populateBean(ChartProvider ob) { |
|
|
|
for (int i = 0; i < this.cards.size(); i++) { |
|
|
|
for (int i = 0; i < this.cards.size(); i++) { |
|
|
|
FurtherBasicBeanPane pane = cards.get(i); |
|
|
|
FurtherBasicBeanPane pane = cards.get(i); |
|
|
|
if (pane.accept(ob)) { |
|
|
|
if (pane.accept(ob)) { |
|
|
|
pane.populateBean(ob); |
|
|
|
pane.populateBean(ob); |
|
|
|
Object item = pane.title4PopupWindow(); |
|
|
|
Object item = pane.title4PopupWindow(); |
|
|
|
for (int j = 0; j < cardNames.length; j++) { |
|
|
|
for (int j = 0; j < cardNames.length; j++) { |
|
|
|
if (ComparatorUtils.equals(item, cardNames[j])) { |
|
|
|
if (ComparatorUtils.equals(item, cardNames[j])) { |
|
|
|
jcb.setSelectedIndex(j); |
|
|
|
jcb.setSelectedIndex(j); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public ChartProvider updateBean() { |
|
|
|
public ChartProvider updateBean() { |
|
|
|
return getSelectedPane().updateBean(); |
|
|
|
return getSelectedPane().updateBean(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public FurtherBasicBeanPane<? extends ChartProvider> getSelectedPane() { |
|
|
|
public FurtherBasicBeanPane<? extends ChartProvider> getSelectedPane() { |
|
|
|
Object item = jcb.getSelectedItem(); |
|
|
|
Object item = jcb.getSelectedItem(); |
|
|
|
for (int i = 0; i < cards.size(); i++){ |
|
|
|
for (int i = 0; i < cards.size(); i++) { |
|
|
|
if (ComparatorUtils.equals(item, cards.get(i).title4PopupWindow())){ |
|
|
|
if (ComparatorUtils.equals(item, cards.get(i).title4PopupWindow())) { |
|
|
|
return cards.get(i); |
|
|
|
return cards.get(i); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return cards.get(0); |
|
|
|
return cards.get(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 面板重构 |
|
|
|
* 面板重构 |
|
|
|
* @param lastPlotID |
|
|
|
* |
|
|
|
* @param collection |
|
|
|
* @param lastPlotID |
|
|
|
*/ |
|
|
|
* @param collection |
|
|
|
public void reLayoutEditPane(String lastPlotID, ChartCollection collection){ |
|
|
|
*/ |
|
|
|
if (editPane == null) { |
|
|
|
public void reLayoutEditPane(String lastPlotID, ChartCollection collection) { |
|
|
|
return; |
|
|
|
if (editPane == null) { |
|
|
|
} |
|
|
|
return; |
|
|
|
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); |
|
|
|
} |
|
|
|
String plotID = chart.getID(); |
|
|
|
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); |
|
|
|
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); |
|
|
|
String plotID = chart.getID(); |
|
|
|
if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))) { |
|
|
|
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); |
|
|
|
editPane.reLayout(chart); |
|
|
|
if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))) { |
|
|
|
} |
|
|
|
editPane.reLayout(chart); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void relayoutChartTypePane(ChartCollection collection){ |
|
|
|
|
|
|
|
chartTypeComBox.relayout(collection); |
|
|
|
public void relayoutChartTypePane(ChartCollection collection) { |
|
|
|
} |
|
|
|
chartTypeComBox.relayout(collection); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* 更新界面属性 用于展示 |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 更新界面属性 用于展示 |
|
|
|
public void populate(ChartCollection collection) { |
|
|
|
*/ |
|
|
|
editingCollection = collection; |
|
|
|
public void populate(ChartCollection collection) { |
|
|
|
|
|
|
|
editingCollection = collection; |
|
|
|
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); |
|
|
|
|
|
|
|
this.remove(leftContentPane); |
|
|
|
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); |
|
|
|
initContentPane(); |
|
|
|
this.remove(leftContentPane); |
|
|
|
|
|
|
|
initContentPane(); |
|
|
|
buttonPane.populateBean(collection); |
|
|
|
|
|
|
|
chartTypeComBox.populateBean(chart); |
|
|
|
buttonPane.populateBean(collection); |
|
|
|
|
|
|
|
chartTypeComBox.populateBean(chart); |
|
|
|
buttonPane.setVisible(ChartTypeInterfaceManager.getInstance().needChartChangePane(chart)); |
|
|
|
|
|
|
|
|
|
|
|
buttonPane.setVisible(ChartTypeInterfaceManager.getInstance().needChartChangePane(chart)); |
|
|
|
this.initAllListeners(); |
|
|
|
|
|
|
|
} |
|
|
|
this.initAllListeners(); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
|
|
|
|
* 保存界面属性 |
|
|
|
/** |
|
|
|
*/ |
|
|
|
* 保存界面属性 |
|
|
|
public void update(ChartCollection collection) { |
|
|
|
*/ |
|
|
|
|
|
|
|
public void update(ChartCollection collection) { |
|
|
|
editingCollection = collection; |
|
|
|
editingCollection = collection; |
|
|
|
buttonPane.update(collection);// 内部操作时 已经做过处理.
|
|
|
|
buttonPane.update(collection);// 内部操作时 已经做过处理.
|
|
|
|
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); |
|
|
|
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); |
|
|
|
chartTypeComBox.updateBean(chart); |
|
|
|
chartTypeComBox.updateBean(chart); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 所有图表的类型界面 |
|
|
|
* 所有图表的类型界面 |
|
|
|
|
|
|
|
* |
|
|
|
* @return 类型界面 |
|
|
|
* @return 类型界面 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public FurtherBasicBeanPane[] getPaneList(){ |
|
|
|
public FurtherBasicBeanPane[] getPaneList() { |
|
|
|
return chartTypeComBox.getCards().toArray(new FurtherBasicBeanPane[0]); |
|
|
|
return chartTypeComBox.getCards().toArray(new FurtherBasicBeanPane[0]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 当前选中的图表的index |
|
|
|
* 当前选中的图表的index |
|
|
|
|
|
|
|
* |
|
|
|
* @return 当前选中的图表的index |
|
|
|
* @return 当前选中的图表的index |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int getSelectedIndex(){ |
|
|
|
public int getSelectedIndex() { |
|
|
|
return chartTypeComBox.getSelectedIndex(); |
|
|
|
return chartTypeComBox.getSelectedIndex(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 返回选中的图表的index |
|
|
|
* 返回选中的图表的index |
|
|
|
|
|
|
|
* |
|
|
|
* @return 选中的图标的序号 |
|
|
|
* @return 选中的图标的序号 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public int getSelectedChartIndex(){ |
|
|
|
public int getSelectedChartIndex() { |
|
|
|
return chartTypeComBox.getSelectedIndex(); |
|
|
|
return chartTypeComBox.getSelectedIndex(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设置下编辑的面板 |
|
|
|
* 设置下编辑的面板 |
|
|
|
|
|
|
|
* |
|
|
|
* @param currentEditPane 设置下编辑的面板 |
|
|
|
* @param currentEditPane 设置下编辑的面板 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void registerChartEditPane(ChartEditPane currentEditPane) { |
|
|
|
public void registerChartEditPane(ChartEditPane currentEditPane) { |
|
|
|