// {
// // Doesn't work with DatePicker (because DatePicker updates the value after onblur event.
// }
// });
fs.add(dependentFormComponents[1] = weekDatePanel);
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("calendarWeek")) {
@Override
public final void onSubmit()
{
}
}.setDefaultFormProcessing(false), new Model<String>() {
@Override
public String getObject()
{
if (data.getWeek() != null) {
return getString("calendar.weekOfYearShortLabel") + " " + DateTimeFormatter.formatWeekOfYear(data.getWeek());
} else {
return getString("calendar.weekOfYearShortLabel");
}
}
}, SingleButtonPanel.NORMAL).setTooltip(getString("recalculate")));
final DivPanel checkBoxDiv = new DivPanel(fs.newChildId(), DivType.BTN_GROUP) {
/**
* @see org.apache.wicket.Component#isVisible()
*/
@Override
public boolean isVisible()
{
return data.hasDeletedEntries();
}
};
fs.add(checkBoxDiv);
checkBoxDiv.add(new CheckBoxButton(checkBoxDiv.newChildId(), new PropertyModel<Boolean>(this, "showDeletedOnly"),
getString("onlyDeleted")) {
/**
* @see org.projectforge.web.wicket.flowlayout.CheckBoxButton#onSelectionChanged(java.lang.Boolean)
*/
@Override
protected void onSelectionChanged(final Boolean newSelection)
{
super.onSelectionChanged(newSelection);
refresh();
}
@Override
protected boolean wantOnSelectionChangedNotifications()
{
return true;
}
});
if (isNew() == true) {
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("predecessor")) {
@Override
public final void onSubmit()
{
if (getPredecessor() != null && predecessor.getEntries() != null) {
final Iterator<HRPlanningEntryDO> it = getData().getEntries().iterator();
while (it.hasNext() == true) {
if (it.next().isEmpty() == true) {
it.remove();
}
}
for (final HRPlanningEntryDO entry : predecessor.getEntries()) {
getData().addEntry(entry.newClone());
}
}
predecessor = null;
refresh();
}
}.setDefaultFormProcessing(false), getString("hr.planning.entry.copyFromPredecessor")) {
/**
* @see org.apache.wicket.Component#isVisible()
*/
@Override
public boolean isVisible()
{
return getPredecessor() != null;
}
});
}
}
gridBuilder.newGridPanel();
entriesRepeater = gridBuilder.newRepeatingView();
refresh();
if (getBaseDao().hasInsertAccess(getUser()) == true && showDeletedOnly == false) {
final DivPanel panel = gridBuilder.newGridPanel().getPanel();
final Button addPositionButton = new Button(SingleButtonPanel.WICKET_ID) {
@Override
public final void onSubmit()
{
getData().addEntry(new HRPlanningEntryDO());
refresh();
}
};
final SingleButtonPanel addPositionButtonPanel = new SingleButtonPanel(panel.newChildId(), addPositionButton, getString("add"));
addPositionButtonPanel.setTooltip(getString("hr.planning.tooltip.addEntry"));
panel.add(addPositionButtonPanel);
}
WicketUtils.addShowDeleteRowQuestionDialog(this, hrPlanningEntryDao);
}