Browse Source

Merge pull request #6174 in DESIGN/design from release/10.0 to bugfix/10.0

* commit '7f9fe1ebdea39d6c186b2a8813b3985bc6216436':
  REPORT-60561 全局自适应-样式细节优化
  REPORT-60516 10.0release设计器打开cpt很慢
  REPORT-56437 & REPORT-58955 国际化问题调整
  REPORT-59475 控件校验错误提示支持公式
  REPORT-59475 控件校验错误提示支持公式
  REPORT-59476 && REPORT-59475 1、文本控件校验规则支持国际化 2、控件校验错误提示支持公式
  REPORT-59166 韩文设计器设置条件属性 条件属性框体标题显示不全
bugfix/10.0
superman 3 years ago
parent
commit
17cd53501b
  1. 11
      designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java
  2. 46
      designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java
  3. 11
      designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java
  4. 11
      designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java
  5. 22
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java
  6. 22
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java
  7. 60
      designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java
  8. 5
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  9. 23
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  10. 1
      designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java
  11. 2
      designer-base/src/main/java/com/fr/env/ErrorDialog.java
  12. 3
      designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java
  13. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  14. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  15. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  16. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  17. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  18. 53
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  19. 35
      designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java
  20. 42
      designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java
  21. 20
      designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java

11
designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java

@ -0,0 +1,11 @@
package com.fr.design.beans;
import javax.swing.JComponent;
public interface ErrorMsgTextFieldAdapter {
void setText(String str);
String getText();
JComponent getErrorMsgTextField();
}

46
designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java

@ -0,0 +1,46 @@
package com.fr.design.beans;
import com.fr.design.gui.itextfield.UITextField;
import javax.swing.JComponent;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
public class UITextFieldAdapter implements ErrorMsgTextFieldAdapter {
private final UITextField uiTextField = new UITextField();
public UITextFieldAdapter(){
addDocumentListener();
}
@Override
public void setText(String str) {
uiTextField.setText(str);
}
@Override
public String getText() {
return uiTextField.getText();
}
public void addDocumentListener() {
uiTextField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
uiTextField.setToolTipText(uiTextField.getText());
}
public void insertUpdate(DocumentEvent e) {
uiTextField.setToolTipText(uiTextField.getText());
}
public void removeUpdate(DocumentEvent e) {
uiTextField.setToolTipText(uiTextField.getText());
}
});
}
@Override
public JComponent getErrorMsgTextField() {
return uiTextField;
}
}

11
designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java

@ -0,0 +1,11 @@
package com.fr.design.fun;
import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.stable.fun.mark.Immutable;
public interface RegPaneProvider extends Immutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "RegPaneProvider";
RegFieldPane createRegPane();
}

11
designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java

@ -0,0 +1,11 @@
package com.fr.design.fun;
import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.stable.fun.mark.Immutable;
public interface TextFieldAdapterProvider extends Immutable {
String XML_TAG = "ErrorMesPaneWrapperProvider";
int CURRENT_LEVEL = 1;
ErrorMsgTextFieldAdapter createTextFieldAdapter();
}

22
designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java

@ -0,0 +1,22 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.RegPaneProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Joe
* 2021/10/8 15:19
*/
@API(level = RegPaneProvider.CURRENT_LEVEL)
public abstract class AbstractRegPaneProvider implements RegPaneProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

22
designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java

@ -0,0 +1,22 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Joe
* 2021/10/8 15:17
*/
@API(level = TextFieldAdapterProvider.CURRENT_LEVEL)
public abstract class AbstractTextFieldAdapterProvider implements TextFieldAdapterProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

60
designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java

@ -1,21 +1,25 @@
package com.fr.design.gui.frpane; package com.fr.design.gui.frpane;
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.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.TextFieldAdapterProvider;
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.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.form.ui.reg.NoneReg; import com.fr.form.ui.reg.NoneReg;
import com.fr.form.ui.reg.RegExp; import com.fr.form.ui.reg.RegExp;
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.Dimension;
/** /**
* Created by kerry on 2017/9/4. * Created by kerry on 2017/9/4.
@ -23,7 +27,7 @@ import java.awt.*;
public class RegFieldPane extends RegPane { public class RegFieldPane extends RegPane {
protected RegErrorMsgPane regErrorMsgPane; protected RegErrorMsgPane regErrorMsgPane;
public RegFieldPane(){ public RegFieldPane() {
this(ALL_REG_TYPE); this(ALL_REG_TYPE);
} }
@ -39,8 +43,8 @@ public class RegFieldPane extends RegPane {
@Override @Override
public void regChangeAction() { public void regChangeAction() {
RegExp regExp = (RegExp)getRegComboBox().getSelectedItem(); RegExp regExp = (RegExp) getRegComboBox().getSelectedItem();
if(regExp instanceof NoneReg){ if (regExp instanceof NoneReg) {
regErrorMsgPane.setVisible(false); regErrorMsgPane.setVisible(false);
return; return;
} }
@ -67,33 +71,35 @@ public class RegFieldPane extends RegPane {
} }
private static class RegErrorMsgPane extends BasicPane { private static class RegErrorMsgPane extends BasicPane {
private UITextField regErrorMsgField; private ErrorMsgTextFieldAdapter errorMsgTextFieldAdapter;
public RegErrorMsgPane() { public RegErrorMsgPane() {
initRegErrorMsgField();
setStyle();
}
private void setStyle() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0));
initRegErrorMsgField();
UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"));
tipLabel.setPreferredSize(new Dimension(60, 20)); tipLabel.setPreferredSize(new Dimension(60, 20));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, errorMsgTextFieldAdapter.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM);
this.add(panel); this.add(panel);
} }
private void initRegErrorMsgField() { private void initRegErrorMsgField() {
regErrorMsgField = new UITextField(); TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG);
regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() { if (provider == null) {
public void changedUpdate(DocumentEvent e) { errorMsgTextFieldAdapter = new UITextFieldAdapter();
regErrorMsgField.setToolTipText(regErrorMsgField.getText()); return;
} }
try {
public void insertUpdate(DocumentEvent e) { errorMsgTextFieldAdapter = provider.createTextFieldAdapter();
regErrorMsgField.setToolTipText(regErrorMsgField.getText()); } catch (Exception e) {
} FineLoggerFactory.getLogger().error(e.getMessage(), e);
errorMsgTextFieldAdapter = new UITextFieldAdapter();
public void removeUpdate(DocumentEvent e) { }
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
});
} }
@Override @Override
@ -102,11 +108,11 @@ public class RegFieldPane extends RegPane {
} }
public void populate(TextEditor textEditor) { public void populate(TextEditor textEditor) {
regErrorMsgField.setText(textEditor.getRegErrorMessage()); errorMsgTextFieldAdapter.setText(textEditor.getRegErrorMessage());
} }
public void update(TextEditor textEditor) { public void update(TextEditor textEditor) {
textEditor.setRegErrorMessage(regErrorMsgField.getText()); textEditor.setRegErrorMessage(errorMsgTextFieldAdapter.getText());
} }
} }

5
designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java

@ -41,6 +41,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
public JPanel attrJPanel; public JPanel attrJPanel;
public FitPreviewPane previewJPanel; public FitPreviewPane previewJPanel;
public FitAttrModel fitAttrModel; public FitAttrModel fitAttrModel;
private static final int BELOW_SET_COMPONENT_HSPACE = 8;
protected BaseFitAttrPane() { protected BaseFitAttrPane() {
@ -179,7 +180,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); return i18nText("Fine-Designer_PC_Fit_Attr");
} }
protected abstract String[] getItemNames(); protected abstract String[] getItemNames();
@ -202,7 +203,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
itemChoose.addItemListener(itemListener); itemChoose.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set"));
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{
belowSetLabel, itemChoose}, FlowLayout.LEFT, 0, 0); belowSetLabel, itemChoose}, FlowLayout.LEFT, BELOW_SET_COMPONENT_HSPACE);
chooseJPanel.add(buttonPane); chooseJPanel.add(buttonPane);
chooseJPanel.setPreferredSize(new Dimension(500, 50)); chooseJPanel.setPreferredSize(new Dimension(500, 50));
JPanel jPanel = new JPanel(); JPanel jPanel = new JPanel();

23
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java

@ -34,22 +34,6 @@ public class ReportFitAttrAction extends JTemplateAction {
return null; return null;
} }
}; };
private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public ReportFitAttrAction(JTemplate jTemplate) { public ReportFitAttrAction(JTemplate jTemplate) {
super(jTemplate); super(jTemplate);
@ -57,12 +41,7 @@ public class ReportFitAttrAction extends JTemplateAction {
} }
private void initMenuStyle() { private void initMenuStyle() {
JTemplate jTemplate = getEditingComponent(); this.setMenuKeySet(REPORT_FIT_ATTR);
if (jTemplate.isJWorkBook()) {
this.setMenuKeySet(REPORT_FIT_ATTR);
} else {
this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE);
}
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon("/com/fr/design/images/reportfit/fit"); this.setSmallIcon("/com/fr/design/images/reportfit/fit");

1
designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java

@ -53,7 +53,6 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
@Override @Override
protected T doInBackground() throws Exception { protected T doInBackground() throws Exception {
TimeUnit.SECONDS.sleep(5);
return this.callable.call(); return this.callable.call();
} }

2
designer-base/src/main/java/com/fr/env/ErrorDialog.java vendored

@ -39,7 +39,7 @@ public class ErrorDialog extends JDialog implements ActionListener {
messagePanel.setBorder(BorderFactory.createEmptyBorder(5,0,0,0)); messagePanel.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
MessageWithLink messageWithLink = new MessageWithLink(message + ",", Toolkit.i18nText("Fine-Design_Basic_Sync_Help"), CloudCenter.getInstance().acquireUrlByKind("help.replacejars", "https://help.fanruan.com/finereport/doc-view-3268.html")); MessageWithLink messageWithLink = new MessageWithLink(message + ",", Toolkit.i18nText("Fine-Design_Basic_Sync_Help"), CloudCenter.getInstance().acquireUrlByKind("help.replacejars", "https://help.fanruan.com/finereport/doc-view-3268.html"));
messageWithLink.setPreferredSize(new Dimension(108, 20)); messageWithLink.setPreferredSize(new Dimension(150, 20));
JPanel messageLinkPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel messageLinkPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
messageLinkPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 5, 0)); messageLinkPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 5, 0));
messageLinkPane.add(messageWithLink); messageLinkPane.add(messageWithLink);

3
designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java vendored

@ -5,6 +5,7 @@ import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -62,7 +63,7 @@ public class SyncFailedPluginsDialog extends JDialog {
JPanel messagePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel messagePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
MessageWithLink messageWithLink = new MessageWithLink(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugin_Fail_Suggestion"),Toolkit.i18nText("Fine-Design_Basic_Sync_Deal_Immediately"), MessageWithLink messageWithLink = new MessageWithLink(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugin_Fail_Suggestion"),Toolkit.i18nText("Fine-Design_Basic_Sync_Deal_Immediately"),
CloudCenter.getInstance().acquireUrlByKind("help.installplugins", "https://help.fanruan.com/finereport/doc-view-2198.html")); CloudCenter.getInstance().acquireUrlByKind("help.installplugins", "https://help.fanruan.com/finereport/doc-view-2198.html"));
messageWithLink.setPreferredSize(new Dimension(316, 20)); messageWithLink.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.env.SyncFailedPluginsDialog.messageWithLink"));
messagePane.add(messageWithLink); messagePane.add(messageWithLink);
messagePane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); messagePane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -7,4 +7,5 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=490*95 com.fr.design.version.check.dialog=490*95
com.fr.design.version.detail.label=750*30 com.fr.design.version.detail.label=750*30
com.fr.design.version.detail.dialog=900*500 com.fr.design.version.detail.dialog=900*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=450*20 com.fr.design.web.pane.text.field=450*20

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

@ -6,4 +6,5 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=430*95 com.fr.design.version.check.dialog=430*95
com.fr.design.version.detail.label=650*30 com.fr.design.version.detail.label=650*30
com.fr.design.version.detail.dialog=800*500 com.fr.design.version.detail.dialog=800*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=400*20 com.fr.design.web.pane.text.field=400*20

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

@ -6,4 +6,5 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=450*95 com.fr.design.version.check.dialog=450*95
com.fr.design.version.detail.label=700*30 com.fr.design.version.detail.label=700*30
com.fr.design.version.detail.dialog=850*500 com.fr.design.version.detail.dialog=850*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=450*20 com.fr.design.web.pane.text.field=450*20

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -7,4 +7,5 @@ com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95 com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500 com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
com.fr.design.web.pane.text.field=450*20 com.fr.design.web.pane.text.field=450*20

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -6,4 +6,5 @@ com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95 com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500 com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
com.fr.design.web.pane.text.field=450*20 com.fr.design.web.pane.text.field=450*20

53
designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

@ -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() {

35
designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java

@ -1,7 +1,9 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.fun.RegPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -11,10 +13,12 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -65,27 +69,36 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); widgetValueLabel.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{widgetValueLabel, formWidgetValuePane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"), SwingConstants.LEFT), waterMarkDictPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"), SwingConstants.LEFT), waterMarkDictPane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT), fontSizePane} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT), fontSizePane}
}; };
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p,f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 3},{1, 1},{1, 1}}; int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
boundsPane.add(panel); boundsPane.add(panel);
return boundsPane; return boundsPane;
} }
public JPanel setValidatePane(){ public JPanel setValidatePane() {
return regPane; return regPane;
} }
protected RegFieldPane createRegPane() { protected RegFieldPane createRegPane() {
return new RegFieldPane(); RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG);
if (provider == null) {
return new RegFieldPane();
}
try {
return provider.createRegPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return new RegFieldPane();
}
} }
@Override @Override
@ -102,7 +115,7 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
@Override @Override
protected TextEditor updateSubFieldEditorBean() { protected TextEditor updateSubFieldEditorBean() {
TextEditor ob = (TextEditor)creator.toData(); TextEditor ob = (TextEditor) creator.toData();
this.regPane.update(ob); this.regPane.update(ob);
ob.setWaterMark(waterMarkDictPane.getText()); ob.setWaterMark(waterMarkDictPane.getText());
formWidgetValuePane.update(ob); formWidgetValuePane.update(ob);

42
designer-realize/src/main/java/com/fr/design/widget/ui/FieldEditorDefinePane.java

@ -1,19 +1,21 @@
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 com.fr.log.FineLoggerFactory;
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 +24,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 +47,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());
}
});
} }
@Override @Override
@ -101,7 +97,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 +113,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);

20
designer-realize/src/main/java/com/fr/design/widget/ui/TextFieldEditorDefinePane.java

@ -1,14 +1,16 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.RegPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
@ -60,7 +62,17 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
protected RegFieldPane createRegPane() { protected RegFieldPane createRegPane() {
return new RegFieldPane(); RegPaneProvider provider = ExtraDesignClassManager.getInstance().getSingle(RegPaneProvider.XML_TAG);
if (provider == null) {
return new RegFieldPane();
}
try {
return provider.createRegPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return new RegFieldPane();
}
} }
@Override @Override

Loading…
Cancel
Save