Browse Source

Merge pull request #1187 in BA/design from ~PLOUGH/design:release/9.0 to release/9.0

* commit 'abfb808f569ce5d677717ca1565e68f03f5782fa':
  REPORT-3837 代码规范
  REPORT-3837 代码规范
  REPORT-3837 [9.0一轮回归]新建单元 格条件属性自动显示之前公式状态=>修复强转给其他地方引入的bug
master
neil 7 years ago
parent
commit
405f09bbd5
  1. 2
      designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java
  2. 34
      designer_base/src/com/fr/design/condition/LiteConditionPane.java
  3. 8
      designer_base/src/com/fr/design/condition/ObjectLiteConditionPane.java

2
designer/src/com/fr/design/dscolumn/DSColumnConditionsPane.java

@ -38,7 +38,7 @@ public class DSColumnConditionsPane extends BasicPane {
if (setting > DSColumnPane.SETTING_DSRELATED) { if (setting > DSColumnPane.SETTING_DSRELATED) {
liteConditionPane = new DSColumnLiteConditionPane() { liteConditionPane = new DSColumnLiteConditionPane() {
protected boolean needDoWithCondition(Condition liteCondition) { protected boolean isNeedDoWithCondition(Condition liteCondition) {
return liteCondition != null; return liteCondition != null;
} }
}; };

34
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.base.Formula;
import com.fr.data.DataConstants; import com.fr.data.DataConstants;
import com.fr.data.condition.*; import com.fr.data.condition.*;
import com.fr.data.core.Compare;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
@ -67,6 +66,9 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
private UIButton moveDownButton; private UIButton moveDownButton;
private UIButton bracketButton; private UIButton bracketButton;
private UIButton unBracketButton; 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() { private ActionListener actionListener1 = new ActionListener() {
@ -76,7 +78,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
String text = formulaTextArea.getText(); String text = formulaTextArea.getText();
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
formula = new Formula(""); formula = new Formula(StringUtils.EMPTY);
} else { } else {
formula = new Formula(text); formula = new Formula(text);
} }
@ -89,7 +91,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
public void doOk() { public void doOk() {
Formula formula = formulaPane.update(); Formula formula = formulaPane.update();
if (formula.getContent().length() <= 1) {// 如果没有填任何字符,则是空白文本 if (formula.getContent().length() <= 1) {// 如果没有填任何字符,则是空白文本
formulaTextArea.setText(""); formulaTextArea.setText(StringUtils.EMPTY);
} else { } else {
formulaTextArea.setText(formula.getContent().substring(1)); formulaTextArea.setText(formula.getContent().substring(1));
} }
@ -487,11 +489,11 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
UILabel conditionTypeLabel = new UILabel(Inter.getLocText("FR-Designer_Type") + ":"); UILabel conditionTypeLabel = new UILabel(Inter.getLocText("FR-Designer_Type") + ":");
conditonTypePane.add(conditionTypeLabel, BorderLayout.WEST); 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); JPanel northPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
conditonTypePane.add(northPane, BorderLayout.CENTER); 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(commonRadioButton, FlowLayout.CENTER));
northPane.add(GUICoreUtils.createFlowPane(formulaRadioButton, FlowLayout.CENTER)); northPane.add(GUICoreUtils.createFlowPane(formulaRadioButton, FlowLayout.CENTER));
commonRadioButton.addActionListener(radioActionListener); commonRadioButton.addActionListener(radioActionListener);
@ -549,14 +551,14 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
radioPane.add(andRadioButton); radioPane.add(andRadioButton);
radioPane.add(orRadioButton); 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 = new UIButton(Inter.getLocText("FR-Designer_Add"), BaseUtils.readIcon("com/fr/base/images/cell/control/add.png"));
addButton.setMnemonic('A'); addButton.setMnemonic('A');
addControlPane.add(addButton); addControlPane.add(addButton);
addButton.addActionListener(actionListener2); 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 = new UIButton(Inter.getLocText("FR-Designer_Modify"), BaseUtils.readIcon("com/fr/base/images/cell/control/rename.png"));
modifyButton.setMnemonic('M'); modifyButton.setMnemonic('M');
@ -844,7 +846,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
*/ */
@Override @Override
public void populateBean(Condition liteCondition) { public void populateBean(Condition liteCondition) {
if(liteCondition == null){ if (liteCondition == null){
return; return;
} }
// peter: 先删除所有的节点 // peter: 先删除所有的节点
@ -854,7 +856,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
rootTreeNode.removeAllChildren(); rootTreeNode.removeAllChildren();
// 清空编辑框 // 清空编辑框
defaultConditionPane.populateBean((T)new ObjectCondition(new Compare(Compare.EQUALS, StringUtils.EMPTY))); clearDefaultConditionPane();
formulaTextArea.setText(StringUtils.EMPTY); formulaTextArea.setText(StringUtils.EMPTY);
// peter:需要构建成ListCondition,加入到里面. // peter:需要构建成ListCondition,加入到里面.
@ -870,7 +872,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
for (int i = 0; i < joinConditionCount; i++) { for (int i = 0; i < joinConditionCount; i++) {
addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i));
} }
} else if (needDoWithCondition(liteCondition)) { } else if (isNeedDoWithCondition(liteCondition)) {
// peter:直接添加 // peter:直接添加
ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition));
rootTreeNode.add(newTreeNode); rootTreeNode.add(newTreeNode);
@ -892,7 +894,11 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
} }
} }
protected boolean needDoWithCondition(Condition liteCondition) { // 有需要再重写,不用做成抽象方法
protected void clearDefaultConditionPane() {
}
protected boolean isNeedDoWithCondition(Condition liteCondition) {
return true; return true;
} }
@ -931,12 +937,10 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
// peter: 如果只有一个孩子节点, 返回空的 ListCondition // peter: 如果只有一个孩子节点, 返回空的 ListCondition
if (childCount == 0) { if (childCount == 0) {
return new ListCondition(); return new ListCondition();
} // peter: 如果roottreeNode只有一个孩子节点. } else if (childCount == 1) { // peter: 如果roottreeNode只有一个孩子节点.
else if (childCount == 1) {
JoinCondition joinCondition = (JoinCondition) ((ExpandMutableTreeNode) rootTreeNode.getChildAt(0)).getUserObject(); JoinCondition joinCondition = (JoinCondition) ((ExpandMutableTreeNode) rootTreeNode.getChildAt(0)).getUserObject();
return joinCondition.getCondition(); return joinCondition.getCondition();
} // peter: 有好多的孩子节点. } else { // peter: 有好多的孩子节点.
else {
// peter:深度遍历所有的孩子节点 // peter:深度遍历所有的孩子节点
Enumeration depthEnumeration = rootTreeNode.depthFirstEnumeration(); Enumeration depthEnumeration = rootTreeNode.depthFirstEnumeration();
while (depthEnumeration.hasMoreElements()) { while (depthEnumeration.hasMoreElements()) {

8
designer_base/src/com/fr/design/condition/ObjectLiteConditionPane.java

@ -20,6 +20,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition> { public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition> {
@ -33,6 +34,11 @@ public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition>
return VariableResolver.DEFAULT; return VariableResolver.DEFAULT;
} }
@Override
protected void clearDefaultConditionPane() {
defaultConditionPane.populateBean(new ObjectCondition(new Compare(Compare.EQUALS, StringUtils.EMPTY)));
}
private class ObjectConditionPane extends BasicBeanPane<ObjectCondition> { private class ObjectConditionPane extends BasicBeanPane<ObjectCondition> {
private UIComboBox conditionOPComboBox; private UIComboBox conditionOPComboBox;
@ -68,7 +74,7 @@ public class ObjectLiteConditionPane extends LiteConditionPane<ObjectCondition>
conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPane(); conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPane();
Component[][] components = { { new UILabel(Inter.getLocText("ConditionB-Operator") + ":"), new UILabel() }, Component[][] components = { { new UILabel(Inter.getLocText("FR-Designer_ConditionB-Operator") + ":"), new UILabel() },
{ conditionOPComboBox, conditionValuePane } }; { conditionOPComboBox, conditionValuePane } };
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;

Loading…
Cancel
Save