Source Code Cross Referenced for RedeConf.java in  » ERP-CRM-Financial » Personal-Finance-Manager » br » com » gfp » windows » config » 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 » ERP CRM Financial » Personal Finance Manager » br.com.gfp.windows.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 10/02/2005
003:         * 
004:         * Swing Components - visit http://sf.net/projects/gfd
005:         * 
006:         * Copyright (C) 2004  Igor Regis da Silva Simões
007:         * 
008:         * This program is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public License
010:         * as published by the Free Software Foundation; either version 2
011:         * of the License, or (at your option) any later version.
012:         *
013:         * This program 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
016:         * GNU General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public License
019:         * along with this program; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:         * 
022:         */
023:        package br.com.gfp.windows.config;
024:
025:        import java.io.File;
026:        import java.io.FileInputStream;
027:        import java.io.FileNotFoundException;
028:        import java.io.FileOutputStream;
029:        import java.io.IOException;
030:        import java.util.Properties;
031:
032:        /**
033:         * Esta classe é responsável por guardar a configuração de localização
034:         * no disco local da maquina do usuário.
035:         * @author Igor Regis da Silva Simoes
036:         * @since 10/02/2005 17:45:21
037:         */
038:        public class RedeConf {
039:            private Properties redeFile = new Properties();
040:
041:            private File arquivo = new File(System.getProperty("user.dir")
042:                    + File.separator + "rede.conf");
043:
044:            private boolean empty = true;
045:
046:            /**
047:             * 
048:             * @throws FileNotFoundException 
049:             */
050:            public RedeConf() throws IOException {
051:                if (!arquivo.exists()) {
052:                    arquivo.createNewFile();
053:                } else {
054:                    FileInputStream fis = new FileInputStream(arquivo);
055:                    redeFile.load(fis);
056:                    empty = false;
057:                    fis.close();
058:                }
059:            }
060:
061:            /**
062:             * Determina o nome/endereço do proxy a ser usado para acessar a rede
063:             * @param country
064:             */
065:            public void setUseProxy(Boolean use) {
066:                redeFile.setProperty("proxy", use.toString());
067:                empty = false;
068:            }
069:
070:            /**
071:             * Determina o nome/endereço do proxy a ser usado para acessar a rede
072:             * @param proxy
073:             */
074:            public void setProxy(String proxy) {
075:                redeFile.setProperty("proxy.name", proxy);
076:                empty = false;
077:            }
078:
079:            /**
080:             * Determina a porta em que o proxy atende
081:             * @param port
082:             */
083:            public void setProxyPort(Integer port) {
084:                redeFile.setProperty("proxy.port", port.toString());
085:                empty = false;
086:            }
087:
088:            /**
089:             * Determina o usário usado para acessar o proxy
090:             * @param user
091:             */
092:            public void setProxyUser(String user) {
093:                redeFile.setProperty("proxy.user", user);
094:                empty = false;
095:            }
096:
097:            /**
098:             * Determina o usário usado para acessar o proxy
099:             * @return user
100:             */
101:            public String getProxyUser() {
102:                return redeFile.getProperty("proxy.user");
103:            }
104:
105:            /**
106:             * Determina o nome/endereço do proxy a ser usado para acessar a rede
107:             * @return String
108:             */
109:            public Boolean getUseProxy() {
110:                String value = redeFile.getProperty("proxy");
111:                value = value == null ? "false" : value;
112:                return Boolean.valueOf(value);
113:            }
114:
115:            /**
116:             * Determina o nome/endereço do proxy a ser usado para acessar a rede
117:             * @return String 
118:             */
119:            public String getProxy() {
120:                return redeFile.getProperty("proxy.name");
121:            }
122:
123:            /**
124:             * Determina a porta em que o proxy atende
125:             * @return String
126:             */
127:            public Integer getProxyPort() {
128:                String value = redeFile.getProperty("proxy.port");
129:                value = value == null ? "0" : value;
130:                return Integer.valueOf(value);
131:            }
132:
133:            /**
134:             * Determina se é necessário usário para acessar o proxy
135:             * @return String
136:             */
137:            public Boolean getNeedUser() {
138:                String value = redeFile.getProperty("need.user");
139:                value = value == null ? "false" : value;
140:                return Boolean.valueOf(value);
141:            }
142:
143:            /**
144:             * Determina se é necessário usário para acessar o proxy
145:             * @param need 
146:             * 
147:             */
148:            public void setNeedUser(Boolean need) {
149:                redeFile.setProperty("need.user", need.toString());
150:                empty = false;
151:            }
152:
153:            /**
154:             * Salva os dados em um arquivo de configuração
155:             * @throws IOException
156:             */
157:            public void saveData() throws IOException {
158:                FileOutputStream fos = new FileOutputStream(arquivo);
159:                redeFile.store(fos, null);
160:                fos.flush();
161:                fos.close();
162:            }
163:
164:            /**
165:             * Indica que as configurações ainda nao foram setadas
166:             * @return
167:             */
168:            public boolean isEmpty() {
169:                return empty;
170:            }
171:
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.