From 88c2d8697a8a32bb7698d4968bdbec162633801d Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 23 Oct 2017 16:38:06 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-5137=20[9.0=E4=BA=8C=E8=BD=AE=E5=9B=9E?= =?UTF-8?q?=E5=BD=92]=E8=A1=A8=E5=8D=95=E5=B8=83=E5=B1=80=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E9=97=B4=E9=9A=94=E5=8F=AA=E8=83=BD=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=9C=80=E5=A4=9A2=E4=BD=8D=E6=95=B0=E5=92=8C=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E5=A4=A7=E5=B0=8F=E6=8E=A7=E4=BB=B6=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/NumberEditorDefinePane.java | 4 +- .../com/fr/design/gui/ispinner/UISpinner.java | 2 + .../component/NumberEditorValidatePane.java | 5 ++- .../parameter/RootDesignDefinePane.java | 2 +- .../ui/designer/CheckBoxDefinePane.java | 13 ++++--- .../ui/designer/FieldEditorDefinePane.java | 9 ++--- .../ui/designer/MultiFileEditorPane.java | 7 ++-- .../designer/component/FontSizeComboPane.java | 38 +++++++++++++++++++ .../designer/component/PaddingBoundPane.java | 10 ++--- .../component/WidgetAbsoluteBoundPane.java | 8 ++-- .../designer/component/WidgetBoundPane.java | 4 +- .../layout/FRFitLayoutDefinePane.java | 20 +++++++++- .../layout/WTabFitLayoutDefinePane.java | 2 +- 13 files changed, 91 insertions(+), 33 deletions(-) create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 88244b903..ed8f4315e 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -1,12 +1,12 @@ package com.fr.design.widget.ui; -import java.awt.*; -import javax.swing.BorderFactory; import javax.swing.JPanel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.component.NumberEditorValidatePane; import com.fr.form.ui.NumberEditor; +import java.awt.BorderLayout; + public class NumberEditorDefinePane extends FieldEditorDefinePane { /** * FieldEditorDefinePane diff --git a/designer_base/src/com/fr/design/gui/ispinner/UISpinner.java b/designer_base/src/com/fr/design/gui/ispinner/UISpinner.java index 2ffd53e19..0ec3768aa 100644 --- a/designer_base/src/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer_base/src/com/fr/design/gui/ispinner/UISpinner.java @@ -262,7 +262,9 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver textField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { + textField.getDocument().removeDocumentListener(docListener); textField.setValue(value); + textField.getDocument().addDocumentListener(docListener); } }); } diff --git a/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java index 68ca5ae1e..bc2612aa6 100644 --- a/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -254,11 +254,12 @@ public class NumberEditorValidatePane extends JPanel { minValueSpinner.setEnabled(true); minValueSpinner.setValue(new Double(e.getMinValue())); } - errorMsgTextField.setText(e.getRegErrorMessage()); - if(e.getMaxValue() == Double.MAX_VALUE || e.getMinValue() == -Double.MAX_VALUE){ + if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ errorMsgTextFieldPane.setVisible(true); + errorMsgTextField.setText(e.getRegErrorMessage()); }else{ errorMsgTextFieldPane.setVisible(false); + errorMsgTextField.setText(StringUtils.EMPTY); } } diff --git a/designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java b/designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java index d8ef6f0fc..c1725e8b7 100644 --- a/designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java @@ -47,7 +47,7 @@ public class RootDesignDefinePane extends AbstractDataModify { public void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - designerWidth = new UISpinner(1, 1000, 1); + designerWidth = new UISpinner(1, Integer.MAX_VALUE, 1); JPanel advancePane = createAdvancePane(); UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); this.add(advanceExpandablePane, BorderLayout.NORTH); diff --git a/designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java index ab65dbda6..133318fe2 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java @@ -4,21 +4,22 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.CheckBox; import com.fr.general.Inter; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.Component; public class CheckBoxDefinePane extends AbstractDataModify { private UITextField text; - private UISpinner fontSizePane; + private FontSizeComboPane fontSizePane; private FormWidgetValuePane formWidgetValuePane; protected UITextField labelNameTextField; @@ -30,7 +31,7 @@ public class CheckBoxDefinePane extends AbstractDataModify { private void iniComoponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); text = new UITextField(); - fontSizePane = new UISpinner(0, 20, 1, 0); + fontSizePane = new FontSizeComboPane(); labelNameTextField = new UITextField(); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); double f = TableLayout.FILL; @@ -70,7 +71,7 @@ public class CheckBoxDefinePane extends AbstractDataModify { public CheckBox updateBean() { CheckBox box = (CheckBox)creator.toData(); box.setText(text.getText()); - box.setFontSize((int)fontSizePane.getValue()); + box.setFontSize(fontSizePane.getValue()); formWidgetValuePane.update(box); box.setLabelName(labelNameTextField.getText()); return box; diff --git a/designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index 8392ac2b6..ad47924d4 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -6,11 +6,10 @@ import com.fr.design.designer.creator.*; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.form.ui.FieldEditor; import com.fr.general.Inter; @@ -26,7 +25,7 @@ public abstract class FieldEditorDefinePane extends Abstr // richer:错误信息,是所有控件共有的属性,所以放到这里来 protected UITextField errorMsgTextField; protected JPanel validatePane; - protected UISpinner fontSizePane; + protected FontSizeComboPane fontSizePane; protected UITextField labelNameTextField; @@ -40,7 +39,7 @@ public abstract class FieldEditorDefinePane extends Abstr labelNameTextField = new UITextField(); allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - fontSizePane = new UISpinner(0, 20, 1, 0); + fontSizePane = new FontSizeComboPane(); errorMsgTextField = new UITextField(); JPanel contentPane = this.setFirstContentPane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -70,7 +69,7 @@ public abstract class FieldEditorDefinePane extends Abstr e.setAllowBlank(this.allowBlankCheckBox.isSelected()); e.setErrorMessage(this.errorMsgTextField.getText()); - e.setFontSize((int)fontSizePane.getValue()); + e.setFontSize(fontSizePane.getValue()); e.setLabelName(labelNameTextField.getText()); return e; } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java b/designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java index cf406f56e..a2819ca24 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.form.ui.MultiFileEditor; import com.fr.general.Inter; @@ -20,7 +21,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane private DictionaryComboBox acceptType; private UICheckBox singleFileCheckBox; private UISpinner fileSizeField; - private UISpinner fontSizeField; + private FontSizeComboPane fontSizeField; public MultiFileEditorPane(XCreator xCreator) { super(xCreator); @@ -39,7 +40,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1); fileSizeField.setPreferredSize(new Dimension(140, 20)); - fontSizeField = new UISpinner(0, 20, 1, 0); + fontSizeField = new FontSizeComboPane(); JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); @@ -82,7 +83,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane ob.setAccept((String) acceptType.getSelectedItem()); ob.setSingleFile(singleFileCheckBox.isSelected()); ob.setMaxSize(fileSizeField.getValue()); - ob.setFontSize((int)fontSizeField.getValue()); + ob.setFontSize(fontSizeField.getValue()); return ob; } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java new file mode 100644 index 000000000..57df97ee1 --- /dev/null +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java @@ -0,0 +1,38 @@ +package com.fr.design.widget.ui.designer.component; + +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.layout.FRGUIPaneFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.util.Vector; + +/** + * Created by kerry on 2017/10/23. + */ +public class FontSizeComboPane extends JPanel{ + private static final int MAX_FONT_SIZE = 100; + private UIComboBox comboBox; + public FontSizeComboPane(){ + initComponent(); + } + public void initComponent(){ + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + Vector integerList = new Vector(); + for (int i = 1; i < MAX_FONT_SIZE; i++) { + integerList.add(i); + } + comboBox = new UIComboBox(integerList); + comboBox.setEditable(true); + this.add(comboBox, BorderLayout.CENTER); + } + + public int getValue() { + return Integer.valueOf(comboBox.getSelectedItem().toString()); + } + + public void setValue(int fontSize) { + comboBox.setSelectedItem(fontSize); + } + + +} diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java index b33a913c4..992eb76c6 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java @@ -32,10 +32,10 @@ public class PaddingBoundPane extends BasicPane{ public void initBoundPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - top = new UISpinner(0, 1000, 1, 0); - bottom = new UISpinner(0, 1000, 1, 0); - left = new UISpinner(0, 1000, 1, 0); - right = new UISpinner(0, 1000, 1, 0); + top = new UISpinner(0, Integer.MAX_VALUE, 1, 0); + bottom = new UISpinner(0, Integer.MAX_VALUE, 1, 0); + left = new UISpinner(0, Integer.MAX_VALUE, 1, 0); + right = new UISpinner(0, Integer.MAX_VALUE, 1, 0); top.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding")); bottom.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding")); left.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding")); @@ -52,7 +52,7 @@ public class PaddingBoundPane extends BasicPane{ new Component[]{null, createRightPane(new UILabel(Inter.getLocText("FR-Designer_Left"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Right"), SwingConstants.CENTER))}, }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); this.add(panel); } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index a2e44fce7..c0d71c08a 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -21,10 +21,10 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { } public void initBoundPane() { - x = new UISpinner(0, 1200, 1); - y = new UISpinner(0, 1200, 1); - width = new UISpinner(0, 1200, 1); - height = new UISpinner(0, 1200, 1); + x = new UISpinner(0, Integer.MAX_VALUE, 1); + y = new UISpinner(0, Integer.MAX_VALUE, 1); + width = new UISpinner(0, Integer.MAX_VALUE, 1); + height = new UISpinner(0, Integer.MAX_VALUE, 1); x.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size")); y.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size")); width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size")); diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index 68feb1596..2a033227e 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -48,8 +48,8 @@ public class WidgetBoundPane extends BasicPane { } public void initBoundPane() { - width = new UISpinner(0, 1200, 1); - height = new UISpinner(0, 1200, 1); + width = new UISpinner(0, Integer.MAX_VALUE, 1); + height = new UISpinner(0, Integer.MAX_VALUE, 1); width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size")); height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size")); if (creator.acceptType(XWCardLayout.class)) { diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index eaafb9dbf..b429ff84b 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -80,7 +80,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS); adaptComboBox = initUIComboBox(FRFitConstraintsItems.ITEMS); - componentIntervel = new UISpinner(0, 100, 1, 0); + componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, 0); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p}; @@ -185,10 +185,26 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { //todo 验证下 layout.setLayoutType(WBodyLayoutType.parse(state)); layout.setCompState(adaptComboBox.getSelectedIndex()); - layout.setCompInterval((int)componentIntervel.getValue()); + + int intervelValue = (int)componentIntervel.getValue(); + if (xWFitLayout.canAddInterval(intervelValue)) { +// 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果 + setLayoutGap(intervelValue); + } + return layout; } + private void setLayoutGap(int value) { + int interval = wFitLayout.getCompInterval(); + if (value != interval) { + xWFitLayout.moveContainerMargin(); + xWFitLayout.moveCompInterval(xWFitLayout.getAcualInterval()); + wFitLayout.setCompInterval(value); + xWFitLayout.addCompInterval(xWFitLayout.getAcualInterval()); + } + } + @Override public DataCreatorUI dataUI() { return null; diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java index 8ca22dad1..85ca8ee97 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java @@ -56,7 +56,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify { } public void initLayoutComponent(){ - componentInterval = new UISpinner(0, 100, 1, 0); + componentInterval = new UISpinner(0, Integer.MAX_VALUE, 1, 0); titleField = new UITextField(); Component[][] components = new Component[][]{ new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentInterval},