Skip to content

Commit

Permalink
adempiere#1697, Add improvements for source code, reference to issue:
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Oct 4, 2018
1 parent 5c8dbaa commit f06db7b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
4 changes: 4 additions & 0 deletions base/src/org/spin/util/FieldCondition.java
Expand Up @@ -141,4 +141,8 @@ public boolean isValid(HashMap<String, Object> value) {
return false;
}

@Override
public String toString() {
return "FieldCondition [styleSheet=" + styleSheet + ", condition=" + condition + "]";
}
}
Expand Up @@ -397,11 +397,14 @@ else if (DisplayType.isNumeric(gridField[i].getDisplayType())) {
}

// FR [ 1697 ]
definition = FieldDefinition.getInstance(gridField[i].getVO());
FieldCondition condition = definition.getConditionValid(columnValues);
div.setStyle(divStyle);
if(condition != null && condition.isValid()) {
div.setStyle(divStyle+condition.getStyleSheet());
// Validate field condition
if(gridField[i].getAD_FieldDefinition_ID() > 0) {
definition = FieldDefinition.getInstance(gridField[i].getVO());
FieldCondition condition = definition.getConditionValid(columnValues);
div.setStyle(divStyle);
if(condition != null && condition.isValid()) {
div.setStyle(divStyle + condition.getStyleSheet());
}
}

div.setReadOnly(!gridField[i].isEditable(true));
Expand Down Expand Up @@ -688,39 +691,38 @@ public void setADWindowPanel(AbstractADWindowPanel windowPanel) {
* Valid Condition for Change Div Style
*/
public void validCondition() {
if(definition == null)
return;
FieldCondition condition = definition.getConditionValid(null);
if(condition == null)
return;

Row currentRow = getCurrentRow();

String divStyle = DIVSTYLE;
GridField[] gridField = gridTab.getFields();

for(int i=0; i < gridField.length; i++) {
if(gridField[i].getAD_FieldDefinition_ID() != 0) {
if(condition.isValid(null)) {
if (DisplayType.YesNo == gridField[i].getDisplayType() || DisplayType.Image == gridField[i].getDisplayType()) {
divStyle += "text-align:center; ";
}
else if (DisplayType.isNumeric(gridField[i].getDisplayType())) {
divStyle += "text-align:right; ";
}
List divList = currentRow.getChildren();
for(int j=0; j< divList.size(); j++ ) {
if(divList.get(j) instanceof Div) {
Div div = (Div)divList.get(j);
if(div.getAttribute("columnName").equals(gridField[i].getColumnName())) {
div.setStyle(divStyle+condition.getStyleSheet());
div.invalidate();
}
}
if(definition == null)
return;
FieldCondition condition = definition.getConditionValid(null);
if(condition == null)
return;

Row currentRow = getCurrentRow();

String divStyle = DIVSTYLE;
GridField[] gridField = gridTab.getFields();
// Iterate it
for(int i=0; i < gridField.length; i++) {
if(gridField[i].getAD_FieldDefinition_ID() != 0) {
if(condition.isValid(null)) {
if (DisplayType.YesNo == gridField[i].getDisplayType() || DisplayType.Image == gridField[i].getDisplayType()) {
divStyle += "text-align:center; ";
} else if (DisplayType.isNumeric(gridField[i].getDisplayType())) {
divStyle += "text-align:right; ";
}
List<?> divList = currentRow.getChildren();
for(int j=0; j< divList.size(); j++ ) {
if(divList.get(j) instanceof Div) {
Div div = (Div)divList.get(j);
if(div.getAttribute("columnName").equals(gridField[i].getColumnName())) {
div.setStyle(divStyle + condition.getStyleSheet());
div.invalidate();
}
}
}
}
}
}
}

/**
Expand Down

0 comments on commit f06db7b

Please sign in to comment.