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