Search in sources :

Example 1 with AttributeDto

use of com.evolveum.midpoint.web.component.wizard.resource.dto.AttributeDto 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 2 with AttributeDto

use of com.evolveum.midpoint.web.component.wizard.resource.dto.AttributeDto in project midpoint by Evolveum.

the class SchemaListPanel method loadAttributes.

private List<AttributeDto> loadAttributes() {
    List<AttributeDto> list = new ArrayList<>();
    ObjectClassDto selected = getSelectedObjectClass();
    if (selected == null) {
        return list;
    }
    for (ResourceAttributeDefinition def : selected.getDefinition().getAttributeDefinitions()) {
        list.add(new AttributeDto(def));
    }
    return list;
}
Also used : AttributeDto(com.evolveum.midpoint.web.component.wizard.resource.dto.AttributeDto) ResourceAttributeDefinition(com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition) ArrayList(java.util.ArrayList) ObjectClassDto(com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto)

Aggregations

AttributeDto (com.evolveum.midpoint.web.component.wizard.resource.dto.AttributeDto)2 ObjectClassDto (com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto)2 ResourceAttributeDefinition (com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)1 NavigatorPanel (com.evolveum.midpoint.web.component.data.paging.NavigatorPanel)1 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 ObjectClassDataProvider (com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDataProvider)1 ArrayList (java.util.ArrayList)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)1 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Label (org.apache.wicket.markup.html.basic.Label)1 TextField (org.apache.wicket.markup.html.form.TextField)1 Item (org.apache.wicket.markup.repeater.Item)1 DataView (org.apache.wicket.markup.repeater.data.DataView)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1