diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 88244b903f..ed8f4315e0 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 2ffd53e19f..0ec3768aa5 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 68ca5ae1e9..bc2612aa67 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 d8ef6f0fc4..c1725e8b72 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 ab65dbda6f..133318fe2c 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 8392ac2b6c..ad47924d43 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 cf406f56e2..a2819ca243 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 0000000000..57df97ee12 --- /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 b33a913c4a..992eb76c67 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 a2e44fce7c..c0d71c08af 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 68feb15960..2a033227e8 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 eaafb9dbf8..b429ff84b4 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 8ca22dad1f..85ca8ee977 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},