Skip to content

Commit

Permalink
TheCoder4eu/BootsFaces-OSP#1078 added a demo showing week-days-disabl…
Browse files Browse the repository at this point in the history
…ed="[0,6]"
  • Loading branch information
stephanrauh committed Aug 3, 2019
1 parent 17c1f74 commit ba9390f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/main/java/net/bootsfaces/demo/DateTimeBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class DateTimeBean implements Serializable {
private boolean allowInputToggle = false;

private boolean useCurrent = true;

private String weekDaysDisabled = null;

private String locale = Locale.getDefault().getLanguage();

Expand Down Expand Up @@ -522,4 +524,20 @@ public void setJavaFormatString(String javaFormatString) {
momentJSFormatString = "(an error occurred: " + e.getClass().getSimpleName() + " " + e.getMessage() + ")";
}
}

public String getWeekDaysDisabled() {
return weekDaysDisabled;
}

public boolean isDisableWeekend() {
return weekDaysDisabled != null;
}

public void setDisableWeekend(boolean value) {
if (value) {
this.weekDaysDisabled = "6,0";
} else {
this.weekDaysDisabled = null;
}
}
}
6 changes: 5 additions & 1 deletion src/main/webapp/forms/DateTimePicker.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
show-date="#{dateTimeBean.showDate}"
show-time="#{dateTimeBean.showTime}"
show-icon="#{dateTimeBean.showIcon}"
use-current="#{dateTimeBean.useCurrent}" />
use-current="#{dateTimeBean.useCurrent}"
week-days-disabled="#{dateTimeBean.weekDaysDisabled}" />
<b:panel title="Settings" look="primary">
<b:panelGrid columns="1" id="settings">
<b:selectBooleanCheckbox value="#{dateTimeBean.modeInline}" caption="mode='inline' (default is 'popup')"
Expand All @@ -65,6 +66,9 @@
<b:selectBooleanCheckbox value="#{dateTimeBean.useCurrent}" caption="useCurrent='true' (default: true)"
onclick="ajax:dateTimeBean.updateSettings()"
update="@form" />
<b:selectBooleanCheckbox value="#{dateTimeBean.disableWeekend}" caption="week-days-disabled='6,0'"
onclick="ajax:dateTimeBean.updateSettings()"
update="@form" />
</b:panelGrid>
</b:panel>
</b:panelGrid>
Expand Down

0 comments on commit ba9390f

Please sign in to comment.