Browse Source

數據配置界面

master
xiaohu 9 years ago
parent
commit
909b4b1a0b
  1. 44
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java

44
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[] columnSize = { p,f};
double[] rowSize = { p, p,p,p,p,p,p,p, p}; double[] rowSize = { p, p,p,p,p,p,p,p, p};
Component[][] components = new Component[][]{ Component[][] components = createComponents();
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}
} ;
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
this.add(panel,BorderLayout.CENTER); this.add(panel,BorderLayout.CENTER);
@ -65,7 +58,17 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
valueBox.addItemListener(tooltipListener); 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(nameBox, list);
refreshBoxItems(valueBox, list); refreshBoxItems(valueBox, list);
} }
@ -84,14 +87,19 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
public void populateBean(ChartCollection ob) { public void populateBean(ChartCollection ob) {
if(ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) { if(ob != null && ob.getSelectedChart().getFilterDefinition() instanceof MeterTableDefinition) {
MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition(); MeterTableDefinition meter = (MeterTableDefinition)ob.getSelectedChart().getFilterDefinition();
nameBox.setSelectedItem(meter.getName()); populateNameComponent(meter.getName());
valueBox.setSelectedItem(meter.getValue()); valueBox.setSelectedItem(meter.getValue());
filterPane.populateBean(ob); filterPane.populateBean(ob);
} }
} }
/** protected void populateNameComponent(String name) {
nameBox.setSelectedItem(name);
}
/**
* 保存界面属性. * 保存界面属性.
*/ */
public void updateBean(ChartCollection ob) { public void updateBean(ChartCollection ob) {
@ -99,13 +107,18 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
MeterTableDefinition meter = new MeterTableDefinition(); MeterTableDefinition meter = new MeterTableDefinition();
ob.getSelectedChart().setFilterDefinition(meter); ob.getSelectedChart().setFilterDefinition(meter);
meter.setName(Utils.objectToString(nameBox.getSelectedItem())); updateNameComponent(meter);
meter.setValue(Utils.objectToString(valueBox.getSelectedItem())); meter.setValue(Utils.objectToString(valueBox.getSelectedItem()));
filterPane.updateBean(ob); filterPane.updateBean(ob);
} }
} }
/** protected void updateNameComponent(MeterTableDefinition meter) {
meter.setName(Utils.objectToString(nameBox.getSelectedItem()));
}
/**
* 重新布局整个面板 * 重新布局整个面板
*/ */
public void redoLayoutPane(){ public void redoLayoutPane(){
@ -113,4 +126,7 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
} }
protected Component getNameComponent() {
return nameBox;
}
} }
Loading…
Cancel
Save