protected void init()
{
super.init();
gridBuilder.newGridPanel();
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("task"));
final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(data, "task"), parentPage, "taskId") {
@Override
protected void selectTask(final TaskDO task)
{
super.selectTask(task);
parentPage.refresh(); // Task was changed. Therefore update the kost2 list.
}
};
fs.add(taskSelectPanel);
taskSelectPanel.init();
taskSelectPanel.setRequired(true);
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("gantt.name"));
final RequiredMaxLengthTextField name = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, "name"));
WicketUtils.setStrong(name);
fs.add(name);
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("gantt.owner"));
final UserSelectPanel userSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(data, "owner"), parentPage,
"ownerId");
fs.add(userSelectPanel);
userSelectPanel.init();
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("title"));
final RequiredMaxLengthTextField title = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(getSettings(),
"title"), 100);
WicketUtils.setStrong(title);
fs.add(title);
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// read-access:
final FieldsetPanel fs = gridBuilder.newFieldset(getString("access.read"));
final LabelValueChoiceRenderer<GanttAccess> readAccessChoiceRenderer = new LabelValueChoiceRenderer<GanttAccess>(this,
GanttAccess.values());
final DropDownChoice<GanttAccess> readAccessChoice = new DropDownChoice<GanttAccess>(fs.getDropDownChoiceId(),
new PropertyModel<GanttAccess>(getData(), "readAccess"), readAccessChoiceRenderer.getValues(), readAccessChoiceRenderer);
readAccessChoice.setNullValid(false);
fs.add(readAccessChoice);
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// Width
final FieldsetPanel fs = gridBuilder.newFieldset(getString("gantt.settings.width"));
fs.add(new MinMaxNumberField<Integer>(fs.getTextFieldId(), new PropertyModel<Integer>(data.getStyle(), "width"), 100, 10000));
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// write-access:
final FieldsetPanel fs = gridBuilder.newFieldset(getString("access.write"));
final LabelValueChoiceRenderer<GanttAccess> writeAccessChoiceRenderer = new LabelValueChoiceRenderer<GanttAccess>(this,
GanttAccess.values());
final DropDownChoice<GanttAccess> writeAccessChoice = new DropDownChoice<GanttAccess>(fs.getDropDownChoiceId(),
new PropertyModel<GanttAccess>(getData(), "writeAccess"), writeAccessChoiceRenderer.getValues(), writeAccessChoiceRenderer);
writeAccessChoice.setNullValid(false);
fs.add(writeAccessChoice);
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// Total label width:
final FieldsetPanel fs = gridBuilder.newFieldset(getString("gantt.settings.totalLabelWidth"));
fs.add(new MinMaxNumberField<Double>(fs.getTextFieldId(), new PropertyModel<Double>(data.getStyle(), "totalLabelWidth"), 10.0,
10000.0));
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// Options
final FieldsetPanel fs = gridBuilder.newFieldset(getString("label.options")).suppressLabelForWarning();
final DivPanel checkBoxPanel = fs.addNewCheckBoxButtonDiv();
checkBoxPanel.addCheckBoxButton(new PropertyModel<Boolean>(data.getStyle(), "relativeTimeValues"),
getString("gantt.style.relativeTimeValues"));
checkBoxPanel.addCheckBoxButton(new PropertyModel<Boolean>(data.getStyle(), "showToday"), getString("gantt.style.showToday"));
checkBoxPanel.addCheckBoxButton(new PropertyModel<Boolean>(data.getStyle(), "showCompletion"), getString("gantt.style.showCompletion"));
checkBoxPanel.add(new CheckBoxButton(checkBoxPanel.newChildId(), new PropertyModel<Boolean>(getSettings(), "showOnlyVisibles"),
getString("gantt.settings.showOnlyVisibles")) {
/**
* @see org.projectforge.web.wicket.flowlayout.CheckBoxButton#wantOnSelectionChangedNotifications()
*/
@Override
protected boolean wantOnSelectionChangedNotifications()
{
// Submit form after toggling the check box.
return true;
}
});
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// Time period
final FieldsetPanel fs = gridBuilder.newFieldset(getString("timePeriod")).suppressLabelForWarning();
final DatePanel fromDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(getSettings(), "fromDate"), DatePanelSettings
.get().withSelectProperty("fromDate"));
fs.add(fromDatePanel);
fs.add(new DivTextPanel(fs.newChildId(), "-"));
final DatePanel toDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(getSettings(), "toDate"), DatePanelSettings
.get().withSelectProperty("toDate"));
fs.add(toDatePanel);
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
final FieldsetPanel fs = gridBuilder.newFieldset(getString("export"));
final LabelValueChoiceRenderer<String> exportFormatChoiceRenderer = new LabelValueChoiceRenderer<String>();
exportFormatChoiceRenderer.addValue(EXPORT_JPG, getString("gantt.export.jpg"));
exportFormatChoiceRenderer.addValue(EXPORT_MS_PROJECT_MPX, getString("gantt.export.msproject.mpx"));
exportFormatChoiceRenderer.addValue(EXPORT_MS_PROJECT_XML, getString("gantt.export.msproject.xml"));
exportFormatChoiceRenderer.addValue(EXPORT_PDF, getString("gantt.export.pdf"));
exportFormatChoiceRenderer.addValue(EXPORT_PNG, getString("gantt.export.png"));
exportFormatChoiceRenderer.addValue(EXPORT_PROJECTFORGE, getString("gantt.export.projectforge"));
exportFormatChoiceRenderer.addValue(EXPORT_SVG, getString("gantt.export.svg"));
final DropDownChoice<String> exportFormatChoice = new DropDownChoice<String>(fs.getDropDownChoiceId(), new PropertyModel<String>(
this, "exportFormat"), exportFormatChoiceRenderer.getValues(), exportFormatChoiceRenderer);
exportFormatChoice.setNullValid(false);
fs.add(exportFormatChoice);
fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("export")) {
@Override
public final void onSubmit()
{
parentPage.export(exportFormat);
}