Skip to content

Commit

Permalink
#175 changes symptoms "set all to no" to "set cleared to no"
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Wahnschaffe committed Apr 5, 2017
1 parent 2a77365 commit fff97c5
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public class SymptomsForm extends AbstractEditForm<SymptomsDto> {
+ LayoutUtil.h3(CssStyles.VSPACE3, "Recent symptoms")
+ LayoutUtil.divCss(CssStyles.VSPACE3,
LayoutUtil.fluidRowLocs(SymptomsDto.ONSET_DATE, SymptomsDto.ONSET_SYMPTOM))
+ LayoutUtil.fluidRow(
LayoutUtil.fluidColumn(9, 0,
+ LayoutUtil.fluidRowCss(CssStyles.VSPACE3,
LayoutUtil.fluidColumn(8, 0,
LayoutUtil.div(I18nProperties.getFieldCaption("Symptoms.hint"))),
LayoutUtil.fluidColumn(3, 0,
LayoutUtil.locCss(CssStyles.VSPACE3, BUTTONS_LOC)))
LayoutUtil.fluidColumn(4, 0,
LayoutUtil.locCss(CssStyles.ALIGN_RIGHT, BUTTONS_LOC)))
+ LayoutUtil.fluidRow(
LayoutUtil.fluidColumn(6, 0,
LayoutUtil.locsCss(CssStyles.VSPACE3,
Expand Down Expand Up @@ -185,22 +185,22 @@ public void buttonClick(ClickEvent event) {
}
});

Button setAllToNoButton = new Button("Set all to No");
setAllToNoButton.addStyleName(ValoTheme.BUTTON_LINK);
Button setEmptyToNoButton = new Button("Set cleared to No");
setEmptyToNoButton.addStyleName(ValoTheme.BUTTON_LINK);

setAllToNoButton.addClickListener(new ClickListener() {
setEmptyToNoButton.addClickListener(new ClickListener() {
@SuppressWarnings("unchecked")
@Override
public void buttonClick(ClickEvent event) {
for (Object symptomId : unconditionalSymptomFieldIds) {
Field<SymptomState> symptom = (Field<SymptomState>) getFieldGroup().getField(symptomId);
if (symptom.isVisible()) {
if (symptom.isVisible() && symptom.getValue() == null) {
symptom.setValue(SymptomState.NO);
}
}
for (Object symptomId : conditionalBleedingSymptomFieldIds) {
Field<SymptomState> symptom = (Field<SymptomState>) getFieldGroup().getField(symptomId);
if (symptom.isVisible()) {
if (symptom.isVisible() && symptom.getValue() == null) {
symptom.setValue(SymptomState.NO);
}
}
Expand All @@ -209,7 +209,7 @@ public void buttonClick(ClickEvent event) {

HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.addComponent(clearAllButton);
buttonsLayout.addComponent(setAllToNoButton);
buttonsLayout.addComponent(setEmptyToNoButton);
buttonsLayout.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
getContent().addComponent(buttonsLayout, BUTTONS_LOC);
}
Expand Down

0 comments on commit fff97c5

Please sign in to comment.