|
|
@ -1,9 +1,17 @@ |
|
|
|
package com.fr.design.widget.ui.designer; |
|
|
|
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.constants.LayoutConstants; |
|
|
|
import com.fr.design.designer.IntervalConstants; |
|
|
|
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.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.gui.itextfield.UITextField; |
|
|
@ -11,19 +19,19 @@ import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.widget.ui.designer.component.FontSizeComboPane; |
|
|
|
import com.fr.design.widget.ui.designer.component.FontSizeComboPane; |
|
|
|
import com.fr.form.ui.FieldEditor; |
|
|
|
import com.fr.form.ui.FieldEditor; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
import java.awt.Component; |
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
import java.awt.event.ItemListener; |
|
|
|
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; |
|
|
|
protected FontSizeComboPane fontSizePane; |
|
|
|
protected FontSizeComboPane fontSizePane; |
|
|
|
protected UITextField labelNameTextField; |
|
|
|
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 = 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)); |
|
|
|
fontSizePane = new FontSizeComboPane(); |
|
|
|
fontSizePane = new FontSizeComboPane(); |
|
|
|
errorMsgTextField = new UITextField(); |
|
|
|
|
|
|
|
JPanel contentPane = this.setFirstContentPane(); |
|
|
|
JPanel contentPane = this.setFirstContentPane(); |
|
|
|
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
jPanel.add(contentPane, BorderLayout.CENTER); |
|
|
|
jPanel.add(contentPane, BorderLayout.CENTER); |
|
|
@ -76,23 +83,17 @@ 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 = new UITextFieldAdapter(); |
|
|
|
|
|
|
|
return; |
|
|
|
public void changedUpdate(DocumentEvent e) { |
|
|
|
} |
|
|
|
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
|
|
try { |
|
|
|
} |
|
|
|
errorMsgTextField = provider.createTextFieldAdapter(); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
|
|
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(); |
|
|
|
validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
final UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); |
|
|
|
final UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); |
|
|
|
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(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); |
|
|
|
errorTipPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); |
|
|
|
borderPane.add(errorTipPane, BorderLayout.CENTER); |
|
|
|
borderPane.add(errorTipPane, BorderLayout.CENTER); |
|
|
|
allowBlankCheckBox.addItemListener(new ItemListener() { |
|
|
|
allowBlankCheckBox.addItemListener(new ItemListener() { |
|
|
|