Changeset 991


Ignore:
Timestamp:
12/14/10 12:57:56 (13 years ago)
Author:
oschonef
Message:
  • allow setting CSS class from source
File:
1 edited

Legend:

Unmodified
Added
Removed
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/border/AjaxToggleBorder.java

    r975 r991  
    1818public class AjaxToggleBorder extends Border {
    1919    private final static String COLLAPSED_CLASS = "collapsed";
    20    
     20
    2121    public AjaxToggleBorder(String id, IModel<String> title,
    22             final boolean expanded) {
     22            boolean expanded, String cssClass) {
    2323        super(id);
    2424        setRenderBodyOnly(true);
    2525
    2626        final WebMarkupContainer header = new WebMarkupContainer("header");
     27        add(header);
    2728        header.add(new Label("title", title));
    2829
    2930        final WebMarkupContainer content = new WebMarkupContainer("content");
     31        add(content);
    3032        content.setOutputMarkupId(true);
    3133        content.add(getBodyContainer());
    32         add(header);
    33         add(content);
    3434
    3535        header.add(new WiQueryEventBehavior(new Event(MouseEvent.CLICK) {
     
    5050                    new Model<String>("display:none"), ";"));
    5151        }
     52        if (cssClass != null) {
     53            content.add(new AttributeAppender("class",
     54                    new Model<String>(cssClass), " "));
     55        }
     56    }
     57
     58    public AjaxToggleBorder(String id, IModel<String> title, String cssClass) {
     59        this(id, title, true, cssClass);
    5260    }
    5361
    5462    public AjaxToggleBorder(String id, IModel<String> title) {
    55         this(id, title, true);
     63        this(id, title, true, null);
    5664    }
    57    
     65
    5866} // class AjaxToggleBorder
Note: See TracChangeset for help on using the changeset viewer.