Search in sources :

Example 1 with ObjectClassDto

use of com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto 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<Void> link = new AjaxLink<Void>(ID_CLASS_LINK) {

                private static final long serialVersionUID = 1L;

                @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 IModel<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 : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) 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) AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) IModel(org.apache.wicket.model.IModel) ObjectClassDataProvider(com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDataProvider) ObjectClassDto(com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AttributeDto(com.evolveum.midpoint.web.component.wizard.resource.dto.AttributeDto) DataView(org.apache.wicket.markup.repeater.data.DataView)

Example 2 with ObjectClassDto

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

the class SchemaListPanel method objectClassClickPerformed.

private void objectClassClickPerformed(AjaxRequestTarget target, ObjectClassDto dto) {
    for (ObjectClassDto o : allClasses.getObject()) {
        o.setSelected(false);
    }
    dto.setSelected(true);
    attributeModel.reset();
    detailsModel.reset();
    target.add(get(ID_TABLE_BODY), get(ID_OBJECT_CLASS_INFO_CONTAINER));
}
Also used : ObjectClassDto(com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto)

Example 3 with ObjectClassDto

use of com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto 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)

Example 4 with ObjectClassDto

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

the class SchemaListPanel method loadAllClasses.

private List<ObjectClassDto> loadAllClasses() {
    List<ObjectClassDto> list = new ArrayList<>();
    ResourceSchema schema = loadResourceSchema();
    if (schema == null) {
        return list;
    }
    for (ResourceObjectTypeDefinition definition : schema.getObjectTypeDefinitions()) {
        list.add(new ObjectClassDto(definition));
    }
    Collections.sort(list);
    return list;
}
Also used : ResourceSchema(com.evolveum.midpoint.schema.processor.ResourceSchema) ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) ArrayList(java.util.ArrayList) ObjectClassDto(com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto)

Aggregations

ObjectClassDto (com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectClassDto)4 AttributeDto (com.evolveum.midpoint.web.component.wizard.resource.dto.AttributeDto)2 ArrayList (java.util.ArrayList)2 ResourceAttributeDefinition (com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition)1 ResourceObjectTypeDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition)1 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)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 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