| Line | Hits | Source |
|---|---|---|
| 1 | /******************************************************************************* | |
| 2 | * Demetrix process modelling system | |
| 3 | * | |
| 4 | * Copyright (c) 2003, 2004 Dimitri A. Pissarenko | |
| 5 | * | |
| 6 | * This file is part of Demetrix. | |
| 7 | * | |
| 8 | * Demetrix is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2.1 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * Demetrix is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with Demetrix; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | * | |
| 22 | * For further information you may | |
| 23 | * | |
| 24 | * - send an e-mail in Russian, German or English to dimitri.pissarenko@gmx.net | |
| 25 | * - look at http://sourceforge.net/projects/demetrix/ | |
| 26 | * - look at http://demetrix.sourceforge.net/ | |
| 27 | * - look at http://members.inode.at/d.pissarenko/ | |
| 28 | * | |
| 29 | *****************************************************************************/ | |
| 30 | /* | |
| 31 | * Created on 05.02.2004 | |
| 32 | */ | |
| 33 | package net.sourceforge.demetrix.ui; | |
| 34 | ||
| 35 | import org.apache.log4j.Logger; | |
| 36 | ||
| 37 | import net.sourceforge.demetrix.model.JavaBeanBasedResource; | |
| 38 | import net.sourceforge.demetrix.model.JavaBeanBasedTask; | |
| 39 | import net.sourceforge.demetrix.properties.DemetrixPropertiesHolder; | |
| 40 | import net.sourceforge.demetrix.properties.JavaBeanBasedDemetrixPropertiesHolder; | |
| 41 | ||
| 42 | /** | |
| 43 | * @author Dimitri Pissarenko | |
| 44 | * | |
| 45 | */ | |
| 46 | ||
| 47 | /** | |
| 48 | * | |
| 49 | * Note: part of this code was provided by Gerhard Görlich | |
| 50 | * | |
| 51 | */ | |
| 52 | public class JavaBeanBasedPropertiesPanel extends PropertiesPanel { | |
| 53 | private boolean updateUnderlyingBean; | |
| 54 | private Logger logger=Logger.getLogger(getClass()); | |
| 55 | public JavaBeanBasedPropertiesPanel() { | |
| 56 | 6 | super(); |
| 57 | 6 | this.newPropertyButton.setEnabled(false); |
| 58 | 6 | this.setUpdateUnderlyingBean(false); |
| 59 | 6 | } |
| 60 | ||
| 61 | protected void applyButtonAction() { | |
| 62 | 2 | if (this.updateDataObject()) |
| 63 | { | |
| 64 | 2 | if ((this.getPropertiesHolder() instanceof JavaBeanBasedDemetrixPropertiesHolder) && |
| 65 | this.isUpdateUnderlyingBean()) | |
| 66 | { | |
| 67 | 1 | ((JavaBeanBasedDemetrixPropertiesHolder)this.getPropertiesHolder()).updateUnderlyingBean(); |
| 68 | } | |
| 69 | } | |
| 70 | 2 | } |
| 71 | ||
| 72 | /** | |
| 73 | * @return | |
| 74 | */ | |
| 75 | public boolean isUpdateUnderlyingBean() { | |
| 76 | 4 | return updateUnderlyingBean; |
| 77 | } | |
| 78 | ||
| 79 | /** | |
| 80 | * @param b | |
| 81 | */ | |
| 82 | public void setUpdateUnderlyingBean(boolean b) { | |
| 83 | 8 | updateUnderlyingBean = b; |
| 84 | 8 | } |
| 85 | ||
| 86 | /* (non-Javadoc) | |
| 87 | * @see net.sourceforge.demetrix.ui.PropertiesPanel#setPropertiesHolder(net.sourceforge.demetrix.properties.DemetrixPropertiesHolder) | |
| 88 | */ | |
| 89 | public void setPropertiesHolder(DemetrixPropertiesHolder holder) { | |
| 90 | 8 | if ((holder instanceof JavaBeanBasedDemetrixPropertiesHolder) || |
| 91 | (holder instanceof JavaBeanBasedResource) || | |
| 92 | (holder instanceof JavaBeanBasedTask)) | |
| 93 | { | |
| 94 | 6 | super.setPropertiesHolder(holder); |
| 95 | } | |
| 96 | else | |
| 97 | { | |
| 98 | this.logger.debug("\"" + holder + "\" is not a JavaBeanBasedDemetrixPropertiesHolder, propertiesHolder set to null"); | |
| 99 | 2 | super.setPropertiesHolder(null); |
| 100 | } | |
| 101 | 8 | } |
| 102 | ||
| 103 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |