Coverage Report - org.jtheque.core.managers.view.impl.frame.abstraction.SwingFrameView
 
Classes in this File Line Coverage Branch Coverage Complexity
SwingFrameView
0 %
0/19
N/A
1.091
 
 1  
 package org.jtheque.core.managers.view.impl.frame.abstraction;
 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.Managers;
 20  
 import org.jtheque.core.managers.resource.IResourceManager;
 21  
 import org.jtheque.core.managers.view.able.IWindowView;
 22  
 import org.jtheque.core.managers.view.able.components.IModel;
 23  
 import org.jtheque.utils.ui.SwingUtils;
 24  
 
 25  
 import javax.swing.JFrame;
 26  
 import java.awt.Image;
 27  
 
 28  
 /**
 29  
  * A swing frame view.
 30  
  *
 31  
  * @author Baptiste Wicht
 32  
  */
 33  0
 public abstract class SwingFrameView extends JFrame implements IWindowView {
 34  
     private IModel model;
 35  
 
 36  
     /**
 37  
      * Construct a new SwingFrameView.
 38  
      */
 39  
     protected SwingFrameView() {
 40  0
         this("");
 41  0
     }
 42  
 
 43  
     /**
 44  
      * Construct a new SwingFrameView.
 45  
      *
 46  
      * @param title The title of the frame.
 47  
      */
 48  
     private SwingFrameView(String title) {
 49  0
         super(title);
 50  0
     }
 51  
 
 52  
     /**
 53  
      * Return the default icon for the window icon.
 54  
      *
 55  
      * @return The default icon.
 56  
      */
 57  
     protected static Image getDefaultWindowIcon() {
 58  0
         return Managers.getManager(IResourceManager.class).getImage(
 59  
                 "file:" + Managers.getCore().getApplication().getWindowIcon(),
 60  
                 Managers.getCore().getApplication().getWindowIconType());
 61  
     }
 62  
 
 63  
     @Override
 64  
     public void closeDown() {
 65  0
         setVisible(false);
 66  0
     }
 67  
 
 68  
     @Override
 69  
     public final void display() {
 70  0
         setVisible(true);
 71  0
     }
 72  
 
 73  
     @Override
 74  
     public final void toFirstPlan() {
 75  0
         toFront();
 76  0
     }
 77  
 
 78  
     @Override
 79  
     public void sendMessage(String message, Object value) {
 80  0
         throw new UnsupportedOperationException();
 81  
     }
 82  
 
 83  
     @Override
 84  
     public final void refresh() {
 85  0
         SwingUtils.refresh(this);
 86  0
     }
 87  
 
 88  
     /**
 89  
      * Set the model of the view.
 90  
      *
 91  
      * @param model The model of the view.
 92  
      */
 93  
     public final void setModel(IModel model) {
 94  0
         this.model = model;
 95  0
     }
 96  
 
 97  
     @Override
 98  
     public final IModel getModel() {
 99  0
         return model;
 100  
     }
 101  
 
 102  
     @Override
 103  
     public final JFrame getImpl() {
 104  0
         return this;
 105  
     }
 106  
 }