001    // This file is part of AceWiki.
002    // Copyright 2008-2012, AceWiki developers.
003    // 
004    // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU
005    // Lesser General Public License as published by the Free Software Foundation, either version 3 of
006    // the License, or (at your option) any later version.
007    // 
008    // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
009    // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
010    // Lesser General Public License for more details.
011    // 
012    // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If
013    // not, see http://www.gnu.org/licenses/.
014    
015    package ch.uzh.ifi.attempto.echocomp;
016    
017    import nextapp.echo.app.Extent;
018    import nextapp.echo.app.Font;
019    import nextapp.echo.app.ImageReference;
020    import nextapp.echo.app.button.ButtonGroup;
021    
022    /**
023     * This class represents a radio button in blue style.
024     * 
025     * @author Tobias Kuhn
026     */
027    public class RadioButton extends nextapp.echo.app.RadioButton {
028            
029            private static final long serialVersionUID = 1429240270043389676L;
030    
031            /**
032             * Creates a new radio button having a text and an icon.
033             * 
034             * @param text The text.
035             * @param icon The icon.
036             * @param group The button group.
037             */
038            public RadioButton(String text, ImageReference icon, ButtonGroup group) {
039                    super(text, icon);
040                    if (group != null) setGroup(group);
041                    setStateIcon(Style.getImage("ch/uzh/ifi/attempto/echocomp/style/radiooff.png"));
042                    setSelectedStateIcon(Style.getImage("ch/uzh/ifi/attempto/echocomp/style/radioon.png"));
043                    setFont(new Font(Style.fontTypeface, Font.PLAIN, new Extent(13)));
044            }
045            
046            /**
047             * Creates a new radio button having only a text.
048             * 
049             * @param text The text.
050             * @param group The button group.
051             */
052            public RadioButton(String text, ButtonGroup group) {
053                    this(text, null, group);
054            }
055            
056            /**
057             * Creates a new radio button having only an icon.
058             * 
059             * @param icon The icon.
060             * @param group The button group.
061             */
062            public RadioButton(ImageReference icon, ButtonGroup group) {
063                    this(null, icon, group);
064            }
065            
066            /**
067             * Creates a new radio button having neither a text nor an icon.
068             * 
069             * @param group The button group.
070             */
071            public RadioButton(ButtonGroup group) {
072                    this(null, null, group);
073            }
074            
075            /**
076             * Creates a new radio button having only a text.
077             * 
078             * @param text The text.
079             */
080            public RadioButton(String text) {
081                    this(text, null, null);
082            }
083            
084            /**
085             * Creates a new radio button having only an icon.
086             * 
087             * @param icon The icon.
088             */
089            public RadioButton(ImageReference icon) {
090                    this(null, icon, null);
091            }
092            
093            /**
094             * Creates a new radio button having neither a text nor an icon.
095             */
096            public RadioButton() {
097                    this(null, null, null);
098            }
099    
100    }