initDatePanel();
{
// ALL DAY CHECKBOX
final FieldsetPanel fieldSet = gridBuilder.newFieldset("").suppressLabelForWarning();
final DivPanel divPanel = fieldSet.addNewCheckBoxButtonDiv();
final CheckBoxButton checkBox = new CheckBoxButton(divPanel.newChildId(), new PropertyModel<Boolean>(data, "allDay"),
getString("plugins.teamcal.event.allDay"));
checkBox.getCheckBox().add(new AjaxFormComponentUpdatingBehavior("onChange") {
@Override
protected void onUpdate(final AjaxRequestTarget target)
{
if (data.isAllDay() == false) {
setDateDropChoiceVisible(true);
} else {
setDateDropChoiceVisible(false);
}
target.add(startDateField.getFieldset(), endDateField.getFieldset());
}
});
setDateDropChoiceVisible(data.isAllDay() == false);
divPanel.add(checkBox);
fieldSet.add(divPanel);
if (access == false)
fieldSet.setEnabled(false);
// ///////////////////////////////
// Reminder
// ///////////////////////////////
final FieldsetPanel reminderPanel = gridBuilder.newFieldset(getString("plugins.teamcal.event.reminder.title"));
reminderPanel.add(new TeamEventReminderComponent(reminderPanel.newChildId(), Model.of(data), reminderPanel));
reminderPanel.addHelpIcon(getString("plugins.teamcal.event.reminder.tooltip"));
}
// ///////////////////////////////
// Recurrence
// ///////////////////////////////
gridBuilder.newSplitPanel(GridSize.COL50);
gridBuilder.newFormHeading(getString("plugins.teamcal.event.recurrence"));
{
// Recurrence interval type:
recurrenceFieldset = gridBuilder.newFieldset(getString("plugins.teamcal.event.recurrence"));
recurrencePanel = gridBuilder.getPanel().getDiv();
recurrencePanel.setOutputMarkupId(true);
final RecurrenceFrequency[] supportedFrequencies = TeamEventUtils.getSupportedRecurrenceFrequencies();
final LabelValueChoiceRenderer<RecurrenceFrequency> frequencyChoiceRenderer = new LabelValueChoiceRenderer<RecurrenceFrequency>(
recurrenceFieldset, supportedFrequencies);
final DropDownChoice<RecurrenceFrequency> frequencyChoice = new DropDownChoice<RecurrenceFrequency>(
recurrenceFieldset.getDropDownChoiceId(), new PropertyModel<RecurrenceFrequency>(recurrenceData, "frequency"),
frequencyChoiceRenderer.getValues(), frequencyChoiceRenderer);
frequencyChoice.setNullValid(false);
recurrenceFieldset.add(frequencyChoice);
recurrenceFieldset.getFieldset().setOutputMarkupId(true);
frequencyChoice.add(new AjaxFormComponentUpdatingBehavior("onChange") {
@Override
protected void onUpdate(final AjaxRequestTarget target)
{
setRecurrenceComponentsVisibility(target);
}
});
customizedCheckBoxButton = recurrenceFieldset.addNewCheckBoxButtonDiv();
final CheckBoxButton checkBox = new CheckBoxButton(customizedCheckBoxButton.newChildId(), new PropertyModel<Boolean>(recurrenceData,
"customized"), getString("plugins.teamcal.event.recurrence.customized"));
checkBox.getCheckBox().add(new AjaxFormComponentUpdatingBehavior("onChange") {
@Override
protected void onUpdate(final AjaxRequestTarget target)
{
setRecurrenceComponentsVisibility(target);
}