Search in sources :

Example 1 with NavigatorPanel

use of com.evolveum.midpoint.web.component.data.paging.NavigatorPanel in project midpoint by Evolveum.

the class SynchronizationStep method initLayout.

private void initLayout() {
    final ListDataProvider<ObjectSynchronizationType> syncProvider = new ListDataProvider<>(this, new PropertyModel<List<ObjectSynchronizationType>>(syncDtoModel, ResourceSynchronizationDto.F_OBJECT_SYNCRONIZATION_LIST));
    //first row - object sync list
    WebMarkupContainer tableBody = new WebMarkupContainer(ID_TABLE_ROWS);
    tableBody.setOutputMarkupId(true);
    add(tableBody);
    //second row - ObjectSynchronizationType editor
    WebMarkupContainer objectSyncEditor = new WebMarkupContainer(ID_OBJECT_SYNC_EDITOR);
    objectSyncEditor.setOutputMarkupId(true);
    objectSyncEditor.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isAnySelected();
        }
    });
    add(objectSyncEditor);
    //third row - container for more specific editors
    WebMarkupContainer thirdRowContainer = new WebMarkupContainer(ID_THIRD_ROW_CONTAINER);
    thirdRowContainer.setOutputMarkupId(true);
    add(thirdRowContainer);
    DataView<ObjectSynchronizationType> syncDataView = new DataView<ObjectSynchronizationType>(ID_OBJECT_SYNC_ROW, syncProvider, UserProfileStorage.DEFAULT_PAGING_SIZE) {

        @Override
        protected void populateItem(Item<ObjectSynchronizationType> item) {
            final ObjectSynchronizationType syncObject = item.getModelObject();
            AjaxSubmitLink link = new AjaxSubmitLink(ID_OBJECT_SYNC_LINK) {

                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    editSyncObjectPerformed(target, syncObject);
                }
            };
            item.add(link);
            Label label = new Label(ID_OBJECT_SYNC_LABEL, createObjectSyncTypeDisplayModel(syncObject));
            label.setOutputMarkupId(true);
            link.add(label);
            AjaxLink delete = new AjaxLink(ID_OBJECT_SYNC_DELETE) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteSyncObjectPerformed(target, syncObject);
                }
            };
            parentPage.addEditingVisibleBehavior(delete);
            link.add(delete);
            item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (isSelected(syncObject)) {
                        return "success";
                    }
                    return null;
                }
            }));
        }
    };
    tableBody.add(syncDataView);
    NavigatorPanel navigator = new NavigatorPanel(ID_PAGING, syncDataView, true);
    navigator.setOutputMarkupId(true);
    navigator.setOutputMarkupPlaceholderTag(true);
    add(navigator);
    AjaxLink add = new AjaxLink(ID_OBJECT_SYNC_ADD) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addSyncObjectPerformed(target);
        }
    };
    parentPage.addEditingVisibleBehavior(add);
    add(add);
    initObjectSyncEditor(objectSyncEditor);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Label(org.apache.wicket.markup.html.basic.Label) AjaxSubmitLink(org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DataView(org.apache.wicket.markup.repeater.data.DataView) ListItem(org.apache.wicket.markup.html.list.ListItem) Item(org.apache.wicket.markup.repeater.Item) NavigatorPanel(com.evolveum.midpoint.web.component.data.paging.NavigatorPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Example 2 with NavigatorPanel

use of com.evolveum.midpoint.web.component.data.paging.NavigatorPanel in project midpoint by Evolveum.

the class SchemaListPanel method initLayout.

protected void initLayout() {
    final ObjectClassDataProvider dataProvider = new ObjectClassDataProvider(allClasses);
    TextField objectClass = new TextField<>(ID_OBJECT_CLASS, new Model<>());
    objectClass.setOutputMarkupId(true);
    objectClass.add(new AjaxFormComponentUpdatingBehavior("keyup") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            updateSearchPerformed(target, dataProvider);
        }
    });
    add(objectClass);
    AjaxButton clearSearch = new AjaxButton(ID_CLEAR_SEARCH) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            clearSearchPerformed(target, dataProvider);
        }
    };
    add(clearSearch);
    WebMarkupContainer tableBody = new WebMarkupContainer(ID_TABLE_BODY);
    tableBody.setOutputMarkupId(true);
    add(tableBody);
    DataView<ObjectClassDto> objectClassDataView = new DataView<ObjectClassDto>(ID_OBJECT_CLASS_LIST, dataProvider, UserProfileStorage.DEFAULT_PAGING_SIZE) {

        @Override
        protected void populateItem(final Item<ObjectClassDto> item) {
            AjaxLink link = new AjaxLink(ID_CLASS_LINK) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    objectClassClickPerformed(target, item.getModelObject());
                }
            };
            item.add(link);
            Label label = new Label(ID_LABEL, new PropertyModel<>(item.getModel(), ObjectClassDto.F_DISPLAY_NAME));
            link.add(label);
            item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<Object>() {

                @Override
                public Object getObject() {
                    return item.getModelObject().isSelected() ? "success" : null;
                }
            }));
        }
    };
    tableBody.add(objectClassDataView);
    NavigatorPanel objectClassNavigator = new NavigatorPanel(ID_NAVIGATOR, objectClassDataView, true);
    objectClassNavigator.setOutputMarkupId(true);
    objectClassNavigator.setOutputMarkupPlaceholderTag(true);
    add(objectClassNavigator);
    WebMarkupContainer objectClassInfoContainer = new WebMarkupContainer(ID_OBJECT_CLASS_INFO_CONTAINER);
    objectClassInfoContainer.setOutputMarkupId(true);
    add(objectClassInfoContainer);
    WebMarkupContainer objectClassInfoColumn = new WebMarkupContainer(ID_OBJECT_CLASS_INFO_COLUMN);
    objectClassInfoColumn.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getSelectedObjectClass() != null;
        }
    });
    objectClassInfoContainer.add(objectClassInfoColumn);
    initDetailsPanel(objectClassInfoColumn);
    ListDataProvider<AttributeDto> attributeProvider = new ListDataProvider<>(this, attributeModel, true);
    attributeProvider.setSort(AttributeDto.F_DISPLAY_ORDER, SortOrder.ASCENDING);
    BoxedTablePanel<AttributeDto> attributeTable = new BoxedTablePanel<>(ID_ATTRIBUTE_TABLE, attributeProvider, initColumns());
    attributeTable.setOutputMarkupId(true);
    attributeTable.setItemsPerPage(UserProfileStorage.DEFAULT_PAGING_SIZE);
    attributeTable.setShowPaging(true);
    objectClassInfoColumn.add(attributeTable);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) Label(org.apache.wicket.markup.html.basic.Label) ObjectClassDataProvider(com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDataProvider) ObjectClassDto(com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AttributeDto(com.evolveum.midpoint.web.component.wizard.resource.dto.AttributeDto) DataView(org.apache.wicket.markup.repeater.data.DataView) Item(org.apache.wicket.markup.repeater.Item) NavigatorPanel(com.evolveum.midpoint.web.component.data.paging.NavigatorPanel) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) TextField(org.apache.wicket.markup.html.form.TextField) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel)

Example 3 with NavigatorPanel

use of com.evolveum.midpoint.web.component.data.paging.NavigatorPanel in project midpoint by Evolveum.

the class SchemaHandlingStep method initLayout.

private void initLayout() {
    final ListDataProvider<ResourceObjectTypeDefinitionTypeDto> objectTypeProvider = new ListDataProvider<>(this, new PropertyModel<List<ResourceObjectTypeDefinitionTypeDto>>(schemaHandlingDtoModel, SchemaHandlingDto.F_OBJECT_TYPE_DTO_LIST));
    // first row - object types table
    WebMarkupContainer objectTypesTable = new WebMarkupContainer(ID_ROWS);
    objectTypesTable.setOutputMarkupId(true);
    add(objectTypesTable);
    // second row - object type editor
    WebMarkupContainer objectTypeEditor = new WebMarkupContainer(ID_OBJECT_TYPE_EDITOR);
    objectTypeEditor.setOutputMarkupId(true);
    objectTypeEditor.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isAnySelected();
        }
    });
    add(objectTypeEditor);
    // third row container
    WebMarkupContainer thirdRowContainer = new WebMarkupContainer(ID_THIRD_ROW_CONTAINER);
    thirdRowContainer.setOutputMarkupId(true);
    add(thirdRowContainer);
    // ---------------------- details -----------------------
    // Object type table (list)
    DataView<ResourceObjectTypeDefinitionTypeDto> objectTypeDataView = new DataView<ResourceObjectTypeDefinitionTypeDto>(ID_ROW_OBJECT_TYPE, objectTypeProvider, UserProfileStorage.DEFAULT_PAGING_SIZE) {

        @Override
        protected void populateItem(final Item<ResourceObjectTypeDefinitionTypeDto> item) {
            final ResourceObjectTypeDefinitionTypeDto objectType = item.getModelObject();
            AjaxSubmitLink link = new AjaxSubmitLink(ID_LINK_OBJECT_TYPE) {

                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    editObjectTypePerformed(target, objectType);
                }

                @Override
                protected void onError(AjaxRequestTarget target, Form<?> form) {
                    target.add(parentPage.getFeedbackPanel());
                }
            };
            item.add(link);
            Label label = new Label(ID_NAME_OBJECT_TYPE, createObjectTypeDisplayModel(objectType));
            label.setOutputMarkupId(true);
            link.add(label);
            AjaxLink delete = new AjaxLink(ID_BUTTON_DELETE_OBJECT_TYPE) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteObjectTypePerformed(target, objectType);
                }
            };
            parentPage.addEditingVisibleBehavior(delete);
            link.add(delete);
            item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    return isSelected(item.getModelObject()) ? "success" : null;
                }
            }));
        }
    };
    objectTypesTable.add(objectTypeDataView);
    NavigatorPanel navigator = new NavigatorPanel(ID_PAGING_OBJECT_TYPE, objectTypeDataView, true);
    navigator.setOutputMarkupPlaceholderTag(true);
    navigator.setOutputMarkupId(true);
    add(navigator);
    AjaxSubmitLink add = new AjaxSubmitLink(ID_BUTTON_ADD_OBJECT_TYPE) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            addObjectTypePerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(parentPage.getFeedbackPanel());
        }
    };
    parentPage.addEditingVisibleBehavior(add);
    add(add);
    initObjectTypeEditor(objectTypeEditor);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Label(org.apache.wicket.markup.html.basic.Label) AjaxSubmitLink(org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DataView(org.apache.wicket.markup.repeater.data.DataView) ListItem(org.apache.wicket.markup.html.list.ListItem) Item(org.apache.wicket.markup.repeater.Item) NavigatorPanel(com.evolveum.midpoint.web.component.data.paging.NavigatorPanel) ResourceObjectTypeDefinitionTypeDto(com.evolveum.midpoint.web.component.wizard.resource.dto.ResourceObjectTypeDefinitionTypeDto) List(java.util.List) ArrayList(java.util.ArrayList) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Example 4 with NavigatorPanel

use of com.evolveum.midpoint.web.component.data.paging.NavigatorPanel in project midpoint by Evolveum.

the class TablePanel method initLayout.

private void initLayout(List<IColumn<T, String>> columns, ISortableDataProvider provider, long pageSize) {
    DataTable<T, String> table = new SelectableDataTable<>(ID_TABLE, columns, provider, (int) pageSize);
    table.setOutputMarkupId(true);
    TableHeadersToolbar headers = new TableHeadersToolbar(table, provider);
    headers.setOutputMarkupId(true);
    table.addTopToolbar(headers);
    CountToolbar count = new CountToolbar(table) {

        @Override
        protected void pageSizeChanged(AjaxRequestTarget target) {
            PageBase page = (PageBase) getPage();
            Integer pageSize = page.getSessionStorage().getUserProfile().getPagingSize(tableId);
            setItemsPerPage(pageSize);
            target.add(getNavigatorPanel());
            target.add(getDataTable());
        }

        @Override
        protected boolean isPageSizePopupVisible() {
            return tableId != null;
        }
    };
    addVisibleBehaviour(count, showCount);
    table.addBottomToolbar(count);
    add(table);
    NavigatorPanel nb2 = new NavigatorPanel(ID_PAGING, table, showPagedPagingModel(provider));
    addVisibleBehaviour(nb2, showPaging);
    add(nb2);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) NavigatorPanel(com.evolveum.midpoint.web.component.data.paging.NavigatorPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Aggregations

NavigatorPanel (com.evolveum.midpoint.web.component.data.paging.NavigatorPanel)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)3 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 Label (org.apache.wicket.markup.html.basic.Label)3 Item (org.apache.wicket.markup.repeater.Item)3 DataView (org.apache.wicket.markup.repeater.data.DataView)3 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)3 AjaxSubmitLink (org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink)2 ListItem (org.apache.wicket.markup.html.list.ListItem)2 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)1 AttributeDto (com.evolveum.midpoint.web.component.wizard.resource.dto.AttributeDto)1 ObjectClassDataProvider (com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDataProvider)1 ObjectClassDto (com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto)1 ResourceObjectTypeDefinitionTypeDto (com.evolveum.midpoint.web.component.wizard.resource.dto.ResourceObjectTypeDefinitionTypeDto)1 ArrayList (java.util.ArrayList)1