Search in sources :

Example 21 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project midpoint by Evolveum.

the class TaskSubtasksAndThreadsPanel method initLayout.

protected void initLayout() {
    Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
    add(subtasksLabel);
    TaskTablePanel subtasksPanel = new TaskTablePanel(ID_SUBTASKS_PANEL, createOperationOptions()) {

        @Override
        protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
            return createSelectableBeanObjectDataProvider(() -> createSubtasksQuery(), null);
        }

        @Override
        protected List<Component> createToolbarButtonsList(String buttonId) {
            return new ArrayList<>();
        }

        @Override
        protected List<IColumn<SelectableBean<TaskType>, String>> createDefaultColumns() {
            List<IColumn<SelectableBean<TaskType>, String>> columns = super.createDefaultColumns();
            // });
            return columns;
        }

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.TABLE_SUBTASKS;
        }

        @Override
        @NotNull
        protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
            return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, getObjectDetailsModels().getRootTaskModelObject());
        }
    };
    add(subtasksPanel);
    Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
    add(workerThreadsTableLabel);
    TaskTablePanel workerThreadsTable = new TaskTablePanel(ID_WORKER_THREADS_TABLE, null) {

        @Override
        protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
            return new SelectableListDataProvider<>(TaskSubtasksAndThreadsPanel.this, createWorkersModel());
        }

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.TABLE_WORKERS;
        }

        @Override
        protected boolean isHeaderVisible() {
            return false;
        }

        @Override
        protected List<Component> createToolbarButtonsList(String buttonId) {
            return new ArrayList<>();
        }

        @Override
        @NotNull
        protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
            return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, getObjectDetailsModels().getRootTaskModelObject());
        }
    };
    add(workerThreadsTable);
}
Also used : UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) TaskTablePanel(com.evolveum.midpoint.web.page.admin.server.TaskTablePanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) SelectableListDataProvider(com.evolveum.midpoint.web.component.util.SelectableListDataProvider) Label(org.apache.wicket.markup.html.basic.Label) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) ArrayList(java.util.ArrayList) ResourceModel(org.apache.wicket.model.ResourceModel) Component(org.apache.wicket.Component)

Example 22 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project midpoint by Evolveum.

the class TaskSubtasksAndThreadsTabPanel method initLayout.

private void initLayout() {
    Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
    add(subtasksLabel);
    TaskTablePanel subtasksPanel = new TaskTablePanel(ID_SUBTASKS_PANEL, createOperationOptions()) {

        @Override
        protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
            return createSelectableBeanObjectDataProvider(() -> createSubtasksQuery(), null);
        }

        @Override
        protected List<IColumn<SelectableBean<TaskType>, String>> createDefaultColumns() {
            List<IColumn<SelectableBean<TaskType>, String>> columns = super.createDefaultColumns();
            // });
            return columns;
        }

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.TABLE_SUBTASKS;
        }

        @Override
        @NotNull
        protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
            return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, rootTaskModel.getObject());
        }
    };
    add(subtasksPanel);
    Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
    add(workerThreadsTableLabel);
    TaskTablePanel workerThreadsTable = new TaskTablePanel(ID_WORKER_THREADS_TABLE, null) {

        @Override
        protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
            return new SelectableListDataProvider<>(TaskSubtasksAndThreadsTabPanel.this, createWorkersModel());
        }

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.TABLE_WORKERS;
        }

        @Override
        protected boolean isHeaderVisible() {
            return false;
        }

        @Override
        @NotNull
        protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
            return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, rootTaskModel.getObject());
        }
    };
    add(workerThreadsTable);
}
Also used : UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) SelectableListDataProvider(com.evolveum.midpoint.web.component.util.SelectableListDataProvider) Label(org.apache.wicket.markup.html.basic.Label) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) ResourceModel(org.apache.wicket.model.ResourceModel)

Example 23 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project the-app by devops-dojo.

the class HomePage method topSellerPanel.

private Component topSellerPanel() {
    boolean userAuthorized = isUserAuthorized();
    String ressourceKey = userAuthorized ? "your.favorite.products.topic" : "category.top.seller.topic";
    String recommenderType = userAuthorized ? "FAVORITE_PRODUCTS" : "STARTPAGE_TOPSELLER";
    return new RecommendationItemListPanel("topSellerProductsContainer", feedback, recommenderType, new ResourceModel(ressourceKey), new LoadableDetachableModel<List<ProductInfo>>() {

        @Override
        protected List<ProductInfo> load() {
            return recommendationService.getTopsellerRecommendations(4);
        }
    }) {
    };
}
Also used : RecommendationItemListPanel(io.github.zutherb.appstash.shop.ui.panel.product.RecommendationItemListPanel) ResourceModel(org.apache.wicket.model.ResourceModel) List(java.util.List)

Example 24 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project oc-explorer by devgateway.

the class ListViewSectionPanel method getAddNewChildButton.

/**
 * Returns the new child button
 *
 * @return
 */
protected BootstrapAddButton getAddNewChildButton() {
    BootstrapAddButton newButton = new BootstrapAddButton("newButton", new ResourceModel("newButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            @SuppressWarnings("unchecked") T newChild = createNewChild((IModel<PARENT>) ListViewSectionPanel.this.getParent().getDefaultModel());
            ListViewSectionPanel.this.getModel().getObject().add(newChild);
            listView.removeAll();
            target.add(listWrapper);
        }
    };
    newButton.setOutputMarkupPlaceholderTag(true);
    return newButton;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) BootstrapAddButton(org.devgateway.toolkit.forms.wicket.components.form.BootstrapAddButton) Form(org.apache.wicket.markup.html.form.Form) ResourceModel(org.apache.wicket.model.ResourceModel)

Example 25 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project oc-explorer by devgateway.

the class BasePage method newMyDashboardsMenu.

protected NavbarButton<ListMyDashboardsPage> newMyDashboardsMenu() {
    // home
    NavbarButton<ListMyDashboardsPage> menu = new NavbarButton<>(ListMyDashboardsPage.class, this.getPageParameters(), new ResourceModel("mydashboards"));
    menu.setIconType(GlyphIconType.filter);
    MetaDataRoleAuthorizationStrategy.authorize(menu, Component.RENDER, SecurityConstants.Roles.ROLE_PROCURING_ENTITY);
    return menu;
}
Also used : ListMyDashboardsPage(org.devgateway.ocds.forms.wicket.page.list.ListMyDashboardsPage) NavbarButton(de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarButton) ResourceModel(org.apache.wicket.model.ResourceModel) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Aggregations

ResourceModel (org.apache.wicket.model.ResourceModel)48 ArrayList (java.util.ArrayList)20 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)19 Label (org.apache.wicket.markup.html.basic.Label)17 StringResourceModel (org.apache.wicket.model.StringResourceModel)15 Panel (org.apache.wicket.markup.html.panel.Panel)11 List (java.util.List)9 AbstractTab (org.apache.wicket.extensions.markup.html.tabs.AbstractTab)9 AjaxBootstrapTabbedPanel (de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel)8 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)8 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)8 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)6 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)5 Form (org.apache.wicket.markup.html.form.Form)5 Serializable (java.io.Serializable)4 HashMap (java.util.HashMap)4 WizardMgtPanel (org.apache.syncope.client.console.wizards.WizardMgtPanel)4 Fragment (org.apache.wicket.markup.html.panel.Fragment)4 NavbarButton (de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarButton)3 StringUtils (org.apache.commons.lang3.StringUtils)3