View Javadoc

1   package org.appfuse.webapp.pages.components;
2   
3   import org.apache.wicket.Component;
4   import org.apache.wicket.behavior.Behavior;
5   import org.apache.wicket.markup.ComponentTag;
6   
7   /**
8    * A behavior that adds a placeholder attribute support for an input components.
9    */
10  public class PlaceholderBehavior extends Behavior {
11  
12      private final String placeholder;
13  
14      public PlaceholderBehavior(String placeholder) {
15          this.placeholder = placeholder;
16      }
17  
18      @Override
19      public void onComponentTag(Component component, ComponentTag tag) {
20          super.onComponentTag(component, tag);
21          tag.put("placeholder", placeholder);
22      }
23  }