Search in sources :

Example 1 with DivTextPanel

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

the class MonthlyEmployeeReportForm method init.

@SuppressWarnings("serial")
@Override
protected void init() {
    super.init();
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("timesheet.user"));
        if (accessChecker.hasLoggedInUserAccessToTimesheetsOfOtherUsers()) {
            final UserSelectPanel userSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(filter, "user"), parentPage, "user");
            userSelectPanel.setRequired(true);
            fs.add(userSelectPanel);
            userSelectPanel.init();
        } else {
            filter.setUser(ThreadLocalUserContext.getUser());
            fs.add(new DivTextPanel(fs.newChildId(), filter.getUser().getFullname()));
        }
    }
    gridBuilder.newSplitPanel(GridSize.COL50);
    {
        final FieldsetPanel fs = gridBuilder.newFieldset(getString("calendar.month"));
        yearChoice = new DropDownChoice<Integer>(fs.getDropDownChoiceId(), new PropertyModel<Integer>(filter, "year"), new ArrayList<Integer>()) {

            /**
             * @see org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
             */
            @Override
            protected boolean wantOnSelectionChangedNotifications() {
                return true;
            }
        };
        yearChoice.setNullValid(false).setRequired(true);
        fs.add(yearChoice);
        // DropDownChoice months
        final LabelValueChoiceRenderer<Integer> monthChoiceRenderer = new LabelValueChoiceRenderer<Integer>();
        for (int month = 1; month <= 12; month++) {
            monthChoiceRenderer.addValue(month, StringHelper.format2DigitNumber(month));
        }
        monthChoice = new DropDownChoice<Integer>(fs.getDropDownChoiceId(), new PropertyModel<Integer>(filter, "month"), monthChoiceRenderer.getValues(), monthChoiceRenderer) {

            /**
             * @see org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
             */
            @Override
            protected boolean wantOnSelectionChangedNotifications() {
                return true;
            }
        };
        monthChoice.setNullValid(false).setRequired(true);
        fs.add(monthChoice);
        final QuickSelectMonthPanel quickSelectPanel = new QuickSelectMonthPanel(fs.newChildId(), new Model<LocalDate>() {

            /**
             * @see org.apache.wicket.model.Model#getObject()
             */
            @Override
            public LocalDate getObject() {
                Integer year = filter.getYear();
                Integer month = filter.getMonth();
                PFDateTime date;
                if (year == null || month == null) {
                    date = PFDateTime.now().getBeginOfMonth();
                } else {
                    date = PFDateTime.withDate(filter.getYear(), PFDayUtils.validateMonthValue(filter.getMonth()), 1);
                }
                return date.getLocalDate();
            }

            /**
             * @see org.apache.wicket.model.Model#setObject(java.io.Serializable)
             */
            @Override
            public void setObject(final LocalDate object) {
                if (object != null) {
                    setDate(object);
                }
            }
        }, parentPage, "quickSelect");
        fs.add(quickSelectPanel);
        quickSelectPanel.init();
    }
    {
        final Button showButton = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("show"));
        final SingleButtonPanel showButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), showButton, getString("show"), SingleButtonPanel.DEFAULT_SUBMIT);
        actionButtons.add(showButtonPanel);
        setDefaultButton(showButton);
    }
}
Also used : PropertyModel(org.apache.wicket.model.PropertyModel) LocalDate(java.time.LocalDate) PFDateTime(org.projectforge.framework.time.PFDateTime) QuickSelectMonthPanel(org.projectforge.web.calendar.QuickSelectMonthPanel) UserSelectPanel(org.projectforge.web.user.UserSelectPanel) DivTextPanel(org.projectforge.web.wicket.flowlayout.DivTextPanel) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) Button(org.apache.wicket.markup.html.form.Button) LabelValueChoiceRenderer(org.projectforge.web.wicket.components.LabelValueChoiceRenderer) 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)

Example 2 with DivTextPanel

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

the class AccountingRecordListForm method onOptionsPanelCreate.

/**
 * @see org.projectforge.web.wicket.AbstractListForm#onOptionsPanelCreate(org.projectforge.web.wicket.flowlayout.FieldsetPanel,
 * org.projectforge.web.wicket.flowlayout.DivPanel)
 */
@Override
protected void onOptionsPanelCreate(final FieldsetPanel optionsFieldsetPanel, final DivPanel optionsCheckBoxesPanel) {
    // DropDownChoices from
    final YearListCoiceRenderer yearListChoiceRenderer = new YearListCoiceRenderer(buchungssatzDao.getYears(), false);
    final DropDownChoice<Integer> fromYearChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "fromYear"), yearListChoiceRenderer.getYears(), yearListChoiceRenderer);
    fromYearChoice.setNullValid(false).setRequired(true);
    optionsFieldsetPanel.add(fromYearChoice);
    final LabelValueChoiceRenderer<Integer> monthChoiceRenderer = new LabelValueChoiceRenderer<Integer>();
    for (int i = 1; i <= 12; i++) {
        monthChoiceRenderer.addValue(i, StringHelper.format2DigitNumber(i));
    }
    final DropDownChoice<Integer> fromMonthChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "fromMonth"), monthChoiceRenderer.getValues(), monthChoiceRenderer);
    fromMonthChoice.setNullValid(true);
    optionsFieldsetPanel.add(fromMonthChoice);
    optionsFieldsetPanel.add(new DivTextPanel(optionsFieldsetPanel.newChildId(), " - "));
    // DropDownChoices to
    final DropDownChoice<Integer> toYearChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "toYear"), yearListChoiceRenderer.getYears(), yearListChoiceRenderer);
    toYearChoice.setNullValid(false).setRequired(true);
    optionsFieldsetPanel.add(toYearChoice);
    final DropDownChoice<Integer> toMonthChoice = new DropDownChoice<Integer>(optionsFieldsetPanel.getDropDownChoiceId(), new PropertyModel<Integer>(this, "toMonth"), monthChoiceRenderer.getValues(), monthChoiceRenderer);
    toMonthChoice.setNullValid(true);
    optionsFieldsetPanel.add(toMonthChoice);
}
Also used : DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) DivTextPanel(org.projectforge.web.wicket.flowlayout.DivTextPanel) LabelValueChoiceRenderer(org.projectforge.web.wicket.components.LabelValueChoiceRenderer) YearListCoiceRenderer(org.projectforge.web.wicket.components.YearListCoiceRenderer)

Example 3 with DivTextPanel

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

the class ModalMessageDialog method setMessage.

/**
 * Don't use this method for updating messages.
 * @param message
 * @return this for chaining.
 */
public ModalMessageDialog setMessage(final IModel<String> message) {
    this.messageModel = message;
    final DivTextPanel textPanel = new DivTextPanel(getMessageComponentId(), message);
    gridContentContainer.add(textPanel);
    messageComponent = textPanel.getDiv().setOutputMarkupId(true);
    return this;
}
Also used : DivTextPanel(org.projectforge.web.wicket.flowlayout.DivTextPanel)

Example 4 with DivTextPanel

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

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

the class SqlConsoleForm method init.

@Override
@SuppressWarnings("serial")
protected void init() {
    super.init();
    gridBuilder.newGridPanel();
    {
        final FieldsetPanel fs = gridBuilder.newFieldset("SQL");
        final MaxLengthTextArea sqlTextArea = new MaxLengthTextArea(TextAreaPanel.WICKET_ID, new PropertyModel<String>(this, "sql"), 10000);
        sqlTextArea.add(AttributeModifier.append("style", "width: 100%; height: 5em;"));
        fs.add(sqlTextArea);
    }
    {
        final FieldsetPanel fs = gridBuilder.newFieldset("").suppressLabelForWarning();
        final Button button = new Button(SingleButtonPanel.WICKET_ID, new Model<String>()) {

            @Override
            public final void onSubmit() {
                parentPage.excecute(sql);
            }
        };
        final SingleButtonPanel buttonPanel = new SingleButtonPanel(fs.newChildId(), button, "execute", SingleButtonPanel.DANGER);
        fs.add(buttonPanel);
    }
    gridBuilder.newGridPanel();
    final DivPanel section = gridBuilder.getPanel();
    final DivTextPanel resultPanel = new DivTextPanel(section.newChildId(), new Model<String>() {

        @Override
        public String getObject() {
            return resultString;
        }
    });
    resultPanel.getLabel().setEscapeModelStrings(false);
    section.add(resultPanel);
}
Also used : DivTextPanel(org.projectforge.web.wicket.flowlayout.DivTextPanel) Button(org.apache.wicket.markup.html.form.Button) MaxLengthTextArea(org.projectforge.web.wicket.components.MaxLengthTextArea) PropertyModel(org.apache.wicket.model.PropertyModel) PropertyModel(org.apache.wicket.model.PropertyModel) Model(org.apache.wicket.model.Model) FieldsetPanel(org.projectforge.web.wicket.flowlayout.FieldsetPanel) DivPanel(org.projectforge.web.wicket.flowlayout.DivPanel) SingleButtonPanel(org.projectforge.web.wicket.components.SingleButtonPanel)

Aggregations

DivTextPanel (org.projectforge.web.wicket.flowlayout.DivTextPanel)20 FieldsetPanel (org.projectforge.web.wicket.flowlayout.FieldsetPanel)13 PropertyModel (org.apache.wicket.model.PropertyModel)12 Model (org.apache.wicket.model.Model)10 Button (org.apache.wicket.markup.html.form.Button)8 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)7 SingleButtonPanel (org.projectforge.web.wicket.components.SingleButtonPanel)7 DivPanel (org.projectforge.web.wicket.flowlayout.DivPanel)7 UserSelectPanel (org.projectforge.web.user.UserSelectPanel)5 LabelValueChoiceRenderer (org.projectforge.web.wicket.components.LabelValueChoiceRenderer)5 MaxLengthTextArea (org.projectforge.web.wicket.components.MaxLengthTextArea)5 AjaxButton (org.apache.wicket.ajax.markup.html.form.AjaxButton)4 IFormValidator (org.apache.wicket.markup.html.form.validation.IFormValidator)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 Form (org.apache.wicket.markup.html.form.Form)3 TaskSelectPanel (org.projectforge.web.task.TaskSelectPanel)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 BooleanSupplier (java.util.function.BooleanSupplier)2 FormComponent (org.apache.wicket.markup.html.form.FormComponent)2