RefreshDataViewsClickListener.java

  1. /*
  2.  * Copyright 2010-2025 James Pether Sörling
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *   http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  *
  16.  *  $Id$
  17.  *  $HeadURL$
  18. */
  19. package com.hack23.cia.web.impl.ui.application.views.pageclicklistener;

  20. import com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest;
  21. import com.vaadin.ui.Button.ClickEvent;
  22. import com.vaadin.ui.Button.ClickListener;
  23. import com.vaadin.ui.Notification;

  24. /**
  25.  * The Class RefreshDataViewsClickListener.
  26.  *
  27.  * @see RefreshDataViewsClickEvent
  28.  */
  29. public final class RefreshDataViewsClickListener extends AbstractClickListener implements ClickListener {

  30.     public static final String REFRESH_DESC = "refresh desc";

  31.     /** The Constant REFRESH_VIEWS_STARTED. */
  32.     public static final String REFRESH_VIEWS_STARTED = "Refresh Views Started";

  33.     /** The Constant serialVersionUID. */
  34.     private static final long serialVersionUID = 1L;

  35.     /** The service request. */
  36.     private final RefreshDataViewsRequest serviceRequest;

  37.     /**
  38.      * Instantiates a new refresh data views click listener.
  39.      *
  40.      * @param serviceRequest the service request
  41.      */
  42.     public RefreshDataViewsClickListener(final RefreshDataViewsRequest serviceRequest) {
  43.         super();
  44.         this.serviceRequest = serviceRequest;
  45.     }

  46.     @Override
  47.     public void buttonClick(final ClickEvent event) {
  48.         getApplicationManager().asyncService(serviceRequest);
  49.         showNotification(REFRESH_VIEWS_STARTED, REFRESH_DESC, Notification.Type.HUMANIZED_MESSAGE);
  50.     }
  51. }