diff --git a/designer/src/com/fr/design/widget/ui/ParameterTreeComboBox.java b/designer/src/com/fr/design/widget/ui/ParameterTreeComboBox.java index b6806a992..4bbdc301f 100644 --- a/designer/src/com/fr/design/widget/ui/ParameterTreeComboBox.java +++ b/designer/src/com/fr/design/widget/ui/ParameterTreeComboBox.java @@ -15,6 +15,7 @@ import com.fr.general.Inter; import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; @@ -76,7 +77,8 @@ public class ParameterTreeComboBox extends FRTreeComboBox { if (obj instanceof TreePath) { return ((Parameter)((ExpandMutableTreeNode)((TreePath)obj).getLastPathComponent()).getUserObject()).getName(); } - return (String)obj; + Object item = this.getEditor().getItem(); + return item == null ? StringUtils.EMPTY : item.toString(); } @Override diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index edbfda3cb..da5090740 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -951,7 +951,7 @@ zeroMarginWarn=\u7531\u4E8E\u6253\u5370\u673A\u5B58\u5728\u7269\u7406\u8FB9\u8DD Widget-Date_Selector_Return_Type=\u8FD4\u56DE\u503C\u7C7B\u578B Utils-Switch_To_Template_Reportlet=\u5207\u6362\u5230\u6A21\u677F\u7F51\u7EDC\u62A5\u8868 satisfy=\u6EE1\u8DB3\u6761\u4EF6 -FR-Designer_WidgetDisplyPosition=\u63A7\u4EF6\u663E\u793A\u4F4D\u7F6E +FR-Designer_WidgetDisplyPosition=\u663E\u793A\u4F4D\u7F6E FR-Base_Top=\u4E0A FR-Designer_Form-CheckBox=\u590D\u9009\u6846 Reportlet-Parameter_Type=\u53C2\u6570\u4F20\u9012\u65B9\u5F0F diff --git a/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java b/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java index d79c489e7..594b11e90 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleIconEditor.java @@ -27,11 +27,6 @@ public class AccessibleIconEditor extends UneditableAccessibleEditor { return new RendererField(new IconCellRenderer()); } - protected void setBorderVisible(){ - this.setBorder(BorderFactory.createLineBorder(Color.lightGray)); - } - - @Override protected void showEditorPane() { if (customIconPane == null) { diff --git a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java index 10840d300..c71cd8ad1 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java @@ -1,9 +1,6 @@ package com.fr.design.mainframe.widget.accessibles; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Insets; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -45,11 +42,9 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor this.decoder = dec; initComponents(); txtValue.setEditable(dec != null); - setBorderVisible(); - } - - protected void setBorderVisible(){ - ((JComponent) txtValue).setBorder(null); + ((JComponent) txtValue).setOpaque(true); + ((JComponent) txtValue).setBorder(BorderFactory.createLineBorder(Color.lightGray)); + ((JComponent) txtValue).setBackground(Color.WHITE); } @Override diff --git a/designer_base/src/com/fr/design/widget/component/DateValuePane.java b/designer_base/src/com/fr/design/widget/component/DateValuePane.java index 6ea7d056e..b6f59ec6e 100644 --- a/designer_base/src/com/fr/design/widget/component/DateValuePane.java +++ b/designer_base/src/com/fr/design/widget/component/DateValuePane.java @@ -1,11 +1,12 @@ package com.fr.design.widget.component; +import com.fr.base.Formula; import com.fr.design.constants.LayoutConstants; import com.fr.design.editor.editor.*; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; - +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -17,13 +18,16 @@ import java.awt.*; public class DateValuePane extends JPanel { private UIButtonGroup widgetValueHead; private Editor[] editor; + private static final String NONE_EDITOR_NAME = Inter.getLocText("None"); + private static final String DATE_EDITOR_NAME = Inter.getLocText("Date"); + private static final String FORMULA_EDITOR_NAME = Inter.getLocText("Parameter-Formula"); public DateValuePane() { editor = new Editor[]{ - new NoneEditor(null, Inter.getLocText("None")), - new DateEditor(true, Inter.getLocText("Date")), - new FormulaEditor(Inter.getLocText("Parameter-Formula")) + new NoneEditor(null, NONE_EDITOR_NAME), + new DateEditor(true, DATE_EDITOR_NAME), + new FormulaEditor(FORMULA_EDITOR_NAME) }; this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL)); final CardLayout cardLayout = new CardLayout(); @@ -56,6 +60,9 @@ public class DateValuePane extends JPanel { int index = widgetValueHead.getSelectedIndex(); Editor e = editor[index]; Object value = e.getValue(); + if(value == null && ComparatorUtils.equals(FORMULA_EDITOR_NAME, e.getName())){ + value = new Formula(StringUtils.EMPTY); + } return value; } 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 63b297925..68ca5ae1e 100644 --- a/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -1,7 +1,6 @@ package com.fr.design.widget.component; import com.fr.design.designer.IntervalConstants; -import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; @@ -12,6 +11,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NumberEditor; import com.fr.general.Inter; +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -35,10 +35,8 @@ public class NumberEditorValidatePane extends JPanel { private SpinnerNumberModel minValueModel; private UISpinner decimalLength; private JPanel limitNumberPane; - private UITextField maxValueErrorTextField; - private UITextField minValueErrorTextField; - private JPanel maxValueFieldPane; - private JPanel minValueFieldPane; + private UITextField errorMsgTextField; + private JPanel errorMsgTextFieldPane; private ActionListener allowDecimalsListener; @@ -79,13 +77,10 @@ public class NumberEditorValidatePane extends JPanel { this.setMinValueCheckBox.addActionListener(setMinListener); this.minValueSpinner.addChangeListener(minValueChangeListener); setMinValueCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - initMaxMinValueFieldPane(); - JPanel maxValueBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - maxValueBorderPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0)); - maxValueBorderPane.add(maxValueFieldPane, BorderLayout.CENTER); - JPanel minValueBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - minValueBorderPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, IntervalConstants.INTERVAL_L1, 0)); - minValueBorderPane.add(minValueFieldPane, BorderLayout.CENTER); + initErrorMsgPane(); + JPanel errorMsgBorderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + errorMsgBorderPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, IntervalConstants.INTERVAL_L1, 0)); + errorMsgBorderPane.add(errorMsgTextFieldPane, BorderLayout.CENTER); UILabel numberLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Double", "Numbers"})); limitNumberPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{numberLabel, decimalLength}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); limitNumberPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L5, 0, 0)); @@ -96,37 +91,20 @@ public class NumberEditorValidatePane extends JPanel { new Component[]{limitNumberPane, null}, new Component[]{allowNegativeCheckBox, null}, new Component[]{setMaxValueCheckBox, maxValueSpinner}, - new Component[]{maxValueBorderPane, null}, new Component[]{setMinValueCheckBox, minValueSpinner}, - new Component[]{minValueBorderPane, null}, + new Component[]{errorMsgBorderPane, null}, }; - double[] rowSize = {p, p, p, p, p, p, p}; + double[] rowSize = {p, p, p, p, p, p}; double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); this.add(panel); } - private void initMaxMinValueFieldPane() { - maxValueErrorTextField = new UITextField(); - minValueErrorTextField = new UITextField(); - - maxValueFieldPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), maxValueErrorTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); - setMaxValueCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - maxValueFieldPane.setVisible(setMaxValueCheckBox.isSelected()); - } - }); - - minValueFieldPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), minValueErrorTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); - setMinValueCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - minValueFieldPane.setVisible(setMinValueCheckBox.isSelected()); - } - }); - + private void initErrorMsgPane() { + errorMsgTextField = new UITextField(); + errorMsgTextFieldPane = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); } @@ -257,28 +235,31 @@ public class NumberEditorValidatePane extends JPanel { allowNegativeCheckBox.setSelected(e.isAllowNegative()); if (e.getMaxValue() == Double.MAX_VALUE) { setMaxValueCheckBox.setSelected(false); - maxValueFieldPane.setVisible(false); +// maxValueFieldPane.setVisible(false); maxValueSpinner.setValue(new Double(Double.MAX_VALUE)); maxValueSpinner.setEnabled(false); } else { setMaxValueCheckBox.setSelected(true); maxValueSpinner.setEnabled(true); - maxValueFieldPane.setVisible(true); maxValueSpinner.setValue(new Double(e.getMaxValue())); } if (e.getMinValue() == -Double.MAX_VALUE) { setMinValueCheckBox.setSelected(false); - minValueFieldPane.setVisible(false); minValueSpinner.setValue(new Double(-Double.MAX_VALUE)); minValueSpinner.setEnabled(false); } else { setMinValueCheckBox.setSelected(true); - minValueFieldPane.setVisible(true); minValueSpinner.setEnabled(true); minValueSpinner.setValue(new Double(e.getMinValue())); } + errorMsgTextField.setText(e.getRegErrorMessage()); + if(e.getMaxValue() == Double.MAX_VALUE || e.getMinValue() == -Double.MAX_VALUE){ + errorMsgTextFieldPane.setVisible(true); + }else{ + errorMsgTextFieldPane.setVisible(false); + } } public void update(NumberEditor ob) { @@ -289,15 +270,22 @@ public class NumberEditorValidatePane extends JPanel { ob.setAllowNegative(allowNegativeCheckBox.isSelected()); if (setMaxValueCheckBox.isSelected()) { - ob.setMaxValue(Double.parseDouble("" + maxValueSpinner.getValue())); + ob.setMaxValue(Double.parseDouble(StringUtils.EMPTY + maxValueSpinner.getValue())); } else { ob.setMaxValue(Double.MAX_VALUE); } if (setMinValueCheckBox.isSelected()) { - ob.setMinValue(Double.parseDouble("" + minValueSpinner.getValue())); + ob.setMinValue(Double.parseDouble(StringUtils.EMPTY + minValueSpinner.getValue())); } else { ob.setMinValue(-Double.MAX_VALUE); } + if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ + errorMsgTextFieldPane.setVisible(true); + }else{ + errorMsgTextFieldPane.setVisible(false); + errorMsgTextField.setText(StringUtils.EMPTY); + } + ob.setRegErrorMessage(errorMsgTextField.getText()); } } diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java index c2345cd83..8ec7cc417 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleWLayoutBorderStyleEditor.java @@ -27,10 +27,6 @@ public class AccessibleWLayoutBorderStyleEditor extends UneditableAccessibleEdit return new RendererField(new LayoutBorderStyleRenderer()); } - protected void setBorderVisible(){ - this.setBorder(BorderFactory.createLineBorder(Color.lightGray)); - } - @Override protected void showEditorPane() { if (borderPane == null) { diff --git a/designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java index cb988f24f..30d703aee 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java @@ -82,7 +82,7 @@ public class LabelDefinePane extends AbstractDataModify