// add teamCal drop down
initTeamCalPicker(gridBuilder.newFieldset(getString("plugins.teamcal.event.teamCal")));
{
// SUBJECT
final FieldsetPanel fieldSet = gridBuilder.newFieldset(getString("plugins.teamcal.event.subject"));
final MaxLengthTextField subjectField = new MaxLengthTextField(fieldSet.getTextFieldId(), new PropertyModel<String>(data, "subject"));
subjectField.setRequired(true);
fieldSet.add(subjectField);
if (access == false) {
fieldSet.setEnabled(false);
} else {
WicketUtils.setFocus(subjectField);
}
}
{
// LOCATION
final FieldsetPanel fieldSet = gridBuilder.newFieldset(getString("plugins.teamcal.event.location"));
final PFAutoCompleteMaxLengthTextField locationTextField = new PFAutoCompleteMaxLengthTextField(fieldSet.getTextFieldId(),
new PropertyModel<String>(data, "location")) {
@Override
protected List<String> getChoices(final String input)
{
return teamEventDao.getLocationAutocompletion(input, calendarsWithFullAccess);
}
};
locationTextField.withMatchContains(true).withMinChars(3);
fieldSet.add(locationTextField);
if (access == false)
fieldSet.setEnabled(false);
}
{
// NOTE
final FieldsetPanel fieldSet = gridBuilder.newFieldset(getString("plugins.teamcal.event.note"));
final MaxLengthTextArea noteField = new MaxLengthTextArea(fieldSet.getTextAreaId(), new PropertyModel<String>(data, "note"));
fieldSet.add(noteField).setAutogrow();
if (access == false)
fieldSet.setEnabled(false);
}
gridBuilder.newSplitPanel(GridSize.COL50);
// add date panel
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);
}
});
customizedCheckBoxButton.add(checkBox);
}
{
// Interval (day, weeks, months, ...). Only visible if recurrenceData.interval != NONE.
recurrenceIntervalFieldset = gridBuilder.newFieldset("");
DivTextPanel panel = new DivTextPanel(recurrenceIntervalFieldset.newChildId(), HtmlHelper.escapeHtml(
getString("plugins.teamcal.event.recurrence.customized.all"), false) + " ");
panel.getLabel().setEscapeModelStrings(false);
recurrenceIntervalFieldset.add(panel);
final MinMaxNumberField<Integer> intervalNumberField = new MinMaxNumberField<Integer>(InputPanel.WICKET_ID,
new PropertyModel<Integer>(recurrenceData, "interval"), 0, 1000);
WicketUtils.setSize(intervalNumberField, 1);
recurrenceIntervalFieldset.add(intervalNumberField);
panel = new DivTextPanel(recurrenceIntervalFieldset.newChildId(), new Model<String>() {
@Override
public String getObject()
{
final RecurrenceFrequency interval = recurrenceData.getFrequency();
final String unitI18nKey = getString(interval.getUnitI18nKey());
if (unitI18nKey != null) {
return " " + HtmlHelper.escapeHtml(unitI18nKey, false);
}
return "";
}
});
panel.getLabel().setEscapeModelStrings(false);
recurrenceIntervalFieldset.add(panel);
recurrenceIntervalFieldset.getFieldset().setOutputMarkupId(true);
}
{
// Until. Only visible if recurrenceData.interval != NONE.
recurrenceUntilDateFieldset = gridBuilder.newFieldset(getString("plugins.teamcal.event.recurrence.until"));
recurrenceUntilDateFieldset.add(new DatePanel(recurrenceUntilDateFieldset.newChildId(), new PropertyModel<Date>(recurrenceData,
"until"), DatePanelSettings.get().withTargetType(java.sql.Date.class)));
recurrenceUntilDateFieldset.getFieldset().setOutputMarkupId(true);
recurrenceUntilDateFieldset.add(new HtmlCommentPanel(recurrenceUntilDateFieldset.newChildId(), new Model<String>() {
@Override
public String getObject()
{
return WicketUtils.getUTCDate("until", recurrenceData.getUntil());
}
}));
}
{
// customized weekly: day of week
}
{
// customized monthly: day of month (1-31, at 1st, 2nd, ..., last week day)
}
{
// customized yearly: month of year and see day of month.
}
if (WebConfiguration.isDevelopmentMode() == true) {
gridBuilder.newSplitPanel(GridSize.COL50);
final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.teamcal.attendees")).suppressLabelForWarning();
attendees = getData().ensureAttendees();
fs.add(new TeamAttendeesPanel(fs.newChildId(), attendees));
}
// {
// final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), "*.*");
// fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
// final FileUploadPanel fileUploadPanel;
// fs.add(fileUploadPanel = new FileUploadPanel(fs.newChildId(), fileUploadField));
// }
gridBuilder.newGridPanel();
{
final ToggleContainerPanel extendedSettingsPanel = new ToggleContainerPanel(gridBuilder.getPanel().newChildId());
extendedSettingsPanel.setHeading(getString("plugins.teamcal.event.expertSettings"));
gridBuilder.getPanel().add(extendedSettingsPanel);
extendedSettingsPanel.setClosed();
final GridBuilder innerGridBuilder = extendedSettingsPanel.createGridBuilder();
{
// Until. Only visible if recurrenceData.interval != NONE.
recurrenceExDateFieldset = innerGridBuilder.newFieldset(getString("plugins.teamcal.event.recurrence.exDate"));
recurrenceExDateFieldset.add(new MaxLengthTextField(recurrenceExDateFieldset.getTextFieldId(), new PropertyModel<String>(data,
"recurrenceExDate")));
recurrenceExDateFieldset.getFieldset().setOutputMarkupId(true);
recurrenceExDateFieldset.addHelpIcon(getString("plugins.teamcal.event.recurrence.exDate.tooltip"));
}
{
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("plugins.teamcal.event.externalUid"));
fs.add(new MaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "externalUid")));
}
}
gridBuilder.newGridPanel();
if (parentPage.getRecurrencyChangeType() != null) {