Search in sources :

Example 1 with FieldsetPanel

use of org.projectforge.web.wicket.flowlayout.FieldsetPanel in project projectforge by micromata.

the class ToDoListForm method init.

@SuppressWarnings("serial")
@Override
protected void init() {
    super.init();
    gridBuilder.newSplitPanel(GridSize.COL66);
    {
        // Assignee
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.todo.assignee"));
        final UserSelectPanel assigneeSelectPanel = new UserSelectPanel(fs.newChildId(), new Model<PFUserDO>() {

            @Override
            public PFUserDO getObject() {
                return UserGroupCache.getInstance().getUser(getSearchFilter().getAssigneeId());
            }

            @Override
            public void setObject(final PFUserDO object) {
                if (object == null) {
                    getSearchFilter().setAssigneeId(null);
                } else {
                    getSearchFilter().setAssigneeId(object.getId());
                }
            }
        }, parentPage, "assigneeId");
        fs.add(assigneeSelectPanel);
        assigneeSelectPanel.setDefaultFormProcessing(false);
        assigneeSelectPanel.init().withAutoSubmit(true);
    }
    gridBuilder.newSplitPanel(GridSize.COL33);
    {
        // Reporter
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("plugins.todo.reporter"));
        final UserSelectPanel reporterSelectPanel = new UserSelectPanel(fs.newChildId(), new Model<PFUserDO>() {

            @Override
            public PFUserDO getObject() {
                return UserGroupCache.getInstance().getUser(getSearchFilter().getReporterId());
            }

            @Override
            public void setObject(final PFUserDO object) {
                if (object == null) {
                    getSearchFilter().setReporterId(null);
                } else {
                    getSearchFilter().setReporterId(object.getId());
                }
            }
        }, parentPage, "reporterId");
        fs.add(reporterSelectPanel);
        reporterSelectPanel.setDefaultFormProcessing(false);
        reporterSelectPanel.init().withAutoSubmit(true);
    }
    {
        gridBuilder.newSplitPanel(GridSize.COL100);
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("task")).suppressLabelForWarning();
        final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new Model<TaskDO>() {

            @Override
            public TaskDO getObject() {
                return getTaskTree().getTaskById(getSearchFilter().getTaskId());
            }

            @Override
            public void setObject(final TaskDO task) {
                if (task != null) {
                    getSearchFilter().setTaskId(task.getId());
                } else {
                    getSearchFilter().setTaskId(null);
                }
            }
        }, parentPage, "taskId");
        fs.add(taskSelectPanel);
        taskSelectPanel.init();
        taskSelectPanel.setRequired(false);
    }
}
Also used : UserSelectPanel(org.projectforge.web.user.UserSelectPanel) TaskDO(org.projectforge.business.task.TaskDO) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) FieldsetPanel(org.projectforge.web.wicket.flowlayout.FieldsetPanel) TaskSelectPanel(org.projectforge.web.task.TaskSelectPanel) PFUserDO(org.projectforge.framework.persistence.user.entities.PFUserDO)

Example 2 with FieldsetPanel

use of org.projectforge.web.wicket.flowlayout.FieldsetPanel in project projectforge by micromata.

the class EmployeeBillingImportForm method init.

@SuppressWarnings("serial")
@Override
protected void init() {
    super.init();
    gridBuilder.newGridPanel();
    // Date DropDowns
    final FieldsetPanel fsMonthYear = gridBuilder.newFieldset(I18nHelper.getLocalizedMessage("plugins.eed.listcare.yearmonth"));
    dropDownMonth = new DropDownChoicePanel<>(fsMonthYear.newChildId(), new DropDownChoice<>(DropDownChoicePanel.WICKET_ID, new PropertyModel<>(this, "selectedMonth"), EEDHelper.MONTH_INTEGERS));
    fsMonthYear.add(dropDownMonth);
    dropDownYear = new DropDownChoicePanel<>(fsMonthYear.newChildId(), new DropDownChoice<>(DropDownChoicePanel.WICKET_ID, new PropertyModel<>(this, "selectedYear"), eedHelper.getDropDownYears()));
    fsMonthYear.add(dropDownYear);
    // upload buttons
    {
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), "*.xls");
        fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
        fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
        fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID) {

            @Override
            public final void onSubmit() {
                final Date dateToSelectAttrRow = new GregorianCalendar(selectedYear, selectedMonth - 1, 1, 0, 0).getTime();
                storagePanel.setDateToSelectAttrRow(dateToSelectAttrRow);
                final boolean success = parentPage.doImport(dateToSelectAttrRow);
                if (success) {
                    setDateDropDownsEnabled(false);
                }
            }
        }, getString("upload"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip")));
        addClearButton(fs);
    }
    addImportFilterRadio(gridBuilder);
    // preview of the imported data
    gridBuilder.newGridPanel();
    final DivPanel panel = gridBuilder.getPanel();
    storagePanel = new EmployeeBillingImportStoragePanel(panel.newChildId(), parentPage, importFilter);
    final Date dateToSelectAttrRow = new GregorianCalendar(selectedYear, selectedMonth - 1, 1, 0, 0).getTime();
    storagePanel.setDateToSelectAttrRow(dateToSelectAttrRow);
    panel.add(storagePanel);
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date) FileUploadField(org.apache.wicket.markup.html.form.upload.FileUploadField) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) Button(org.apache.wicket.markup.html.form.Button) FieldsetPanel(org.projectforge.web.wicket.flowlayout.FieldsetPanel) FileUploadPanel(org.projectforge.web.wicket.flowlayout.FileUploadPanel) DivPanel(org.projectforge.web.wicket.flowlayout.DivPanel) SingleButtonPanel(org.projectforge.web.wicket.components.SingleButtonPanel)

Example 3 with FieldsetPanel

use of org.projectforge.web.wicket.flowlayout.FieldsetPanel in project projectforge by micromata.

the class LiquidityEntryEditForm method init.

@SuppressWarnings("serial")
@Override
protected void init() {
    super.init();
    {
        // Date of payment
        final FieldProperties<LocalDate> props = getDateOfPaymentProperties();
        final FieldsetPanel fs = gridBuilder.newFieldset(LiquidityEntryDO.class, "dateOfPayment");
        final LocalDatePanel dateOfPayment = new LocalDatePanel(fs.newChildId(), new LocalDateModel(props.getModel()));
        fs.add(dateOfPayment);
        if (isNew()) {
            dateOfPayment.setFocus();
        }
    }
    {
        // Amount
        final FieldsetPanel fs = gridBuilder.newFieldset(LiquidityEntryDO.class, "amount");
        final RequiredMinMaxNumberField<BigDecimal> amount = new RequiredMinMaxNumberField<BigDecimal>(fs.getTextFieldId(), new PropertyModel<>(data, "amount"), Constants.TEN_BILLION_NEGATIVE, Constants.TEN_BILLION) {

            @SuppressWarnings({ "rawtypes", "unchecked" })
            @Override
            public IConverter getConverter(final Class type) {
                return new CurrencyConverter();
            }
        };
        WicketUtils.setSize(amount, 8);
        fs.add(amount);
        if (!isNew()) {
            amount.add(WicketUtils.setFocus());
        }
    }
    {
        final FieldsetPanel fs = gridBuilder.newFieldset(LiquidityEntryDO.class, "paid");
        fs.addCheckBox(new PropertyModel<>(data, "paid"), null);
    }
    {
        // Subject
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("fibu.rechnung.betreff"));
        final RequiredMaxLengthTextField subject = new RequiredMaxLengthTextField(fs.getTextFieldId(), new PropertyModel<>(data, "subject"));
        fs.add(subject);
    }
    {
        // Text comment
        final FieldsetPanel fs = gridBuilder.newFieldset(LiquidityEntryDO.class, "comment");
        fs.add(new MaxLengthTextArea(fs.getTextAreaId(), new PropertyModel<>(data, "comment"))).setAutogrow();
    }
    addCloneButton();
}
Also used : FieldProperties(org.projectforge.web.wicket.flowlayout.FieldProperties) PropertyModel(org.apache.wicket.model.PropertyModel) BigDecimal(java.math.BigDecimal) CurrencyConverter(org.projectforge.web.wicket.converter.CurrencyConverter) FieldsetPanel(org.projectforge.web.wicket.flowlayout.FieldsetPanel) IConverter(org.apache.wicket.util.convert.IConverter)

Example 4 with FieldsetPanel

use of org.projectforge.web.wicket.flowlayout.FieldsetPanel in project projectforge by micromata.

the class AccessEditForm method init.

@SuppressWarnings("serial")
@Override
protected void init() {
    super.init();
    gridBuilder.newGridPanel();
    {
        // Task
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("task"));
        final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(data, "task"), parentPage, "taskId");
        fs.add(taskSelectPanel.setRequired(true));
        taskSelectPanel.init();
    }
    {
        // Group
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("group")).suppressLabelForWarning();
        groupSelectPanel = new NewGroupSelectPanel(fs.newChildId(), new PropertyModel<GroupDO>(data, "group"), parentPage, "groupId");
        fs.add(groupSelectPanel.setRequired(true));
        groupSelectPanel.init();
    }
    {
        // Option recursive
        gridBuilder.newFieldset(getString("recursive")).addCheckBox(new PropertyModel<Boolean>(data, "recursive"), null).setTooltip(getString("access.recursive.help"));
    }
    {
        // Access entries table
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("access.accessTable")).suppressLabelForWarning();
        final AccessEditTablePanel accessEditTablePanel = new AccessEditTablePanel(fs.newChildId(), data);
        fs.add(accessEditTablePanel);
        accessEditTablePanel.init();
    }
    {
        // Templates
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("access.templates")).suppressLabelForWarning();
        fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("clear")) {

            @Override
            public final void onSubmit() {
                data.clear();
            }
        }, getString("access.templates.clear"), SingleButtonPanel.NORMAL));
        fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("guest")) {

            @Override
            public final void onSubmit() {
                data.guest();
            }
        }, getString("access.templates.guest"), SingleButtonPanel.NORMAL));
        fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("employee")) {

            @Override
            public final void onSubmit() {
                data.employee();
            }
        }, getString("access.templates.employee"), SingleButtonPanel.NORMAL));
        fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("leader")) {

            @Override
            public final void onSubmit() {
                data.leader();
            }
        }, getString("access.templates.leader"), SingleButtonPanel.NORMAL));
        fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("administrator")) {

            @Override
            public final void onSubmit() {
                data.administrator();
            }
        }, getString("access.templates.administrator"), SingleButtonPanel.DANGER));
    }
    {
        // Description
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("description"));
        fs.add(new MaxLengthTextArea(fs.getTextAreaId(), new PropertyModel<String>(data, "description")), true);
    }
}
Also used : PropertyModel(org.apache.wicket.model.PropertyModel) MaxLengthTextArea(org.projectforge.web.wicket.components.MaxLengthTextArea) TaskSelectPanel(org.projectforge.web.task.TaskSelectPanel) NewGroupSelectPanel(org.projectforge.web.user.NewGroupSelectPanel) Button(org.apache.wicket.markup.html.form.Button) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) FieldsetPanel(org.projectforge.web.wicket.flowlayout.FieldsetPanel) SingleButtonPanel(org.projectforge.web.wicket.components.SingleButtonPanel) GroupDO(org.projectforge.framework.persistence.user.entities.GroupDO)

Example 5 with FieldsetPanel

use of org.projectforge.web.wicket.flowlayout.FieldsetPanel in project projectforge by micromata.

the class AccessListForm method init.

@SuppressWarnings("serial")
@Override
protected void init() {
    super.init();
    gridBuilder.newSplitPanel(GridSize.COL66);
    {
        // Group
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("group")).suppressLabelForWarning();
        groupSelectPanel = new NewGroupSelectPanel(fs.newChildId(), new Model<GroupDO>() {

            @Override
            public GroupDO getObject() {
                return groupService.getGroup(getSearchFilter().getGroupId());
            }

            @Override
            public void setObject(final GroupDO object) {
                if (object == null) {
                    getSearchFilter().setGroupId(null);
                } else {
                    getSearchFilter().setGroupId(object.getId());
                }
            }
        }, parentPage, "groupId");
        fs.add(groupSelectPanel);
        groupSelectPanel.setDefaultFormProcessing(false);
        groupSelectPanel.init();
    }
    gridBuilder.newSplitPanel(GridSize.COL33);
    {
        // User
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("user")).suppressLabelForWarning();
        final UserSelectPanel assigneeSelectPanel = new UserSelectPanel(fs.newChildId(), new Model<PFUserDO>() {

            @Override
            public PFUserDO getObject() {
                return userGroupCache.getUser(getSearchFilter().getUserId());
            }

            @Override
            public void setObject(final PFUserDO object) {
                if (object == null) {
                    getSearchFilter().setUserId(null);
                } else {
                    getSearchFilter().setUserId(object.getId());
                }
            }
        }, parentPage, "userId");
        fs.add(assigneeSelectPanel);
        assigneeSelectPanel.setDefaultFormProcessing(false);
        assigneeSelectPanel.init().withAutoSubmit(true);
        fs.addHelpIcon(getString("access.tooltip.filter.user"));
    }
    gridBuilder.newGridPanel();
    {
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("task")).suppressLabelForWarning();
        final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new Model<TaskDO>() {

            @Override
            public TaskDO getObject() {
                return taskTree.getTaskById(getSearchFilter().getTaskId());
            }

            @Override
            public void setObject(final TaskDO task) {
                if (task != null) {
                    getSearchFilter().setTaskId(task.getId());
                } else {
                    getSearchFilter().setTaskId(null);
                }
            }
        }, parentPage, "taskId");
        fs.add(taskSelectPanel);
        taskSelectPanel.init();
        taskSelectPanel.setRequired(false);
    }
}
Also used : UserSelectPanel(org.projectforge.web.user.UserSelectPanel) TaskDO(org.projectforge.business.task.TaskDO) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) FieldsetPanel(org.projectforge.web.wicket.flowlayout.FieldsetPanel) TaskSelectPanel(org.projectforge.web.task.TaskSelectPanel) NewGroupSelectPanel(org.projectforge.web.user.NewGroupSelectPanel) PFUserDO(org.projectforge.framework.persistence.user.entities.PFUserDO) GroupDO(org.projectforge.framework.persistence.user.entities.GroupDO)

Aggregations

FieldsetPanel (org.projectforge.web.wicket.flowlayout.FieldsetPanel)69 PropertyModel (org.apache.wicket.model.PropertyModel)39 Model (org.apache.wicket.model.Model)18 Button (org.apache.wicket.markup.html.form.Button)17 SingleButtonPanel (org.projectforge.web.wicket.components.SingleButtonPanel)15 DivTextPanel (org.projectforge.web.wicket.flowlayout.DivTextPanel)15 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)13 DivPanel (org.projectforge.web.wicket.flowlayout.DivPanel)10 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)9 MaxLengthTextArea (org.projectforge.web.wicket.components.MaxLengthTextArea)9 PFUserDO (org.projectforge.framework.persistence.user.entities.PFUserDO)8 TaskSelectPanel (org.projectforge.web.task.TaskSelectPanel)8 LabelValueChoiceRenderer (org.projectforge.web.wicket.components.LabelValueChoiceRenderer)8 AjaxButton (org.apache.wicket.ajax.markup.html.form.AjaxButton)7 FileUploadField (org.apache.wicket.markup.html.form.upload.FileUploadField)7 IFormValidator (org.apache.wicket.markup.html.form.validation.IFormValidator)7 GroupDO (org.projectforge.framework.persistence.user.entities.GroupDO)7 UserSelectPanel (org.projectforge.web.user.UserSelectPanel)7 FileUploadPanel (org.projectforge.web.wicket.flowlayout.FileUploadPanel)7 ResourceModel (org.apache.wicket.model.ResourceModel)6