diff options
author | Artur Signell <artur@vaadin.com> | 2014-12-08 20:13:20 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-12-10 22:10:39 +0000 |
commit | 405262d805f68979c8aa4c1dc25614d7bf9e80cf (patch) | |
tree | 4432c4d3eadc82136f1e530e8204aa3b33466cc6 /server/src/com/vaadin/ui/DefaultFieldFactory.java | |
parent | 60221e96255eddfaaffb87ecd1b7b282fb85e6de (diff) | |
download | vaadin-framework-405262d805f68979c8aa4c1dc25614d7bf9e80cf.tar.gz vaadin-framework-405262d805f68979c8aa4c1dc25614d7bf9e80cf.zip |
Split and capitalize header captions by default
Only done on the server side where we have property ids to generate the default
headers from. On the client side you must always specify the header.
Change-Id: Ic743fb3f52517116193b022cfdd2df7dea8dd487
Diffstat (limited to 'server/src/com/vaadin/ui/DefaultFieldFactory.java')
-rw-r--r-- | server/src/com/vaadin/ui/DefaultFieldFactory.java | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/server/src/com/vaadin/ui/DefaultFieldFactory.java b/server/src/com/vaadin/ui/DefaultFieldFactory.java index ad6461686c..535943bcd5 100644 --- a/server/src/com/vaadin/ui/DefaultFieldFactory.java +++ b/server/src/com/vaadin/ui/DefaultFieldFactory.java @@ -20,6 +20,7 @@ import java.util.Date; import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.Property; +import com.vaadin.shared.util.SharedUtil; /** * This class contains a basic implementation for both {@link FormFieldFactory} @@ -75,42 +76,7 @@ public class DefaultFieldFactory implements FormFieldFactory, TableFieldFactory * @return the formatted caption string */ public static String createCaptionByPropertyId(Object propertyId) { - String name = propertyId.toString(); - if (name.length() > 0) { - - int dotLocation = name.lastIndexOf('.'); - if (dotLocation > 0 && dotLocation < name.length() - 1) { - name = name.substring(dotLocation + 1); - } - if (name.indexOf(' ') < 0 - && name.charAt(0) == Character.toLowerCase(name.charAt(0)) - && name.charAt(0) != Character.toUpperCase(name.charAt(0))) { - StringBuffer out = new StringBuffer(); - out.append(Character.toUpperCase(name.charAt(0))); - int i = 1; - - while (i < name.length()) { - int j = i; - for (; j < name.length(); j++) { - char c = name.charAt(j); - if (Character.toLowerCase(c) != c - && Character.toUpperCase(c) == c) { - break; - } - } - if (j == name.length()) { - out.append(name.substring(i)); - } else { - out.append(name.substring(i, j)); - out.append(" " + name.charAt(j)); - } - i = j + 1; - } - - name = out.toString(); - } - } - return name; + return SharedUtil.propertyIdToHumanFriendly(propertyId); } /** |