extendedFilter.setMarkupId("extendedFilter");
if (searchFilter.isUseModificationFilter() == false) {
extendedFilter.add(AttributeModifier.append("style", "display: none;"));
}
{
final FieldsetPanel fieldset = gridBuilder.newFieldset(getString("search.periodOfModification"));
fieldset.add(new HiddenInputPanel(fieldset.newChildId(), new HiddenField<Boolean>(InputPanel.WICKET_ID, new PropertyModel<Boolean>(
searchFilter, "useModificationFilter"))).setHtmlId("useModificationFilter"));
startDateTimePanel = new DateTimePanel(fieldset.newChildId(), new PropertyModel<Date>(searchFilter, "startTimeOfModification"),
(DateTimePanelSettings) DateTimePanelSettings.get().withSelectProperty("startDateOfModification").withSelectPeriodMode(true),
DatePrecision.MINUTE);
fieldset.add(startDateTimePanel);
fieldset.setLabelFor(startDateTimePanel);
stopDateTimePanel = new DateTimePanel(fieldset.newChildId(), new PropertyModel<Date>(searchFilter, "stopTimeOfModification"),
(DateTimePanelSettings) DateTimePanelSettings.get().withSelectProperty("stopDateOfModification").withSelectPeriodMode(true),
DatePrecision.MINUTE);
stopDateTimePanel.setRequired(false);
fieldset.add(stopDateTimePanel);
final HtmlCommentPanel comment = new HtmlCommentPanel(fieldset.newChildId(), new DatesAsUTCModel() {
@Override
public Date getStartTime()
{
return searchFilter.getStartTimeOfModification();
}
@Override
public Date getStopTime()
{
return searchFilter.getStopTimeOfModification();
}
});
fieldset.add(comment);
// DropDownChoice for convenient selection of time periods.
final LabelValueChoiceRenderer<String> timePeriodChoiceRenderer = new LabelValueChoiceRenderer<String>();
timePeriodChoiceRenderer.addValue("lastMinute", getString("search.lastMinute"));
timePeriodChoiceRenderer.addValue("lastMinutes:10", PFUserContext.getLocalizedMessage("search.lastMinutes", 10));
timePeriodChoiceRenderer.addValue("lastMinutes:30", PFUserContext.getLocalizedMessage("search.lastMinutes", 30));
timePeriodChoiceRenderer.addValue("lastHour", getString("search.lastHour"));
timePeriodChoiceRenderer.addValue("lastHours:4", PFUserContext.getLocalizedMessage("search.lastHours", 4));
timePeriodChoiceRenderer.addValue("today", getString("search.today"));
timePeriodChoiceRenderer.addValue("sinceYesterday", getString("search.sinceYesterday"));
timePeriodChoiceRenderer.addValue("lastDays:3", PFUserContext.getLocalizedMessage("search.lastDays", 3));
timePeriodChoiceRenderer.addValue("lastDays:7", PFUserContext.getLocalizedMessage("search.lastDays", 7));
timePeriodChoiceRenderer.addValue("lastDays:14", PFUserContext.getLocalizedMessage("search.lastDays", 14));
timePeriodChoiceRenderer.addValue("lastDays:30", PFUserContext.getLocalizedMessage("search.lastDays", 30));
timePeriodChoiceRenderer.addValue("lastDays:60", PFUserContext.getLocalizedMessage("search.lastDays", 60));
timePeriodChoiceRenderer.addValue("lastDays:90", PFUserContext.getLocalizedMessage("search.lastDays", 90));
final DropDownChoice<String> modificationSinceChoice = new DropDownChoice<String>(fieldset.getDropDownChoiceId(),
new PropertyModel<String>(this, "modificationSince"), timePeriodChoiceRenderer.getValues(), timePeriodChoiceRenderer);
modificationSinceChoice.setNullValid(true);
modificationSinceChoice.setRequired(false);
fieldset.add(modificationSinceChoice, true);
}
{
gridBuilder.newSplitPanel(GridSize.COL33);
final FieldsetPanel fs = gridBuilder.newFieldset(getString("modifiedBy"), getString("user"));
final UserSelectPanel userSelectPanel = new UserSelectPanel(fs.newChildId(), new Model<PFUserDO>() {
@Override
public PFUserDO getObject()
{
return userGroupCache.getUser(searchFilter.getModifiedByUserId());
}
@Override
public void setObject(final PFUserDO object)
{
if (object == null) {
searchFilter.setModifiedByUserId(null);
} else {
searchFilter.setModifiedByUserId(object.getId());
}
}
}, parentPage, "modifiedByUserId");
fs.add(userSelectPanel);
userSelectPanel.setDefaultFormProcessing(false);
userSelectPanel.init().withAutoSubmit(true);
}
gridBuilder.setCurrentLevel(0); // Go back to main row panel.
}