Java Code Examples for org.apache.wicket.model.Model.ofList()

The following are Jave code examples for showing how to use ofList() of the org.apache.wicket.model.Model class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: engerek   File: AssignmentCatalogPanel.java   View Source Code Vote up 6 votes
private void initViewSelector(WebMarkupContainer headerPanel){
    DropDownChoice<AssignmentViewType> viewSelect = new DropDownChoice(ID_VIEW_TYPE, viewModel,
            Model.ofList(viewTypeList != null && viewTypeList.size() > 0 ?
                    viewTypeList : createAssignableTypesList()),
            new EnumChoiceRenderer<AssignmentViewType>(this));
    viewSelect.add(new OnChangeAjaxBehavior() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            if (AssignmentViewType.USER_TYPE.equals(viewSelect.getModelObject())){
                initUserViewSelectionPopup(createStringResource("AssignmentCatalogPanel.selectAssignmentsUserOwner"),
                        target);
            } else {
                searchModel.reset();
                AssignmentCatalogPanel.this.addOrReplaceSearchPanel(getHeaderPanel());
                AssignmentCatalogPanel.this.addOrReplaceLayout(target, getCatalogItemsPanelContainer(), getPageBase());
                target.add(getCatalogItemsPanelContainer());
                target.add(getHeaderPanel());
            }
        }
    });
    viewSelect.setOutputMarkupId(true);
    headerPanel.add(viewSelect);

}
 
Example 2
Project: engerek   File: CatalogItemsPanel.java   View Source Code Vote up 5 votes
private void initItemListModel() {
    List<AssignmentEditorDto> itemList = new ArrayList<>();
    if (isListProvider){
        itemList = listProvider != null ? listProvider.getAvailableData() : new ArrayList<>();
    } else {
        itemList = objectDataProvider != null ? objectDataProvider.getAvailableData() : new ArrayList<>();
    }
    itemsListModel = Model.ofList(itemList);
}
 
Example 3
Project: engerek   File: AssignmentDataTablePanel.java   View Source Code Vote up 4 votes
private void addOrReplaceAssignmentsTable(WebMarkupContainer assignmentsContainer){
    fillInRelationAssignmentsMap();
    DropDownChoicePanel relation = WebComponentUtil.createEnumPanel(RelationTypes.class, ID_RELATION,
            WebComponentUtil.createReadonlyModelFromEnum(RelationTypes.class), relationModel, this, false);
    relation.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            relationModel.setObject((RelationTypes)relation.getBaseFormComponent().getConvertedInput());
            addOrReplaceAssignmentsTable(getAssignmentsContainer());
            target.add(AssignmentDataTablePanel.this.get(ID_ASSIGNMENTS).get(ID_ASSIGNMENTS_TABLE));
        }
    });
    relation.setOutputMarkupId(true);
    relation.setOutputMarkupPlaceholderTag(true);
    assignmentsContainer.addOrReplace(relation);

    AjaxButton showAllAssignmentsButton = new AjaxButton(ID_SHOW_ALL_ASSIGNMENTS_BUTTON,
            createStringResource("AssignmentTablePanel.menu.showAllAssignments")) {
        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            showAllAssignments(ajaxRequestTarget);
        }
    };
    assignmentsContainer.addOrReplace(showAllAssignmentsButton);

    ListDataProvider<AssignmentEditorDto> assignmentsProvider = new ListDataProvider<AssignmentEditorDto>(this,
            Model.ofList(relationAssignmentsMap.get(relationModel.getObject())), false){
        private static final long serialVersionUID = 1L;

        @Override
        protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
            getAssignmentsStorage().setPaging(paging);
        }

    };
    BoxedTablePanel<AssignmentEditorDto> assignmentTable = new BoxedTablePanel<AssignmentEditorDto>(ID_ASSIGNMENTS_TABLE,
            assignmentsProvider, initColumns(), UserProfileStorage.TableId.ASSIGNMENTS_TAB_TABLE,
            (int) pageBase.getItemsPerPage(UserProfileStorage.TableId.ASSIGNMENTS_TAB_TABLE)){
        private static final long serialVersionUID = 1L;

        @Override
        protected Item<AssignmentEditorDto> customizeNewRowItem(Item<AssignmentEditorDto> item, IModel<AssignmentEditorDto> model) {
                item.add(AttributeModifier.append("class", AssignmentsUtil.createAssignmentStatusClassModel(model)));
            return item;
        }

        @Override
        public int getItemsPerPage() {
            return pageBase.getSessionStorage().getUserProfile().getTables().get(UserProfileStorage.TableId.ASSIGNMENTS_TAB_TABLE);
        }

    };
    assignmentTable.setOutputMarkupId(true);
    assignmentTable.setCurrentPage(getAssignmentsStorage().getPaging());
    assignmentsContainer.addOrReplace(assignmentTable);

}
 
Example 4
Project: engerek   File: PageAssignmentsList.java   View Source Code Vote up 4 votes
private void initModels() {
    assignmentsModel = Model.ofList(getSessionStorage().getRoleCatalog().getAssignmentShoppingCart());
    descriptionModel = Model.of(getSessionStorage().getRoleCatalog().getRequestDescription());
}
 
Example 5
Project: vlo-curation   File: PartitionedDataProvider.java   View Source Code Vote up 4 votes
@Override
public IModel<List<T>> model(List<T> object) {
    // Iterators.partition sometimes returns lists that are not deeply serializable, 
    // so we need to copy this into a serializable list here :(
    return Model.ofList(ImmutableList.copyOf(object));
}