Clover coverage report - Maven Clover report
Coverage timestamp: Thu Oct 11 2007 08:41:48 CEST
file stats: LOC: 125   Methods: 11
NCLOC: 88   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
UpdatePanel.java - 0% 0% 0%
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.palette;
 19   
 20    import java.awt.BorderLayout;
 21    import java.awt.FlowLayout;
 22    import java.awt.event.ActionEvent;
 23    import java.awt.event.ActionListener;
 24    import java.util.Map;
 25   
 26    import javax.swing.JButton;
 27    import javax.swing.JDialog;
 28    import javax.swing.JPanel;
 29   
 30    import org.ericmignot.modeler.data.BusinessObject;
 31   
 32    public abstract class UpdatePanel extends JPanel
 33    {
 34    private BusinessObject businessObject;
 35   
 36    public static final boolean OK = true;
 37    public static final boolean CANCEL = false;
 38    private boolean state;
 39   
 40    private JButton okButton, cancelButton;
 41    private JPanel buttonPanel;
 42   
 43    private JDialog dialog;
 44   
 45  0 public UpdatePanel()
 46    {
 47  0 this.businessObject = null;
 48  0 this.dialog = null;
 49  0 this.state = CANCEL;
 50  0 initComponents();
 51    }
 52   
 53  0 public BusinessObject getBusinessObject()
 54    {
 55  0 return businessObject;
 56    }
 57   
 58  0 public void setBusinessObject(BusinessObject businessObject)
 59    {
 60  0 this.businessObject = businessObject;
 61  0 this.add(this.getSpecificPanel(), BorderLayout.CENTER);
 62    }
 63   
 64  0 public void setDialog (JDialog dialog)
 65    {
 66  0 this.dialog = dialog;
 67    }
 68   
 69  0 private void initComponents()
 70    {
 71  0 okButton = new JButton("OK");
 72  0 okButton.addActionListener(new ActionListener()
 73    {
 74  0 public void actionPerformed(ActionEvent e)
 75    {
 76  0 UpdatePanel.this.treatOK();
 77    }
 78    }
 79    );
 80  0 cancelButton = new JButton ("Cancel");
 81  0 cancelButton.addActionListener(new ActionListener()
 82    {
 83  0 public void actionPerformed(ActionEvent e)
 84    {
 85  0 UpdatePanel.this.treatCancel();
 86    }
 87    }
 88    );
 89   
 90  0 this.setLayout(new BorderLayout());
 91  0 JPanel tmp = new JPanel();
 92  0 this.add(tmp, BorderLayout.NORTH);
 93   
 94  0 buttonPanel = new JPanel(new FlowLayout());
 95  0 buttonPanel.add(okButton);
 96  0 buttonPanel.add(cancelButton);
 97  0 this.add(buttonPanel, BorderLayout.SOUTH);
 98    }
 99   
 100  0 private void treatOK()
 101    {
 102  0 this.state = OK;
 103  0 this.dialog.dispose();
 104    }
 105  0 private void treatCancel()
 106    {
 107  0 this.state = CANCEL;
 108  0 this.dialog.dispose();
 109    }
 110   
 111  0 public boolean getState()
 112    {
 113  0 return this.state;
 114    }
 115   
 116  0 public JPanel getButtonPanel()
 117    {
 118  0 return this.buttonPanel;
 119    }
 120   
 121    protected abstract JPanel getSpecificPanel();
 122    protected abstract Map getNewValues();
 123   
 124   
 125    }