|
|
|
@ -1,19 +1,20 @@
|
|
|
|
|
package com.fr.design.widget.ui; |
|
|
|
|
|
|
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
|
import com.fr.design.beans.ErrorMsgTextFieldAdapter; |
|
|
|
|
import com.fr.design.beans.UITextFieldAdapter; |
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
|
import com.fr.design.designer.IntervalConstants; |
|
|
|
|
import com.fr.design.foldablepane.UIExpandablePane; |
|
|
|
|
import com.fr.design.fun.TextFieldAdapterProvider; |
|
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.form.ui.FieldEditor; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
@ -22,7 +23,7 @@ import java.awt.event.ItemListener;
|
|
|
|
|
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { |
|
|
|
|
protected UICheckBox allowBlankCheckBox; |
|
|
|
|
// richer:错误信息,是所有控件共有的属性,所以放到这里来
|
|
|
|
|
protected UITextField errorMsgTextField; |
|
|
|
|
protected ErrorMsgTextFieldAdapter errorMsgTextField; |
|
|
|
|
protected JPanel validatePane; |
|
|
|
|
|
|
|
|
|
public FieldEditorDefinePane() { |
|
|
|
@ -45,23 +46,12 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
|
|
|
|
|
|
|
|
|
|
protected void initErrorMsgPane() { |
|
|
|
|
// 错误信息
|
|
|
|
|
errorMsgTextField = new UITextField(); |
|
|
|
|
// // richer:主要为了方便查看比较长的错误信息
|
|
|
|
|
errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { |
|
|
|
|
|
|
|
|
|
public void changedUpdate(DocumentEvent e) { |
|
|
|
|
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
|
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
|
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); |
|
|
|
|
if (provider != null) { |
|
|
|
|
errorMsgTextField= provider.createTextFieldAdapter(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
errorMsgTextField = new UITextFieldAdapter(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -101,7 +91,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
|
|
|
|
|
allowBlankCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Null")); |
|
|
|
|
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
|
|
|
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
|
|
|
|
final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
|
|
|
|
errorTipPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0)); |
|
|
|
|
borderPane.add(errorTipPane, BorderLayout.CENTER); |
|
|
|
|
allowBlankCheckBox.addItemListener(new ItemListener() { |
|
|
|
@ -117,7 +107,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
|
|
|
|
|
new Component[]{allowBlankCheckBox}, |
|
|
|
|
new Component[]{borderPane}, |
|
|
|
|
}; |
|
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,TableLayoutHelper.FILL_LASTCOLUMN, 5, 5); |
|
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, 5, 5); |
|
|
|
|
panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L6, 0)); |
|
|
|
|
validatePane.add(panel, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|