Browse Source

REPORT-26492 二维码显示不对

bugfix/10.0
hades 5 years ago
parent
commit
96630f3992
  1. 68
      designer-realize/src/main/java/com/fr/design/present/BarCodePane.java

68
designer-realize/src/main/java/com/fr/design/present/BarCodePane.java

@ -48,17 +48,17 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private UIComboBox typeComboBox;
private UISpinner barWidthSpinner;
private UISpinner barHeightSpinner;
private UISpinner RCodesizespinner;
private UISpinner sizeSpinner;
private UICheckBox drawingTextCheckBox;
private UIComboBox RCodeVersionComboBox;
private UIComboBox RCodeErrorCorrectComboBox;
private UIComboBox versionComboBox;
private UIComboBox errorCorrectComboBox;
private UILabel typeSetLabel;
private String testText = "12345";
public BarCodePane() {
this.initComponents();
addlistener();
addListener();
}
private void initComponents() {
@ -73,9 +73,9 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
borderPane.add(barCodePreviewPane, BorderLayout.CENTER);
setTypeComboBox();
setSome();
RCodesizespinner = new UISpinner(1,6,1,2);
RCodeVersionComboBox = new UIComboBox();
RCodeErrorCorrectComboBox = new UIComboBox();
sizeSpinner = new UISpinner(1,6,1,2);
versionComboBox = new UIComboBox();
errorCorrectComboBox = new UIComboBox();
typeSetLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Set"), UILabel.LEFT);
initVersionComboBox();
initErrorCorrectComboBox();
@ -169,31 +169,34 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Version"), UILabel.LEFT);
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize());
RCodeVersionComboBox.setPreferredSize(new Dimension(155,20));
RCodeErrorCorrectComboBox.setPreferredSize(new Dimension(155,20));
RCodesizespinner.setPreferredSize(new Dimension(155,20));
versionComboBox.setPreferredSize(new Dimension(155,20));
errorCorrectComboBox.setPreferredSize(new Dimension(155,20));
sizeSpinner.setPreferredSize(new Dimension(155,20));
Component[][] components_special = new Component[][]{
new Component[]{uiLabel, RCodeVersionComboBox},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Error_Correct"), UILabel.LEFT), RCodeErrorCorrectComboBox},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCodeDrawPix"), UILabel.LEFT), RCodesizespinner}
new Component[]{uiLabel, versionComboBox},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCode_Error_Correct"), UILabel.LEFT), errorCorrectComboBox},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_RCodeDrawPix"), UILabel.LEFT), sizeSpinner}
};
JPanel specialPane = TableLayoutHelper.createGapTableLayoutPane(components_special, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE);
return specialPane;
}
private void addlistener() {
RCodesizespinner.addChangeListener(new ChangeListener() {
private void addListener() {
sizeSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
repaintPreviewBarCode();
}
});
RCodeVersionComboBox.addItemListener(new ItemListener() {
versionComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
repaintPreviewBarCode();
}
});
RCodeErrorCorrectComboBox.addItemListener(new ItemListener() {
errorCorrectComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
repaintPreviewBarCode();
}
@ -204,6 +207,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
}
});
this.barHeightSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
repaintPreviewBarCode();
}
@ -217,24 +221,21 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
}
@Override
/**
*
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Highlight_Barcode");
}
private void initVersionComboBox() {
String[] array = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Auto_Choose"), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"};
initcombobox(this.RCodeVersionComboBox, array, 0);
initCombobox(this.versionComboBox, array, 0);
}
private void initErrorCorrectComboBox() {
String[] array = {"L" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "7%", "M" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "15%", "Q" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "25%", "H" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Level") + "30%"};
initcombobox(this.RCodeErrorCorrectComboBox, array, 1);
initCombobox(this.errorCorrectComboBox, array, 1);
}
private void initcombobox(UIComboBox combobox, String[] array, int index) {
private void initCombobox(UIComboBox combobox, String[] array, int index) {
combobox.removeAllItems();
for (int i = 0; i < array.length; i++) {
combobox.addItem(array[i]);
@ -257,6 +258,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
/**
*
*/
@Override
public void reset() {
populateBean(new BarcodePresent());
}
@ -269,10 +271,14 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
}
this.setTestText(BarCodeUtils.getTestTextByBarCode(barcodeAttr.getType()));
this.typeComboBox.setSelectedIndex(barcodeAttr.getType());
this.barWidthSpinner.setValue(new Double(barcodeAttr.getBarWidth()) * 10);
this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight()));
if (barcodeAttr.getType() == NUM16) {
this.versionComboBox.setSelectedIndex(barcodeAttr.getRCodeVersion());
this.errorCorrectComboBox.setSelectedIndex(barcodeAttr.getRCodeErrorCorrect());
this.sizeSpinner.setValue(barcodeAttr.getRcodeDrawPix());
}
this.barWidthSpinner.setValue(barcodeAttr.getBarWidth() * 10);
this.barHeightSpinner.setValue(barcodeAttr.getBarHeight());
this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText());
this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix()));
this.repaintPreviewBarCode();
}
@ -280,12 +286,12 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
public BarcodePresent updateBean() {
BarcodeAttr barcodeAttr = new BarcodeAttr();
if ((typeComboBox.getSelectedIndex() == NUM16)) {
barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex());
barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex());
barcodeAttr.setRcodeDrawPix((int) this.RCodesizespinner.getValue());
barcodeAttr.setRCodeVersion(this.versionComboBox.getSelectedIndex());
barcodeAttr.setRCodeErrorCorrect(this.errorCorrectComboBox.getSelectedIndex());
barcodeAttr.setRcodeDrawPix((int) this.sizeSpinner.getValue());
}
barcodeAttr.setType(this.typeComboBox.getSelectedIndex());
barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10);
barcodeAttr.setBarWidth(this.barWidthSpinner.getValue() / 10);
barcodeAttr.setBarHeight((int) this.barHeightSpinner.getValue());
barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected());
return new BarcodePresent(barcodeAttr);
@ -303,7 +309,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private Object obj;
public BarCodePreviewPane() {
// setBackground(Color.WHITE);
}
/**

Loading…
Cancel
Save