Source Code Cross Referenced for RadialView.java in  » Swing-Library » abeille-forms-designer » com » jeta » swingbuilder » gui » effects » 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 » abeille forms designer » com.jeta.swingbuilder.gui.effects 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2005 Jeff Tassin
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2.1 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package com.jeta.swingbuilder.gui.effects;
020:
021:        import java.awt.BorderLayout;
022:
023:        import javax.swing.JSpinner;
024:        import javax.swing.SpinnerNumberModel;
025:
026:        import com.jeta.forms.components.colors.ColorSelector;
027:        import com.jeta.forms.components.panel.FormPanel;
028:        import com.jeta.forms.gui.effects.Painter;
029:        import com.jeta.forms.gui.effects.RadialGradientPainter;
030:        import com.jeta.forms.gui.form.GridView;
031:        import com.jeta.forms.store.properties.effects.PaintProperty;
032:        import com.jeta.forms.store.properties.effects.RadialGradientProperty;
033:        import com.jeta.open.gui.framework.JETAPanel;
034:
035:        /**
036:         * @author Jeff Tassin
037:         */
038:        public class RadialView extends JETAPanel implements  PaintView {
039:            /**
040:             * The fillProperties form.
041:             */
042:            private FormPanel m_view;
043:
044:            /**
045:             * The preview for the gradient settings
046:             */
047:            private GridView m_preview;
048:
049:            /**
050:             * Responsible for rendering the gradient in the parent view
051:             */
052:            private RadialGradientPainter m_painter = new RadialGradientPainter();
053:
054:            private RadialGradientProperty m_gp = new RadialGradientProperty();
055:
056:            /**
057:             * ctor
058:             */
059:            public RadialView(GridView preview) {
060:                this (preview, null);
061:            }
062:
063:            /**
064:             * ctor
065:             */
066:            public RadialView(GridView preview, PaintProperty pp) {
067:                m_preview = preview;
068:                setLayout(new BorderLayout());
069:                m_view = new FormPanel(
070:                        "com/jeta/swingbuilder/gui/effects/radialGradientProperties.frm");
071:                add(m_view, BorderLayout.CENTER);
072:                setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10,
073:                        10, 10));
074:
075:                JSpinner sp = (JSpinner) m_view
076:                        .getSpinner(RadialNames.ID_MAGNITUDE_SPINNER);
077:                sp.setModel(new SpinnerNumberModel(1, 1, 1000, 1));
078:                sp.setValue(new Integer(100));
079:
080:                if (pp != null) {
081:                    initialize((RadialGradientProperty) pp.getPaintDelegate());
082:                }
083:
084:                setController(new RadialViewController(this ));
085:            }
086:
087:            /**
088:             * Initializes the view
089:             */
090:            private void initialize(RadialGradientProperty gp) {
091:                ColorSelector view = (ColorSelector) m_view
092:                        .getComponentByName(RadialNames.ID_START_COLOR_SELECTOR);
093:                view.setColorProperty(gp.getStartColor());
094:                view = (ColorSelector) m_view
095:                        .getComponentByName(RadialNames.ID_END_COLOR_SELECTOR);
096:                view.setColorProperty(gp.getEndColor());
097:
098:                // setColorProperty( RadialNames.ID_START_COLOR, gp.getStartColor() );
099:                // setColorProperty( RadialNames.ID_END_COLOR, gp.getEndColor() );
100:                setPosition(gp.getPosition());
101:                setMagnitude(gp.getMagnitude());
102:            }
103:
104:            public int getMagnitude() {
105:                JSpinner sp = (JSpinner) m_view
106:                        .getSpinner(RadialNames.ID_MAGNITUDE_SPINNER);
107:                SpinnerNumberModel model = (SpinnerNumberModel) sp.getModel();
108:                Integer ival = (Integer) model.getValue();
109:                return ival.intValue();
110:            }
111:
112:            public void setPosition(int pos) {
113:                String pos_name = "CENTER";
114:                if (pos == RadialGradientProperty.TOP_LEFT) {
115:                    pos_name = "TOP_LEFT";
116:                } else if (pos == RadialGradientProperty.TOP_CENTER) {
117:                    pos_name = "TOP_CENTER";
118:                } else if (pos == RadialGradientProperty.TOP_RIGHT) {
119:                    pos_name = "TOP_RIGHT";
120:                } else if (pos == RadialGradientProperty.BOTTOM_LEFT) {
121:                    pos_name = "BOTTOM_LEFT";
122:                } else if (pos == RadialGradientProperty.BOTTOM_CENTER) {
123:                    pos_name = "BOTTOM_CENTER";
124:                } else if (pos == RadialGradientProperty.BOTTOM_RIGHT) {
125:                    pos_name = "BOTTOM_RIGHT";
126:                } else if (pos == RadialGradientProperty.LEFT_CENTER) {
127:                    pos_name = "LEFT_CENTER";
128:                } else if (pos == RadialGradientProperty.RIGHT_CENTER) {
129:                    pos_name = "RIGHT_CENTER";
130:                }
131:                m_view.setSelectedItem(RadialNames.ID_POSITION_COMBO, pos_name);
132:            }
133:
134:            public void setMagnitude(int mag) {
135:                JSpinner sp = (JSpinner) m_view
136:                        .getSpinner(RadialNames.ID_MAGNITUDE_SPINNER);
137:                sp.setModel(new SpinnerNumberModel(1, 1, 1000, 1));
138:                sp.setValue(new Integer(mag));
139:            }
140:
141:            /**
142:             * @return a painter object for this the properties in this view
143:             */
144:            public Painter getPainter() {
145:                m_painter.setGradientProperty(getGradientProperty());
146:                return m_painter;
147:            }
148:
149:            /**
150:             * @return the
151:             */
152:            public RadialGradientProperty getGradientProperty() {
153:                RadialGradientProperty rp = new RadialGradientProperty();
154:                rp.setPosition(getPosition());
155:
156:                ColorSelector view = (ColorSelector) m_view
157:                        .getComponentByName(RadialNames.ID_START_COLOR_SELECTOR);
158:                rp.setStartColor(view.getColorProperty());
159:                view = (ColorSelector) m_view
160:                        .getComponentByName(RadialNames.ID_END_COLOR_SELECTOR);
161:                rp.setEndColor(view.getColorProperty());
162:                rp.setMagnitude(getMagnitude());
163:                return rp;
164:            }
165:
166:            /**
167:             * @return the
168:             */
169:            public PaintProperty getPaintProperty() {
170:                return new PaintProperty(getGradientProperty());
171:            }
172:
173:            /**
174:             * @return the position of the gradient center
175:             */
176:            private int getPosition() {
177:                String pos = (String) m_view
178:                        .getSelectedItem(RadialNames.ID_POSITION_COMBO);
179:                if ("TOP_LEFT".equals(pos))
180:                    return RadialGradientProperty.TOP_LEFT;
181:                if ("TOP_CENTER".equals(pos))
182:                    return RadialGradientProperty.TOP_CENTER;
183:                if ("TOP_RIGHT".equals(pos))
184:                    return RadialGradientProperty.TOP_RIGHT;
185:
186:                if ("BOTTOM_LEFT".equals(pos))
187:                    return RadialGradientProperty.BOTTOM_LEFT;
188:                if ("BOTTOM_CENTER".equals(pos))
189:                    return RadialGradientProperty.BOTTOM_CENTER;
190:                if ("BOTTOM_RIGHT".equals(pos))
191:                    return RadialGradientProperty.BOTTOM_RIGHT;
192:
193:                if ("LEFT_CENTER".equals(pos))
194:                    return RadialGradientProperty.LEFT_CENTER;
195:                if ("RIGHT_CENTER".equals(pos))
196:                    return RadialGradientProperty.RIGHT_CENTER;
197:
198:                return RadialGradientProperty.CENTER;
199:            }
200:
201:            /**
202:             * Sets the property for the view
203:             */
204:            public void setPaintProperty(PaintProperty pp) {
205:                if (pp.getPaintDelegate() instanceof  RadialGradientProperty) {
206:                    RadialGradientProperty gp = (RadialGradientProperty) pp
207:                            .getPaintDelegate();
208:                    m_gp.setValue(gp);
209:                    initialize(m_gp);
210:                    updatePreview();
211:                }
212:            }
213:
214:            /**
215:             * Updates the preview view
216:             */
217:            public void updatePreview() {
218:                m_preview.setBackgroundPainter(getPainter());
219:            }
220:
221:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.