001    // This file is part of the Attempto Java Packages.
002    // Copyright 2008-2009, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch).
003    //
004    // The Attempto Java Packages is free software: you can redistribute it and/or modify it under the
005    // terms of the GNU Lesser General Public License as published by the Free Software Foundation,
006    // either version 3 of the License, or (at your option) any later version.
007    //
008    // The Attempto Java Packages is distributed in the hope that it will be useful, but WITHOUT ANY
009    // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
010    // PURPOSE. See the GNU Lesser General Public License for more details.
011    //
012    // You should have received a copy of the GNU Lesser General Public License along with the Attempto
013    // Java Packages. If not, see http://www.gnu.org/licenses/.
014    
015    package ch.uzh.ifi.attempto.echocomp;
016    
017    import nextapp.echo2.app.Extent;
018    import nextapp.echo2.app.Font;
019    import nextapp.echo2.app.ImageReference;
020    import nextapp.echo2.app.ResourceImageReference;
021    
022    /**
023     * This class represents a blue style check box.
024     * 
025     * @author Tobias Kuhn
026     */
027    public class CheckBox extends nextapp.echo2.app.CheckBox {
028    
029            private static final long serialVersionUID = -8160475963811004744L;
030    
031            /**
032             * Creates a new check box having a text and an icon.
033             * 
034             * @param text The text.
035             * @param icon The icon.
036             */
037            public CheckBox(String text, ImageReference icon) {
038                    super(text, icon);
039                    setStateIcon(new ResourceImageReference("ch/uzh/ifi/attempto/echocomp/style/notchecked.png"));
040                    setSelectedStateIcon(new ResourceImageReference("ch/uzh/ifi/attempto/echocomp/style/checked.png"));
041                    setFont(new Font(Style.fontTypeface, Font.PLAIN, new Extent(13)));
042            }
043            
044            /**
045             * Creates a new check box having only a text.
046             * 
047             * @param text The text.
048             */
049            public CheckBox(String text) {
050                    this(text, null);
051            }
052            
053            /**
054             * Creates a new check box having only an icon.
055             * 
056             * @param icon The icon.
057             */
058            public CheckBox(ImageReference icon) {
059                    this(null, icon);
060            }
061            
062            /**
063             * Creates a new check box having neither a text nor an icon.
064             */
065            public CheckBox() {
066                    this(null, null);
067            }
068    
069    }