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    import nextapp.echo2.app.button.ButtonGroup;
022    
023    /**
024     * This class represents a blue style radio button.
025     * 
026     * @author Tobias Kuhn
027     */
028    public class RadioButton extends nextapp.echo2.app.RadioButton {
029            
030            private static final long serialVersionUID = 1429240270043389676L;
031    
032            /**
033             * Creates a new radio button having a text and an icon.
034             * 
035             * @param text The text.
036             * @param icon The icon.
037             * @param group The button group.
038             */
039            public RadioButton(String text, ImageReference icon, ButtonGroup group) {
040                    super(text, icon);
041                    if (group != null) setGroup(group);
042                    setStateIcon(new ResourceImageReference("ch/uzh/ifi/attempto/echocomp/style/radiooff.png"));
043                    setSelectedStateIcon(new ResourceImageReference("ch/uzh/ifi/attempto/echocomp/style/radioon.png"));
044                    setFont(new Font(Style.fontTypeface, Font.PLAIN, new Extent(13)));
045            }
046            
047            /**
048             * Creates a new radio button having only a text.
049             * 
050             * @param text The text.
051             * @param group The button group.
052             */
053            public RadioButton(String text, ButtonGroup group) {
054                    this(text, null, group);
055            }
056            
057            /**
058             * Creates a new radio button having only an icon.
059             * 
060             * @param icon The icon.
061             * @param group The button group.
062             */
063            public RadioButton(ImageReference icon, ButtonGroup group) {
064                    this(null, icon, group);
065            }
066            
067            /**
068             * Creates a new radio button having neither a text nor an icon.
069             * 
070             * @param group The button group.
071             */
072            public RadioButton(ButtonGroup group) {
073                    this(null, null, group);
074            }
075            
076            /**
077             * Creates a new radio button having only a text.
078             * 
079             * @param text The text.
080             */
081            public RadioButton(String text) {
082                    this(text, null, null);
083            }
084            
085            /**
086             * Creates a new radio button having only an icon.
087             * 
088             * @param icon The icon.
089             */
090            public RadioButton(ImageReference icon) {
091                    this(null, icon, null);
092            }
093            
094            /**
095             * Creates a new radio button having neither a text nor an icon.
096             */
097            public RadioButton() {
098                    this(null, null, null);
099            }
100    
101    }