diff --git a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java index f29efe7af..868fefbf7 100644 --- a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java @@ -30,7 +30,7 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ return new Dimension(super.getPreferredSize().width, 18); } }; - nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); + nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); nameLabel.setHorizontalAlignment(SwingConstants.CENTER); } diff --git a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java index 1d9732205..53609b49d 100644 --- a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java @@ -16,6 +16,7 @@ import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.general.Inter; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -30,11 +31,11 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ public MiddleChartPropertyPane() { initComponenet(); } - + protected void initComponenet() { this.setLayout(new BorderLayout()); this.setBorder(null); - + createNameLabel(); this.add(createNorthComponent(), BorderLayout.NORTH); chartEditPane = StableUtils.construct(ChartEditPane.class); @@ -47,11 +48,11 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ this.createMainPane(); setSureProperty(); } - + protected abstract void createNameLabel(); - + protected abstract JComponent createNorthComponent(); - + protected abstract void createMainPane(); @@ -64,10 +65,10 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ chartEditPane.setContainer(container); chartEditPane.addTitleChangeListener(titleListener); String tabname = chartEditPane.getSelectedTabName(); - nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); + nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : StringUtils.EMPTY)); resetChartEditPane(); } - + protected void resetChartEditPane() { remove(chartEditPane); add(chartEditPane, BorderLayout.CENTER); @@ -75,20 +76,20 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ repaint(); revalidate(); } - + protected TitleChangeListener titleListener = new TitleChangeListener() { - + @Override public void fireTitleChange(String addName) { nameLabel.setText(Inter.getLocText("Chart-Property_Table") + '-' + addName); } }; - /** - * 感觉ChartCollection加载图表属性界面. - * @param collection 收集图表 - * @param ePane 面板 - */ + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ public void populateChartPropertyPane(ChartCollection collection, TargetComponent ePane) { addChartEditPane(collection.getSelectedChart().getPlot().getPlotID()); setSupportCellData(true); @@ -96,11 +97,11 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ chartEditPane.populate(collection); } - /** - * 感觉ChartCollection加载图表属性界面. - * @param collection 收集图表 - * @param ePane 面板 - */ + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent ePane) { if (collection instanceof ChartCollection) { populateChartPropertyPane((ChartCollection)collection, ePane); @@ -127,18 +128,18 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ return BaseUtils.readIcon("/com/fr/design/images/m_report/qb.png"); } - /** - * 预定义定位 - * @return 定位 - */ + /** + * 预定义定位 + * @return 定位 + */ public Location preferredLocation() { return Location.WEST_BELOW; } - /** - * 创建标题Panel - * @return 标题panel - */ + /** + * 创建标题Panel + * @return 标题panel + */ public UITitlePanel createTitlePanel() { return new UITitlePanel(this); } @@ -148,14 +149,14 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ */ public void refreshDockingView() { // TODO Auto-generated method stub - + } - + /** * 设置是否支持单元格数据. */ public void setSupportCellData(boolean supportCellData) { - if(chartEditPane != null) { + if (chartEditPane != null) { chartEditPane.setSupportCellData(supportCellData); } } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index 3397fe9f9..f681f275e 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -6,6 +6,8 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.AttributeChangeListener; @@ -20,14 +22,17 @@ import com.fr.design.mainframe.chart.gui.ChartTypePane; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -public class ChartEditPane extends BasicPane implements AttributeChange, ChartEditPaneProvider { +public class ChartEditPane extends BasicPane implements AttributeChange, Prepare4DataSourceChange, ChartEditPaneProvider { private final static int CHANGE_MIN_TIME = 80; @@ -65,9 +70,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd paneList.add(otherPane); createTabsPane(); - - //TableDataComboBox 中有注册DSChangeListener,这里没有必要再次注册。 - //registerDSChangeListener(); + registerDSChangeListener(); } //构建主面板 @@ -140,7 +143,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd addTypePane(); boolean isDefault = true; - String plotID = ""; + String plotID = StringUtils.EMPTY; if (currentChart.getPlot() != null) { plotID = currentChart.getPlot().getPlotID(); isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); @@ -177,6 +180,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd } protected void setSelectedTab() { + //doNothing } /** @@ -222,7 +226,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd return; } - if (checkNeedsReLayout(collection.getSelectedChart())) { + if (isNeedsReLayout(collection.getSelectedChart())) { reLayout(collection.getSelectedChart()); } @@ -263,7 +267,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd } //populate的时候看看要不要重构面板 - private boolean checkNeedsReLayout(Chart chart) { + private boolean isNeedsReLayout(Chart chart) { if (chart != null) { int lastIndex = typePane.getSelectedIndex(); int currentIndex = getSelectedChartIndex(chart); @@ -315,7 +319,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd } protected void dealWithStyleChange() { - + //doNothing } /** @@ -324,7 +328,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd * @param isFromToolBar 是否来自工具栏 */ public void styleChange(boolean isFromToolBar) { - + //doNothing } /** @@ -336,4 +340,18 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd paneList.get(index).addAttributeChangeListener(listener); } + /** + * 数据集改变的事件监听 + */ + public void registerDSChangeListener() { + DesignTableDataManager.addDsChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); + //不显示,没有处于编辑状态,没必要更新。 + if (attrPane.isShowing()) { + attrPane.refreshChartDataPane(collection); + } + } + }); + } } \ No newline at end of file