Coverage Report - org.jtheque.core.managers.error.ErrorManager
 
Classes in this File Line Coverage Branch Coverage Complexity
ErrorManager
0 %
0/18
0 %
0/2
1.167
 
 1  
 package org.jtheque.core.managers.error;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.AbstractManager;
 20  
 import org.jtheque.core.managers.view.able.IViewManager;
 21  
 
 22  
 import javax.annotation.Resource;
 23  
 import java.util.ArrayList;
 24  
 import java.util.Collection;
 25  
 
 26  
 /**
 27  
  * An error manager implementation.
 28  
  *
 29  
  * @author Baptiste Wicht
 30  
  */
 31  0
 public final class ErrorManager extends AbstractManager implements IErrorManager {
 32  0
     private static final Collection<JThequeError> STARTUP_ERRORS = new ArrayList<JThequeError>(10);
 33  
 
 34  0
     private final Collection<JThequeError> errors = new ArrayList<JThequeError>(10);
 35  
 
 36  
     @Resource
 37  
     private IViewManager viewManager;
 38  
 
 39  
     @Override
 40  
     public void init(){
 41  0
         errors.addAll(STARTUP_ERRORS);
 42  
 
 43  0
         STARTUP_ERRORS.clear();
 44  0
     }
 45  
 
 46  
     @Override
 47  
     public void addError(JThequeError error) {
 48  0
         errors.add(error);
 49  
 
 50  0
         viewManager.displayError(error);
 51  0
     }
 52  
 
 53  
     @Override
 54  
     public void addStartupError(JThequeError error) {
 55  0
         STARTUP_ERRORS.add(error);
 56  0
     }
 57  
 
 58  
     @Override
 59  
     public void displayErrors() {
 60  0
         for (JThequeError error : errors) {
 61  0
             viewManager.displayError(error);
 62  
         }
 63  0
     }
 64  
 
 65  
     @Override
 66  
     public void addInternationalizedError(String messageKey) {
 67  0
         addError(new InternationalizedError(messageKey));
 68  0
     }
 69  
 
 70  
     @Override
 71  
     public void addInternationalizedError(String messageKey, Object... messageReplaces) {
 72  0
         addError(new InternationalizedError(messageKey, messageReplaces));
 73  0
     }
 74  
 }