|
|
|
@ -1,9 +1,17 @@
|
|
|
|
|
package com.fr.design.widget.ui.designer; |
|
|
|
|
|
|
|
|
|
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.designer.creator.*; |
|
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
|
import com.fr.design.designer.creator.XCreatorUtils; |
|
|
|
|
import com.fr.design.designer.creator.XLayoutContainer; |
|
|
|
|
import com.fr.design.designer.creator.XWFitLayout; |
|
|
|
|
import com.fr.design.designer.creator.XWParameterLayout; |
|
|
|
|
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; |
|
|
|
@ -11,19 +19,19 @@ import com.fr.design.layout.FRGUIPaneFactory;
|
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.design.widget.ui.designer.component.FontSizeComboPane; |
|
|
|
|
import com.fr.form.ui.FieldEditor; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
|
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; |
|
|
|
|
protected FontSizeComboPane fontSizePane; |
|
|
|
|
protected UITextField labelNameTextField; |
|
|
|
@ -40,7 +48,6 @@ 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)); |
|
|
|
|
fontSizePane = new FontSizeComboPane(); |
|
|
|
|
errorMsgTextField = new UITextField(); |
|
|
|
|
JPanel contentPane = this.setFirstContentPane(); |
|
|
|
|
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
jPanel.add(contentPane, BorderLayout.CENTER); |
|
|
|
@ -76,23 +83,17 @@ 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()); |
|
|
|
|
TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG); |
|
|
|
|
if (provider == null) { |
|
|
|
|
errorMsgTextField = new UITextFieldAdapter(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
|
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
|
|
|
try { |
|
|
|
|
errorMsgTextField = provider.createTextFieldAdapter(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
errorMsgTextField = new UITextFieldAdapter(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
|
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -111,7 +112,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
|
|
|
|
|
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
final UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); |
|
|
|
|
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(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); |
|
|
|
|
borderPane.add(errorTipPane, BorderLayout.CENTER); |
|
|
|
|
allowBlankCheckBox.addItemListener(new ItemListener() { |
|
|
|
|