| 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 | package net.sourceforge.demetrix.properties.swixml; | |
| 31 | import javax.swing.JCheckBox; | |
| 32 | import javax.swing.JLabel; | |
| 33 | import javax.swing.JPanel; | |
| 34 | import org.apache.log4j.Logger; | |
| 35 | import org.swixml.SwingEngine; | |
| 36 | import net.sourceforge.demetrix.properties.*; | |
| 37 | ||
| 38 | /** | |
| 39 | * @author Dimitri Pissarenko | |
| 40 | * | |
| 41 | */ | |
| 42 | public class BooleanPropertySwixMLRepresentation | |
| 43 | implements SwixMLDemetrixPropertyRepresentation { | |
| 44 | private Logger logger = Logger.getLogger(getClass()); | |
| 45 | private JPanel panel; | |
| 46 | public JLabel propertyNameLabel; | |
| 47 | public JCheckBox propertyValueCheckBox; | |
| 48 | public final static String UI_DEF_FILE_NAME = | |
| 49 | "net/sourceforge/demetrix/properties/swixml/BooleanPropertySwixMLRepresentation.xml"; | |
| 50 | 8 | public BooleanPropertySwixMLRepresentation() { |
| 51 | ||
| 52 | try { | |
| 53 | 8 | this.panel = |
| 54 | (JPanel) (new SwingEngine(this)).render( | |
| 55 | ClassLoader.getSystemClassLoader().getResource( | |
| 56 | UI_DEF_FILE_NAME)); | |
| 57 | 0 | } catch (Exception exception) { |
| 58 | this.logger.error("", exception); | |
| 59 | 8 | } |
| 60 | 8 | } |
| 61 | /* (non-Javadoc) | |
| 62 | * @see net.sourceforge.demetrix.properties.DemetrixPropertyRepresentation#updatePropertyData(net.sourceforge.demetrix.properties.DemetrixProperty) | |
| 63 | */ | |
| 64 | public void updatePropertyData(DemetrixProperty property) { | |
| 65 | 2 | property.setValue(new Boolean(this.propertyValueCheckBox.isSelected())); |
| 66 | 2 | } |
| 67 | /* (non-Javadoc) | |
| 68 | * @see net.sourceforge.demetrix.properties.DemetrixPropertyRepresentation#updateRepresentation(net.sourceforge.demetrix.properties.DemetrixProperty) | |
| 69 | */ | |
| 70 | public void updateRepresentation(DemetrixProperty property) { | |
| 71 | 6 | this.propertyNameLabel.setText(property.getName()); |
| 72 | 6 | this.propertyValueCheckBox.setEnabled(!property.isReadOnly()); |
| 73 | 6 | this.propertyValueCheckBox.setSelected( |
| 74 | ((Boolean) property.getValue()).booleanValue()); | |
| 75 | 6 | } |
| 76 | /* (non-Javadoc) | |
| 77 | * @see net.sourceforge.demetrix.properties.swixml.SwixMLDemetrixPropertyRepresentation#getPanel() | |
| 78 | */ | |
| 79 | public JPanel getPanel() { | |
| 80 | 7 | return this.panel; |
| 81 | } | |
| 82 | /* (non-Javadoc) | |
| 83 | * @see net.sourceforge.demetrix.properties.DemetrixPropertyRepresentation#isEnteredDataValid() | |
| 84 | */ | |
| 85 | public boolean isEnteredDataValid() { | |
| 86 | 2 | return true; |
| 87 | } | |
| 88 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |