From 8144245ac9b838e8a498469ec005c20733406921 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 6 Sep 2017 11:46:49 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3837=20=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dscolumn/DSColumnConditionsPane.java | 2 +- .../design/condition/LiteConditionPane.java | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java b/designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java index 228e88ae4..88e807e92 100644 --- a/designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java +++ b/designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java @@ -38,7 +38,7 @@ public class DSColumnConditionsPane extends BasicPane { if (setting > DSColumnPane.SETTING_DSRELATED) { liteConditionPane = new DSColumnLiteConditionPane() { - protected boolean needDoWithCondition(Condition liteCondition) { + protected boolean isNeedDoWithCondition(Condition liteCondition) { return liteCondition != null; } }; diff --git a/designer_base/src/com/fr/design/condition/LiteConditionPane.java b/designer_base/src/com/fr/design/condition/LiteConditionPane.java index 674bd7d39..815699a76 100644 --- a/designer_base/src/com/fr/design/condition/LiteConditionPane.java +++ b/designer_base/src/com/fr/design/condition/LiteConditionPane.java @@ -4,7 +4,6 @@ import com.fr.base.BaseUtils; import com.fr.base.Formula; import com.fr.data.DataConstants; import com.fr.data.condition.*; -import com.fr.data.core.Compare; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.formula.FormulaFactory; @@ -67,6 +66,9 @@ public abstract class LiteConditionPane extends BasicBeanPa private UIButton moveDownButton; private UIButton bracketButton; private UIButton unBracketButton; + private static final int DOWN_PADDING = 4; + private static final int STRUT_ONE = 35; + private static final int STRUT_TWO = 4; private ActionListener actionListener1 = new ActionListener() { @@ -76,7 +78,7 @@ public abstract class LiteConditionPane extends BasicBeanPa String text = formulaTextArea.getText(); if (text == null || text.length() <= 0) { - formula = new Formula(""); + formula = new Formula(StringUtils.EMPTY); } else { formula = new Formula(text); } @@ -89,7 +91,7 @@ public abstract class LiteConditionPane extends BasicBeanPa public void doOk() { Formula formula = formulaPane.update(); if (formula.getContent().length() <= 1) {// 如果没有填任何字符,则是空白文本 - formulaTextArea.setText(""); + formulaTextArea.setText(StringUtils.EMPTY); } else { formulaTextArea.setText(formula.getContent().substring(1)); } @@ -487,11 +489,11 @@ public abstract class LiteConditionPane extends BasicBeanPa UILabel conditionTypeLabel = new UILabel(Inter.getLocText("FR-Designer_Type") + ":"); conditonTypePane.add(conditionTypeLabel, BorderLayout.WEST); - conditionTypeLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); + conditionTypeLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, DOWN_PADDING, 0)); JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); conditonTypePane.add(northPane, BorderLayout.CENTER); - northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, DOWN_PADDING, 0)); northPane.add(GUICoreUtils.createFlowPane(commonRadioButton, FlowLayout.CENTER)); northPane.add(GUICoreUtils.createFlowPane(formulaRadioButton, FlowLayout.CENTER)); commonRadioButton.addActionListener(radioActionListener); @@ -549,14 +551,14 @@ public abstract class LiteConditionPane extends BasicBeanPa radioPane.add(andRadioButton); radioPane.add(orRadioButton); - addControlPane.add(Box.createHorizontalStrut(35)); + addControlPane.add(Box.createHorizontalStrut(STRUT_ONE)); addButton = new UIButton(Inter.getLocText("FR-Designer_Add"), BaseUtils.readIcon("com/fr/base/images/cell/control/add.png")); addButton.setMnemonic('A'); addControlPane.add(addButton); addButton.addActionListener(actionListener2); - addControlPane.add(Box.createHorizontalStrut(4)); + addControlPane.add(Box.createHorizontalStrut(STRUT_TWO)); modifyButton = new UIButton(Inter.getLocText("FR-Designer_Modify"), BaseUtils.readIcon("com/fr/base/images/cell/control/rename.png")); modifyButton.setMnemonic('M'); @@ -844,7 +846,7 @@ public abstract class LiteConditionPane extends BasicBeanPa */ @Override public void populateBean(Condition liteCondition) { - if(liteCondition == null){ + if (liteCondition == null){ return; } // peter: 先删除所有的节点 @@ -870,7 +872,7 @@ public abstract class LiteConditionPane extends BasicBeanPa for (int i = 0; i < joinConditionCount; i++) { addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); } - } else if (needDoWithCondition(liteCondition)) { + } else if (isNeedDoWithCondition(liteCondition)) { // peter:直接添加 ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); rootTreeNode.add(newTreeNode); @@ -896,7 +898,7 @@ public abstract class LiteConditionPane extends BasicBeanPa protected void clearDefaultConditionPane() { } - protected boolean needDoWithCondition(Condition liteCondition) { + protected boolean isNeedDoWithCondition(Condition liteCondition) { return true; } @@ -935,12 +937,10 @@ public abstract class LiteConditionPane extends BasicBeanPa // peter: 如果只有一个孩子节点, 返回空的 ListCondition if (childCount == 0) { return new ListCondition(); - } // peter: 如果roottreeNode只有一个孩子节点. - else if (childCount == 1) { + } else if (childCount == 1) { // peter: 如果roottreeNode只有一个孩子节点. JoinCondition joinCondition = (JoinCondition) ((ExpandMutableTreeNode) rootTreeNode.getChildAt(0)).getUserObject(); return joinCondition.getCondition(); - } // peter: 有好多的孩子节点. - else { + } else { // peter: 有好多的孩子节点. // peter:深度遍历所有的孩子节点 Enumeration depthEnumeration = rootTreeNode.depthFirstEnumeration(); while (depthEnumeration.hasMoreElements()) {