parentTaskSelectPanel.setRequired(true);
}
{
// Title
final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.title"));
final MaxLengthTextField title = new RequiredMaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "title"));
WicketUtils.setStrong(title);
fs.add(title);
if (isNew() == true) {
WicketUtils.setFocus(title);
}
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// Status drop down box:
final FieldsetPanel fs = gridBuilder.newFieldset(getString("status"));
final LabelValueChoiceRenderer<TaskStatus> statusChoiceRenderer = new LabelValueChoiceRenderer<TaskStatus>(fs, TaskStatus.values());
final DropDownChoice<TaskStatus> statusChoice = new DropDownChoice<TaskStatus>(fs.getDropDownChoiceId(),
new PropertyModel<TaskStatus>(data, "status"), statusChoiceRenderer.getValues(), statusChoiceRenderer);
statusChoice.setNullValid(false).setRequired(true);
fs.add(statusChoice);
}
{
// Assigned user:
final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.assignedUser"));
PFUserDO responsibleUser = data.getResponsibleUser();
if (Hibernate.isInitialized(responsibleUser) == false) {
responsibleUser = userGroupCache.getUser(responsibleUser.getId());
data.setResponsibleUser(responsibleUser);
}
final UserSelectPanel responsibleUserSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(data,
"responsibleUser"), parentPage, "responsibleUserId");
fs.add(responsibleUserSelectPanel);
responsibleUserSelectPanel.init();
}
gridBuilder.newSplitPanel(GridSize.COL50);
{
// Priority drop down box:
final FieldsetPanel fs = gridBuilder.newFieldset(getString("priority"));
final LabelValueChoiceRenderer<Priority> priorityChoiceRenderer = new LabelValueChoiceRenderer<Priority>(fs, Priority.values());
final DropDownChoice<Priority> priorityChoice = new DropDownChoice<Priority>(fs.getDropDownChoiceId(), new PropertyModel<Priority>(
data, "priority"), priorityChoiceRenderer.getValues(), priorityChoiceRenderer);
priorityChoice.setNullValid(true);
fs.add(priorityChoice);
}
{
// Max hours:
final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.maxHours"));
final MinMaxNumberField<Integer> maxNumberField = new MinMaxNumberField<Integer>(InputPanel.WICKET_ID, new PropertyModel<Integer>(
data, "maxHours"), 0, 9999);
WicketUtils.setSize(maxNumberField, 6);
fs.add(maxNumberField);
if (isNew() == false && taskTree.hasOrderPositions(data.getId(), true) == true) {
WicketUtils.setWarningTooltip(maxNumberField);
WicketUtils.addTooltip(maxNumberField, getString("task.edit.maxHoursIngoredDueToAssignedOrders"));
}
}
gridBuilder.newGridPanel();
{
// Short description:
final FieldsetPanel fs = gridBuilder.newFieldset(getString("shortDescription"));
final IModel<String> model = new PropertyModel<String>(data, "shortDescription");
fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, model));
fs.addJIRAField(model);
}
{
// Reference
final FieldsetPanel fs = gridBuilder.newFieldset(getString("task.reference"));
fs.add(new MaxLengthTextField(InputPanel.WICKET_ID, new PropertyModel<String>(data, "reference")));
}
// ///////////////////////////////
// GANTT
// ///////////////////////////////
gridBuilder.newGridPanel();
{
final ToggleContainerPanel extendedSettingsPanel = new ToggleContainerPanel(gridBuilder.getPanel().newChildId()) {
/**
* @see org.projectforge.web.wicket.flowlayout.ToggleContainerPanel#wantsOnStatusChangedNotification()
*/
@Override
protected boolean wantsOnStatusChangedNotification()
{
return true;
}
};
extendedSettingsPanel.setHeading(getString("task.gantt.settings"));
gridBuilder.getPanel().add(extendedSettingsPanel);
extendedSettingsPanel.setClosed();
final GridBuilder innerGridBuilder = extendedSettingsPanel.createGridBuilder();
innerGridBuilder.newSplitPanel(GridSize.COL50);
{
// Gantt object type:
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.objectType"));
final LabelValueChoiceRenderer<GanttObjectType> objectTypeChoiceRenderer = new LabelValueChoiceRenderer<GanttObjectType>(fs,
GanttObjectType.values());
final DropDownChoice<GanttObjectType> objectTypeChoice = new DropDownChoice<GanttObjectType>(fs.getDropDownChoiceId(),
new PropertyModel<GanttObjectType>(data, "ganttObjectType"), objectTypeChoiceRenderer.getValues(), objectTypeChoiceRenderer);
objectTypeChoice.setNullValid(true);
fs.add(objectTypeChoice);
}
{
// Gantt: start date
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.startDate"));
final DatePanel startDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(data, "startDate"), DatePanelSettings.get()
.withTargetType(java.sql.Date.class).withSelectProperty("startDate"));
fs.add(startDatePanel);
}
{
// Gantt: end date
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.endDate"));
final DatePanel endDatePanel = new DatePanel(fs.newChildId(), new PropertyModel<Date>(data, "endDate"), DatePanelSettings.get()
.withTargetType(java.sql.Date.class).withSelectProperty("endDate"));
fs.add(endDatePanel);
dependentFormComponents[1] = endDatePanel;
}
innerGridBuilder.newSplitPanel(GridSize.COL50);
{
// Progress
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("task.progress")).setUnit("%");
final MinMaxNumberField<Integer> progressField = new MinMaxNumberField<Integer>(InputPanel.WICKET_ID, new PropertyModel<Integer>(
data, "progress"), 0, 100) {
@SuppressWarnings({ "unchecked", "rawtypes"})
@Override
public IConverter getConverter(final Class type)
{
return new IntegerPercentConverter(0);
}
};
WicketUtils.setSize(progressField, 3);
fs.add(progressField);
}
{
// Gantt: duration
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.duration")).suppressLabelForWarning();
final MinMaxNumberField<BigDecimal> durationField = new MinMaxNumberField<BigDecimal>(InputPanel.WICKET_ID,
new PropertyModel<BigDecimal>(data, "duration"), BigDecimal.ZERO, TaskEditForm.MAX_DURATION_DAYS);
WicketUtils.setSize(durationField, 6);
fs.add(durationField);
dependentFormComponents[0] = durationField;
}
{
// Gantt: predecessor offset
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.predecessorOffset")).setUnit(getString("days"));
final MinMaxNumberField<Integer> ganttPredecessorField = new MinMaxNumberField<Integer>(InputPanel.WICKET_ID,
new PropertyModel<Integer>(data, "ganttPredecessorOffset"), Integer.MIN_VALUE, Integer.MAX_VALUE);
WicketUtils.setSize(ganttPredecessorField, 6);
fs.add(ganttPredecessorField);
}
innerGridBuilder.newGridPanel();
{
// Gantt relation type:
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.relationType"));
final LabelValueChoiceRenderer<GanttRelationType> relationTypeChoiceRenderer = new LabelValueChoiceRenderer<GanttRelationType>(fs,
GanttRelationType.values());
final DropDownChoice<GanttRelationType> relationTypeChoice = new DropDownChoice<GanttRelationType>(fs.getDropDownChoiceId(),
new PropertyModel<GanttRelationType>(data, "ganttRelationType"), relationTypeChoiceRenderer.getValues(),
relationTypeChoiceRenderer);
relationTypeChoice.setNullValid(true);
fs.add(relationTypeChoice);
}
{
// Gantt: predecessor
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("gantt.predecessor"));
final TaskSelectPanel ganttPredecessorSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(data, "ganttPredecessor"),
parentPage, "ganttPredecessorId");
fs.add(ganttPredecessorSelectPanel);
ganttPredecessorSelectPanel.setShowFavorites(true);
ganttPredecessorSelectPanel.init();
}
}
// ///////////////////////////////
// FINANCE ADMINISTRATION
// ///////////////////////////////
gridBuilder.newGridPanel();
{
final ToggleContainerPanel extendedSettingsPanel = new ToggleContainerPanel(gridBuilder.getPanel().newChildId()) {
/**
* @see org.projectforge.web.wicket.flowlayout.ToggleContainerPanel#wantsOnStatusChangedNotification()
*/
@Override
protected boolean wantsOnStatusChangedNotification()
{
return true;
}
};
extendedSettingsPanel.setHeading(getString("financeAdministration"));
gridBuilder.getPanel().add(extendedSettingsPanel);
extendedSettingsPanel.setClosed();
final GridBuilder innerGridBuilder = extendedSettingsPanel.createGridBuilder();
innerGridBuilder.newSplitPanel(GridSize.COL50);
if (Configuration.getInstance().isCostConfigured() == true) {
// Cost 2 settings
final FieldsetPanel fs = innerGridBuilder.newFieldset(getString("fibu.kost2"));
this.projektKostLabel = new DivTextPanel(fs.newChildId(), "");
WicketUtils.addTooltip(projektKostLabel.getLabel(), new Model<String>() {
@Override
public String getObject()
{
final List<Kost2DO> kost2DOs = taskTree.getKost2List(projekt, data, data.getKost2BlackWhiteItems(), data.isKost2IsBlackList());
final String[] kost2s = TaskListPage.getKost2s(kost2DOs);
if (kost2s == null || kost2s.length == 0) {
return " - (-)";
}
return StringHelper.listToString("\n", kost2s);
};
});
fs.add(projektKostLabel);
final PropertyModel<String> model = new PropertyModel<String>(data, "kost2BlackWhiteList");
kost2BlackWhiteTextField = new MaxLengthTextField(InputPanel.WICKET_ID, model);
WicketUtils.setSize(kost2BlackWhiteTextField, 10);
fs.add(kost2BlackWhiteTextField);
final LabelValueChoiceRenderer<Boolean> kost2listTypeChoiceRenderer = new LabelValueChoiceRenderer<Boolean>() //
.addValue(Boolean.FALSE, getString("task.kost2list.whiteList")) //
.addValue(Boolean.TRUE, getString("task.kost2list.blackList"));