CleverGWT
From PlcWiki
(Difference between revisions)
m (→StringUtil) |
m (→StringUtil) |
||
Line 42: | Line 42: | ||
} | } | ||
}); | }); | ||
+ | </java> | ||
+ | |||
+ | Way how to build string from collection: | ||
+ | |||
+ | <java> | ||
+ | ToString<MaterialOption> toStr = new ToString<MaterialOption>() { | ||
+ | |||
+ | @Override | ||
+ | public String get(MaterialOption obj) { //make a token: | ||
+ | return obj == null? null:obj.getOptionString(); | ||
+ | } | ||
+ | }; | ||
+ | String result = StringUtil.toString(myCollection, ", ", toStr); | ||
</java> | </java> | ||
Revision as of 07:52, 20 June 2012
ClvListGrid - Extension of ListGrid
Simplification of CRUD usage:
ClvListGrid grid = new ClvListGrid(new ClvListGrid.Delegate() { @Override public void executeUpdate(ClvListGridResponse response) { // Map<String, Object> reqMap = response.getRequestMap(); // response.response(... } @Override public void executeRemove(ClvListGridResponse response) {} @Override public void executeFetch(ClvListGridResponse response) {} @Override public void executeAdd(ClvListGridResponse response) {} @Override public DataSourceField[] createFields() { return new DataSourceField[] { new DataSourceTextField("Field Name") }; } });
Note: If you are implementing executeRemove/Add/Fetch you must call response.response(...). Not in executeUpdate.
StringUtil
java.util.StringTokenizer is prohibited in the GWT client side. Here is my substitution:
StringUtil.tokenizer("Jirka, Petr, Honza", ",", new ValueCallback() { @Override public void execute(String token) { // Your code } });
Way how to build string from collection:
ToString<MaterialOption> toStr = new ToString<MaterialOption>() { @Override public String get(MaterialOption obj) { //make a token: return obj == null? null:obj.getOptionString(); } }; String result = StringUtil.toString(myCollection, ", ", toStr);
BCrypt
String hashed = BCrypt.hashpw("password", BCrypt.gensalt()); boolean verified = BCrypt.checkpw("password", hashed);