Clover coverage report - Maven Clover report
Coverage timestamp: Thu Oct 11 2007 08:41:48 CEST
file stats: LOC: 130   Methods: 12
NCLOC: 97   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ModelerFrame.java 0% 34.4% 41.7% 27.6%
coverage coverage
 1    /*
 2    * Copyright (C) 2007 Eric MIGNOT - mignots.eric@free.fr
 3    *
 4    * This library is free software; you can redistribute it and/or
 5    * modify it under the terms of the GNU Lesser General Public
 6    * License as published by the Free Software Foundation; either
 7    * version 2.1 of the License, or (at your option) any later version.
 8    *
 9    * This library is distributed in the hope that it will be useful,
 10    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12    * Lesser General Public License for more details.
 13    *
 14    * You should have received a copy of the GNU Lesser General Public
 15    * License along with this library; if not, write to the Free Software
 16    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17    */
 18    package org.ericmignot.modeler.gui;
 19   
 20    import java.awt.BorderLayout;
 21    import java.awt.Dimension;
 22    import java.awt.event.WindowAdapter;
 23    import java.awt.event.WindowEvent;
 24   
 25    import javax.swing.JFrame;
 26   
 27    import org.ericmignot.modeler.Interoperable;
 28    import org.ericmignot.modeler.data.BusinessObject;
 29    import org.ericmignot.modeler.util.action.NotifyableAction;
 30   
 31    public class ModelerFrame extends JFrame implements Interoperable
 32    {
 33    private Controller controller;
 34   
 35  1 public ModelerFrame()
 36    {
 37  1 this.setTitle(this.getApplicationTitle());
 38  1 getContentPane().setLayout(new BorderLayout());
 39  1 addWindowListener(new WindowAdapter()
 40    {
 41  0 public void windowClosing(WindowEvent e)
 42    {
 43  0 System.exit(0);
 44    }
 45    });
 46  1 this.controller = this.buildController();
 47  1 this.controller.setInteroperable(this);
 48  1 this.initController(this.controller);
 49   
 50  1 this.getContentPane().removeAll();
 51  1 this.getContentPane().add(controller.createMainPanel(), BorderLayout.CENTER);
 52    }
 53   
 54  1 public String getApplicationTitle()
 55    {
 56  1 return "Abstract modeler";
 57    }
 58  1 public Controller buildController()
 59    {
 60  1 return new Controller();
 61    }
 62   
 63  1 public void initController(Controller controller)
 64    {
 65   
 66    }
 67   
 68  1 public Controller getController()
 69    {
 70  1 return controller;
 71    }
 72   
 73  0 public void setData(String xml) throws IllegalArgumentException
 74    {
 75  0 this.controller.setData(xml);
 76    }
 77   
 78  0 public String getData()
 79    {
 80  0 return this.controller.getModel().getXML();
 81    }
 82   
 83  0 public void fireEvent(String event)
 84    {
 85  0 if (event != null)
 86    {
 87  0 System.out.println(event);
 88    }
 89    }
 90  0 public void fireDoEvent(NotifyableAction action, BusinessObject target)
 91    {
 92  0 if (action != null)
 93    {
 94  0 String javascriptCall = action.getDoEvent();
 95  0 if (javascriptCall != null)
 96    {
 97  0 if (javascriptCall.indexOf("xml") != -1)
 98    {
 99  0 javascriptCall = javascriptCall.replaceAll("xml", "\"" + target.getXML() + "\"");
 100    }
 101  0 fireEvent(javascriptCall);
 102    }
 103    }
 104    }
 105  0 public void fireUndoEvent(NotifyableAction action, BusinessObject target)
 106    {
 107  0 if (action != null)
 108    {
 109  0 String javascriptCall = action.getUndoEvent();
 110  0 if (javascriptCall != null)
 111    {
 112  0 if (javascriptCall.indexOf("xml") != -1)
 113    {
 114  0 javascriptCall = javascriptCall.replaceAll("xml", "\"" + target.getXML() + "\"");
 115    }
 116  0 fireEvent(javascriptCall);
 117    }
 118    }
 119    }
 120   
 121   
 122  0 public static void main(String[] arg)
 123    {
 124  0 ModelerFrame frame = new ModelerFrame();
 125  0 frame.setSize(new Dimension(558, 386));
 126  0 frame.setLocation(100, 100);
 127  0 frame.setVisible(true);
 128    }
 129   
 130    }