|
|
@ -30,6 +30,7 @@ public class MinMaxValuePane extends JPanel { |
|
|
|
protected UICheckBox isCustomSecUnitBox; |
|
|
|
protected UICheckBox isCustomSecUnitBox; |
|
|
|
protected UITextField secUnitField; |
|
|
|
protected UITextField secUnitField; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MinMaxValuePane() { |
|
|
|
public MinMaxValuePane() { |
|
|
|
minCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Min_Value"})); |
|
|
|
minCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Min_Value"})); |
|
|
|
minValueField = new UITextField(6); |
|
|
|
minValueField = new UITextField(6); |
|
|
@ -39,17 +40,24 @@ public class MinMaxValuePane extends JPanel { |
|
|
|
mainUnitField = new UITextField(6); |
|
|
|
mainUnitField = new UITextField(6); |
|
|
|
isCustomSecUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_SecondGraduationUnit")); |
|
|
|
isCustomSecUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_SecondGraduationUnit")); |
|
|
|
secUnitField = new UITextField(6); |
|
|
|
secUnitField = new UITextField(6); |
|
|
|
|
|
|
|
|
|
|
|
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, 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+=2) { |
|
|
|
protected double[] getRowSize(double p) { |
|
|
|
|
|
|
|
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() { |
|
|
|
((UICheckBox) components[i][0]).addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -57,23 +65,20 @@ public class MinMaxValuePane extends JPanel { |
|
|
|
checkBoxUse(); |
|
|
|
checkBoxUse(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
ChartSwingUtils.addListener((UICheckBox)components[i][0], (UITextField)components[i+1][0]); |
|
|
|
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}, |
|
|
|
new Component[]{minCheckBox, minValueField}, |
|
|
|
new Component[]{minValueField}, |
|
|
|
new Component[]{maxCheckBox, maxValueField}, |
|
|
|
new Component[]{maxCheckBox}, |
|
|
|
new Component[]{isCustomMainUnitBox, mainUnitField}, |
|
|
|
new Component[]{maxValueField}, |
|
|
|
new Component[]{isCustomSecUnitBox, secUnitField}, |
|
|
|
new Component[]{isCustomMainUnitBox}, |
|
|
|
|
|
|
|
new Component[]{mainUnitField}, |
|
|
|
|
|
|
|
new Component[]{isCustomSecUnitBox}, |
|
|
|
|
|
|
|
new Component[]{secUnitField}, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void checkBoxUse() { |
|
|
|
protected void checkBoxUse() { |
|
|
|
minValueField.setEnabled(minCheckBox.isSelected()); |
|
|
|
minValueField.setEnabled(minCheckBox.isSelected()); |
|
|
|
maxValueField.setEnabled(maxCheckBox.isSelected()); |
|
|
|
maxValueField.setEnabled(maxCheckBox.isSelected()); |
|
|
|
|
|
|
|
|
|
|
@ -153,7 +158,7 @@ public class MinMaxValuePane extends JPanel { |
|
|
|
updateUnit(axis); |
|
|
|
updateUnit(axis); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateUnit(Axis axis) { |
|
|
|
protected void updateUnit(Axis axis) { |
|
|
|
// 主要刻度
|
|
|
|
// 主要刻度
|
|
|
|
if (isCustomMainUnitBox.isSelected()){ |
|
|
|
if (isCustomMainUnitBox.isSelected()){ |
|
|
|
String increment = mainUnitField.getText(); |
|
|
|
String increment = mainUnitField.getText(); |
|
|
|