Notificaciones

Editar top.xhtml

<!-- Notifications Menu -->
                                    <li class="dropdown notifications-menu">
                                        <!-- Menu toggle button -->
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                            <i class="fa fa-bell-o"></i>
                                            <span class="label label-warning">#{notificacionesController.numeroNotificaciones()}</span>
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li class="header">#{msg['title.tienenotificaciones']} #{notificacionesController.numeroNotificaciones()} #{msg['title.notificaciones']}</li>
                                            <li>
                                                <!-- Inner Menu: contains the notifications -->
                                                <ul class="menu">
                                                    <li><!-- start notification -->
                                                        <a href="#">
                                                            <i class="fa fa-users text-aqua"></i>

<!--                                                            5 new members joined today-->
                                                        </a>

                                                    </li><!-- end notification -->
                                                </ul>
                                            </li>
                                            <li class="footer"><a href="#"><p:link value="#{msg['menu.vernotificaciones']}"  outcome="/pages/notificaciones/list"/></a></li>
                                        </ul>
                                    </li>
                                    <!-- Tasks Menu -->
                                   <li class="dropdown tasks-menu">
                                         <!--Menu Toggle Button--> 
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                            <i class="fa fa-flag-o"></i>
                                            <span class="label label-danger">9</span>
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li class="header">You have 9 tasks</li>
                                            <li>
                                                 Inner menu: contains the tasks 
                                                <ul class="menu">
                                                    <li> Task item 
                                                        <a href="#">
                                                             Task title and progress text 
                                                            <h3>
                                                                Design some buttons
                                                                <small class="pull-right">20%</small>
                                                            </h3>
                                                             The progress bar 
                                                            <div class="progress xs">
                                                                 Change the css width attribute to simulate progress 
                                                                <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                                                                    <span class="sr-only">20% Complete</span>
                                                                </div>
                                                            </div>
                                                        </a>
                                                    </li> end task item 
                                                </ul>
                                            </li>
                                            <li class="footer">
                                                <a href="#">View all tasks</a>
                                            </li>
                                        </ul>
                                    </li>
En la seccion notification
 <!-- Notifications Menu -->
                                    <li class="dropdown notifications-menu">
                                        <!-- Menu toggle button -->
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                            <i class="fa fa-bell-o"></i>
                                            <span class="label label-warning">#{notificacionesController.numeroNotificaciones()}</span>
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li class="header">#{msg['title.tienenotificaciones']} #{notificacionesController.numeroNotificaciones()} #{msg['title.notificaciones']}</li>
                                            <li>
                                                <!-- Inner Menu: contains the notifications -->
                                                <ul class="menu">
                                                    <li><!-- start notification -->
                                                        <a href="#">
                                                            <i class="fa fa-users text-aqua"></i>

<!--                                                            5 new members joined today-->
                                                        </a>

                                                    </li><!-- end notification -->
                                                </ul>
                                            </li>
                                            <li class="footer"><a href="#"><p:link value="#{msg['menu.vernotificaciones']}"  outcome="/pages/notificaciones/list"/></a></li>
                                        </ul>
                                    </li>

CONTROLLER

public Integer numeroNotificaciones(){
        return notificacionesFacade.findAll().size();
    }


     @PostConstruct
    public void init() {
        try {
            String id = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("id");

            if (id != null) {
                notificaciones = notificacionesFacade.find("Idnotificacion", id);

            }else{
                notificaciones = new Notificaciones();
                notificaciones.setIdnotificacion(JsfUtil.getUUID());

            }
            clienteList = new ArrayList<>();

            notificacionesFiltered = new ArrayList<>();
            notificacionesList = new ArrayList<>();
            notificacionesList = notificacionesFacade.findAll(new Document());
            notificacionesFiltered = notificacionesList;
        } catch (Exception e) {
            JsfUtil.errorMessage("init() " + e.getLocalizedMessage());
        }

    }

Last updated