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

Loading…
Cancel
Save