Return-Path: Delivered-To: apmail-velocity-dev-archive@www.apache.org Received: (qmail 55041 invoked from network); 8 Feb 2009 22:26:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Feb 2009 22:26:32 -0000 Received: (qmail 41873 invoked by uid 500); 8 Feb 2009 22:26:32 -0000 Delivered-To: apmail-velocity-dev-archive@velocity.apache.org Received: (qmail 41734 invoked by uid 500); 8 Feb 2009 22:26:31 -0000 Mailing-List: contact dev-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Velocity Developers List" Delivered-To: mailing list dev@velocity.apache.org Delivered-To: moderator for dev@velocity.apache.org Received: (qmail 98034 invoked by uid 99); 7 Feb 2009 23:41:50 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of serg472@gmail.com designates 209.85.198.234 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=vdwzfWLdn/eEX0dov4HzPGeFjcoNXLxCAwQh+FE3QBY=; b=LdY9pT9tt3/ceNDjiRIKk3uMD9tXN7M09iFryjTH3Jv/b5AFvmrAM3f7TVgFUn0jcW yeEi9/tY4DwD7yhDfVtqgB8AFqzj4nKBzlynyPI6NeKdIt1hcW4Pu0Mj3k0ZYAKQx4TG IaZO+/dbj/bAXQflzr0IPg5kmlEgeov+CqUQE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=MQVirrXA0YBi/piVOWYzMizfaurY1hy32c6mGpj6u9jEI9RdOB0x8RMf1oGImhYVTp wXdylidqYci1gOnD2aR7frHQSAolp0ENLOtmdCJb0j6SPz/FEeolrvA/lzAqnlubZnhN 8udhxY+hlvh7fx6C6xLHIk+u90LiEQCzJk0VE= MIME-Version: 1.0 Date: Sat, 7 Feb 2009 16:41:21 -0700 Message-ID: <67624990902071541id65f661se6e4ae93a1ed1a59@mail.gmail.com> Subject: Few suggested improvements for DisplayTools From: serg472@gmail.com To: dev@velocity.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello, I wanted to share with you a few ideas I have about new simple improvements for DisplayTools. I should be able to make patches for them if you are interested. 1. Add new method isEmpty(object) that will return true if the object is null or empty (for strings it's zero length; for collections, maps and arrays it's zero size). This should help with annoying null checks. (Probably a better place for this method would be Engine, not Tools) 2. Add new "property" parameter to list(Object list, String delim, String finaldelim, String property) method that will format an array or collection of objects on selected property (similar to SortTools). 3. Add new method: stripTags(Object obj, String... allowedTags) that will strip all (html) tags from the text except those listed in allowedTags (allowed tags are passed like this: "br","img","p"). 4. Add new method: br(Object obj) that will replace \n with "
\n" 5. Add new "preserveWords" parameter to: truncate(Object truncateMe, int maxLength, String suffix, boolean preserveWords) that will truncate a string to a last complete word within maxLength instead of exact character. Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org For additional commands, e-mail: dev-help@velocity.apache.org