Browse Source

修改最大最小值值定义,兼容vancharts插件

master
mengao 8 years ago
parent
commit
cc43c53143
  1. 28
      designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java

28
designer_chart/src/com/fr/design/chart/axis/MinMaxValuePane.java

@ -42,24 +42,30 @@ public class MinMaxValuePane extends JPanel {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f }; double[] columnSize = { p, f };
double[] rowSize = { p, p, p, p};
Component[][] components = getPanelComponents(); Component[][] components = getPanelComponents();
JPanel panel = TableLayoutHelper.createTableLayoutPane(components ,rowSize,columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, getRowSize(p), columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
addComponentListener(components);
}
for(int i = 0; i < components.length; i++) { protected double[] getRowSize(double p) {
((UICheckBox)components[i][0]).addActionListener(new ActionListener() { return new double[]{p, p, p, p};
}
public void addComponentListener(Component[][] components) {
for (int i = 0; i < components.length; i++) {
((UICheckBox) components[i][0]).addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkBoxUse(); checkBoxUse();
} }
}); });
ChartSwingUtils.addListener((UICheckBox)components[i][0], (UITextField)components[i][1]); ChartSwingUtils.addListener((UICheckBox) components[i][0], (UITextField) components[i][1]);
} }
} }
protected Component[][] getPanelComponents() { protected Component[][] getPanelComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{minCheckBox, minValueField}, new Component[]{minCheckBox, minValueField},
@ -69,7 +75,7 @@ public class MinMaxValuePane extends JPanel {
}; };
} }
private void checkBoxUse() { protected void checkBoxUse() {
minValueField.setEnabled(minCheckBox.isSelected()); minValueField.setEnabled(minCheckBox.isSelected());
maxValueField.setEnabled(maxCheckBox.isSelected()); maxValueField.setEnabled(maxCheckBox.isSelected());
@ -100,7 +106,7 @@ public class MinMaxValuePane extends JPanel {
if(axis.getMinValue() != null) { if(axis.getMinValue() != null) {
minValueField.setText(axis.getMinValue().toString()); minValueField.setText(axis.getMinValue().toString());
} }
} }
// 最大值 // 最大值
if (axis.isCustomMaxValue()) { if (axis.isCustomMaxValue()) {
@ -108,7 +114,7 @@ public class MinMaxValuePane extends JPanel {
if(axis.getMaxValue() != null) { if(axis.getMaxValue() != null) {
maxValueField.setText(axis.getMaxValue().toString()); maxValueField.setText(axis.getMaxValue().toString());
} }
} }
// 主次刻度单位 // 主次刻度单位
if (axis.isCustomMainUnit()) { if (axis.isCustomMainUnit()) {
@ -116,7 +122,7 @@ public class MinMaxValuePane extends JPanel {
if(axis.getMainUnit() != null) { if(axis.getMainUnit() != null) {
mainUnitField.setText(axis.getMainUnit().toString()); mainUnitField.setText(axis.getMainUnit().toString());
} }
} }
if(axis.isCustomSecUnit()) { if(axis.isCustomSecUnit()) {
isCustomSecUnitBox.setSelected(true); isCustomSecUnitBox.setSelected(true);

Loading…
Cancel
Save