This is my updated version right know.

Its very dangerous to copy wicket:id and id. On ajax updating the component
get cloned and cloned and cloned...

public class CopyAttributesBehavior extends AbstractBehavior { 

  private static final long serialVersionUID = 1L; 
  private IValueMap attributes; 
  
  List<String> notAllowedAttributes = Arrays.asList("wicket:id", "id");

  @Override 
  public void onComponentTag(Component component, ComponentTag tag) { 
      if (attributes != null) {
        
        for(Entry<String, Object> entry : attributes.entrySet()){
                if(!notAllowedAttributes.contains(entry.getKey())){
                        tag.getAttributes().put(entry.getKey(), 
entry.getValue());
                }
                
        }
      }
  } 

  public IValueMap getAttributes() { 
      return attributes; 
  } 
  public void setAttributes(IValueMap attributes) { 
      this.attributes = attributes; 
  } 
} 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Attribute-Inheritance-or-Copying-tp3332828p3940229.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to