Guest User

Untitled

a guest
Jul 20th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public class WicketPropertyResolver implements IComponentResolver {
  2. private static final long serialVersionUID = 1L;
  3.  
  4. static {
  5. WicketTagIdentifier.registerWellKnownTagName("property");
  6. }
  7.  
  8. public boolean resolve(final MarkupContainer arg0, final MarkupStream arg1, final ComponentTag arg2) {
  9. if(arg2.getId().equals("_property")) {
  10. if(arg0 instanceof MarkupContainer) {
  11. IModel<?> model = ((Component)arg0).getDefaultModel();
  12. if(model != null){
  13. String propertyName = String.valueOf(arg2.getString("name"));
  14. boolean toEscape = Boolean.valueOf(String.valueOf(arg2.getString("escape")));
  15. IModel<?> pModel = new PropertyModel<String>(model,propertyName);
  16. arg0.autoAdd(new Label(propertyName,pModel).setEscapeModelStrings(toEscape), arg1);
  17. }
  18. }
  19. arg1.next();
  20. return true;
  21. }
  22. return false;
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment