Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sundayAdu committed Mar 2, 2023
1 parent a6249ee commit 297c117
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public static Object getExpressionValue(ExpressionParser expressionParser, List<
throw new EmptyStackException();
}
} else{
System.out.println("EmptyStackException: NEW >>>>>>-");

throw new SpelEvaluationException(SpelMessage.NOT_A_REAL);
}
return expression.getValue(context, valueType);
Expand All @@ -257,27 +257,39 @@ public static void handleDependingOn(
if (dependingOnValues != null) {
constraints = (List) Arrays.stream(dependingOnValues).collect(Collectors.toList());
ListIterator<String> lstItemsx = constraints.listIterator();
while (lstItemsx.hasNext()) {
if (lstItemsx.hasNext()) {
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@1111>>>>>>>> "+lstItemsx);

depenValuexd = lstItemsx.next().toString();
}
}

System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@22222>>>>>>>> "+depenValuexd);

final String depenValuex = depenValuexd;

if (dependingOn != null && depenValuex != null) {
ControlPropertyField controlPropertyField = fieldMap.get(dependingOn);
setVisibilityDependency(dynamicField, depenValuex, controlPropertyField.getValue());
final ControlPropertyField finalDynamicField = dynamicField;
controlPropertyField.addValueChangedListener(field -> setVisibilityDependency(finalDynamicField, depenValuex, field.getValue()));
controlPropertyField.addValueChangedListener(field -> {
final String manVal = depenValuex;
setVisibilityDependency(finalDynamicField, manVal, field.getValue());
});
};
}
}


public static void setVisibilityDependency(ControlPropertyField field, String dependingOnValues, Object dependingOnFieldValue) {
System.out.println(dependingOnValues+ " = static @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@22>>>>>>>> dynamic = "+dependingOnFieldValue);

String parsedDependingOnFieldValue = dependingOnFieldValue == null
? ""
: dependingOnFieldValue instanceof Boolean
? YesNoUnknown.valueOf(((Boolean) dependingOnFieldValue).booleanValue()).name()
: dependingOnFieldValue.toString();


if (dependingOnValues.contains("!")) {

dependingOnValues = dependingOnValues.replace("!", "");
Expand All @@ -288,11 +300,15 @@ public static void setVisibilityDependency(ControlPropertyField field, String de
field.setVisibility(View.VISIBLE);
}
} else {
if (dependingOnValues.equalsIgnoreCase(parsedDependingOnFieldValue)) {
System.out.println(parsedDependingOnFieldValue+ " VISIBLE @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@22>>>>>>>> "+dependingOnFieldValue);

field.setVisibility(View.VISIBLE);

if (dependingOnValues.contains(parsedDependingOnFieldValue)) {
field.setVisibility(View.GONE);
} else {
field.setVisibility(View.VISIBLE);
System.out.println(parsedDependingOnFieldValue+ " GONE "+field.getCaption()+" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@22>>>>>>>> "+dependingOnFieldValue);

field.setVisibility(View.GONE);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,10 +884,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
}

});

Object defaultValue = campaignFormElement.getDefaultvalue();
formValues.add(new CampaignFormDataEntry(campaignFormElement.getId(), defaultValue == null ? null : defaultValue));
dynamicField.setValue(defaultValue == null ? null : defaultValue);
final String dependingOn = campaignFormElement.getDependingOn();

if (dependingOn != null) {
handleDependingOn(fieldMap, campaignFormElement, dynamicField);
}
Expand Down Expand Up @@ -951,12 +953,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
Boolean isdependingOn = false;
if (dependingOn != null) {
isdependingOn = true;
System.out.println(">>>>>>>>>>>>>>>>> is depending on on? >>> TRUE");
}

Boolean finalIsdependingOn = isdependingOn;
dynamicField.addValueChangedListener(field -> {
final Boolean isRangeandExpressionx = finalIsRangeandExpression;
System.out.println(">>>>>>>>>>>>>>>>>finalIsdependingOn>>>>>>> "+finalIsdependingOn);
System.out.println(isRangeandExpressionx+">>>>>>>>>>>>>>>>>finalIsdependingOn>>>>>>> "+finalIsdependingOn);

Boolean okk = field.getFocusedChild() != null ? true : false;
final CampaignFormDataEntry campaignFormDataEntry = CampaignFormDataFragmentUtils.getOrCreateCampaignFormDataEntry(formValues, campaignFormElement);
Expand All @@ -972,12 +975,14 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
}
expressionMap.forEach((formElement, controlPropertyField) ->
CampaignFormDataFragmentUtils.handleExpressionSec(expressionParser, formValues, CampaignFormElementType.fromString(formElement.getType()), controlPropertyField, formElement.getExpression(), ignoreDisable, field.getValue()));
} else if (field.isFocused()){
System.out.println(">>>>>>>>>>>>>>>>>ONFOCUSSS>>>>>>>>>>>>>>>>>>>>" +fieldMap.get(campaignFormElement.getId()).getCaption());

}
// else if (field.isFocused()){
// System.out.println(">>>>>>>>>>>>>>>>>ONFOCUSSS>>>>>>>>>>>>>>>>>>>>" +fieldMap.get(campaignFormElement.getId()).getCaption());
//
// }

if(finalIsdependingOn){
if(finalIsdependingOn && isRangeandExpressionx){
System.out.println(finalIsdependingOn+" >>>>>>>>>>>>>>>> " + isRangeandExpressionx);
field.setVisibility(View.GONE);
}

Expand All @@ -993,8 +998,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

if (dependingOn != null && finalIsRangeandExpression) {

// handleDependingOn(fieldMap, campaignFormElement, dynamicField);
System.out.println(">>>>>>>>>>>>>>> "+finalIsRangeandExpression);

dynamicField.hideFieldOnly();

} else if (dependingOn != null) {
Expand Down

0 comments on commit 297c117

Please sign in to comment.