Source Code Cross Referenced for ICacheService.java in  » Net » hyperpool-0.4.0 » vicazh » hyperpool » stream » net » http » 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 » Net » hyperpool 0.4.0 » vicazh.hyperpool.stream.net.http 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package vicazh.hyperpool.stream.net.http;
002:
003:        import java.awt.*;
004:        import java.awt.event.*;
005:        import java.beans.*;
006:        import java.util.logging.*;
007:        import javax.swing.*;
008:        import org.jfree.chart.*;
009:        import org.jfree.chart.plot.*;
010:        import org.jfree.chart.title.*;
011:        import org.jfree.data.general.*;
012:        import vicazh.hyperpool.*;
013:        import vicazh.hyperpool.Start;
014:
015:        /**
016:         * The graphic cache service
017:         * 
018:         * @author Victor Zhigunov
019:         * @version 0.4.0
020:         */
021:        public class ICacheService extends IService implements 
022:                CacheServiceMBean, ActionListener, PropertyChangeListener {
023:            private JFreeChart chart;
024:
025:            private PiePlot plot;
026:
027:            private JButton buttonReset;
028:
029:            private LegendTitle legend;
030:
031:            private DefaultPieDataset data;
032:
033:            private JDialog dialog;
034:
035:            private JOptionPane optionPane;
036:
037:            private JTextField textDir;
038:
039:            private Component component;
040:
041:            /**
042:             * @param name
043:             *            service name
044:             * @param chart
045:             *            chart
046:             * @param plot
047:             *            pie plot
048:             * @param buttonReset
049:             *            reset button
050:             * @param legend
051:             *            legend
052:             * @param data
053:             *            pie dataset
054:             * @param dialog
055:             *            options dialog
056:             * @param textDir
057:             *            files directory value field
058:             * @param component
059:             *            component for ui update
060:             */
061:            public ICacheService(String name, JFreeChart chart, PiePlot plot,
062:                    JButton buttonReset, LegendTitle legend,
063:                    DefaultPieDataset data, JDialog dialog, JTextField textDir,
064:                    Component component) {
065:                super (CacheServiceMBean.class, name);
066:                this .chart = chart;
067:                this .plot = plot;
068:                this .data = data;
069:                this .buttonReset = buttonReset;
070:                buttonReset.addActionListener(this );
071:                this .legend = legend;
072:                this .dialog = dialog;
073:                optionPane = (JOptionPane) dialog.getContentPane();
074:                optionPane.addPropertyChangeListener(this );
075:                this .textDir = textDir;
076:                this .component = component;
077:                updateUI();
078:            }
079:
080:            public void actionPerformed(ActionEvent e) {
081:                if (e.getSource() == buttonReset) {
082:                    try {
083:                        setAttribute(CacheServiceMBean.ACTION);
084:                    } catch (Exception ex) {
085:                        Start.logger.log(Level.SEVERE, ex.getMessage(), ex);
086:                    }
087:                    buttonReset.setEnabled(false);
088:                } else {
089:                    dialog.setLocationRelativeTo(dialog.getOwner());
090:                    dialog.setVisible(true);
091:                    Object value = optionPane.getValue();
092:                    if (value == JOptionPane.UNINITIALIZED_VALUE)
093:                        return;
094:                    optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
095:                    if (((Integer) value).intValue() != JOptionPane.OK_OPTION)
096:                        return;
097:                    try {
098:                        setAttribute(CacheServiceMBean.DIR, textDir.getText());
099:                    } catch (Exception ex) {
100:                        Start.logger.log(Level.SEVERE, ex.getMessage(), ex);
101:                    }
102:                }
103:            }
104:
105:            private static final String key = "activeCaption";
106:
107:            private static final String keyi = "inactiveCaption";
108:
109:            private static final String keyw = "window";
110:
111:            private static final String keyt = "controlText";
112:
113:            public void updateUI() {
114:                plot.setSectionPaint(0, UIManager.getColor(key));
115:                plot.setSectionPaint(1, UIManager.getColor(keyi));
116:                chart.setBackgroundPaint(UIManager.getColor(keyw));
117:                plot.setBackgroundPaint(UIManager.getColor(keyw));
118:                legend.setBackgroundPaint(UIManager.getColor(keyw));
119:                plot.setOutlinePaint(UIManager.getColor(keyw));
120:                legend.setItemPaint(UIManager.getColor(keyt));
121:                SwingUtilities.updateComponentTreeUI(dialog);
122:                SwingUtilities.updateComponentTreeUI(component);
123:            }
124:
125:            public void propertyChange(PropertyChangeEvent e) {
126:                Component c = ((JComponent) e.getSource())
127:                        .getTopLevelAncestor();
128:                String prop = e.getPropertyName();
129:                if (c.isVisible()
130:                        && (prop.equals(JOptionPane.VALUE_PROPERTY) || prop
131:                                .equals(JOptionPane.INPUT_VALUE_PROPERTY)))
132:                    c.setVisible(false);
133:            }
134:
135:            private void set(Long[] value) {
136:                data.setValue(data.getKey(0), value[0]);
137:                data.setValue(data.getKey(1), value[1]);
138:                buttonReset.setEnabled(value[0] != 0 || value[1] != 1);
139:            }
140:
141:            protected void currentNotification(String type, Object value) {
142:                if (type.equals(ElementMBean.INIT))
143:                    set((Long[]) value);
144:            }
145:
146:            protected void otherNotification(String type, Object value) {
147:                if (type.equals(CacheServiceMBean.DIR))
148:                    textDir.setText((String) value);
149:                else
150:                    set((Long[]) value);
151:            }
152:
153:            public char getSeparator() {
154:                return ((CacheServiceMBean) melement).getSeparator();
155:            }
156:
157:            public String d2p(String dir) {
158:                return dir.replace('/', getSeparator());
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.