From 909b4b1a0bd7fd2d357f6b4fded0681ff041a8c8 Mon Sep 17 00:00:00 2001 From: xiaohu Date: Wed, 18 May 2016 15:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B8=E6=93=9A=E9=85=8D=E7=BD=AE=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table/MeterPlotTableDataContentPane.java | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java index 5ea4e8fe63..22deb51016 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java @@ -49,14 +49,7 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane double[] columnSize = { p,f}; double[] rowSize = { p, p,p,p,p,p,p,p, p}; - Component[][] components = new Component[][]{ - new Component[]{new BoldFontTextLabel(METER_NAME, SwingConstants.RIGHT), nameBox}, - new Component[]{new BoldFontTextLabel(METER_VALUE, SwingConstants.RIGHT), valueBox}, - new Component[]{new JSeparator(), null}, - new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))}, - new Component[]{filterPane, null} - - } ; + Component[][] components = createComponents(); JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); this.add(panel,BorderLayout.CENTER); @@ -65,7 +58,17 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane valueBox.addItemListener(tooltipListener); } - protected void refreshBoxListWithSelectTableData(List list) { + private Component[][] createComponents() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(METER_NAME, SwingConstants.RIGHT), getNameComponent()}, + new Component[]{new BoldFontTextLabel(METER_VALUE, SwingConstants.RIGHT), valueBox}, + new Component[]{new JSeparator(), null}, + new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))}, + new Component[]{filterPane, null} + }; + } + + protected void refreshBoxListWithSelectTableData(List list) { refreshBoxItems(nameBox, list); refreshBoxItems(valueBox, list); } @@ -84,14 +87,19 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane public void populateBean(ChartCollection ob) { if(ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) { MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition(); - - nameBox.setSelectedItem(meter.getName()); + + populateNameComponent(meter.getName()); + valueBox.setSelectedItem(meter.getValue()); filterPane.populateBean(ob); } } - /** + protected void populateNameComponent(String name) { + nameBox.setSelectedItem(name); + } + + /** * 保存界面属性. */ public void updateBean(ChartCollection ob) { @@ -99,13 +107,18 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane MeterTableDefinition meter = new MeterTableDefinition(); ob.getSelectedChart().setFilterDefinition(meter); - meter.setName(Utils.objectToString(nameBox.getSelectedItem())); + updateNameComponent(meter); + meter.setValue(Utils.objectToString(valueBox.getSelectedItem())); filterPane.updateBean(ob); } } - /** + protected void updateNameComponent(MeterTableDefinition meter) { + meter.setName(Utils.objectToString(nameBox.getSelectedItem())); + } + + /** * 重新布局整个面板 */ public void redoLayoutPane(){ @@ -113,4 +126,7 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane } + protected Component getNameComponent() { + return nameBox; + } } \ No newline at end of file