From users-return-93593-archive-asf-public=cust-asf.ponee.io@wicket.apache.org Mon Jan 29 19:40:22 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 74B1E180654 for ; Mon, 29 Jan 2018 19:40:22 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 643FD160C3F; Mon, 29 Jan 2018 18:40:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AB60D160C2F for ; Mon, 29 Jan 2018 19:40:21 +0100 (CET) Received: (qmail 67979 invoked by uid 500); 29 Jan 2018 18:40:20 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Delivered-To: moderator for users@wicket.apache.org Received: (qmail 82320 invoked by uid 99); 29 Jan 2018 18:06:29 -0000 X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.485 X-Spam-Level: *** X-Spam-Status: No, score=3.485 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, NML_ADSP_CUSTOM_MED=1.2, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.972, URI_HEX=1.313] autolearn=disabled Date: Mon, 29 Jan 2018 11:06:27 -0700 (MST) From: extraquoo To: users@wicket.apache.org Message-ID: <1517249187526-0.post@n4.nabble.com> In-Reply-To: References: <1516838576367-0.post@n4.nabble.com> <1516901882825-0.post@n4.nabble.com> Subject: Re: the choices is key instead of value when using DropDownChoice component MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit thanks for replying. Looks like it still put the value in the choices object. Maybe I am describing the issue incorrectly. so if put value in the choices object , construct the DropDownChoice and override localizeDisplayValues DropDownChoice selector = new DropDownChoice(fieldName, choices){ private static final long serialVersionUID = 1L; @Override protected boolean localizeDisplayValues() { return true; } }; then it wont support i18n when executing below code of AbstractChoice.class /** * Generates and appends html for a single choice into the provided buffer * * @param buffer * Appending string buffer that will have the generated html appended * @param choice * Choice object * @param index * The index of this option * @param selected * The currently selected string value */ @SuppressWarnings("unchecked") protected void appendOptionHtml(AppendingStringBuffer buffer, E choice, int index, String selected) { T objectValue = (T)renderer.getDisplayValue(choice); Class objectClass = (Class)(objectValue == null ? null : objectValue.getClass()); String displayValue = ""; if (objectClass != null && objectClass != String.class) { final IConverter converter = getConverter(objectClass); displayValue = converter.convertToString(objectValue, getLocale()); } else if (objectValue != null) { displayValue = objectValue.toString(); } buffer.append("\n"); } the bold line is using getString and here displayValue should be the key not the value. -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org