Source Code Cross Referenced for FillLevelBar.java in  » Collaboration » JacORB » org » jacorb » poa » gui » beans » 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 » Collaboration » JacORB » org.jacorb.poa.gui.beans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.jacorb.poa.gui.beans;
002:
003:        /*
004:         *        JacORB - a free Java ORB
005:         *
006:         *   Copyright (C) 1997-2004 Gerald Brose.
007:         *
008:         *   This library is free software; you can redistribute it and/or
009:         *   modify it under the terms of the GNU Library General Public
010:         *   License as published by the Free Software Foundation; either
011:         *   version 2 of the License, or (at your option) any later version.
012:         *
013:         *   This library is distributed in the hope that it will be useful,
014:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         *   Library General Public License for more details.
017:         *
018:         *   You should have received a copy of the GNU Library General Public
019:         *   License along with this library; if not, write to the Free
020:         *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021:         */
022:
023:        /**
024:         * Provides the functionality of a fill level statebar.
025:         *
026:         * @author Reimo Tiedemann, FU Berlin
027:         * @version 1.0, 05/03/99
028:         * @see		org.jacorb.poa.gui.beans.FillLevelCanvas
029:         */
030:        public class FillLevelBar extends java.awt.Panel {
031:            private boolean useAvg;
032:            private boolean isVariable;
033:            private int max;
034:            private int avg;
035:            private int min;
036:            private int cur;
037:            private java.awt.Label ivjAvgLabel = null;
038:            private java.awt.Label ivjCurLabel = null;
039:            private java.awt.Label ivjMaxLabel = null;
040:            private java.awt.Label ivjMinLabel = null;
041:            private FillLevelCanvas ivjFillLevelCanvas = null;
042:
043:            /**
044:             * Constructor
045:             */
046:            /* WARNING: THIS METHOD WILL BE REGENERATED. */
047:            public FillLevelBar() {
048:                super ();
049:                initialize();
050:            }
051:
052:            /**
053:             * FillLevelBar constructor comment.
054:             * @param layout java.awt.LayoutManager
055:             */
056:            public FillLevelBar(java.awt.LayoutManager layout) {
057:                super (layout);
058:            }
059:
060:            /**
061:             * Return the Label22 property value.
062:             * @return java.awt.Label
063:             */
064:            /* WARNING: THIS METHOD WILL BE REGENERATED. */
065:            private java.awt.Label getAvgLabel() {
066:                if (ivjAvgLabel == null) {
067:                    try {
068:                        ivjAvgLabel = new java.awt.Label();
069:                        ivjAvgLabel.setName("AvgLabel");
070:                        ivjAvgLabel.setText("");
071:                        ivjAvgLabel.setBackground(java.awt.SystemColor.control);
072:                        ivjAvgLabel.setFont(new java.awt.Font("dialog", 0, 10));
073:                        ivjAvgLabel.setBounds(23, 54, 25, 10);
074:                        // user code begin {1}
075:                        // user code end
076:                    } catch (java.lang.Throwable ivjExc) {
077:                        // user code begin {2}
078:                        // user code end
079:                        handleException(ivjExc);
080:                    }
081:                }
082:                ;
083:                return ivjAvgLabel;
084:            }
085:
086:            /**
087:             * Return the Label1 property value.
088:             * @return java.awt.Label
089:             */
090:            /* WARNING: THIS METHOD WILL BE REGENERATED. */
091:            private java.awt.Label getCurLabel() {
092:                if (ivjCurLabel == null) {
093:                    try {
094:                        ivjCurLabel = new java.awt.Label();
095:                        ivjCurLabel.setName("CurLabel");
096:                        ivjCurLabel.setText("");
097:                        ivjCurLabel.setBackground(java.awt.SystemColor.control);
098:                        ivjCurLabel.setFont(new java.awt.Font("dialog", 0, 10));
099:                        ivjCurLabel.setAlignment(1);
100:                        ivjCurLabel.setBounds(0, 115, 25, 12);
101:                        // user code begin {1}
102:                        // user code end
103:                    } catch (java.lang.Throwable ivjExc) {
104:                        // user code begin {2}
105:                        // user code end
106:                        handleException(ivjExc);
107:                    }
108:                }
109:                ;
110:                return ivjCurLabel;
111:            }
112:
113:            /**
114:             * Return the FillLevelCanvas property value.
115:             * @return org.jacorb.poa.gui.beans.FillLevelCanvas
116:             */
117:            /* WARNING: THIS METHOD WILL BE REGENERATED. */
118:            private FillLevelCanvas getFillLevelCanvas() {
119:                if (ivjFillLevelCanvas == null) {
120:                    try {
121:                        ivjFillLevelCanvas = new org.jacorb.poa.gui.beans.FillLevelCanvas();
122:                        ivjFillLevelCanvas.setName("FillLevelCanvas");
123:                        ivjFillLevelCanvas.setBounds(5, 10, 15, 100);
124:                        // user code begin {1}
125:                        // user code end
126:                    } catch (java.lang.Throwable ivjExc) {
127:                        // user code begin {2}
128:                        // user code end
129:                        handleException(ivjExc);
130:                    }
131:                }
132:                ;
133:                return ivjFillLevelCanvas;
134:            }
135:
136:            /**
137:             * Return the Label21 property value.
138:             * @return java.awt.Label
139:             */
140:            /* WARNING: THIS METHOD WILL BE REGENERATED. */
141:            private java.awt.Label getMaxLabel() {
142:                if (ivjMaxLabel == null) {
143:                    try {
144:                        ivjMaxLabel = new java.awt.Label();
145:                        ivjMaxLabel.setName("MaxLabel");
146:                        ivjMaxLabel.setText("");
147:                        ivjMaxLabel.setBackground(java.awt.SystemColor.control);
148:                        ivjMaxLabel.setFont(new java.awt.Font("dialog", 0, 10));
149:                        ivjMaxLabel.setBounds(23, 7, 25, 10);
150:                        // user code begin {1}
151:                        // user code end
152:                    } catch (java.lang.Throwable ivjExc) {
153:                        // user code begin {2}
154:                        // user code end
155:                        handleException(ivjExc);
156:                    }
157:                }
158:                ;
159:                return ivjMaxLabel;
160:            }
161:
162:            /**
163:             * Return the Label2 property value.
164:             * @return java.awt.Label
165:             */
166:            /* WARNING: THIS METHOD WILL BE REGENERATED. */
167:            private java.awt.Label getMinLabel() {
168:                if (ivjMinLabel == null) {
169:                    try {
170:                        ivjMinLabel = new java.awt.Label();
171:                        ivjMinLabel.setName("MinLabel");
172:                        ivjMinLabel.setText("");
173:                        ivjMinLabel.setBackground(java.awt.SystemColor.control);
174:                        ivjMinLabel.setFont(new java.awt.Font("dialog", 0, 10));
175:                        ivjMinLabel.setBounds(23, 104, 25, 10);
176:                        // user code begin {1}
177:                        // user code end
178:                    } catch (java.lang.Throwable ivjExc) {
179:                        // user code begin {2}
180:                        // user code end
181:                        handleException(ivjExc);
182:                    }
183:                }
184:                ;
185:                return ivjMinLabel;
186:            }
187:
188:            /**
189:             * Called whenever the part throws an exception.
190:             * @param exception java.lang.Throwable
191:             */
192:            private void handleException(Throwable exception) {
193:
194:                /* Uncomment the following lines to print uncaught exceptions to stdout */
195:                // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
196:                // exception.printStackTrace(System.out);
197:            }
198:
199:            public void init(int _min, int _avg, int _max,
200:                    java.awt.Color _color1, java.awt.Color _color2,
201:                    boolean _useAvg, boolean _isVariable) {
202:                min = _min;
203:                avg = _avg;
204:                max = _max;
205:                useAvg = _useAvg;
206:                getFillLevelCanvas().init(min, avg, max, _color1, _color2,
207:                        useAvg);
208:                isVariable = _isVariable;
209:                if (useAvg) {
210:                    getAvgLabel().setText("" + _avg);
211:                    getAvgLabel().setLocation(23,
212:                            getFillLevelCanvas().getYAvg() + 6);
213:                }
214:                getMaxLabel().setText("" + _max);
215:                getMinLabel().setText("" + _min);
216:                getCurLabel().setText("" + _min);
217:            }
218:
219:            /**
220:             * Initialize the class.
221:             */
222:            /* WARNING: THIS METHOD WILL BE REGENERATED. */
223:            private void initialize() {
224:                // user code begin {1}
225:                // user code end
226:                setName("FillLevelBar");
227:                setLayout(null);
228:                setBackground(java.awt.SystemColor.control);
229:                setSize(50, 130);
230:                add(getCurLabel(), getCurLabel().getName());
231:                add(getMinLabel(), getMinLabel().getName());
232:                add(getMaxLabel(), getMaxLabel().getName());
233:                add(getAvgLabel(), getAvgLabel().getName());
234:                add(getFillLevelCanvas(), getFillLevelCanvas().getName());
235:                // user code begin {2}
236:                // user code end
237:            }
238:
239:            /**
240:             * main entrypoint - starts the part when it is run as an application
241:             * @param args java.lang.String[]
242:             */
243:            public static void main(java.lang.String[] args) {
244:                try {
245:                    java.awt.Frame frame;
246:                    try {
247:                        Class aFrameClass = Class
248:                                .forName("com.ibm.uvm.abt.edit.TestFrame");
249:                        frame = (java.awt.Frame) aFrameClass.newInstance();
250:                    } catch (java.lang.Throwable ivjExc) {
251:                        frame = new java.awt.Frame();
252:                    }
253:                    FillLevelBar aFillLevelBar;
254:                    aFillLevelBar = new FillLevelBar();
255:                    frame.add("Center", aFillLevelBar);
256:                    frame.setSize(aFillLevelBar.getSize());
257:                    frame.setVisible(true);
258:                } catch (Throwable exception) {
259:                    System.err
260:                            .println("Exception occurred in main() of java.awt.Panel");
261:                    exception.printStackTrace(System.out);
262:                }
263:            }
264:
265:            private int maxCompute(int current) {
266:
267:                int tenPerCent = max / 10;
268:
269:                if (current < tenPerCent) {
270:
271:                    while (max > current * 2 && max > 10) {
272:                        max = max / 2 > 10 ? max / 2 : 10;
273:                    }
274:
275:                } else if (current > max - tenPerCent) {
276:
277:                    while (max < current + tenPerCent) {
278:                        max = max * 2;
279:                    }
280:                }
281:                return max;
282:            }
283:
284:            public void paint(java.awt.Graphics g) {
285:                g.setColor(getBackground());
286:                g.fill3DRect(3, 8, 19, 104, false);
287:            }
288:
289:            public void setAvgValue(int value) {
290:                if (avg == value)
291:                    return;
292:                avg = value;
293:                if (useAvg) {
294:                    getFillLevelCanvas().setAvg(avg);
295:                    getAvgLabel().setLocation(23,
296:                            getFillLevelCanvas().getYAvg() + 6);
297:                    getAvgLabel().setText("" + avg);
298:                }
299:            }
300:
301:            public void setCurrentValue(int value) {
302:                if (cur == value)
303:                    return;
304:                cur = value;
305:                if (isVariable) {
306:                    if (max != maxCompute(cur)) {
307:                        getFillLevelCanvas().setMax(max);
308:                        getMaxLabel().setText("" + max);
309:                    }
310:                }
311:                getFillLevelCanvas().setCurrent(cur > min ? cur - min : 0);
312:                getCurLabel().setText("" + cur);
313:            }
314:
315:            public void setMaxValue(int value) {
316:                if (max == value)
317:                    return;
318:                max = value;
319:                getFillLevelCanvas().setMax(max);
320:                if (useAvg) {
321:                    getAvgLabel().setLocation(23,
322:                            getFillLevelCanvas().getYAvg() + 6);
323:                }
324:                getMaxLabel().setText("" + max);
325:            }
326:
327:            public void setMinValue(int value) {
328:                if (min == value)
329:                    return;
330:                min = value;
331:                getFillLevelCanvas().setMin(min);
332:                if (useAvg) {
333:                    getAvgLabel().setLocation(23,
334:                            getFillLevelCanvas().getYAvg() + 6);
335:                }
336:                getFillLevelCanvas().setCurrent(cur > min ? cur - min : 0);
337:                getMinLabel().setText("" + min);
338:            }
339:
340:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.