Source Code Cross Referenced for SRadioButton.java in  » Swing-Library » wings3 » org » wings » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » wings3 » org.wings 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2000,2005 wingS development team.
003:         *
004:         * This file is part of wingS (http://wingsframework.org).
005:         *
006:         * wingS is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1
009:         * of the License, or (at your option) any later version.
010:         *
011:         * Please see COPYING for the complete licence.
012:         */
013:        package org.wings;
014:
015:        import org.wings.plaf.RadioButtonCG;
016:
017:        /**
018:         * Can be selected or deselected, and displays that state to the user.
019:         *
020:         * <p/>
021:         * Example:
022:         * <form>
023:         * <b>Radiobuttons:</b>
024:         * <p><input type="radio" name="1" value="1" checked>One</p>
025:         * <p><input type="radio" name="1" value="2">Two</p>
026:         * <p><input type="radio" name="1" value="3">Three</p>
027:         * </form>
028:         *
029:         * @author <a href="mailto:haaf@mercatis.de">Armin Haaf</a>
030:         */
031:        public class SRadioButton extends SAbstractButton {
032:
033:            /**
034:             * Creates an unselected radio button.
035:             *
036:             */
037:            public SRadioButton() {
038:                setType(RADIOBUTTON);
039:            }
040:
041:            /**
042:             * Creates a unselected radio button with an initial text.
043:             *
044:             * @param label Text to display
045:             */
046:            public SRadioButton(String label) {
047:                super (label, RADIOBUTTON);
048:            }
049:
050:            /**
051:             * Creates a radio button with a certain state.
052:             *
053:             * @param selected Whether the radio button is initially selected or not.
054:             */
055:            public SRadioButton(boolean selected) {
056:                this ();
057:                setSelected(selected);
058:            }
059:
060:            /**
061:             * Creates a radio button with a text-label and a state.
062:             *
063:             * @param label Text to display
064:             * @param selected Whether the radio button is initially selected or not.
065:             */
066:            public SRadioButton(String label, boolean selected) {
067:                this (selected);
068:                setText(label);
069:            }
070:
071:            public String getLowLevelEventId() {
072:                if (getGroup() != null && getShowAsFormComponent()) {
073:                    return getGroup().getComponentId();
074:                } else {
075:                    return super .getLowLevelEventId();
076:                } // end of if ()
077:            }
078:
079:            /**
080:             * You cannot change type of radio button. <p>
081:             * Accepts only {@link SAbstractButton#RADIOBUTTON}
082:             */
083:            public void setType(String t) {
084:                if (!RADIOBUTTON.equals(t))
085:                    throw new IllegalArgumentException(
086:                            "type change not supported, type is fix: radiobutton");
087:
088:                super .setType(t);
089:            }
090:
091:            public void setCG(RadioButtonCG cg) {
092:                super .setCG(cg);
093:            }
094:
095:            public void processLowLevelEvent(String action, String[] values) {
096:                processKeyEvents(values);
097:                if (action.endsWith("_keystroke"))
098:                    return;
099:
100:                delayEvents(true);
101:
102:                boolean origSelected = isSelected();
103:
104:                if (getShowAsFormComponent()) {
105:                    if (values.length == 1) {
106:                        // this happens if we've got a form component but
107:                        // the CG uses icons since useIconsInForm is true
108:                        if (getName().equals(values[0]) && !isSelected()) {
109:                            setSelected(true);
110:                        }
111:                    } else if (getGroup() == null) {
112:                        // one hidden and one checked event from the form says select
113:                        // it, else deselect it (typically only the hidden event)
114:                        setSelected(values.length == 2);
115:                    } else {
116:                        int eventCount = 0;
117:                        for (int i = 0; i < values.length; i++) {
118:                            // check the count of events, which are for me - with a
119:                            // button group, the value is my component id, if a event is
120:                            // for me
121:                            if (getName().equals(values[i])) {
122:                                eventCount++;
123:                            } // end of if ()
124:                        } // end of for (int i=0; i<; i++)
125:                        // one hidden and one checked event from the form says select
126:                        // it, else deselect it (typically only the hidden event)
127:                        setSelected(eventCount == 2);
128:                    } // end of if ()
129:                } else {
130:                    if (getGroup() != null) {
131:                        getGroup().setDelayEvents(true);
132:                        setSelected(parseSelectionToggle(values[0]));
133:                        getGroup().setDelayEvents(false);
134:                    } else {
135:                        setSelected(parseSelectionToggle(values[0]));
136:                    } // end of else
137:                }
138:
139:                if (isSelected() != origSelected) {
140:                    // got an event, that is a select...
141:                    SForm.addArmedComponent(this );
142:                } // end of if ()
143:
144:                delayEvents(false);
145:            }
146:
147:            protected boolean parseSelectionToggle(String toggleParameter) {
148:                if ("1".equals(toggleParameter) && !isSelected())
149:                    return true;
150:                else
151:                    return isSelected();
152:            }
153:
154:            public String getSelectionParameter() {
155:                if (getGroup() != null && getShowAsFormComponent()) {
156:                    return getName();
157:                } else {
158:                    return "1";
159:                }
160:            }
161:
162:            public String getDeselectionParameter() {
163:                if (getGroup() != null && getShowAsFormComponent()) {
164:                    return getName();
165:                } else {
166:                    return "0";
167:                }
168:            }
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.