Browse Source

數據配置界面

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

36
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,6 +58,16 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
valueBox.addItemListener(tooltipListener); valueBox.addItemListener(tooltipListener);
} }
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) { protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(nameBox, list); refreshBoxItems(nameBox, list);
refreshBoxItems(valueBox, list); refreshBoxItems(valueBox, list);
@ -85,12 +88,17 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
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);
}
/** /**
* 保存界面属性. * 保存界面属性.
*/ */
@ -99,12 +107,17 @@ 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()));
}
/** /**
* 重新布局整个面板 * 重新布局整个面板
*/ */
@ -113,4 +126,7 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
} }
protected Component getNameComponent() {
return nameBox;
}
} }
Loading…
Cancel
Save