Skip to content

Commit

Permalink
adempiere#1697 Add support to evaluate conditions from the context
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul-mz committed Jun 29, 2018
1 parent b25ddf7 commit c547c20
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion base/src/org/spin/model/FieldCondition.java
Expand Up @@ -115,7 +115,6 @@ public String get_ValueAsString (String variableName) {
* @return
*/
public boolean isValid() {
setValue(null);
if(gridFieldVO == null)
return false;
if(Evaluator.evaluateLogic(this, condition))
Expand Down
Expand Up @@ -639,8 +639,6 @@ public void dynamicDisplay(int col) {
comp.repaintComponent(true);
}
} // all components
if(renderer != null && renderer.getCurrentRow() != null)
renderer.validCondition();
}

public void repaintComponents()
Expand Down Expand Up @@ -703,4 +701,8 @@ public void setADWindowPanel(AbstractADWindowPanel winPanel) {
if (renderer != null)
renderer.setADWindowPanel(windowPanel);
}

public void updateCellStyle() {
renderer.validCondition();
}
}
Expand Up @@ -642,15 +642,15 @@ public void setADWindowPanel(AbstractADWindowPanel windowPanel) {
* Valid Condition for Change Div Style
*/
public void validCondition() {
FieldCondition condition = definition.processCondition();
FieldCondition condition = definition.getConditionValid(null);
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()) {
if(condition.isValid(null)) {
if (DisplayType.YesNo == gridField[i].getDisplayType() || DisplayType.Image == gridField[i].getDisplayType()) {
divStyle += "text-align:center; ";
}
Expand Down
Expand Up @@ -37,6 +37,7 @@
import org.adempiere.webui.apps.form.WPayment;
import org.adempiere.webui.component.AbstractADTab;
import org.adempiere.webui.component.CWindowToolbar;
import org.adempiere.webui.component.GridPanel;
import org.adempiere.webui.component.IADTab;
import org.adempiere.webui.component.IADTabList;
import org.adempiere.webui.component.Window;
Expand Down Expand Up @@ -1656,6 +1657,9 @@ private boolean onSave(boolean onSaveEvent)
//curTabPanel.afterSave(onSaveEvent);
toolbar.getCurrentPanel().dynamicDisplay(0);
toolbar.getCurrentPanel().afterSave(onSaveEvent);
GridPanel gridPanel = toolbar.getCurrentPanel().getListPanel();
if(gridPanel != null)
gridPanel.updateCellStyle();

if (wasChanged) {
addToRecentItems();
Expand Down

0 comments on commit c547c20

Please sign in to comment.