Browse Source
* commit 'db9ca2ee21f62fadab9aed9c861e848a9d8847b0': REPORT-2897 9.0设计器修改 修改命名 REPORT-2897 9.0设计器修改 视觉优化 rm button group border hzzzz REPORT-2897 9.0设计器修改 视觉优化 hzzzzzzzzzz REPORT-2897 9.0设计器修改 视觉优化master
superman
7 years ago
24 changed files with 1435 additions and 1351 deletions
@ -1,376 +1,376 @@ |
|||||||
package com.fr.design.present; |
package com.fr.design.present; |
||||||
|
|
||||||
import com.fr.design.beans.FurtherBasicBeanPane; |
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
import com.fr.design.border.UIRoundedBorder; |
import com.fr.design.border.UIRoundedBorder; |
||||||
import com.fr.design.constants.UIConstants; |
import com.fr.design.constants.UIConstants; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.layout.TableLayout; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.report.cell.cellattr.BarcodeAttr; |
import com.fr.report.cell.cellattr.BarcodeAttr; |
||||||
import com.fr.report.cell.cellattr.BarcodePresent; |
import com.fr.report.cell.cellattr.BarcodePresent; |
||||||
import com.fr.report.cell.painter.barcode.BarcodeImpl; |
import com.fr.report.cell.painter.barcode.BarcodeImpl; |
||||||
import com.fr.report.cell.painter.barcode.core.BarCodeUtils; |
import com.fr.report.cell.painter.barcode.core.BarCodeUtils; |
||||||
import com.fr.stable.pinyin.ChineseHelper; |
import com.fr.stable.pinyin.ChineseHelper; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import javax.swing.border.TitledBorder; |
import javax.swing.border.TitledBorder; |
||||||
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
||||||
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
import java.awt.event.ItemEvent; |
import java.awt.event.ItemEvent; |
||||||
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
||||||
import java.awt.font.FontRenderContext; |
import java.awt.font.FontRenderContext; |
||||||
import java.awt.font.LineBreakMeasurer; |
import java.awt.font.LineBreakMeasurer; |
||||||
import java.awt.font.TextAttribute; |
import java.awt.font.TextAttribute; |
||||||
import java.awt.font.TextLayout; |
import java.awt.font.TextLayout; |
||||||
import java.awt.geom.AffineTransform; |
import java.awt.geom.AffineTransform; |
||||||
import java.text.AttributedCharacterIterator; |
import java.text.AttributedCharacterIterator; |
||||||
import java.text.AttributedString; |
import java.text.AttributedString; |
||||||
import java.util.HashMap; |
import java.util.HashMap; |
||||||
import java.util.Map; |
import java.util.Map; |
||||||
|
|
||||||
/** |
/** |
||||||
* @author zhou |
* @author zhou |
||||||
* @since 2012-6-4下午6:49:59 |
* @since 2012-6-4下午6:49:59 |
||||||
*/ |
*/ |
||||||
public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> { |
public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> { |
||||||
private final int NUM16 = 16; |
private final int NUM16 = 16; |
||||||
private BarCodePreviewPane barCodePreviewPane; |
private BarCodePreviewPane barCodePreviewPane; |
||||||
private UIComboBox typeComboBox; |
private UIComboBox typeComboBox; |
||||||
private UIBasicSpinner barWidthSpinner; |
private UIBasicSpinner barWidthSpinner; |
||||||
private UIBasicSpinner barHeightSpinner; |
private UIBasicSpinner barHeightSpinner; |
||||||
private UIBasicSpinner RCodesizespinner; |
private UIBasicSpinner RCodesizespinner; |
||||||
private UICheckBox drawingTextCheckBox; |
private UICheckBox drawingTextCheckBox; |
||||||
private UIComboBox RCodeVersionComboBox; |
private UIComboBox RCodeVersionComboBox; |
||||||
private UIComboBox RCodeErrorCorrectComboBox; |
private UIComboBox RCodeErrorCorrectComboBox; |
||||||
private UILabel typeSetLabel; |
private UILabel typeSetLabel; |
||||||
|
|
||||||
private String testText = "12345"; |
private String testText = "12345"; |
||||||
|
|
||||||
public BarCodePane() { |
public BarCodePane() { |
||||||
this.initComponents(); |
this.initComponents(); |
||||||
addlistener(); |
addlistener(); |
||||||
} |
} |
||||||
|
|
||||||
public static void main(String[] args) { |
public static void main(String[] args) { |
||||||
JFrame jf = new JFrame("test"); |
JFrame jf = new JFrame("test"); |
||||||
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
||||||
JPanel content = (JPanel) jf.getContentPane(); |
JPanel content = (JPanel) jf.getContentPane(); |
||||||
content.setLayout(new BorderLayout()); |
content.setLayout(new BorderLayout()); |
||||||
content.add(new BarCodePane(), BorderLayout.CENTER); |
content.add(new BarCodePane(), BorderLayout.CENTER); |
||||||
GUICoreUtils.centerWindow(jf); |
GUICoreUtils.centerWindow(jf); |
||||||
jf.setSize(270, 400); |
jf.setSize(270, 400); |
||||||
jf.setVisible(true); |
jf.setVisible(true); |
||||||
} |
} |
||||||
|
|
||||||
private void initComponents() { |
private void initComponents() { |
||||||
barCodePreviewPane = new BarCodePreviewPane(); |
barCodePreviewPane = new BarCodePreviewPane(); |
||||||
this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(10.0, 1, 100, 1.0)); |
this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(10.0, 1, 100, 1.0)); |
||||||
this.barHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(30, 1, 100, 1)); |
this.barHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(30, 1, 100, 1)); |
||||||
this.barWidthSpinner.setPreferredSize(new Dimension(60, 20)); |
this.barWidthSpinner.setPreferredSize(new Dimension(60, 20)); |
||||||
this.barHeightSpinner.setPreferredSize(new Dimension(60, 20)); |
this.barHeightSpinner.setPreferredSize(new Dimension(60, 20)); |
||||||
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); |
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); |
||||||
borderPane.setBorder(titledBorder); |
borderPane.setBorder(titledBorder); |
||||||
borderPane.add(barCodePreviewPane, BorderLayout.CENTER); |
borderPane.add(barCodePreviewPane, BorderLayout.CENTER); |
||||||
setTypeComboBox(); |
setTypeComboBox(); |
||||||
setSome(); |
setSome(); |
||||||
RCodesizespinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 6, 1)); |
RCodesizespinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 6, 1)); |
||||||
RCodeVersionComboBox = new UIComboBox(); |
RCodeVersionComboBox = new UIComboBox(); |
||||||
RCodeErrorCorrectComboBox = new UIComboBox(); |
RCodeErrorCorrectComboBox = new UIComboBox(); |
||||||
typeSetLabel = new UILabel(Inter.getLocText("Type_Set") + ":", UILabel.RIGHT); |
typeSetLabel = new UILabel(Inter.getLocText("Type_Set"), UILabel.RIGHT); |
||||||
initVersionComboBox(); |
initVersionComboBox(); |
||||||
initErrorCorrectComboBox(); |
initErrorCorrectComboBox(); |
||||||
|
|
||||||
drawingTextCheckBox = new UICheckBox(Inter.getLocText("BarCodeD-Drawing_Text")); |
drawingTextCheckBox = new UICheckBox(Inter.getLocText("BarCodeD-Drawing_Text")); |
||||||
drawingTextCheckBox.setSelected(true); |
drawingTextCheckBox.setSelected(true); |
||||||
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}; |
double[] rowSize = {p, p, p, p, p, p, p, p}; |
||||||
barCodePreviewPane.setPreferredSize(new Dimension(0, 125)); |
barCodePreviewPane.setPreferredSize(new Dimension(0, 125)); |
||||||
final JPanel centerPane = new JPanel(new CardLayout()); |
final JPanel centerPane = new JPanel(new CardLayout()); |
||||||
|
|
||||||
Component[][] components = new Component[][]{ |
Component[][] components = new Component[][]{ |
||||||
new Component[]{typeSetLabel, typeComboBox}, |
new Component[]{typeSetLabel, typeComboBox}, |
||||||
new Component[]{borderPane, null}, |
new Component[]{borderPane, null}, |
||||||
new Component[]{centerPane, null} |
new Component[]{centerPane, null} |
||||||
}; |
}; |
||||||
JPanel barCode = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
JPanel barCode = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
centerPane.add(getNormalPane(), "normal"); |
centerPane.add(getNormalPane(), "normal"); |
||||||
centerPane.add(getSpecialPane(), "special"); |
centerPane.add(getSpecialPane(), "special"); |
||||||
typeComboBox.addItemListener(new ItemListener() { |
typeComboBox.addItemListener(new ItemListener() { |
||||||
public void itemStateChanged(ItemEvent e) { |
public void itemStateChanged(ItemEvent e) { |
||||||
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); |
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); |
||||||
cardLayout.show(centerPane, typeComboBox.getSelectedIndex() == NUM16 ? "special" : "normal"); |
cardLayout.show(centerPane, typeComboBox.getSelectedIndex() == NUM16 ? "special" : "normal"); |
||||||
setTestText(BarCodeUtils.getTestTextByBarCode(typeComboBox.getSelectedIndex())); |
setTestText(BarCodeUtils.getTestTextByBarCode(typeComboBox.getSelectedIndex())); |
||||||
repaintPreviewBarCode(); |
repaintPreviewBarCode(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
this.setLayout(new BorderLayout()); |
this.setLayout(new BorderLayout()); |
||||||
this.add(barCode, BorderLayout.CENTER); |
this.add(barCode, BorderLayout.CENTER); |
||||||
} |
} |
||||||
|
|
||||||
private void setTypeComboBox() { |
private void setTypeComboBox() { |
||||||
typeComboBox = new UIComboBox(BarCodeUtils.getAllSupportedBarCodeTypeArray()); |
typeComboBox = new UIComboBox(BarCodeUtils.getAllSupportedBarCodeTypeArray()); |
||||||
typeComboBox.setRenderer(new UIComboBoxRenderer() { |
typeComboBox.setRenderer(new UIComboBoxRenderer() { |
||||||
@Override |
@Override |
||||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||||
|
|
||||||
if (value instanceof Integer) { |
if (value instanceof Integer) { |
||||||
this.setText(" " + BarCodeUtils.getBarCodeTypeName(((Integer) value).intValue())); |
this.setText(" " + BarCodeUtils.getBarCodeTypeName(((Integer) value).intValue())); |
||||||
} |
} |
||||||
return this; |
return this; |
||||||
} |
} |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
private void setSome() { |
private void setSome() { |
||||||
JFormattedTextField heightTextField = ((JSpinner.DefaultEditor) barHeightSpinner.getEditor()).getTextField(); |
JFormattedTextField heightTextField = ((JSpinner.DefaultEditor) barHeightSpinner.getEditor()).getTextField(); |
||||||
heightTextField.setColumns(2); |
heightTextField.setColumns(2); |
||||||
|
|
||||||
JFormattedTextField widthTextField = ((JSpinner.DefaultEditor) barWidthSpinner.getEditor()).getTextField(); |
JFormattedTextField widthTextField = ((JSpinner.DefaultEditor) barWidthSpinner.getEditor()).getTextField(); |
||||||
widthTextField.setColumns(2); |
widthTextField.setColumns(2); |
||||||
} |
} |
||||||
|
|
||||||
private JPanel getNormalPane() { |
private JPanel getNormalPane() { |
||||||
double f = TableLayout.FILL; |
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double p = TableLayout.PREFERRED; |
||||||
double[] rowSize = {p, p, p, p, p, p, p, p}; |
double[] rowSize = {p, p, p, p, p, p, p, p}; |
||||||
double[] columnSize1 = {p, f, f}; |
double[] columnSize1 = {p, f, f}; |
||||||
JPanel barWidthContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); |
JPanel barWidthContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); |
||||||
barWidthContainer.add(barWidthSpinner); |
barWidthContainer.add(barWidthSpinner); |
||||||
JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); |
JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); |
||||||
barHeightContainer.add(barHeightSpinner); |
barHeightContainer.add(barHeightSpinner); |
||||||
UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT); |
UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT); |
||||||
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); |
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); |
||||||
Component[][] components_normal = new Component[][]{ |
Component[][] components_normal = new Component[][]{ |
||||||
new Component[]{new UILabel("条形码大小", UILabel.LEFT), barWidthContainer, barHeightContainer}, |
new Component[]{new UILabel("条形码大小", UILabel.LEFT), barWidthContainer, barHeightContainer}, |
||||||
new Component[]{null, new UILabel(Inter.getLocText("Tree-Width"), UILabel.CENTER), new UILabel(Inter.getLocText("Height"), UILabel.CENTER)}, |
new Component[]{null, new UILabel(Inter.getLocText("Tree-Width"), UILabel.CENTER), new UILabel(Inter.getLocText("Height"), UILabel.CENTER)}, |
||||||
new Component[]{drawingTextCheckBox, null, null} |
new Component[]{drawingTextCheckBox, null, null} |
||||||
}; |
}; |
||||||
|
|
||||||
|
|
||||||
JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1); |
JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1); |
||||||
return normalPane; |
return normalPane; |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
private JPanel getSpecialPane() { |
private JPanel getSpecialPane() { |
||||||
double p = TableLayout.PREFERRED; |
double p = TableLayout.PREFERRED; |
||||||
double f = TableLayout.FILL; |
double f = TableLayout.FILL; |
||||||
double[] columnSize1 = {p, p}; |
double[] columnSize1 = {p, p}; |
||||||
double[] rowSize = {p, p, p, p, p, p, p, p}; |
double[] rowSize = {p, p, p, p, p, p, p, p}; |
||||||
UILabel uiLabel = new UILabel(Inter.getLocText("RCodeVersion") + ":", UILabel.RIGHT); |
UILabel uiLabel = new UILabel(Inter.getLocText("RCodeVersion") + ":", UILabel.RIGHT); |
||||||
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); |
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); |
||||||
Component[][] components_special = new Component[][]{ |
Component[][] components_special = new Component[][]{ |
||||||
new Component[]{uiLabel, RCodeVersionComboBox}, |
new Component[]{uiLabel, RCodeVersionComboBox}, |
||||||
new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect") + ":", UILabel.RIGHT), RCodeErrorCorrectComboBox}, |
new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect") + ":", UILabel.RIGHT), RCodeErrorCorrectComboBox}, |
||||||
new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix") + ":", UILabel.RIGHT), RCodesizespinner} |
new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix") + ":", UILabel.RIGHT), RCodesizespinner} |
||||||
}; |
}; |
||||||
|
|
||||||
JPanel specialPane = TableLayoutHelper.createTableLayoutPane(components_special, rowSize, columnSize1); |
JPanel specialPane = TableLayoutHelper.createTableLayoutPane(components_special, rowSize, columnSize1); |
||||||
return specialPane; |
return specialPane; |
||||||
} |
} |
||||||
|
|
||||||
private void addlistener() { |
private void addlistener() { |
||||||
RCodesizespinner.addChangeListener(new ChangeListener() { |
RCodesizespinner.addChangeListener(new ChangeListener() { |
||||||
public void stateChanged(ChangeEvent e) { |
public void stateChanged(ChangeEvent e) { |
||||||
repaintPreviewBarCode(); |
repaintPreviewBarCode(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
RCodeVersionComboBox.addItemListener(new ItemListener() { |
RCodeVersionComboBox.addItemListener(new ItemListener() { |
||||||
public void itemStateChanged(ItemEvent e) { |
public void itemStateChanged(ItemEvent e) { |
||||||
repaintPreviewBarCode(); |
repaintPreviewBarCode(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
RCodeErrorCorrectComboBox.addItemListener(new ItemListener() { |
RCodeErrorCorrectComboBox.addItemListener(new ItemListener() { |
||||||
public void itemStateChanged(ItemEvent e) { |
public void itemStateChanged(ItemEvent e) { |
||||||
repaintPreviewBarCode(); |
repaintPreviewBarCode(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
this.barWidthSpinner.addChangeListener(new ChangeListener() { |
this.barWidthSpinner.addChangeListener(new ChangeListener() { |
||||||
public void stateChanged(ChangeEvent e) { |
public void stateChanged(ChangeEvent e) { |
||||||
repaintPreviewBarCode(); |
repaintPreviewBarCode(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
this.barHeightSpinner.addChangeListener(new ChangeListener() { |
this.barHeightSpinner.addChangeListener(new ChangeListener() { |
||||||
public void stateChanged(ChangeEvent e) { |
public void stateChanged(ChangeEvent e) { |
||||||
repaintPreviewBarCode(); |
repaintPreviewBarCode(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
drawingTextCheckBox.addChangeListener(new ChangeListener() { |
drawingTextCheckBox.addChangeListener(new ChangeListener() { |
||||||
public void stateChanged(ChangeEvent e) { |
public void stateChanged(ChangeEvent e) { |
||||||
repaintPreviewBarCode(); |
repaintPreviewBarCode(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
repaintPreviewBarCode(); |
repaintPreviewBarCode(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public String title4PopupWindow() { |
public String title4PopupWindow() { |
||||||
return Inter.getLocText("Highlight-Barcode"); |
return Inter.getLocText("Highlight-Barcode"); |
||||||
} |
} |
||||||
|
|
||||||
private void initVersionComboBox() { |
private void initVersionComboBox() { |
||||||
String[] array = {Inter.getLocText(new String[]{"Auto", "Choose"}), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}; |
String[] array = {Inter.getLocText(new String[]{"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.RCodeVersionComboBox, array, 0); |
||||||
} |
} |
||||||
|
|
||||||
private void initErrorCorrectComboBox() { |
private void initErrorCorrectComboBox() { |
||||||
String[] array = {"L" + Inter.getLocText("Level") + "7%", "M" + Inter.getLocText("Level") + "15%", "Q" + Inter.getLocText("Level") + "25%", "H" + Inter.getLocText("Level") + "30%"}; |
String[] array = {"L" + Inter.getLocText("Level") + "7%", "M" + Inter.getLocText("Level") + "15%", "Q" + Inter.getLocText("Level") + "25%", "H" + Inter.getLocText("Level") + "30%"}; |
||||||
initcombobox(this.RCodeErrorCorrectComboBox, array, 1); |
initcombobox(this.RCodeErrorCorrectComboBox, 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]); |
||||||
} |
} |
||||||
combobox.setSelectedIndex(index); |
combobox.setSelectedIndex(index); |
||||||
} |
} |
||||||
|
|
||||||
private void repaintPreviewBarCode() { |
private void repaintPreviewBarCode() { |
||||||
try { |
try { |
||||||
// carl:不支持中文转条形码
|
// carl:不支持中文转条形码
|
||||||
if (ChineseHelper.containChinese(getTestText()) && this.typeComboBox.getSelectedIndex() != NUM16) { |
if (ChineseHelper.containChinese(getTestText()) && this.typeComboBox.getSelectedIndex() != NUM16) { |
||||||
throw new Exception("Illegal Character."); |
throw new Exception("Illegal Character."); |
||||||
} |
} |
||||||
this.barCodePreviewPane.setObject(BarCodeUtils.getBarcodeImpl(this.updateBean().getBarcode(), getTestText())); |
this.barCodePreviewPane.setObject(BarCodeUtils.getBarcodeImpl(this.updateBean().getBarcode(), getTestText())); |
||||||
} catch (Exception exp) { |
} catch (Exception exp) { |
||||||
this.barCodePreviewPane.setObject(Inter.getLocText("Error") + ": " + exp.getMessage()); |
this.barCodePreviewPane.setObject(Inter.getLocText("Error") + ": " + exp.getMessage()); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public void reset() { |
public void reset() { |
||||||
populateBean(new BarcodePresent()); |
populateBean(new BarcodePresent()); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void populateBean(BarcodePresent ob) { |
public void populateBean(BarcodePresent ob) { |
||||||
BarcodeAttr barcodeAttr = ob.getBarcode(); |
BarcodeAttr barcodeAttr = ob.getBarcode(); |
||||||
if (barcodeAttr == null) { |
if (barcodeAttr == null) { |
||||||
barcodeAttr = new BarcodeAttr(); |
barcodeAttr = new BarcodeAttr(); |
||||||
} |
} |
||||||
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())); |
this.barWidthSpinner.setValue(new Double(barcodeAttr.getBarWidth())); |
||||||
this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight())); |
this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight())); |
||||||
this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText()); |
this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText()); |
||||||
this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); |
this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); |
||||||
this.repaintPreviewBarCode(); |
this.repaintPreviewBarCode(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
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.RCodeVersionComboBox.getSelectedIndex()); |
||||||
barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); |
barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); |
||||||
barcodeAttr.setRcodeDrawPix(((Integer) this.RCodesizespinner.getValue()).intValue()); |
barcodeAttr.setRcodeDrawPix(((Integer) this.RCodesizespinner.getValue()).intValue()); |
||||||
} |
} |
||||||
barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); |
barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); |
||||||
barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10); |
barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10); |
||||||
barcodeAttr.setBarHeight(((Integer) this.barHeightSpinner.getValue()).intValue()); |
barcodeAttr.setBarHeight(((Integer) this.barHeightSpinner.getValue()).intValue()); |
||||||
barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected()); |
barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected()); |
||||||
return new BarcodePresent(barcodeAttr); |
return new BarcodePresent(barcodeAttr); |
||||||
} |
} |
||||||
|
|
||||||
public void setTestText(String testText) { |
public void setTestText(String testText) { |
||||||
this.testText = testText; |
this.testText = testText; |
||||||
} |
} |
||||||
|
|
||||||
public String getTestText() { |
public String getTestText() { |
||||||
return testText; |
return testText; |
||||||
} |
} |
||||||
|
|
||||||
private static class BarCodePreviewPane extends JPanel { |
private static class BarCodePreviewPane extends JPanel { |
||||||
private Object obj; |
private Object obj; |
||||||
|
|
||||||
public BarCodePreviewPane() { |
public BarCodePreviewPane() { |
||||||
// setBackground(Color.WHITE);
|
// setBackground(Color.WHITE);
|
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* BarcodeImpl or Error String. |
* BarcodeImpl or Error String. |
||||||
*/ |
*/ |
||||||
public void setObject(Object obj) { |
public void setObject(Object obj) { |
||||||
this.obj = obj; |
this.obj = obj; |
||||||
GUICoreUtils.repaint(this); |
GUICoreUtils.repaint(this); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void paintComponent(Graphics g) { |
public void paintComponent(Graphics g) { |
||||||
super.paintComponent(g); |
super.paintComponent(g); |
||||||
if (obj == null) { |
if (obj == null) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
if (obj instanceof BarcodeImpl) { |
if (obj instanceof BarcodeImpl) { |
||||||
BarcodeImpl barcodeImpl = (BarcodeImpl) obj; |
BarcodeImpl barcodeImpl = (BarcodeImpl) obj; |
||||||
Dimension size = this.getSize(); |
Dimension size = this.getSize(); |
||||||
barcodeImpl.draw((Graphics2D) g, (int) (size.getWidth() - barcodeImpl.getWidth()) / 2, (int) (size.getHeight() - barcodeImpl.getHeight()) / 2); |
barcodeImpl.draw((Graphics2D) g, (int) (size.getWidth() - barcodeImpl.getWidth()) / 2, (int) (size.getHeight() - barcodeImpl.getHeight()) / 2); |
||||||
} else { |
} else { |
||||||
// 在中央画出字符.
|
// 在中央画出字符.
|
||||||
Graphics2D graphics2D = (Graphics2D) g; |
Graphics2D graphics2D = (Graphics2D) g; |
||||||
graphics2D.setPaint(Color.RED); |
graphics2D.setPaint(Color.RED); |
||||||
Map map = new HashMap(); |
Map map = new HashMap(); |
||||||
map.put(TextAttribute.SIZE, new Float(14.0)); |
map.put(TextAttribute.SIZE, new Float(14.0)); |
||||||
AttributedString vanGogh = new AttributedString(obj.toString(), map); |
AttributedString vanGogh = new AttributedString(obj.toString(), map); |
||||||
AttributedCharacterIterator paragraph = vanGogh.getIterator(); |
AttributedCharacterIterator paragraph = vanGogh.getIterator(); |
||||||
int paragraphStart = paragraph.getBeginIndex(); |
int paragraphStart = paragraph.getBeginIndex(); |
||||||
int paragraphEnd = paragraph.getEndIndex(); |
int paragraphEnd = paragraph.getEndIndex(); |
||||||
// Create a new LineBreakMeasurer from the paragraph.
|
// Create a new LineBreakMeasurer from the paragraph.
|
||||||
AffineTransform tx = null; |
AffineTransform tx = null; |
||||||
LineBreakMeasurer lineMeasurer = new LineBreakMeasurer(paragraph, new FontRenderContext(tx, false, false)); |
LineBreakMeasurer lineMeasurer = new LineBreakMeasurer(paragraph, new FontRenderContext(tx, false, false)); |
||||||
// Set formatting width to width of Component.
|
// Set formatting width to width of Component.
|
||||||
Dimension size = getSize(); |
Dimension size = getSize(); |
||||||
float formatWidth = size.width; |
float formatWidth = size.width; |
||||||
float drawPosY = 0; |
float drawPosY = 0; |
||||||
lineMeasurer.setPosition(paragraphStart); |
lineMeasurer.setPosition(paragraphStart); |
||||||
// Get lines from lineMeasurer until the entire
|
// Get lines from lineMeasurer until the entire
|
||||||
// paragraph has been displayed.
|
// paragraph has been displayed.
|
||||||
while (lineMeasurer.getPosition() < paragraphEnd) { |
while (lineMeasurer.getPosition() < paragraphEnd) { |
||||||
// Retrieve next layout.
|
// Retrieve next layout.
|
||||||
TextLayout layout = lineMeasurer.nextLayout(formatWidth); |
TextLayout layout = lineMeasurer.nextLayout(formatWidth); |
||||||
// Move y-coordinate by the ascent of the layout.
|
// Move y-coordinate by the ascent of the layout.
|
||||||
drawPosY += layout.getAscent(); |
drawPosY += layout.getAscent(); |
||||||
// Compute pen x position. If the paragraph is
|
// Compute pen x position. If the paragraph is
|
||||||
// right-to-left, we want to align the TextLayouts
|
// right-to-left, we want to align the TextLayouts
|
||||||
// to the right edge of the panel.
|
// to the right edge of the panel.
|
||||||
float drawPosX; |
float drawPosX; |
||||||
if (layout.isLeftToRight()) { |
if (layout.isLeftToRight()) { |
||||||
drawPosX = 0; |
drawPosX = 0; |
||||||
} else { |
} else { |
||||||
drawPosX = formatWidth - layout.getAdvance(); |
drawPosX = formatWidth - layout.getAdvance(); |
||||||
} |
} |
||||||
// Draw the TextLayout at (drawPosX, drawPosY).
|
// Draw the TextLayout at (drawPosX, drawPosY).
|
||||||
layout.draw(graphics2D, drawPosX, drawPosY); |
layout.draw(graphics2D, drawPosX, drawPosY); |
||||||
// Move y-coordinate in preparation for next layout.
|
// Move y-coordinate in preparation for next layout.
|
||||||
drawPosY += layout.getDescent() + layout.getLeading(); |
drawPosY += layout.getDescent() + layout.getLeading(); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public boolean accept(Object ob) { |
public boolean accept(Object ob) { |
||||||
return ob instanceof BarcodePresent; |
return ob instanceof BarcodePresent; |
||||||
} |
} |
||||||
} |
} |
@ -1,231 +1,231 @@ |
|||||||
package com.fr.design.present; |
package com.fr.design.present; |
||||||
|
|
||||||
import com.fr.design.beans.FurtherBasicBeanPane; |
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
import com.fr.design.border.UIRoundedBorder; |
import com.fr.design.border.UIRoundedBorder; |
||||||
import com.fr.design.constants.UIConstants; |
import com.fr.design.constants.UIConstants; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.layout.TableLayout; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.report.cell.cellattr.CurrencyLineAttr; |
import com.fr.report.cell.cellattr.CurrencyLineAttr; |
||||||
import com.fr.report.cell.cellattr.CurrencyLinePresent; |
import com.fr.report.cell.cellattr.CurrencyLinePresent; |
||||||
import com.fr.report.cell.painter.barcode.BarcodeException; |
import com.fr.report.cell.painter.barcode.BarcodeException; |
||||||
import com.fr.report.core.CurrencyLineImpl; |
import com.fr.report.core.CurrencyLineImpl; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import javax.swing.border.TitledBorder; |
import javax.swing.border.TitledBorder; |
||||||
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
||||||
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
||||||
import javax.swing.event.DocumentEvent; |
import javax.swing.event.DocumentEvent; |
||||||
import javax.swing.event.DocumentListener; |
import javax.swing.event.DocumentListener; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* @author zhou |
* @author zhou |
||||||
* @since 2012-6-4下午7:34:52 |
* @since 2012-6-4下午7:34:52 |
||||||
*/ |
*/ |
||||||
public class CurrencyLinePane extends FurtherBasicBeanPane<CurrencyLinePresent> { |
public class CurrencyLinePane extends FurtherBasicBeanPane<CurrencyLinePresent> { |
||||||
private static final int VS_NUM = 4; |
private static final int VS_NUM = 4; |
||||||
private static final int VG_NUM = 6; |
private static final int VG_NUM = 6; |
||||||
private UIBasicSpinner intPartSpinner; |
private UIBasicSpinner intPartSpinner; |
||||||
private UIBasicSpinner deciPartSpinner; |
private UIBasicSpinner deciPartSpinner; |
||||||
private UITextField textField; |
private UITextField textField; |
||||||
private CurrencyLinePreviewPane CurrencyLinePreviewPane; |
private CurrencyLinePreviewPane CurrencyLinePreviewPane; |
||||||
private int intPart = 9; |
private int intPart = 9; |
||||||
private int deciPart = 3; |
private int deciPart = 3; |
||||||
|
|
||||||
private static final int POSITION = 8; |
private static final int POSITION = 8; |
||||||
ChangeListener listener2 = new ChangeListener() { |
ChangeListener listener2 = new ChangeListener() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void stateChanged(ChangeEvent e) { |
public void stateChanged(ChangeEvent e) { |
||||||
CurrencyLinePreviewPane.setObject(textField.getText(), update()); |
CurrencyLinePreviewPane.setObject(textField.getText(), update()); |
||||||
} |
} |
||||||
|
|
||||||
}; |
}; |
||||||
|
|
||||||
DocumentListener listener = new DocumentListener() { |
DocumentListener listener = new DocumentListener() { |
||||||
@Override |
@Override |
||||||
public void insertUpdate(DocumentEvent e) { |
public void insertUpdate(DocumentEvent e) { |
||||||
CurrencyLinePreviewPane.setObject(textField.getText(), update()); |
CurrencyLinePreviewPane.setObject(textField.getText(), update()); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void removeUpdate(DocumentEvent e) { |
public void removeUpdate(DocumentEvent e) { |
||||||
CurrencyLinePreviewPane.setObject(textField.getText(), update()); |
CurrencyLinePreviewPane.setObject(textField.getText(), update()); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void changedUpdate(DocumentEvent e) { |
public void changedUpdate(DocumentEvent e) { |
||||||
CurrencyLinePreviewPane.setObject(textField.getText(), update()); |
CurrencyLinePreviewPane.setObject(textField.getText(), update()); |
||||||
} |
} |
||||||
}; |
}; |
||||||
|
|
||||||
public CurrencyLinePane() { |
public CurrencyLinePane() { |
||||||
this.initComponents(); |
this.initComponents(); |
||||||
} |
} |
||||||
|
|
||||||
protected void initComponents() { |
protected void initComponents() { |
||||||
// 整数位选择
|
// 整数位选择
|
||||||
intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1)); |
intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1)); |
||||||
intPartSpinner.setPreferredSize(new Dimension(135, 20)); |
intPartSpinner.setPreferredSize(new Dimension(158, 20)); |
||||||
|
|
||||||
// 小数位选择
|
// 小数位选择
|
||||||
deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1)); |
deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1)); |
||||||
deciPartSpinner.setPreferredSize(new Dimension(135, 20)); |
deciPartSpinner.setPreferredSize(new Dimension(158, 20)); |
||||||
// 预览区域
|
// 预览区域
|
||||||
textField = new UITextField(10); |
textField = new UITextField(10); |
||||||
|
|
||||||
CurrencyLinePreviewPane = new CurrencyLinePreviewPane(); |
CurrencyLinePreviewPane = new CurrencyLinePreviewPane(); |
||||||
CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145)); |
CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145)); |
||||||
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); |
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); |
||||||
borderPane.setBorder(titledBorder); |
borderPane.setBorder(titledBorder); |
||||||
borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER); |
borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER); |
||||||
|
|
||||||
textField.requestFocus(); |
textField.requestFocus(); |
||||||
|
|
||||||
double vs = VS_NUM; |
double vs = VS_NUM; |
||||||
double vg = VG_NUM; |
double vg = VG_NUM; |
||||||
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}; |
double[] rowSize = {p, p, p, p}; |
||||||
|
|
||||||
|
|
||||||
Component[][] components = new Component[][]{ |
Component[][] components = new Component[][]{ |
||||||
new Component[]{new UILabel(Inter.getLocText("Data"), UILabel.LEFT), textField}, |
new Component[]{new UILabel(Inter.getLocText("Data"), UILabel.LEFT), textField}, |
||||||
new Component[]{borderPane, null}, |
new Component[]{borderPane, null}, |
||||||
new Component[]{new UILabel(Inter.getLocText("IntPart"), UILabel.LEFT), groupPane(intPartSpinner)}, |
new Component[]{new UILabel(Inter.getLocText("IntPart"), UILabel.LEFT), groupPane(intPartSpinner)}, |
||||||
new Component[]{new UILabel(Inter.getLocText("DeciPart"), UILabel.LEFT), groupPane(deciPartSpinner)} |
new Component[]{new UILabel(Inter.getLocText("DeciPart"), UILabel.LEFT), groupPane(deciPartSpinner)} |
||||||
|
|
||||||
}; |
}; |
||||||
|
|
||||||
JPanel linePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
JPanel linePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
this.setLayout(new BorderLayout()); |
this.setLayout(new BorderLayout()); |
||||||
this.add(linePane, BorderLayout.CENTER); |
this.add(linePane, BorderLayout.CENTER); |
||||||
|
|
||||||
|
|
||||||
textField.getDocument().addDocumentListener(listener); |
textField.getDocument().addDocumentListener(listener); |
||||||
intPartSpinner.addChangeListener(listener2); |
intPartSpinner.addChangeListener(listener2); |
||||||
deciPartSpinner.addChangeListener(listener2); |
deciPartSpinner.addChangeListener(listener2); |
||||||
textField.setText("123456.78"); |
textField.setText("123456.78"); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
* 窗口名 |
* 窗口名 |
||||||
* @return 同上 |
* @return 同上 |
||||||
*/ |
*/ |
||||||
public String title4PopupWindow() { |
public String title4PopupWindow() { |
||||||
return Inter.getLocText("Currency_Line"); |
return Inter.getLocText("Currency_Line"); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public CurrencyLineAttr update() { |
public CurrencyLineAttr update() { |
||||||
CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); |
CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); |
||||||
currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); |
currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); |
||||||
currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); |
currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); |
||||||
return currencylineAttr; |
return currencylineAttr; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public void setintPart(int intpart) { |
public void setintPart(int intpart) { |
||||||
this.intPart = intpart; |
this.intPart = intpart; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public void setdeciPart(int decipart) { |
public void setdeciPart(int decipart) { |
||||||
this.deciPart = decipart; |
this.deciPart = decipart; |
||||||
} |
} |
||||||
|
|
||||||
private class CurrencyLinePreviewPane extends JPanel { |
private class CurrencyLinePreviewPane extends JPanel { |
||||||
private String text; |
private String text; |
||||||
CurrencyLineAttr currencyLineAttr; |
CurrencyLineAttr currencyLineAttr; |
||||||
|
|
||||||
public CurrencyLinePreviewPane() { |
public CurrencyLinePreviewPane() { |
||||||
// setBackground(Color.WHITE);
|
// setBackground(Color.WHITE);
|
||||||
} |
} |
||||||
|
|
||||||
public void setObject(String text, CurrencyLineAttr currencyLineAttr) { |
public void setObject(String text, CurrencyLineAttr currencyLineAttr) { |
||||||
this.text = text; |
this.text = text; |
||||||
this.currencyLineAttr = currencyLineAttr; |
this.currencyLineAttr = currencyLineAttr; |
||||||
GUICoreUtils.repaint(this); |
GUICoreUtils.repaint(this); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void paintComponent(Graphics g) { |
public void paintComponent(Graphics g) { |
||||||
super.paintComponent(g); |
super.paintComponent(g); |
||||||
if (text == null) { |
if (text == null) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
Dimension size = this.getSize(); |
Dimension size = this.getSize(); |
||||||
try { |
try { |
||||||
CurrencyLineImpl currencyLineImpl = new CurrencyLineImpl(text, currencyLineAttr); |
CurrencyLineImpl currencyLineImpl = new CurrencyLineImpl(text, currencyLineAttr); |
||||||
currencyLineImpl.draw((Graphics2D) g, (int) (size.getWidth()), (int) (size.getHeight())); |
currencyLineImpl.draw((Graphics2D) g, (int) (size.getWidth()), (int) (size.getHeight())); |
||||||
} catch (BarcodeException e) { |
} catch (BarcodeException e) { |
||||||
Color oldColor = g.getColor(); |
Color oldColor = g.getColor(); |
||||||
g.setColor(Color.red); |
g.setColor(Color.red); |
||||||
g.drawString(e.getMessage(), (int) (size.getWidth() / POSITION), (int) (size.getHeight() / POSITION)); |
g.drawString(e.getMessage(), (int) (size.getWidth() / POSITION), (int) (size.getHeight() / POSITION)); |
||||||
g.setColor(oldColor); |
g.setColor(oldColor); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
protected static JPanel groupPane(JComponent comp) { |
protected static JPanel groupPane(JComponent comp) { |
||||||
JPanel jp = new JPanel(); |
JPanel jp = new JPanel(); |
||||||
jp.setBorder(null); |
jp.setBorder(null); |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
jp.add(comp); |
jp.add(comp); |
||||||
return jp; |
return jp; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
* 是否为该类型 |
* 是否为该类型 |
||||||
* @param ob 对象 |
* @param ob 对象 |
||||||
* @return 同上 |
* @return 同上 |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public boolean accept(Object ob) { |
public boolean accept(Object ob) { |
||||||
return ob instanceof CurrencyLinePresent; |
return ob instanceof CurrencyLinePresent; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 重置 |
* 重置 |
||||||
*/ |
*/ |
||||||
public void reset() { |
public void reset() { |
||||||
this.intPartSpinner.setValue(9); |
this.intPartSpinner.setValue(9); |
||||||
this.deciPartSpinner.setValue(3); |
this.deciPartSpinner.setValue(3); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void populateBean(CurrencyLinePresent ob) { |
public void populateBean(CurrencyLinePresent ob) { |
||||||
CurrencyLineAttr currencyLine = ob.getCurrencyLineAttr(); |
CurrencyLineAttr currencyLine = ob.getCurrencyLineAttr(); |
||||||
if (currencyLine == null) { |
if (currencyLine == null) { |
||||||
currencyLine = new CurrencyLineAttr(); |
currencyLine = new CurrencyLineAttr(); |
||||||
} |
} |
||||||
this.intPartSpinner.setValue(new Integer(currencyLine.getintPart())); |
this.intPartSpinner.setValue(new Integer(currencyLine.getintPart())); |
||||||
this.deciPartSpinner.setValue(new Integer(currencyLine.getdeciPart())); |
this.deciPartSpinner.setValue(new Integer(currencyLine.getdeciPart())); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public CurrencyLinePresent updateBean() { |
public CurrencyLinePresent updateBean() { |
||||||
CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); |
CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); |
||||||
currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); |
currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); |
||||||
currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); |
currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); |
||||||
return new CurrencyLinePresent(currencylineAttr); |
return new CurrencyLinePresent(currencylineAttr); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -1,59 +1,63 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent; |
import java.awt.*; |
||||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
import java.awt.event.ActionEvent; |
||||||
import java.awt.event.ActionListener; |
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||||
|
import java.awt.event.ActionListener; |
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import javax.swing.JPanel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import javax.swing.SpinnerNumberModel; |
import javax.swing.JPanel; |
||||||
|
import javax.swing.SpinnerNumberModel; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.form.ui.ButtonGroup; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.general.Inter; |
import com.fr.form.ui.ButtonGroup; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
public class ButtonGroupDictPane extends JPanel { |
|
||||||
private UIBasicSpinner columnSpinner; |
public class ButtonGroupDictPane extends JPanel { |
||||||
private UICheckBox adaptiveCheckbox; |
private UIBasicSpinner columnSpinner; |
||||||
private UILabel columnLabel; |
private UICheckBox adaptiveCheckbox; |
||||||
|
private UILabel columnLabel; |
||||||
public ButtonGroupDictPane() { |
|
||||||
this.initComponents(); |
public ButtonGroupDictPane() { |
||||||
} |
this.initComponents(); |
||||||
|
} |
||||||
/** |
|
||||||
* |
/** |
||||||
*/ |
* |
||||||
public void initComponents() { |
*/ |
||||||
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
public void initComponents() { |
||||||
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); |
this.setLayout(new FlowLayout(0)); |
||||||
adaptiveCheckbox.addActionListener(new ActionListener() { |
JPanel pane = new JPanel(new FlowLayout()); |
||||||
public void actionPerformed(ActionEvent e) { |
adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); |
||||||
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
adaptiveCheckbox.addActionListener(new ActionListener() { |
||||||
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
public void actionPerformed(ActionEvent e) { |
||||||
} |
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
}); |
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
this.add(adaptiveCheckbox); |
} |
||||||
|
}); |
||||||
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); |
|
||||||
this.add(columnLabel); |
this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns")); |
||||||
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); |
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); |
||||||
this.add(columnSpinner); |
pane.add(adaptiveCheckbox); |
||||||
} |
pane.add(columnLabel); |
||||||
|
pane.add(columnSpinner); |
||||||
public void populate(ButtonGroup buttonGroup) { |
|
||||||
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); |
this.add(pane); |
||||||
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
} |
||||||
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
|
||||||
columnSpinner.setValue(buttonGroup.getColumnsInRow()); |
public void populate(ButtonGroup buttonGroup) { |
||||||
} |
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); |
||||||
|
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
public void update(ButtonGroup buttonGroup) { |
columnLabel.setVisible(!adaptiveCheckbox.isSelected()); |
||||||
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); |
columnSpinner.setValue(buttonGroup.getColumnsInRow()); |
||||||
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); |
} |
||||||
} |
|
||||||
|
public void update(ButtonGroup buttonGroup) { |
||||||
|
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); |
||||||
|
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,48 +1,62 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.foldablepane.UIExpandablePane; |
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
|
|
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.form.ui.CheckBox; |
import com.fr.form.ui.CheckBox; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { |
||||||
private UITextField text; |
private UITextField text; |
||||||
|
|
||||||
public CheckBoxDefinePane() { |
public CheckBoxDefinePane() { |
||||||
this.iniComoponents(); |
this.iniComoponents(); |
||||||
} |
} |
||||||
|
|
||||||
private void iniComoponents() { |
private void iniComoponents() { |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); |
text = new UITextField(8); |
||||||
JPanel textPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
JPanel panel = new JPanel(new BorderLayout()); |
||||||
textPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
panel.add(text, BorderLayout.CENTER); |
||||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, textPane); |
panel.setBorder(BorderFactory.createEmptyBorder(0, 35, 0, 0)); |
||||||
textPane.add(new UILabel(Inter.getLocText("Text") + ":")); |
|
||||||
text = new UITextField(8); |
double f = TableLayout.FILL; |
||||||
textPane.add(text); |
double p = TableLayout.PREFERRED; |
||||||
this.add(uiExpandablePane); |
Component[][] components = new Component[][]{ |
||||||
} |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), panel}, |
||||||
|
}; |
||||||
@Override |
double[] rowSize = {p}; |
||||||
protected String title4PopupWindow() { |
double[] columnSize = {p, f}; |
||||||
return "CheckBox"; |
int[][] rowCount = {{1, 1}}; |
||||||
} |
JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); |
||||||
|
|
||||||
@Override |
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, pane); |
||||||
public void populateBean(CheckBox check) { |
pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); |
||||||
text.setText(check.getText()); |
|
||||||
} |
this.add(uiExpandablePane); |
||||||
|
} |
||||||
@Override |
|
||||||
public CheckBox updateBean() { |
@Override |
||||||
CheckBox box = new CheckBox(); |
protected String title4PopupWindow() { |
||||||
box.setText(text.getText()); |
return "CheckBox"; |
||||||
return box; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
|
public void populateBean(CheckBox check) { |
||||||
|
text.setText(check.getText()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public CheckBox updateBean() { |
||||||
|
CheckBox box = new CheckBox(); |
||||||
|
box.setText(text.getText()); |
||||||
|
return box; |
||||||
|
} |
||||||
} |
} |
@ -1,92 +1,82 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import java.awt.*; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.icombobox.DictionaryComboBox; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.gui.icombobox.DictionaryConstants; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
import javax.swing.*; |
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.form.ui.MultiFileEditor; |
||||||
import com.fr.design.gui.icombobox.DictionaryComboBox; |
import com.fr.general.Inter; |
||||||
import com.fr.design.gui.icombobox.DictionaryConstants; |
|
||||||
import com.fr.design.gui.itextfield.UINumberField; |
import javax.swing.*; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import java.awt.*; |
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> { |
||||||
import com.fr.form.ui.MultiFileEditor; |
private DictionaryComboBox acceptType; |
||||||
import com.fr.general.Inter; |
private UICheckBox singleFileCheckBox; |
||||||
|
private UISpinner fileSizeField; |
||||||
public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor> { |
|
||||||
private DictionaryComboBox acceptType; |
public MultiFileEditorPane() { |
||||||
private UICheckBox singleFileCheckBox; |
this.initComponents(); |
||||||
private UINumberField fileSizeField; |
} |
||||||
|
|
||||||
public MultiFileEditorPane() { |
|
||||||
this.initComponents(); |
@Override |
||||||
} |
protected String title4PopupWindow() { |
||||||
|
return "file"; |
||||||
|
} |
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
@Override |
||||||
return "file"; |
protected JPanel setFirstContentPane() { |
||||||
} |
JPanel contenter = new JPanel(new BorderLayout()); |
||||||
|
|
||||||
@Override |
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); |
||||||
protected JPanel setFirstContentPane() { |
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); |
||||||
acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); |
// acceptType.setPreferredSize(new Dimension(100, 20));
|
||||||
acceptType.setPreferredSize(new Dimension(200, 18)); |
fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1); |
||||||
singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); |
fileSizeField.setPreferredSize(new Dimension(140, 20)); |
||||||
fileSizeField = new UINumberField(); |
|
||||||
fileSizeField.setPreferredSize(new Dimension(80, 18)); |
JPanel fileSizePane = new JPanel(new BorderLayout()); |
||||||
|
UILabel fileTypeLabel = new UILabel(Inter.getLocText("Utils-File_type")); |
||||||
|
UILabel fileSizeLabel = new UILabel(Inter.getLocText("FR-Designer_Size_Limit")); |
||||||
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
fileSizePane.add(fileSizeField, BorderLayout.CENTER); |
||||||
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
fileSizePane.add(new UILabel(" KB"), BorderLayout.EAST); |
||||||
singleFilePane.add(singleFileCheckBox); |
|
||||||
|
double f = TableLayout.FILL; |
||||||
JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
double p = TableLayout.PREFERRED; |
||||||
allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
Component[][] components = new Component[][]{ |
||||||
allowTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
new Component[]{singleFileCheckBox, null}, |
||||||
allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":")); |
new Component[]{fileTypeLabel, acceptType}, |
||||||
allowTypePane.add(acceptType); |
new Component[]{fileSizeLabel, fileSizePane}, |
||||||
|
}; |
||||||
JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
double[] rowSize = {p, p, p}; |
||||||
fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":")); |
double[] columnSize = {p, f}; |
||||||
fileSizePane.add(fileSizeField); |
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
||||||
fileSizePane.add(new UILabel(" KB")); |
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 22, 10); |
||||||
|
|
||||||
double f = TableLayout.FILL; |
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 00)); |
||||||
double p = TableLayout.PREFERRED; |
contenter.add(panel, BorderLayout.CENTER); |
||||||
Component[][] components = new Component[][]{ |
|
||||||
new Component[]{singleFileCheckBox, null }, |
return contenter; |
||||||
new Component[]{new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":"), acceptType}, |
} |
||||||
new Component[]{new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":"), fileSizeField}, |
|
||||||
}; |
@Override |
||||||
double[] rowSize = {p, p,p}; |
protected void populateSubFieldEditorBean(MultiFileEditor e) { |
||||||
double[] columnSize = {p,f}; |
// 这里存在兼容问题 getAccept可能没在待选项目中
|
||||||
int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; |
acceptType.setSelectedItem(e.getAccept()); |
||||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); |
singleFileCheckBox.setSelected(e.isSingleFile()); |
||||||
|
fileSizeField.setValue(e.getMaxSize()); |
||||||
|
} |
||||||
return panel; |
|
||||||
} |
@Override |
||||||
|
protected MultiFileEditor updateSubFieldEditorBean() { |
||||||
@Override |
MultiFileEditor ob = new MultiFileEditor(); |
||||||
protected void populateSubFieldEditorBean(MultiFileEditor e) { |
ob.setAccept((String) acceptType.getSelectedItem()); |
||||||
// 这里存在兼容问题 getAccept可能没在待选项目中
|
ob.setSingleFile(singleFileCheckBox.isSelected()); |
||||||
acceptType.setSelectedItem(e.getAccept()); |
ob.setMaxSize(fileSizeField.getValue()); |
||||||
singleFileCheckBox.setSelected(e.isSingleFile()); |
return ob; |
||||||
fileSizeField.setValue(e.getMaxSize()); |
} |
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected MultiFileEditor updateSubFieldEditorBean() { |
|
||||||
MultiFileEditor ob = new MultiFileEditor(); |
|
||||||
ob.setAccept((String) acceptType.getSelectedItem()); |
|
||||||
ob.setSingleFile(singleFileCheckBox.isSelected()); |
|
||||||
ob.setMaxSize(fileSizeField.getValue()); |
|
||||||
return ob; |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
@ -1,63 +1,63 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import java.awt.FlowLayout; |
import java.awt.FlowLayout; |
||||||
|
|
||||||
import javax.swing.JPanel; |
import javax.swing.JPanel; |
||||||
|
|
||||||
import com.fr.design.data.DataCreatorUI; |
import com.fr.design.data.DataCreatorUI; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.present.dict.DictionaryPane; |
import com.fr.design.present.dict.DictionaryPane; |
||||||
import com.fr.form.ui.RadioGroup; |
import com.fr.form.ui.RadioGroup; |
||||||
|
|
||||||
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { |
public class RadioGroupDefinePane extends FieldEditorDefinePane<RadioGroup> { |
||||||
private DictionaryPane dictPane; |
private DictionaryPane dictPane; |
||||||
|
|
||||||
private ButtonGroupDictPane buttonGroupDictPane; |
private ButtonGroupDictPane buttonGroupDictPane; |
||||||
|
|
||||||
public RadioGroupDefinePane() { |
public RadioGroupDefinePane() { |
||||||
this.initComponents(); |
this.initComponents(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void initComponents() { |
protected void initComponents() { |
||||||
super.initComponents(); |
super.initComponents(); |
||||||
|
|
||||||
dictPane = new DictionaryPane(); |
dictPane = new DictionaryPane(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected JPanel setFirstContentPane() { |
protected JPanel setFirstContentPane() { |
||||||
|
|
||||||
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
JPanel centerPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||||
buttonGroupDictPane = new ButtonGroupDictPane(); |
buttonGroupDictPane = new ButtonGroupDictPane(); |
||||||
buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
||||||
centerPane.add(buttonGroupDictPane); |
centerPane.add(buttonGroupDictPane); |
||||||
return centerPane; |
return centerPane; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected RadioGroup updateSubFieldEditorBean() { |
protected RadioGroup updateSubFieldEditorBean() { |
||||||
RadioGroup ob = new RadioGroup(); |
RadioGroup ob = new RadioGroup(); |
||||||
|
|
||||||
ob.setDictionary(this.dictPane.updateBean()); |
ob.setDictionary(this.dictPane.updateBean()); |
||||||
this.buttonGroupDictPane.update(ob); |
this.buttonGroupDictPane.update(ob); |
||||||
|
|
||||||
return ob; |
return ob; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected String title4PopupWindow() { |
protected String title4PopupWindow() { |
||||||
return "radiogroup"; |
return "radiogroup"; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void populateSubFieldEditorBean(RadioGroup ob) { |
protected void populateSubFieldEditorBean(RadioGroup ob) { |
||||||
this.dictPane.populateBean(ob.getDictionary()); |
this.dictPane.populateBean(ob.getDictionary()); |
||||||
this.buttonGroupDictPane.populate(ob); |
this.buttonGroupDictPane.populate(ob); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public DataCreatorUI dataUI() { |
public DataCreatorUI dataUI() { |
||||||
return dictPane; |
return dictPane; |
||||||
} |
} |
||||||
} |
} |
@ -1,456 +1,510 @@ |
|||||||
package com.fr.design.layout; |
package com.fr.design.layout; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import com.fr.design.border.UITitledBorder; |
||||||
import java.awt.CardLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.FlowLayout; |
|
||||||
import java.awt.LayoutManager; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.BoxLayout; |
|
||||||
import javax.swing.Icon; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.JRadioButton; |
|
||||||
|
|
||||||
import com.fr.design.border.UITitledBorder; |
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
public class FRGUIPaneFactory { |
public class FRGUIPaneFactory { |
||||||
private FRGUIPaneFactory() { |
private FRGUIPaneFactory() { |
||||||
} |
} |
||||||
|
|
||||||
public static final float WIDTH_PARA_F = 80.0f; |
public static final float WIDTH_PARA_F = 80.0f; |
||||||
public static final int WIDTH_OFFSET_N = 60; |
public static final int WIDTH_OFFSET_N = 60; |
||||||
public static final int WIDTH_OFFSET_M = 20; |
public static final int WIDTH_OFFSET_M = 20; |
||||||
public static final int WIDTH_PARA_INT = 80; |
public static final int WIDTH_PARA_INT = 80; |
||||||
public static final float WIDTHABS_PARA_F = 2.0f; |
public static final float WIDTHABS_PARA_F = 2.0f; |
||||||
public static final int HEIGHT_PARA = 25; |
public static final int HEIGHT_PARA = 25; |
||||||
public static final int HEIGHT_OFFSET = 50; |
public static final int HEIGHT_OFFSET = 50; |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠右靠左的水平间隙为2的流式布局 |
* 创建一个靠右靠左的水平间隙为2的流式布局 |
||||||
|
* |
||||||
* @return FlowLayout对象 |
* @return FlowLayout对象 |
||||||
*/ |
*/ |
||||||
public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多
|
public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多
|
||||||
return new FlowLayout(FlowLayout.LEFT, 2, 0); |
return new FlowLayout(FlowLayout.LEFT, 2, 0); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠左的布局 |
* 创建一个靠左的布局 |
||||||
* @return FlowLayout对象 |
* |
||||||
*/ |
* @return FlowLayout对象 |
||||||
public static LayoutManager createLeftZeroLayout() { |
*/ |
||||||
return new FlowLayout(FlowLayout.LEFT, 0, 0); |
public static LayoutManager createLeftZeroLayout() { |
||||||
} |
return new FlowLayout(FlowLayout.LEFT, 0, 0); |
||||||
|
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠左的水平和垂直间隙均为5的流式布局 |
* 创建一个靠左的水平和垂直间隙均为5的流式布局 |
||||||
|
* |
||||||
|
* @return FlowLayout对象 |
||||||
|
*/ |
||||||
|
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout
|
||||||
|
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个靠左流式布局,间距10,10 |
||||||
|
* |
||||||
|
* @return FlowLayout对象 |
||||||
|
*/ |
||||||
|
public static LayoutManager createL_FlowLayout() { |
||||||
|
return new FlowLayout(FlowLayout.LEFT, 10, 10); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个居中流式布局 |
||||||
|
* |
||||||
|
* @return FlowLayout对象 |
||||||
|
*/ |
||||||
|
public static LayoutManager createCenterFlowLayout() { |
||||||
|
return new FlowLayout(FlowLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个靠右流式布局 |
||||||
|
* |
||||||
* @return FlowLayout对象 |
* @return FlowLayout对象 |
||||||
*/ |
*/ |
||||||
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout
|
public static LayoutManager createRightFlowLayout() { |
||||||
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5
|
return new FlowLayout(FlowLayout.RIGHT); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠左流式布局,间距10,10 |
* 创建一个边框布局 |
||||||
* @return FlowLayout对象 |
* |
||||||
*/ |
* @return BorderLayout对象 |
||||||
public static LayoutManager createL_FlowLayout() { |
*/ |
||||||
return new FlowLayout(FlowLayout.LEFT, 10, 10); |
public static LayoutManager createBorderLayout() { |
||||||
} |
return new BorderLayout(); |
||||||
|
} |
||||||
/** |
|
||||||
* 创建一个居中流式布局 |
/** |
||||||
* @return FlowLayout对象 |
* 创建一个边框布局,间距4,4 |
||||||
*/ |
* |
||||||
public static LayoutManager createCenterFlowLayout() { |
* @return BorderLayout对象 |
||||||
return new FlowLayout(FlowLayout.CENTER); |
*/ |
||||||
} |
public static LayoutManager createM_BorderLayout() { |
||||||
|
return new BorderLayout(4, 4); |
||||||
/** |
} |
||||||
* 创建一个靠右流式布局 |
|
||||||
* @return FlowLayout对象 |
// TODO 删掉
|
||||||
*/ |
|
||||||
public static LayoutManager createRightFlowLayout() { |
/** |
||||||
return new FlowLayout(FlowLayout.RIGHT); |
* 创建一个1列的网格布局 |
||||||
} |
* |
||||||
|
* @return FRGridLayout对象 |
||||||
/** |
*/ |
||||||
* 创建一个边框布局 |
public static LayoutManager create1ColumnGridLayout() { |
||||||
* @return BorderLayout对象 |
return new FRGridLayout(1); |
||||||
*/ |
} |
||||||
public static LayoutManager createBorderLayout() { |
|
||||||
return new BorderLayout(); |
/** |
||||||
} |
* 创建一个2列的网格布局 |
||||||
|
* |
||||||
/** |
* @return FRGridLayout对象 |
||||||
* 创建一个边框布局,间距4,4 |
*/ |
||||||
* @return BorderLayout对象 |
public static LayoutManager create2ColumnGridLayout() { |
||||||
*/ |
return new FRGridLayout(2); |
||||||
public static LayoutManager createM_BorderLayout() { |
} |
||||||
return new BorderLayout(4,4); |
|
||||||
} |
/** |
||||||
|
* 创建一个n列的网格布局 |
||||||
// TODO 删掉
|
* |
||||||
|
* @param nColumn 列数 |
||||||
/** |
* @return FRGridLayout对象 |
||||||
* 创建一个1列的网格布局 |
*/ |
||||||
* @return FRGridLayout对象 |
public static LayoutManager createNColumnGridLayout(int nColumn) { |
||||||
*/ |
return new FRGridLayout(nColumn); |
||||||
public static LayoutManager create1ColumnGridLayout() { |
} |
||||||
return new FRGridLayout(1); |
|
||||||
} |
/** |
||||||
|
* 创建一个带标题边框面板 |
||||||
/** |
* |
||||||
* 创建一个2列的网格布局 |
* @param string 边框标题 |
||||||
* @return FRGridLayout对象 |
* @return JPanel对象 |
||||||
*/ |
*/ |
||||||
public static LayoutManager create2ColumnGridLayout() { |
public static JPanel createTitledBorderPane(String string) { |
||||||
return new FRGridLayout(2); |
JPanel jp = new JPanel(); |
||||||
} |
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); |
||||||
|
jp.setBorder(explainBorder); |
||||||
/** |
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
* 创建一个n列的网格布局 |
return jp; |
||||||
* @param nColumn 列数 |
} |
||||||
* @return FRGridLayout对象 |
|
||||||
*/ |
/** |
||||||
public static LayoutManager createNColumnGridLayout(int nColumn) { |
* 创建一个带标题边框面板并且居中显示 |
||||||
return new FRGridLayout(nColumn); |
* |
||||||
} |
* @param borderTitle 边框标题 |
||||||
|
* @return JPanel对象 |
||||||
/** |
*/ |
||||||
* 创建一个带标题边框面板 |
public static JPanel createTitledBorderPaneCenter(String borderTitle) { |
||||||
* @param string 边框标题 |
JPanel jp = new JPanel(); |
||||||
* @return JPanel对象 |
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle); |
||||||
*/ |
jp.setBorder(explainBorder); |
||||||
public static JPanel createTitledBorderPane(String string) { |
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); |
||||||
JPanel jp = new JPanel(); |
return jp; |
||||||
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); |
} |
||||||
jp.setBorder(explainBorder); |
|
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
/** |
||||||
return jp; |
* 创建一个靠左空边框布局,间隔大 |
||||||
} |
* |
||||||
|
* @return JPanel对象 |
||||||
/** |
*/ |
||||||
* 创建一个带标题边框面板并且居中显示 |
public static JPanel createBigHGapFlowInnerContainer_M_Pane() { |
||||||
* @param borderTitle 边框标题 |
JPanel jp = new JPanel(); |
||||||
* @return JPanel对象 |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
*/ |
jp.setLayout(new FRLeftFlowLayout(5, 60, 5)); |
||||||
public static JPanel createTitledBorderPaneCenter(String borderTitle) { |
return jp; |
||||||
JPanel jp = new JPanel(); |
} |
||||||
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle); |
|
||||||
jp.setBorder(explainBorder); |
/** |
||||||
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); |
* 创建一个靠左空边框面板,间隔中等 |
||||||
return jp; |
* |
||||||
} |
* @return JPanel对象 |
||||||
|
*/ |
||||||
/** |
public static JPanel createMediumHGapFlowInnerContainer_M_Pane() { |
||||||
* 创建一个靠左空边框布局,间隔大 |
JPanel jp = new JPanel(); |
||||||
* @return JPanel对象 |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
*/ |
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); |
||||||
public static JPanel createBigHGapFlowInnerContainer_M_Pane() { |
return jp; |
||||||
JPanel jp = new JPanel(); |
} |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
|
||||||
jp.setLayout(new FRLeftFlowLayout(5, 60, 5)); |
/** |
||||||
return jp; |
* 创建一个靠左空边框面板,间隔中等,firsthgap 为0 |
||||||
} |
* |
||||||
|
* @return JPanel对象 |
||||||
/** |
*/ |
||||||
* 创建一个靠左空边框面板,间隔中等 |
public static JPanel createMediumHGapFlowInnerContainer_M_Pane_First0() { |
||||||
* @return JPanel对象 |
JPanel jp = new JPanel(); |
||||||
*/ |
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
public static JPanel createMediumHGapFlowInnerContainer_M_Pane() { |
jp.setLayout(new FRLeftFlowLayout(0, 20, 5)); |
||||||
JPanel jp = new JPanel(); |
return jp; |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
} |
||||||
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); |
|
||||||
return jp; |
/** |
||||||
} |
* 创建一个靠左空边框面板,间隔中等 |
||||||
|
* |
||||||
/** |
* @return JPanel对象 |
||||||
* 创建一个靠左空边框面板,间隔中等 |
*/ |
||||||
* @return JPanel对象 |
public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() { |
||||||
*/ |
JPanel jp = new JPanel(); |
||||||
public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() { |
jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0)); |
||||||
JPanel jp = new JPanel(); |
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0)); |
return jp; |
||||||
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); |
} |
||||||
return jp; |
|
||||||
} |
/** |
||||||
|
* 创建一个正常靠左空边框面板 |
||||||
/** |
* |
||||||
* 创建一个正常靠左空边框面板 |
* @return JPanel对象 |
||||||
* @return JPanel对象 |
*/ |
||||||
*/ |
public static JPanel createNormalFlowInnerContainer_M_Pane() { |
||||||
public static JPanel createNormalFlowInnerContainer_M_Pane() { |
JPanel jp = new JPanel(); |
||||||
JPanel jp = new JPanel(); |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
return jp; |
||||||
return jp; |
} |
||||||
} |
|
||||||
|
/** |
||||||
/** |
* 创建一个靠左0间距边框面板 |
||||||
* 创建一个靠左0间距边框面板 |
* |
||||||
* @return JPanel对象 |
* @return JPanel对象 |
||||||
*/ |
*/ |
||||||
public static JPanel createLeftFlowZeroGapBorderPane() { |
public static JPanel createLeftFlowZeroGapBorderPane() { |
||||||
JPanel jp = new JPanel(); |
JPanel jp = new JPanel(); |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
||||||
return jp; |
return jp; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠左流式布局,正常流式内嵌 |
* 创建一个靠左流式布局,正常流式内嵌 |
||||||
* @return JPanel对象 |
* |
||||||
*/ |
* @return JPanel对象 |
||||||
public static JPanel createNormalFlowInnerContainer_S_Pane() { |
*/ |
||||||
JPanel jp = new JPanel(); |
public static JPanel createNormalFlowInnerContainer_S_Pane() { |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
JPanel jp = new JPanel(); |
||||||
return jp; |
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
} |
return jp; |
||||||
|
} |
||||||
/** |
|
||||||
* 创建一个靠左流式布局,流式内嵌 |
/** |
||||||
* @return JPanel对象 |
* 创建一个靠左流式布局,流式内嵌 |
||||||
*/ |
* |
||||||
public static JPanel createBoxFlowInnerContainer_S_Pane() { |
* @return JPanel对象 |
||||||
JPanel jp = new JPanel(); |
*/ |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); |
public static JPanel createBoxFlowInnerContainer_S_Pane() { |
||||||
return jp; |
JPanel jp = new JPanel(); |
||||||
} |
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); |
||||||
|
return jp; |
||||||
/** |
} |
||||||
* 创建一个靠右面板 |
|
||||||
* @return JPanel对象 |
/** |
||||||
*/ |
* 创建一个靠左流式布局,流式内嵌,首元素距离左边0 |
||||||
public static JPanel createRightFlowInnerContainer_S_Pane() { |
* |
||||||
JPanel jp = new JPanel(); |
* @return JPanel对象 |
||||||
jp.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
*/ |
||||||
return jp; |
public static JPanel createBoxFlowInnerContainer_S_Pane_First0() { |
||||||
} |
JPanel jp = new JPanel(); |
||||||
|
jp.setLayout(new FRLeftFlowLayout(0, 0, 5)); |
||||||
/** |
return jp; |
||||||
* 创建一个居中面板 |
} |
||||||
* @return JPanel对象 |
|
||||||
*/ |
/** |
||||||
public static JPanel createCenterFlowInnerContainer_S_Pane() { |
* 创建一个靠右面板 |
||||||
JPanel jp = new JPanel(); |
* |
||||||
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); |
* @return JPanel对象 |
||||||
return jp; |
*/ |
||||||
} |
public static JPanel createRightFlowInnerContainer_S_Pane() { |
||||||
|
JPanel jp = new JPanel(); |
||||||
/** |
jp.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
||||||
* 创建一个居中0间距面板 |
return jp; |
||||||
* @return JPanel对象 |
} |
||||||
*/ |
|
||||||
public static JPanel createCenterFlowZeroGapBorderPane() { |
/** |
||||||
JPanel jp = new JPanel(); |
* 创建一个居中面板 |
||||||
jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); |
* |
||||||
jp.setBorder(BorderFactory.createEmptyBorder()); |
* @return JPanel对象 |
||||||
return jp; |
*/ |
||||||
} |
public static JPanel createCenterFlowInnerContainer_S_Pane() { |
||||||
|
JPanel jp = new JPanel(); |
||||||
/** |
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); |
||||||
* 创建纵向排列面板 |
return jp; |
||||||
* @return JPanel对象 |
} |
||||||
*/ |
|
||||||
public static JPanel createY_AXISBoxInnerContainer_L_Pane() { |
/** |
||||||
JPanel jp = new JPanel(); |
* 创建一个居中0间距面板 |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
* |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
* @return JPanel对象 |
||||||
return jp; |
*/ |
||||||
} |
public static JPanel createCenterFlowZeroGapBorderPane() { |
||||||
|
JPanel jp = new JPanel(); |
||||||
/** |
jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); |
||||||
* 创建纵向边框面板 |
jp.setBorder(BorderFactory.createEmptyBorder()); |
||||||
* @return JPanel对象 |
return jp; |
||||||
*/ |
} |
||||||
public static JPanel createYBoxEmptyBorderPane() { |
|
||||||
JPanel jp = new JPanel(); |
/** |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
* 创建纵向排列面板 |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
* |
||||||
return jp; |
* @return JPanel对象 |
||||||
} |
*/ |
||||||
|
public static JPanel createY_AXISBoxInnerContainer_L_Pane() { |
||||||
/** |
JPanel jp = new JPanel(); |
||||||
* 创建横向面板 |
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
* @return JPanel对象 |
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||||
*/ |
return jp; |
||||||
public static JPanel createX_AXISBoxInnerContainer_L_Pane() { |
} |
||||||
JPanel jp = new JPanel(); |
|
||||||
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
/** |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
* 创建纵向边框面板 |
||||||
return jp; |
* |
||||||
} |
* @return JPanel对象 |
||||||
|
*/ |
||||||
/** |
public static JPanel createYBoxEmptyBorderPane() { |
||||||
* 创建纵向面板M |
JPanel jp = new JPanel(); |
||||||
* @return JPanel对象 |
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
*/ |
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||||
public static JPanel createY_AXISBoxInnerContainer_M_Pane() { |
return jp; |
||||||
JPanel jp = new JPanel(); |
} |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
|
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
/** |
||||||
return jp; |
* 创建横向面板 |
||||||
} |
* |
||||||
|
* @return JPanel对象 |
||||||
/** |
*/ |
||||||
* 创建横向内置boxlayout的面板 |
public static JPanel createX_AXISBoxInnerContainer_L_Pane() { |
||||||
* @return JPanel对象 |
JPanel jp = new JPanel(); |
||||||
*/ |
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
public static JPanel createX_AXISBoxInnerContainer_M_Pane() { |
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
||||||
JPanel jp = new JPanel(); |
return jp; |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
} |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
|
||||||
return jp; |
/** |
||||||
} |
* 创建纵向面板M |
||||||
|
* |
||||||
/** |
* @return JPanel对象 |
||||||
* 创建纵向内置boxlayout的面板 |
*/ |
||||||
* @return JPanel对象 |
public static JPanel createY_AXISBoxInnerContainer_M_Pane() { |
||||||
*/ |
JPanel jp = new JPanel(); |
||||||
public static JPanel createY_AXISBoxInnerContainer_S_Pane() { |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
JPanel jp = new JPanel(); |
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
return jp; |
||||||
return jp; |
} |
||||||
} |
|
||||||
|
/** |
||||||
/** |
* 创建横向内置boxlayout的面板 |
||||||
* 创建横向内置boxlayout的面板 |
* |
||||||
* @return JPanel对象 |
* @return JPanel对象 |
||||||
*/ |
*/ |
||||||
public static JPanel createX_AXISBoxInnerContainer_S_Pane() { |
public static JPanel createX_AXISBoxInnerContainer_M_Pane() { |
||||||
JPanel jp = new JPanel(); |
JPanel jp = new JPanel(); |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
return jp; |
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
||||||
} |
return jp; |
||||||
|
} |
||||||
/** |
|
||||||
* 创建n列网格面板 |
/** |
||||||
* @param nColumn 列数 |
* 创建纵向内置boxlayout的面板 |
||||||
* @return JPanel对象 |
* |
||||||
*/ |
* @return JPanel对象 |
||||||
public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) { |
*/ |
||||||
JPanel jp = new JPanel(); |
public static JPanel createY_AXISBoxInnerContainer_S_Pane() { |
||||||
jp.setLayout(new FRGridLayout(nColumn)); |
JPanel jp = new JPanel(); |
||||||
return jp; |
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||||
} |
return jp; |
||||||
|
} |
||||||
/** |
|
||||||
* 创建n列网格面板 |
/** |
||||||
* @param nColumn 列数 |
* 创建横向内置boxlayout的面板 |
||||||
* @param h 水平间距 |
* |
||||||
* @param v 垂直间距 |
* @return JPanel对象 |
||||||
* @return JPanel对象 |
*/ |
||||||
*/ |
public static JPanel createX_AXISBoxInnerContainer_S_Pane() { |
||||||
public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) { |
JPanel jp = new JPanel(); |
||||||
JPanel jp = new JPanel(); |
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
||||||
jp.setLayout(new FRGridLayout(nColumn, h, v)); |
return jp; |
||||||
return jp; |
} |
||||||
} |
|
||||||
|
/** |
||||||
/** |
* 创建n列网格面板 |
||||||
* 创建顶格n列网格面板 |
* |
||||||
* @param nColumn 列数 |
* @param nColumn 列数 |
||||||
* @return JPanel对象 |
* @return JPanel对象 |
||||||
*/ |
*/ |
||||||
public static JPanel createFillColumnPane(int nColumn) { |
public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) { |
||||||
JPanel jp = new JPanel(); |
JPanel jp = new JPanel(); |
||||||
jp.setLayout(new FRGridLayout(nColumn, 0, 0)); |
jp.setLayout(new FRGridLayout(nColumn)); |
||||||
return jp; |
return jp; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建边框面板L |
* 创建n列网格面板 |
||||||
* @return JPanel对象 |
* |
||||||
*/ |
* @param nColumn 列数 |
||||||
public static JPanel createBorderLayout_L_Pane() { |
* @param h 水平间距 |
||||||
JPanel jp = new JPanel(); |
* @param v 垂直间距 |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
* @return JPanel对象 |
||||||
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); |
*/ |
||||||
return jp; |
public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) { |
||||||
} |
JPanel jp = new JPanel(); |
||||||
|
jp.setLayout(new FRGridLayout(nColumn, h, v)); |
||||||
/** |
return jp; |
||||||
* 创建边框面板M |
} |
||||||
* @return JPanel对象 |
|
||||||
*/ |
/** |
||||||
public static JPanel createBorderLayout_M_Pane() { |
* 创建顶格n列网格面板 |
||||||
JPanel jp = new JPanel(); |
* |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
* @param nColumn 列数 |
||||||
jp.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
* @return JPanel对象 |
||||||
return jp; |
*/ |
||||||
} |
public static JPanel createFillColumnPane(int nColumn) { |
||||||
|
JPanel jp = new JPanel(); |
||||||
/** |
jp.setLayout(new FRGridLayout(nColumn, 0, 0)); |
||||||
* 创建边框面板S |
return jp; |
||||||
* @return JPanel对象 |
} |
||||||
*/ |
|
||||||
public static JPanel createBorderLayout_S_Pane() { |
/** |
||||||
JPanel jp = new JPanel(); |
* 创建边框面板L |
||||||
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); |
* |
||||||
return jp; |
* @return JPanel对象 |
||||||
} |
*/ |
||||||
|
public static JPanel createBorderLayout_L_Pane() { |
||||||
/** |
JPanel jp = new JPanel(); |
||||||
* 创建卡片式布局 |
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
* @return JPanel对象 |
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
*/ |
return jp; |
||||||
public static JPanel createCardLayout_S_Pane() { |
} |
||||||
JPanel jp = new JPanel(); |
|
||||||
jp.setLayout(new CardLayout()); |
/** |
||||||
return jp; |
* 创建边框面板M |
||||||
} |
* |
||||||
|
* @return JPanel对象 |
||||||
/** |
*/ |
||||||
* 创建图标IconRadio面板 |
public static JPanel createBorderLayout_M_Pane() { |
||||||
* @param icon 图标 |
JPanel jp = new JPanel(); |
||||||
* @param jradiobtn 按钮 |
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
* @return JPanel对象 |
jp.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
||||||
*/ |
return jp; |
||||||
public static JPanel createIconRadio_S_Pane(Icon icon, |
} |
||||||
JRadioButton jradiobtn) { |
|
||||||
jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); |
/** |
||||||
jradiobtn.setBackground(new Color(255, 255, 255)); |
* 创建边框面板S |
||||||
JPanel iconRadioPane = new JPanel(); |
* |
||||||
iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS)); |
* @return JPanel对象 |
||||||
|
*/ |
||||||
iconRadioPane.add(new UILabel(icon)); |
public static JPanel createBorderLayout_S_Pane() { |
||||||
iconRadioPane.add(jradiobtn); |
JPanel jp = new JPanel(); |
||||||
|
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
return iconRadioPane; |
return jp; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 计算宽度 |
* 创建卡片式布局 |
||||||
* @param width 宽度输入值 |
* |
||||||
* @return w 宽度输出值 |
* @return JPanel对象 |
||||||
*/ |
*/ |
||||||
public static int caculateWidth(int width) { |
public static JPanel createCardLayout_S_Pane() { |
||||||
int w = 0; |
JPanel jp = new JPanel(); |
||||||
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; |
jp.setLayout(new CardLayout()); |
||||||
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; |
return jp; |
||||||
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); |
} |
||||||
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); |
|
||||||
float x = i > j ? i : j; |
/** |
||||||
if (x == i) { |
* 创建图标IconRadio面板 |
||||||
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; |
* |
||||||
} else if (x == j) { |
* @param icon 图标 |
||||||
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N; |
* @param jradiobtn 按钮 |
||||||
} |
* @return JPanel对象 |
||||||
return w; |
*/ |
||||||
} |
public static JPanel createIconRadio_S_Pane(Icon icon, |
||||||
|
JRadioButton jradiobtn) { |
||||||
/** |
jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); |
||||||
* 计算高度 |
jradiobtn.setBackground(new Color(255, 255, 255)); |
||||||
* @param height 高度输入值 |
JPanel iconRadioPane = new JPanel(); |
||||||
* @return 高度输出值 |
iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS)); |
||||||
*/ |
|
||||||
public static int caculateHeight(int height) { |
iconRadioPane.add(new UILabel(icon)); |
||||||
int h = 0; |
iconRadioPane.add(jradiobtn); |
||||||
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; |
|
||||||
h = ((int) x + 1) * HEIGHT_PARA; |
return iconRadioPane; |
||||||
return h; |
} |
||||||
} |
|
||||||
|
/** |
||||||
|
* 计算宽度 |
||||||
|
* |
||||||
|
* @param width 宽度输入值 |
||||||
|
* @return w 宽度输出值 |
||||||
|
*/ |
||||||
|
public static int caculateWidth(int width) { |
||||||
|
int w = 0; |
||||||
|
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; |
||||||
|
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; |
||||||
|
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); |
||||||
|
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); |
||||||
|
float x = i > j ? i : j; |
||||||
|
if (x == i) { |
||||||
|
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; |
||||||
|
} else if (x == j) { |
||||||
|
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N; |
||||||
|
} |
||||||
|
return w; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算高度 |
||||||
|
* |
||||||
|
* @param height 高度输入值 |
||||||
|
* @return 高度输出值 |
||||||
|
*/ |
||||||
|
public static int caculateHeight(int height) { |
||||||
|
int h = 0; |
||||||
|
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; |
||||||
|
h = ((int) x + 1) * HEIGHT_PARA; |
||||||
|
return h; |
||||||
|
} |
||||||
|
|
||||||
} |
} |
Loading…
Reference in new issue