org.apache.wicket.markup.html.list.ListItem Java Examples
The following examples show how to use
org.apache.wicket.markup.html.list.ListItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EventRefDetailsPanel.java From sakai with Educational Community License v2.0 | 7 votes |
@Override protected void onInitialize() { super.onInitialize(); List<EventDetail> detailsList = getDetails(); add(new ListView<EventDetail>("detailsList", detailsList) { @Override protected void populateItem(ListItem<EventDetail> item) { EventDetail ref = item.getModelObject(); item.add(new Label("key", Model.of(ref.getKey())).setRenderBodyOnly(true)); Fragment frag = buildDetailsFragment(ref); item.add(frag); } }); }
Example #2
Source File: SkuAttributesSectionView.java From yes-cart with Apache License 2.0 | 6 votes |
/** * * Some times need additional format for value (keyValue.getSecond()). * */ @Override protected void onBeforeRender() { add( new Label(HEAD, headKeyValues.getFirst()) ); add( new ListView<Pair<String, String>>(KEY_VALUES_LIST, headKeyValues.getSecond()) { @Override protected void populateItem(ListItem<Pair<String, String>> pairListItem) { final Pair<String, String> keyValue = pairListItem.getModelObject(); pairListItem.add( new Label(KEY, keyValue.getFirst()) ).add( new Label(VALUE, StringUtils.defaultIfEmpty(keyValue.getSecond(), StringUtils.EMPTY) ) ); } } ); super.onBeforeRender(); }
Example #3
Source File: FunctionBoxesPanel.java From ontopia with Apache License 2.0 | 6 votes |
public FunctionBoxesPanel(String id) { super(id); Form<Object> form = new Form<Object>("functionBoxesForm"); add(form); List<Component> list = getFunctionBoxesList("functionBox"); ListView<Component> functionBoxes = new ListView<Component>("functionBoxesList", list) { @Override protected void populateItem(ListItem<Component> item) { item.add(item.getModelObject()); } }; functionBoxes.setVisible(!list.isEmpty()); form.add(functionBoxes); }
Example #4
Source File: RangeFilterPanel.java From Orienteer with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public RangeFilterPanel(String id, IModel<List<T>> model, String filterId, IModel<OProperty> propertyModel, IVisualizer visualizer, IFilterCriteriaManager manager) { super(id, model, filterId, propertyModel, visualizer, manager, Model.of(true)); startComponent = (FormComponent<T>) createFilterComponent(Model.of()); endComponent = (FormComponent<T>) createFilterComponent(Model.of()); startComponent.setOutputMarkupId(true); endComponent.setOutputMarkupId(true); List<Component> rangeContainers = Lists.newArrayList(); rangeContainers.add(getRangeContainer(startComponent, getFilterId(), true)); rangeContainers.add(getRangeContainer(endComponent, getFilterId(), false)); ListView<Component> listView = new ListView<Component>("rangeFilters", rangeContainers) { @Override protected void populateItem(ListItem<Component> item) { item.add(item.getModelObject()); } }; add(listView); }
Example #5
Source File: CartPanel.java From AppStash with Apache License 2.0 | 6 votes |
private Component cartView() { cartView = new ListView<CartItemInfo>("cart", cartListModel()) { @Override protected void populateItem(ListItem<CartItemInfo> item) { WebMarkupContainer cartItem = new WebMarkupContainer("item"); cartItem.add(new Label("name", new PropertyModel<String>(item.getModel(), "product.name"))); cartItem.add(new IndicatingAjaxLink<Void>("delete") { @Override public void onClick(AjaxRequestTarget target) { IModel<CartItemInfo> model = item.getModel(); send(CartPanel.this, Broadcast.BREADTH, new RemoveFromCartEvent(model.getObject(), target)); } }); cartItem.add(new Label("price", new PriceModel(new PropertyModel<>(item.getModel(), "totalSum")))); item.add(cartItem); } }; cartView.setReuseItems(false); cartView.setOutputMarkupId(true); return cartView; }
Example #6
Source File: LogsITCase.java From syncope with Apache License 2.0 | 6 votes |
private static Component searchLog(final String property, final String searchPath, final String key) { Component component = TESTER.getComponentFromLastRenderedPage(searchPath); Component result = component.getPage(). visitChildren(ListItem.class, (final ListItem<LoggerTO> object, final IVisit<Component> visit) -> { try { if (object.getModelObject() instanceof LoggerTO && PropertyResolver.getPropertyGetter( property, object.getModelObject()).invoke(object.getModelObject()).equals(key)) { visit.stop(object); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { LOG.error("Error invoke method", ex); } }); return result; }
Example #7
Source File: CartPanel.java From the-app with Apache License 2.0 | 6 votes |
private Component cartView() { cartView = new ListView<CartItemInfo>("cart", cartListModel()) { @Override protected void populateItem(ListItem<CartItemInfo> item) { WebMarkupContainer cartItem = new WebMarkupContainer("item"); cartItem.add(new Label("name", new PropertyModel<String>(item.getModel(), "product.name"))); cartItem.add(new IndicatingAjaxLink<Void>("delete") { @Override public void onClick(AjaxRequestTarget target) { IModel<CartItemInfo> model = item.getModel(); send(CartPanel.this, Broadcast.BREADTH, new RemoveFromCartEvent(model.getObject(), target)); } }); cartItem.add(new Label("price", new PriceModel(new PropertyModel<>(item.getModel(), "totalSum")))); item.add(cartItem); } }; cartView.setReuseItems(false); cartView.setOutputMarkupId(true); return cartView; }
Example #8
Source File: OrderItemListPanel.java From the-app with Apache License 2.0 | 6 votes |
private Component orderItemList() { return new ListView<OrderItemInfo>("orderItems", new PropertyModel<List<OrderItemInfo>>(getDefaultModel(), "orderItems")) { private int orderItemCounter = 1; @Override protected void populateItem(ListItem<OrderItemInfo> orderItem) { orderItem.add(new Label("orderItemCounter", Model.of(orderItemCounter++))); orderItem.add(new Label("product", new PropertyModel<String>(orderItem.getModel(), "product.name"))); orderItem.add(new Label("description", new PropertyModel<String>(orderItem.getModel(), "product.description"))); orderItem.add(new Label("totalSum", new PriceModel(new PropertyModel<>(orderItem.getModel(), "totalSum")))); } @Override protected void onDetach() { orderItemCounter = 1; super.onDetach(); } }; }
Example #9
Source File: ProjectsOverviewPage.java From inception with Apache License 2.0 | 6 votes |
private ListView<ProjectPermission> createRoleBadges(Project aProject) { return new ListView<ProjectPermission>(MID_ROLE, projectService .listProjectPermissionLevel(userRepository.getCurrentUser(), aProject)) { private static final long serialVersionUID = -96472758076828409L; @Override protected void populateItem(ListItem<ProjectPermission> aItem) { PermissionLevel level = aItem.getModelObject().getLevel(); aItem.add(new Label(MID_LABEL, getString( Classes.simpleName(level.getDeclaringClass()) + '.' + level.toString()))); } }; }
Example #10
Source File: PaymentPage.java From yes-cart with Apache License 2.0 | 6 votes |
/** * Get the negative result fragment. * @return negative result fragment */ private MarkupContainer createNegativePaymentResultFragment() { error(getLocalizer().getString(NEGATIVE_PAYMENT_NOTES, this)); final List<CustomerOrderPayment> payments = checkoutServiceFacade.findPaymentRecordsByOrderNumber(getOrderNumber()); return new Fragment(RESULT_CONTAINER, NEGATIVE_RESULT_FRAGMENT, this) .add( new ListView<CustomerOrderPayment>(PAYMENT_DETAIL_LIST, payments) { @Override protected void populateItem(final ListItem<CustomerOrderPayment> item) { final CustomerOrderPayment payment = item.getModelObject(); item.add(new Label(PAYMENT_ID_LABEL, String.valueOf(payment.getCustomerOrderPaymentId()))); item.add(new Label(PAYMENT_TRANS_ID, StringUtils.defaultIfEmpty(payment.getTransactionReferenceId(), StringUtils.EMPTY))); item.add(new Label(PAYMENT_AUTH_CODE, StringUtils.defaultIfEmpty(payment.getTransactionAuthorizationCode(), StringUtils.EMPTY))); item.add(new Label(PAYMENT_ERROR_CODE, StringUtils.defaultIfEmpty(payment.getTransactionOperationResultCode(), StringUtils.EMPTY))); item.add(new Label(PAYMENT_ERROR_DESCR, StringUtils.defaultIfEmpty(payment.getTransactionOperationResultMessage(), StringUtils.EMPTY))); } } ); }
Example #11
Source File: TelemetryDetailsPanel.java From webanno with Apache License 2.0 | 6 votes |
public TelemetryDetailsPanel(String aId, IModel<List<TelemetryDetail>> aModel) { super(aId, aModel); ListView<TelemetryDetail> details = new ListView<TelemetryDetail>("details") { private static final long serialVersionUID = 5156853968330655499L; @Override protected void populateItem(ListItem<TelemetryDetail> aItem) { aItem.add(new Label("key", aItem.getModelObject().getKey())); aItem.add(new Label("value", aItem.getModelObject().getValue())); aItem.add(new Label("description", aItem.getModelObject().getDescription())); } }; details.setModel(aModel); add(details); }
Example #12
Source File: OrderItemListPanel.java From AppStash with Apache License 2.0 | 6 votes |
private Component orderItemList() { return new ListView<OrderItemInfo>("orderItems", new PropertyModel<List<OrderItemInfo>>(getDefaultModel(), "orderItems")) { private int orderItemCounter = 1; @Override protected void populateItem(ListItem<OrderItemInfo> orderItem) { orderItem.add(new Label("orderItemCounter", Model.of(orderItemCounter++))); orderItem.add(new Label("product", new PropertyModel<String>(orderItem.getModel(), "product.name"))); orderItem.add(new Label("description", new PropertyModel<String>(orderItem.getModel(), "product.description"))); orderItem.add(new Label("totalSum", new PriceModel(new PropertyModel<>(orderItem.getModel(), "totalSum")))); } @Override protected void onDetach() { orderItemCounter = 1; super.onDetach(); } }; }
Example #13
Source File: SortGradeItemsByGradeItemPanel.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void onInitialize() { super.onInitialize(); final List<Assignment> assignments = this.businessService.getGradebookAssignments(SortType.SORT_BY_SORTING); add(new ListView<Assignment>("gradeItemList", assignments) { @Override protected void populateItem(final ListItem<Assignment> assignmentItem) { final Assignment assignment = assignmentItem.getModelObject(); assignmentItem.add(new Label("name", assignment.getName())); assignmentItem.add(new HiddenField<Long>("id", Model.of(assignment.getId())).add( new AttributeModifier("name", String.format("id", assignment.getId())))); assignmentItem.add(new HiddenField<Integer>("order", Model.of(assignment.getSortOrder())).add( new AttributeModifier("name", String.format("item_%s[order]", assignment.getId())))); assignmentItem.add(new HiddenField<Integer>("current_order", Model.of(assignment.getSortOrder())).add( new AttributeModifier("name", String.format("item_%s[current_order]", assignment.getId())))); } }); }
Example #14
Source File: ProductPerPageListView.java From yes-cart with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void populateItem(ListItem<String> stringListItem) { final String pageSize = stringListItem.getModelObject(); final Label label = new Label(WebParametersKeys.QUANTITY, pageSize); final AbstractWebPage page = ((AbstractWebPage) getPage()); final PageParameters pageParameters = page.getPageParameters(); final LinksSupport links = page.getWicketSupportFacade().links(); final PaginationSupport pagination = page.getWicketSupportFacade().pagination(); final PageParameters params = links.getFilteredCurrentParameters(pageParameters); params.set(WebParametersKeys.QUANTITY, pageSize); final Link pageSizeLink = links.newLink(ITEMS_PER_PAGE, params); pageSizeLink.add(label); stringListItem.add(pageSizeLink); if (pagination.markSelectedPageSizeLink(pageSizeLink, pageParameters, getModelObject(), NumberUtils.toInt(pageSize))) { stringListItem.add(new AttributeModifier("class", "active")); } }
Example #15
Source File: KeyBindingsConfigurationPanel.java From webanno with Apache License 2.0 | 6 votes |
private ListView<KeyBinding> createKeyBindingsList(String aId, IModel<List<KeyBinding>> aKeyBindings) { return new ListView<KeyBinding>(aId, aKeyBindings) { private static final long serialVersionUID = 432136316377546825L; @Override protected void populateItem(ListItem<KeyBinding> aItem) { AnnotationFeature feature = KeyBindingsConfigurationPanel.this.getModelObject(); FeatureSupport<?> fs = featureSupportRegistry.getFeatureSupport(feature); KeyBinding keyBinding = aItem.getModelObject(); aItem.add(new Label("keyCombo", keyBinding.asHtml()).setEscapeModelStrings(false)); aItem.add( new Label("value", fs.renderFeatureValue(feature, keyBinding.getValue()))); aItem.add(new LambdaAjaxLink("removeKeyBinding", _target -> removeKeyBinding(_target, aItem.getModelObject()))); } }; }
Example #16
Source File: SkuAttributesView.java From yes-cart with Apache License 2.0 | 6 votes |
@Override protected void onBeforeRender() { add( new ListView<Pair<String, List<Pair<String, String>>>>(ATTR_GROUPS, attributesToShow) { @Override protected void populateItem(ListItem<Pair<String, List<Pair<String, String>>>> pairListItem) { final Pair<String, List<Pair<String, String>>> item = pairListItem.getModelObject(); pairListItem.add( new SkuAttributesSectionView(ATTR_GROUP, item) ); } } ); super.onBeforeRender(); }
Example #17
Source File: GradeImportConfirmationStep.java From sakai with Educational Community License v2.0 | 6 votes |
/** * Helper to create a listview for what needs to be shown for new assignments * @param markupId wicket markup id * @param itemList list of Assignments populated by the item creation steps */ private ListView<Assignment> makeAssignmentsToCreateListView(final String markupId, final List<Assignment> itemList) { final ListView<Assignment> rval = new ListView<Assignment>(markupId, itemList) { @Override protected void populateItem(final ListItem<Assignment> item) { final Assignment assignment = item.getModelObject(); String extraCredit = assignment.isExtraCredit() ? yes : no; String dueDate = FormatHelper.formatDate(assignment.getDueDate(), ""); String releaseToStudents = assignment.isReleased() ? yes : no; String includeInCourseGrades = assignment.isCounted() ? yes : no; item.add(new Label("title", assignment.getName())); item.add(new Label("points", assignment.getPoints())); item.add(new Label("extraCredit", extraCredit)); item.add(new Label("dueDate", dueDate)); item.add(new Label("releaseToStudents", releaseToStudents)); item.add(new Label("includeInCourseGrades", includeInCourseGrades)); } }; return rval; }
Example #18
Source File: StringMatchingRecommenderTraitsEditor.java From inception with Apache License 2.0 | 6 votes |
public GazeteerList(String aId, IModel<? extends List<Gazeteer>> aChoices) { super(aId, aChoices); setOutputMarkupPlaceholderTag(true); gazeteerList = new ListView<Gazeteer>("gazeteer", aChoices) { private static final long serialVersionUID = 2827701590781214260L; @Override protected void populateItem(ListItem<Gazeteer> aItem) { Gazeteer gazeteer = aItem.getModelObject(); aItem.add(new Label("name", aItem.getModelObject().getName())); aItem.add(new LambdaAjaxLink("delete", _target -> actionDeleteGazeteer(_target, gazeteer))); aItem.add(new DownloadLink("download", LoadableDetachableModel.of(() -> getGazeteerFile(gazeteer)), gazeteer.getName())); } }; add(gazeteerList); }
Example #19
Source File: ProjectCasDoctorPanel.java From webanno with Apache License 2.0 | 6 votes |
private ListView<LogMessage> createMessagesView(IModel<LogMessageSet> aModel) { return new ListView<LogMessage>("messages", PropertyModel.of(aModel, "messages")) { private static final long serialVersionUID = 8957632000765128508L; @Override protected void populateItem(ListItem<LogMessage> aItem) { IModel<LogMessage> msg = aItem.getModel(); aItem.add(new Label("level", PropertyModel.of(msg, "level"))); aItem.add(new Label("source", PropertyModel.of(msg, "source"))); aItem.add(new Label("message", PropertyModel.of(msg, "message"))); } }; }
Example #20
Source File: ProjectLayersPanel.java From webanno with Apache License 2.0 | 6 votes |
@Override protected void populateItem(final ListItem<AnnotationLayer> item) { item.add(new SelectOption<AnnotationLayer>("layer", new Model<>(item.getModelObject())) { private static final long serialVersionUID = 3095089418860168215L; @Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, item.getModelObject().getUiName()); } }.add(new AttributeModifier("style", "color:" + colors.get(item.getModelObject()) + ";"))); }
Example #21
Source File: PlainAttrs.java From syncope with Apache License 2.0 | 6 votes |
public PlainSchemasOwn( final String id, final Map<String, PlainSchemaTO> schemas, final IModel<List<Attr>> attrTOs) { super(id, schemas, attrTOs); add(new ListView<Attr>("schemas", attrTOs) { private static final long serialVersionUID = 9101744072914090143L; @Override protected void populateItem(final ListItem<Attr> item) { setPanel(schemas, item, false); } }); }
Example #22
Source File: TopicListPanel.java From ontopia with Apache License 2.0 | 5 votes |
@Override protected void populateItem(ListItem<Topic> item) { Topic topic = item.getModelObject(); // FIXME: upgrade to TopicLink item.add(new TopicInstanceLink("topicLink", new TopicModel<Topic>(topic))); //item.add(new org.apache.wicket.markup.html.basic.Label("topicName", topic.getName())); }
Example #23
Source File: RatingFeatureEditor.java From webanno with Apache License 2.0 | 5 votes |
private ListView<Integer> createFeaturesList(List<Integer> range) { return new ListView<Integer>("radios", range) { private static final long serialVersionUID = 6856342528153905386L; @Override protected void populateItem(ListItem<Integer> item) { Radio<Integer> radio = new Radio<>("radio", item.getModel(), field); Radio.Label label = new Radio.Label("label", item.getModel(), radio); item.add(radio, label); } }; }
Example #24
Source File: MyPictures.java From sakai with Educational Community License v2.0 | 5 votes |
protected void populateItem(ListItem<File> listItem) { final File file = (File) listItem.getModelObject(); listItem.add(new Label("file", file.getName())); listItem.add(new Link("delete") { public void onClick() { Files.remove(file); } }); }
Example #25
Source File: OLocalizationEditPanel.java From Orienteer with Apache License 2.0 | 5 votes |
@Override protected Component getKeyEditComponent(ListItem<EmbeddedMapEditPanel.Pair<V>> item) { Select2Choice<String> select2 = new Select2Choice<String>("key", new PropertyModel<String>(item.getModel(), "key"), LanguagesChoiceProvider.INSTANCE); select2.getSettings().setCloseOnSelect(true).setTheme(OClassMetaPanel.BOOTSTRAP_SELECT2_THEME); select2.add(new AttributeModifier("style", "width: 100%")); select2.setRequired(true); return select2; }
Example #26
Source File: ActionPanel.java From wicket-spring-boot with Apache License 2.0 | 5 votes |
public ActionPanel(String id, List<AbstrractActionItem> items) { super(id); ListView<AbstrractActionItem> listItems = new ListView<AbstrractActionItem>("items", items) { @Override protected void populateItem(ListItem<AbstrractActionItem> item) { item.add(item.getModel().getObject()); } }; add(listItems); }
Example #27
Source File: ConvertingErrorsDialog.java From openmeetings with Apache License 2.0 | 5 votes |
@Override protected void populateItem(ListItem<FileItemLog> item) { FileItemLog l = item.getModelObject(); item.add(new Label("exitCode", l.getExitCode())); item.add(new Label("message", l.getMessage())); if (!l.isOk()) { item.add(AttributeModifier.append(ATTR_CLASS, "alert")); } if (l.isWarn()) { item.add(AttributeModifier.append(ATTR_CLASS, "warn")); } }
Example #28
Source File: ModalGeoPickerPage.java From ontopia with Apache License 2.0 | 5 votes |
private void findFields() { MarkupContainer container = this; while (!(container instanceof FieldInstancesPanel)) container = container.getParent(); FieldInstancesPanel parent = (FieldInstancesPanel) container; ListView<FieldInstanceModel> listView = parent.getFieldList(); Iterator<? extends ListItem<FieldInstanceModel>> itfim = listView.iterator(); while (itfim.hasNext()) { ListItem<FieldInstanceModel> li = itfim.next(); FieldInstance fi = li.getModelObject().getFieldInstance(); FieldAssignment fa = fi.getFieldAssignment(); FieldDefinition fd = fa.getFieldDefinition(); if (fd.getFieldType() != FieldDefinition.FIELD_TYPE_OCCURRENCE) continue; OccurrenceField of = (OccurrenceField)fd; OccurrenceType ot = of.getOccurrenceType(); if (ot == null) continue; Collection<LocatorIF> psis = ot.getTopicIF().getSubjectIdentifiers(); if (psis.contains(PSI.ON_LATITUDE) || psis.contains(PSI.ON_LONGITUDE)) { Iterator<? extends Component> it = li.iterator(); while (it.hasNext()) { Object component = it.next(); if (component instanceof FieldInstanceOccurrencePanel) { FieldInstanceOccurrencePanel fiop = (FieldInstanceOccurrencePanel) component; if (psis.contains(PSI.ON_LONGITUDE)) lngpan = fiop; else latpan = fiop; } } } } }
Example #29
Source File: SkuListView.java From yes-cart with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void onBeforeRender() { add( new ListView<ProductSku>(SKU_LIST, skusToShow) { @Override protected void populateItem(final ListItem<ProductSku> productSkuListItem) { productSkuListItem.add( new SkuInListView(SKU_VIEW, productSkuListItem.getModelObject(), supplier) ); } } ); super.onBeforeRender(); }
Example #30
Source File: AbstractProductFilter.java From yes-cart with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected void onBeforeRender() { add( new ListView<Block>( FILTERED_NAVIGATION_LIST, adaptNavigationRecords(navigationRecords)) { @Override protected void populateItem(ListItem<Block> pairListItem) { final Block block = pairListItem.getModelObject(); if ("i18n".equalsIgnoreCase(block.getTemplate())) { pairListItem.add( new I18nFilterView( FILTER, block.code, block.label, block.getValues(), getCategoryFilterLimitConfig(block.getCode(), recordLimit) ) ); } else { pairListItem.add( new BaseFilterView( FILTER, block.code, block.label, block.getValues(), getCategoryFilterLimitConfig(block.getCode(), recordLimit) ) ); } } } ); super.onBeforeRender(); }