|
|
|
@ -30,7 +30,12 @@ public class MinMaxValuePane extends JPanel {
|
|
|
|
|
protected UICheckBox isCustomSecUnitBox; |
|
|
|
|
protected UITextField secUnitField; |
|
|
|
|
|
|
|
|
|
public MinMaxValuePane() { |
|
|
|
|
protected double p = TableLayout.PREFERRED; |
|
|
|
|
protected double f = TableLayout.FILL; |
|
|
|
|
protected double[] columnSize = {p, f}; |
|
|
|
|
protected double[] rowSize = {p, p, p, p}; |
|
|
|
|
|
|
|
|
|
public MinMaxValuePane() { |
|
|
|
|
minCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Min_Value"})); |
|
|
|
|
minValueField = new UITextField(6); |
|
|
|
|
maxCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Custom", "Max_Value"})); |
|
|
|
@ -39,41 +44,41 @@ public class MinMaxValuePane extends JPanel {
|
|
|
|
|
mainUnitField = new UITextField(6); |
|
|
|
|
isCustomSecUnitBox = new UICheckBox(Inter.getLocText("FR-Chart_SecondGraduationUnit")); |
|
|
|
|
secUnitField = new UITextField(6); |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double[] columnSize = { p, f }; |
|
|
|
|
double[] rowSize = { p, p, p, p}; |
|
|
|
|
|
|
|
|
|
Component[][] components = getPanelComponents(); |
|
|
|
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(components ,rowSize,columnSize); |
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
this.add(panel,BorderLayout.CENTER); |
|
|
|
|
addComponentListener(components); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addComponentListener(Component[][] components) { |
|
|
|
|
for (int i = 0; i < components.length; i++) { |
|
|
|
|
((UICheckBox) components[i][0]).addActionListener(new ActionListener() { |
|
|
|
|
Component[][] components = getPanelComponents(); |
|
|
|
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, getRowSize(), columnSize); |
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
this.add(panel, BorderLayout.CENTER); |
|
|
|
|
addComponentListener(components); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
checkBoxUse(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
ChartSwingUtils.addListener((UICheckBox) components[i][0], (UITextField) components[i][1]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
public double[] getRowSize() { |
|
|
|
|
return rowSize; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Component[][] getPanelComponents() { |
|
|
|
|
return new Component[][]{ |
|
|
|
|
new Component[]{minCheckBox, minValueField}, |
|
|
|
|
new Component[]{maxCheckBox, maxValueField}, |
|
|
|
|
new Component[]{isCustomMainUnitBox, mainUnitField}, |
|
|
|
|
new Component[]{isCustomSecUnitBox, secUnitField}, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
public void addComponentListener(Component[][] components) { |
|
|
|
|
for (int i = 0; i < components.length; i++) { |
|
|
|
|
((UICheckBox) components[i][0]).addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
checkBoxUse(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
ChartSwingUtils.addListener((UICheckBox) components[i][0], (UITextField) components[i][1]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Component[][] getPanelComponents() { |
|
|
|
|
return new Component[][]{ |
|
|
|
|
new Component[]{minCheckBox, minValueField}, |
|
|
|
|
new Component[]{maxCheckBox, maxValueField}, |
|
|
|
|
new Component[]{isCustomMainUnitBox, mainUnitField}, |
|
|
|
|
new Component[]{isCustomSecUnitBox, secUnitField}, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkBoxUse() { |
|
|
|
|
protected void checkBoxUse() { |
|
|
|
|
minValueField.setEnabled(minCheckBox.isSelected()); |
|
|
|
|
maxValueField.setEnabled(maxCheckBox.isSelected()); |
|
|
|
|
|
|
|
|
@ -153,7 +158,7 @@ public class MinMaxValuePane extends JPanel {
|
|
|
|
|
updateUnit(axis); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateUnit(Axis axis) { |
|
|
|
|
protected void updateUnit(Axis axis) { |
|
|
|
|
// 主要刻度
|
|
|
|
|
if (isCustomMainUnitBox.isSelected()){ |
|
|
|
|
String increment = mainUnitField.getText(); |
|
|
|
|