Search in sources :

Example 1 with DivPanel

use of org.projectforge.web.wicket.flowlayout.DivPanel 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 2 with DivPanel

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

the class EmployeeConfigurationForm method init.

@Override
protected void init() {
    super.init();
    // AttrPanels
    // set hasSubSplitPanel to true to remove borders from this split panel
    gridBuilder.newSplitPanel(GridSize.COL100, true);
    final DivPanel divPanel = gridBuilder.getPanel();
    final Function<AttrGroup, EmployeeConfigurationTimedDO> addNewEntryFunction = group -> employeeConfigurationService.addNewTimeAttributeRow(data, group.getName());
    attrSchemaService.createAttrPanels(divPanel, data, parentPage, addNewEntryFunction);
}
Also used : AccessException(org.projectforge.framework.access.AccessException) SpringBean(org.apache.wicket.spring.injection.annot.SpringBean) EmployeeConfigurationDO(org.projectforge.plugins.eed.model.EmployeeConfigurationDO) Logger(org.slf4j.Logger) GridSize(org.projectforge.web.wicket.bootstrap.GridSize) EmployeeConfigurationService(org.projectforge.plugins.eed.service.EmployeeConfigurationService) Function(java.util.function.Function) UserRightValue(org.projectforge.business.user.UserRightValue) AttrGroup(de.micromata.genome.db.jpa.tabattr.api.AttrGroup) GuiAttrSchemaService(org.projectforge.framework.persistence.attr.impl.GuiAttrSchemaService) EmployeeConfigurationTimedDO(org.projectforge.plugins.eed.model.EmployeeConfigurationTimedDO) DivPanel(org.projectforge.web.wicket.flowlayout.DivPanel) AbstractEditForm(org.projectforge.web.wicket.AbstractEditForm) UserRightId(org.projectforge.business.user.UserRightId) EmployeeConfigurationTimedDO(org.projectforge.plugins.eed.model.EmployeeConfigurationTimedDO) DivPanel(org.projectforge.web.wicket.flowlayout.DivPanel) AttrGroup(de.micromata.genome.db.jpa.tabattr.api.AttrGroup)

Example 3 with DivPanel

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

the class DatevImportForm method init.

@SuppressWarnings("serial")
@Override
protected void init() {
    super.init();
    this.setOutputMarkupId(true);
    Bytes maxSize = Bytes.valueOf(configurationService.getMaxFileSizeDatev());
    this.setMaxSize(maxSize);
    gridBuilder.newGridPanel();
    String hint = I18nHelper.getLocalizedMessage("finance.datev.upload.hint", NumberHelper.formatBytes(maxSize.bytes()));
    final FieldsetPanel fs = gridBuilder.newFieldset(getString("file"), hint);
    fileUploadField = new FileUploadField(FileUploadPanel.WICKET_ID);
    fs.add(new FileUploadPanel(fs.newChildId(), fileUploadField));
    fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("uploadAccounts")) {

        @Override
        public final void onSubmit() {
            parentPage.importAccountList();
        }
    }, getString("finance.datev.uploadAccountList"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip")));
    fs.add(new SingleButtonPanel(fs.newChildId(), new Button(SingleButtonPanel.WICKET_ID, new Model<String>("uploadRecords")) {

        @Override
        public final void onSubmit() {
            parentPage.importAccountRecords();
        }
    }, getString("finance.datev.uploadAccountingRecords"), SingleButtonPanel.NORMAL).setTooltip(getString("common.import.upload.tooltip")));
    addClearButton(fs);
    addImportFilterRadio(gridBuilder);
    // Statistics
    new BusinessAssessment4Fieldset(gridBuilder) {

        /**
         * @see org.projectforge.web.fibu.BusinessAssessment4Fieldset#getBusinessAssessment()
         */
        @Override
        protected BusinessAssessment getBusinessAssessment() {
            return storagePanel.businessAssessment;
        }

        @Override
        public boolean isVisible() {
            return storagePanel.businessAssessment != null;
        }
    };
    gridBuilder.newGridPanel();
    final DivPanel panel = gridBuilder.getPanel();
    storagePanel = new DatevImportStoragePanel(panel.newChildId(), parentPage, importFilter);
    panel.add(storagePanel);
    this.fileUploadField.add(new FileFieldSizeCheckBehavior() {

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final FileList fileList) {
            // return form to remove errors
            target.add(DatevImportForm.this.feedbackPanel);
        }

        @Override
        protected void addErrorMsg(AjaxRequestTarget target, FileList fileList) {
            DatevImportForm.this.addError("common.uploadpanel.filetolarge", NumberHelper.formatBytes(maxSize.bytes()));
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final FileList fileList) {
            // clear input field to avoid uploading the image
            DatevImportForm.this.fileUploadField.clearInput();
            // return form
            target.add(DatevImportForm.this);
        }
    });
}
Also used : FileList(org.wicketstuff.html5.fileapi.FileList) FileUploadField(org.apache.wicket.markup.html.form.upload.FileUploadField) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Bytes(org.apache.wicket.util.lang.Bytes) Button(org.apache.wicket.markup.html.form.Button) FileFieldSizeCheckBehavior(org.wicketstuff.html5.fileapi.FileFieldSizeCheckBehavior) Model(org.apache.wicket.model.Model) 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 4 with DivPanel

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

the class PluginListForm method init.

@Override
protected void init() {
    super.init();
    List<AbstractPlugin> availables = pluginAdminService.getAvailablePlugins();
    List<String> activatedPlugins = pluginAdminService.getActivatedPluginsFromConfiguration();
    gridBuilder.newFormHeading("Please note: (de)activation of plugins will take effect only after restart!");
    for (AbstractPlugin plugin : availables) {
        gridBuilder.newGridPanel();
        gridBuilder.newSplitPanel(GridSize.SPAN2);
        DivPanel section = gridBuilder.getPanel();
        DivTextPanel pluginId = new DivTextPanel(section.newChildId(), new Model<String>() {

            @Override
            public String getObject() {
                return plugin.getInfo().getId();
            }
        });
        section.add(pluginId);
        gridBuilder.newSplitPanel(GridSize.SPAN8);
        section = gridBuilder.getPanel();
        pluginId = new DivTextPanel(section.newChildId(), new Model<String>() {

            @Override
            public String getObject() {
                return plugin.getInfo().getDescription();
            }
        });
        section.add(pluginId);
        gridBuilder.newSplitPanel(GridSize.SPAN2);
        section = gridBuilder.getPanel();
        final Button button = new Button(SingleButtonPanel.WICKET_ID, new Model<String>()) {

            @Override
            public final void onSubmit() {
                pluginAdminService.storePluginToBeActivated(plugin.getInfo().getId(), !isActivated(activatedPlugins, plugin));
                setResponsePage(new PluginListPage(getPage().getPageParameters()));
            }
        };
        final SingleButtonPanel buttonPanel = new SingleButtonPanel(section.newChildId(), button, isActivated(activatedPlugins, plugin) ? getString("system.pluginAdmin.button.deactivate") : getString("system.pluginAdmin.button.activate"), SingleButtonPanel.DANGER);
        if (isActivated(activatedPlugins, plugin)) {
            buttonPanel.setClassnames(SingleButtonPanel.SUCCESS);
        }
        section.add(buttonPanel);
    }
}
Also used : DivTextPanel(org.projectforge.web.wicket.flowlayout.DivTextPanel) Button(org.apache.wicket.markup.html.form.Button) Model(org.apache.wicket.model.Model) AbstractPlugin(org.projectforge.plugins.core.AbstractPlugin) DivPanel(org.projectforge.web.wicket.flowlayout.DivPanel) SingleButtonPanel(org.projectforge.web.wicket.components.SingleButtonPanel)

Example 5 with DivPanel

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

the class AbstractImportForm method addImportFilterRadio.

/**
 * @return this for chaining.
 */
@SuppressWarnings("serial")
protected AbstractImportForm<F, P, S> addImportFilterRadio(final GridBuilder gridBuilder) {
    final FieldsetPanel fs = new FieldsetPanel(gridBuilder.getPanel(), getString("filter")) {

        /**
         * @see org.apache.wicket.Component#isVisible()
         */
        @Override
        public boolean isVisible() {
            return storagePanel.isVisible();
        }
    };
    final DivPanel radioGroupPanel = fs.addNewRadioBoxButtonDiv();
    final RadioGroupPanel<String> radioGroup = new RadioGroupPanel<String>(radioGroupPanel.newChildId(), "filterType", new PropertyModel<String>(importFilter, "listType")) {

        /**
         * @see org.projectforge.web.wicket.flowlayout.RadioGroupPanel#wantOnSelectionChangedNotifications()
         */
        @Override
        protected boolean wantOnSelectionChangedNotifications() {
            return true;
        }
    };
    radioGroupPanel.add(radioGroup);
    fs.setLabelFor(radioGroup.getRadioGroup());
    radioGroup.add(new Model<String>("all"), getString("filter.all"));
    radioGroup.add(new Model<String>("modified"), getString("modified"));
    radioGroup.add(new Model<String>("faulty"), getString("filter.faulty"));
    return this;
}
Also used : FieldsetPanel(org.projectforge.web.wicket.flowlayout.FieldsetPanel) DivPanel(org.projectforge.web.wicket.flowlayout.DivPanel) RadioGroupPanel(org.projectforge.web.wicket.flowlayout.RadioGroupPanel)

Aggregations

DivPanel (org.projectforge.web.wicket.flowlayout.DivPanel)23 Button (org.apache.wicket.markup.html.form.Button)11 FieldsetPanel (org.projectforge.web.wicket.flowlayout.FieldsetPanel)11 SingleButtonPanel (org.projectforge.web.wicket.components.SingleButtonPanel)10 Model (org.apache.wicket.model.Model)9 PropertyModel (org.apache.wicket.model.PropertyModel)9 DivTextPanel (org.projectforge.web.wicket.flowlayout.DivTextPanel)7 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)5 FileUploadField (org.apache.wicket.markup.html.form.upload.FileUploadField)5 FileUploadPanel (org.projectforge.web.wicket.flowlayout.FileUploadPanel)5 Date (java.util.Date)4 List (java.util.List)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 IModel (org.apache.wicket.model.IModel)3 AttrGroup (de.micromata.genome.db.jpa.tabattr.api.AttrGroup)2 GregorianCalendar (java.util.GregorianCalendar)2 Function (java.util.function.Function)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 IChoiceRenderer (org.apache.wicket.markup.html.form.IChoiceRenderer)2 ResourceModel (org.apache.wicket.model.ResourceModel)2