Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.cdlflex.ui.markup.html.badge;
 
List items for the ListView used in org.cdlflex.ui.markup.html.badge.BadgeList. It also acts as a factory for creating the various components required by rendering an item in a BadgeList.
 
 public class BadgeListItem implements IClusterable {
 
     private static final long serialVersionUID = 1L;
 
     private IModel<?> badgeModel;
     private IModel<?> labelModel;
 
     public BadgeListItem() {
         this(null);
     }

    
Construct.

Parameters:
badgeModel the display model shown inside the badge
 
     public BadgeListItem(IModel<?> badgeModel) {
         this(badgeModelnull);
     }

    
Construct.

Parameters:
badgeModel the display model shown inside the badge
labelModel the display model shown as a label beside the badge
 
     public BadgeListItem(IModel<?> badgeModelIModel<?> labelModel) {
         this. = badgeModel;
         this. = labelModel;
     }

    
Creates the Link which wraps the Badge and the optional Label. By default, this returns a org.cdlflex.ui.markup.html.link.DummyLink that only renders the body (and no link). If you want to navigate somewhere when the Badge item is clicked, overwrite this method and return an appropriate AbstractLink component.

Parameters:
id The component id used for the AbstractLink
Returns:
A new AbstractLink
 
     public AbstractLink createLink(String id) {
         return new DummyLink(id);
     }

    
Creates the BadgeComponent. By default, it uses the return value of getBadgeModel() as constructor parameter for the Badge, which should not be null.

Parameters:
id The component id
Returns:
A new Badge
 
     public Badge createBadge(String id) {
         return new Badge(idgetBadgeModel());
     }

    
Creates the (optional) Label rendered beside the Badge. If the return value of getLabelModel() is null or empty, the Label visibility is set to false.

Parameters:
id The component id
Returns:
A new Label
 
     public Label createLabel(String id) {
         IModel<?> model = getLabelModel();
         Label label = new Label(idmodel);
 
         if (model == null) {
             label.setVisible(false);
         }
 
         return label;
     }
 
     public IModel<?> getBadgeModel() {
         return ;
    }
    public void setBadgeModel(IModel<?> badgeModel) {
        this. = badgeModel;
    }
    public IModel<?> getLabelModel() {
        return ;
    }
    public void setLabelModel(IModel<?> labelModel) {
        this. = labelModel;
    }
New to GrepCode? Check out our FAQ X