Browse Source

Merge pull request #1383 in BA/design from ~KERRY/design:release/9.0 to release/9.0

* commit '16c29f138d37c8a43516b7f68effbf4e32ea0766':
  REPORT-5137 [9.0二轮回归]表单布局组件间隔只能输入最多2位数和字体大小控件样式修改
master
superman 7 years ago
parent
commit
0177007afc
  1. 4
      designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java
  2. 2
      designer_base/src/com/fr/design/gui/ispinner/UISpinner.java
  3. 5
      designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java
  4. 2
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  5. 13
      designer_form/src/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  6. 9
      designer_form/src/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  7. 7
      designer_form/src/com/fr/design/widget/ui/designer/MultiFileEditorPane.java
  8. 38
      designer_form/src/com/fr/design/widget/ui/designer/component/FontSizeComboPane.java
  9. 10
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  10. 8
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  11. 4
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  12. 20
      designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  13. 2
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

4
designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java

@ -1,12 +1,12 @@
package com.fr.design.widget.ui; package com.fr.design.widget.ui;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.component.NumberEditorValidatePane; import com.fr.design.widget.component.NumberEditorValidatePane;
import com.fr.form.ui.NumberEditor; import com.fr.form.ui.NumberEditor;
import java.awt.BorderLayout;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> { public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
/** /**
* FieldEditorDefinePane * FieldEditorDefinePane

2
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() { textField.addFocusListener(new FocusAdapter() {
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
textField.getDocument().removeDocumentListener(docListener);
textField.setValue(value); textField.setValue(value);
textField.getDocument().addDocumentListener(docListener);
} }
}); });
} }

5
designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -254,11 +254,12 @@ public class NumberEditorValidatePane extends JPanel {
minValueSpinner.setEnabled(true); minValueSpinner.setEnabled(true);
minValueSpinner.setValue(new Double(e.getMinValue())); minValueSpinner.setValue(new Double(e.getMinValue()));
} }
errorMsgTextField.setText(e.getRegErrorMessage()); if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){
if(e.getMaxValue() == Double.MAX_VALUE || e.getMinValue() == -Double.MAX_VALUE){
errorMsgTextFieldPane.setVisible(true); errorMsgTextFieldPane.setVisible(true);
errorMsgTextField.setText(e.getRegErrorMessage());
}else{ }else{
errorMsgTextFieldPane.setVisible(false); errorMsgTextFieldPane.setVisible(false);
errorMsgTextField.setText(StringUtils.EMPTY);
} }
} }

2
designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java

@ -47,7 +47,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
public void initComponent() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
designerWidth = new UISpinner(1, 1000, 1); designerWidth = new UISpinner(1, Integer.MAX_VALUE, 1);
JPanel advancePane = createAdvancePane(); JPanel advancePane = createAdvancePane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH); this.add(advanceExpandablePane, BorderLayout.NORTH);

13
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.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel; 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.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; 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.FontSizeComboPane;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBox;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.Component;
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text; private UITextField text;
private UISpinner fontSizePane; private FontSizeComboPane fontSizePane;
private FormWidgetValuePane formWidgetValuePane; private FormWidgetValuePane formWidgetValuePane;
protected UITextField labelNameTextField; protected UITextField labelNameTextField;
@ -30,7 +31,7 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private void iniComoponents() { private void iniComoponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
text = new UITextField(); text = new UITextField();
fontSizePane = new UISpinner(0, 20, 1, 0); fontSizePane = new FontSizeComboPane();
labelNameTextField = new UITextField(); labelNameTextField = new UITextField();
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -70,7 +71,7 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
public CheckBox updateBean() { public CheckBox updateBean() {
CheckBox box = (CheckBox)creator.toData(); CheckBox box = (CheckBox)creator.toData();
box.setText(text.getText()); box.setText(text.getText());
box.setFontSize((int)fontSizePane.getValue()); box.setFontSize(fontSizePane.getValue());
formWidgetValuePane.update(box); formWidgetValuePane.update(box);
box.setLabelName(labelNameTextField.getText()); box.setLabelName(labelNameTextField.getText());
return box; return box;

9
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.foldablepane.UIExpandablePane;
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.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
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.FontSizeComboPane;
import com.fr.form.ui.FieldEditor; import com.fr.form.ui.FieldEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -26,7 +25,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
// richer:错误信息,是所有控件共有的属性,所以放到这里来 // richer:错误信息,是所有控件共有的属性,所以放到这里来
protected UITextField errorMsgTextField; protected UITextField errorMsgTextField;
protected JPanel validatePane; protected JPanel validatePane;
protected UISpinner fontSizePane; protected FontSizeComboPane fontSizePane;
protected UITextField labelNameTextField; protected UITextField labelNameTextField;
@ -40,7 +39,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
labelNameTextField = new UITextField(); labelNameTextField = new UITextField();
allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null"));
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fontSizePane = new UISpinner(0, 20, 1, 0); fontSizePane = new FontSizeComboPane();
errorMsgTextField = new UITextField(); errorMsgTextField = new UITextField();
JPanel contentPane = this.setFirstContentPane(); JPanel contentPane = this.setFirstContentPane();
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -70,7 +69,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); e.setAllowBlank(this.allowBlankCheckBox.isSelected());
e.setErrorMessage(this.errorMsgTextField.getText()); e.setErrorMessage(this.errorMsgTextField.getText());
e.setFontSize((int)fontSizePane.getValue()); e.setFontSize(fontSizePane.getValue());
e.setLabelName(labelNameTextField.getText()); e.setLabelName(labelNameTextField.getText());
return e; return e;
} }

7
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.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; 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.FontSizeComboPane;
import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.MultiFileEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -20,7 +21,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
private DictionaryComboBox acceptType; private DictionaryComboBox acceptType;
private UICheckBox singleFileCheckBox; private UICheckBox singleFileCheckBox;
private UISpinner fileSizeField; private UISpinner fileSizeField;
private UISpinner fontSizeField; private FontSizeComboPane fontSizeField;
public MultiFileEditorPane(XCreator xCreator) { public MultiFileEditorPane(XCreator xCreator) {
super(xCreator); super(xCreator);
@ -39,7 +40,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1); fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1);
fileSizeField.setPreferredSize(new Dimension(140, 20)); fileSizeField.setPreferredSize(new Dimension(140, 20));
fontSizeField = new UISpinner(0, 20, 1, 0); fontSizeField = new FontSizeComboPane();
JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
@ -82,7 +83,7 @@ public class MultiFileEditorPane extends FieldEditorDefinePane<MultiFileEditor>
ob.setAccept((String) acceptType.getSelectedItem()); ob.setAccept((String) acceptType.getSelectedItem());
ob.setSingleFile(singleFileCheckBox.isSelected()); ob.setSingleFile(singleFileCheckBox.isSelected());
ob.setMaxSize(fileSizeField.getValue()); ob.setMaxSize(fileSizeField.getValue());
ob.setFontSize((int)fontSizeField.getValue()); ob.setFontSize(fontSizeField.getValue());
return ob; return ob;
} }

38
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<Integer> integerList = new Vector<Integer>();
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);
}
}

10
designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java

@ -32,10 +32,10 @@ public class PaddingBoundPane extends BasicPane{
public void initBoundPane() { public void initBoundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
top = new UISpinner(0, 1000, 1, 0); top = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
bottom = new UISpinner(0, 1000, 1, 0); bottom = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
left = new UISpinner(0, 1000, 1, 0); left = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
right = new UISpinner(0, 1000, 1, 0); right = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
top.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding")); top.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
bottom.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding")); bottom.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
left.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))}, 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); 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); this.add(panel);
} }

8
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -21,10 +21,10 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
} }
public void initBoundPane() { public void initBoundPane() {
x = new UISpinner(0, 1200, 1); x = new UISpinner(0, Integer.MAX_VALUE, 1);
y = new UISpinner(0, 1200, 1); y = new UISpinner(0, Integer.MAX_VALUE, 1);
width = new UISpinner(0, 1200, 1); width = new UISpinner(0, Integer.MAX_VALUE, 1);
height = new UISpinner(0, 1200, 1); height = new UISpinner(0, Integer.MAX_VALUE, 1);
x.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size")); x.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
y.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")); width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));

4
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -48,8 +48,8 @@ public class WidgetBoundPane extends BasicPane {
} }
public void initBoundPane() { public void initBoundPane() {
width = new UISpinner(0, 1200, 1); width = new UISpinner(0, Integer.MAX_VALUE, 1);
height = new UISpinner(0, 1200, 1); height = new UISpinner(0, Integer.MAX_VALUE, 1);
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size")); width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size")); height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
if (creator.acceptType(XWCardLayout.class)) { if (creator.acceptType(XWCardLayout.class)) {

20
designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -80,7 +80,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS); layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS);
adaptComboBox = initUIComboBox(FRFitConstraintsItems.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 f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p}; double[] rowSize = {p, p};
@ -185,10 +185,26 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
//todo 验证下 //todo 验证下
layout.setLayoutType(WBodyLayoutType.parse(state)); layout.setLayoutType(WBodyLayoutType.parse(state));
layout.setCompState(adaptComboBox.getSelectedIndex()); layout.setCompState(adaptComboBox.getSelectedIndex());
layout.setCompInterval((int)componentIntervel.getValue());
int intervelValue = (int)componentIntervel.getValue();
if (xWFitLayout.canAddInterval(intervelValue)) {
// 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果
setLayoutGap(intervelValue);
}
return layout; 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 @Override
public DataCreatorUI dataUI() { public DataCreatorUI dataUI() {
return null; return null;

2
designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

@ -56,7 +56,7 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
} }
public void initLayoutComponent(){ public void initLayoutComponent(){
componentInterval = new UISpinner(0, 100, 1, 0); componentInterval = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
titleField = new UITextField(); titleField = new UITextField();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentInterval}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Component_Interval")), componentInterval},

Loading…
Cancel
Save