Skip to content
This repository was archived by the owner on Nov 11, 2019. It is now read-only.

Commit 3c34ffb

Browse files
committed
Update files
1 parent 65340ea commit 3c34ffb

File tree

12 files changed

+862
-1
lines changed

12 files changed

+862
-1
lines changed

data/log/events0.log

Whitespace-only changes.

data/settings.ini

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# File: ./data/settings.ini
2+
3+
[Default]
4+
app.acronym=[CA]
5+
app.name.short=Config
6+
app.name.large=Config Application
7+
app.description=[Config 1.0.0] Configuration Free GNU Application
8+
app.copyright=GPL product
9+
app.version=1.0.0
10+
app.build=0001
11+
12+
[Main]
13+
config.appearance=Metal
14+
config.lenguaje=empty
15+
config.load=false
16+
config.web=false
17+
config.login=
18+
config.password=
19+
20+
[Server]
21+
web.port=8080
22+
web.language=English
23+
web.name=TestChannel
24+
web.url=http://localhost/test
25+
web.urlcapt=Click here
26+
27+
[Customer]
28+
personal.nickname=Config
29+
personal.age=0
30+
personal.sex=0
31+
personal.country=0
32+
personal.city=
33+
personal.avatar=avatar.bmp
34+
personal.message=Config project

nbproject/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ javadoc.splitindex=true
5454
javadoc.use=true
5555
javadoc.version=false
5656
javadoc.windowtitle=
57-
main.class=
57+
main.class=Launcher
5858
manifest.file=manifest.mf
5959
meta.inf.dir=${src.dir}/META-INF
6060
mkdist.disabled=false
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// This file is part of Internationalization Project
2+
// Configuration Free GNU Application
3+
// Copyright (C) 2017 Manuel Gil.
4+
//
5+
// This program is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
//
18+
/**
19+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
* $Id$
21+
* <p>
22+
* Title: Configuration Project</p>
23+
* <p>
24+
* Description: Configuration Free GNU Application</p>
25+
* <p>
26+
* Copyright: GPL product</p>
27+
* <p>
28+
* Company: <a href="https://github.com/ManuelGil">Manuel Gil</a></p>
29+
*
30+
* Problem: Configuration Project
31+
*
32+
* @author $Author: Manuel Gil $
33+
* @version $Revisión: 1.0.0.0001 $ $Date: 12/09/2017 $
34+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35+
*/
36+
package Configuration.Controller;
37+
38+
import Configuration.Model.Configuration;
39+
import Configuration.View.CentralPanel;
40+
import java.awt.event.ActionEvent;
41+
import java.awt.event.ActionListener;
42+
43+
/**
44+
* Clase Controller
45+
*/
46+
public class Controller implements ActionListener {
47+
48+
// -----------------------------------------------------------------
49+
// Relations
50+
// -----------------------------------------------------------------
51+
private final CentralPanel panel;
52+
private final Configuration config;
53+
54+
// -----------------------------------------------------------------
55+
// Builders
56+
// -----------------------------------------------------------------
57+
/**
58+
* This method create a instance of the Controller.
59+
*
60+
* @param panel - Central Panel
61+
*/
62+
public Controller(CentralPanel panel) {
63+
// Gets a instance of model
64+
config = Configuration.getPrevInstance();
65+
66+
// Sets the panel
67+
this.panel = panel;
68+
}
69+
70+
// -----------------------------------------------------------------
71+
// Methods
72+
// -----------------------------------------------------------------
73+
/**
74+
* This method handles the behavior of controls.
75+
*
76+
* @param e - action event
77+
*/
78+
@Override
79+
public void actionPerformed(ActionEvent e) {
80+
// Gets the source of event
81+
Object source = e.getSource();
82+
83+
// If the event occurs in the combo box
84+
if (source.equals(panel.getCmbKey())) {
85+
// Show the value of key in the text area
86+
panel.getTxtValue().setText(config.getProperty((String) panel.getCmbKey().getSelectedItem()));
87+
} else {
88+
// Else, close the program
89+
System.exit(0);
90+
}
91+
}
92+
93+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// This file is part of Internationalization Project
2+
// Configuration Free GNU Application
3+
// Copyright (C) 2017 Manuel Gil.
4+
//
5+
// This program is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
//
18+
/**
19+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
* $Id$
21+
* <p>
22+
* Title: Configuration Project</p>
23+
* <p>
24+
* Description: Configuration Free GNU Application</p>
25+
* <p>
26+
* Copyright: GPL product</p>
27+
* <p>
28+
* Company: <a href="https://github.com/ManuelGil">Manuel Gil</a></p>
29+
*
30+
* Problem: Configuration Project
31+
*
32+
* @author $Author: Manuel Gil $
33+
* @version $Revisión: 1.0.0.0001 $ $Date: 12/09/2017 $
34+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35+
*/
36+
package Configuration.Logic;
37+
38+
import java.io.PrintWriter;
39+
import java.io.StringWriter;
40+
import java.util.Date;
41+
import java.util.logging.LogRecord;
42+
import java.util.logging.SimpleFormatter;
43+
44+
/**
45+
* Clase Formatter
46+
*/
47+
public final class Formatter extends SimpleFormatter {
48+
49+
// -----------------------------------------------------------------
50+
// Constants
51+
// -----------------------------------------------------------------
52+
private final String LINE_SEPARATOR = System.getProperty("line.separator");
53+
54+
// -----------------------------------------------------------------
55+
// Methods
56+
// -----------------------------------------------------------------
57+
/**
58+
* This method creates a format of the LOG file.
59+
*
60+
* @return format - the format of the LOG file
61+
*/
62+
@Override
63+
public String format(LogRecord record) {
64+
// Sets the format:
65+
// Date/Time ClassName MethodName
66+
// ErrorLevel: Message
67+
// Thrown
68+
StringBuilder stringBuilder = new StringBuilder();
69+
stringBuilder.append(new Date(record.getMillis()));
70+
stringBuilder.append("\t");
71+
stringBuilder.append(record.getSourceClassName());
72+
stringBuilder.append("\t");
73+
stringBuilder.append(record.getSourceMethodName());
74+
stringBuilder.append(LINE_SEPARATOR);
75+
stringBuilder.append(record.getLevel().getLocalizedName());
76+
stringBuilder.append(": ");
77+
stringBuilder.append(formatMessage(record));
78+
stringBuilder.append(LINE_SEPARATOR);
79+
if (record.getThrown() != null) {
80+
StringWriter sw = new StringWriter();
81+
try (PrintWriter pw = new PrintWriter(sw)) {
82+
record.getThrown().printStackTrace(pw);
83+
}
84+
stringBuilder.append(sw.toString());
85+
}
86+
stringBuilder.append(LINE_SEPARATOR);
87+
return stringBuilder.toString();
88+
}
89+
90+
}

src/Configuration/Logic/Log.java

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// This file is part of Internationalization Project
2+
// Configuration Free GNU Application
3+
// Copyright (C) 2017 Manuel Gil.
4+
//
5+
// This program is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
//
18+
/**
19+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
* $Id$
21+
* <p>
22+
* Title: Configuration Project</p>
23+
* <p>
24+
* Description: Configuration Free GNU Application</p>
25+
* <p>
26+
* Copyright: GPL product</p>
27+
* <p>
28+
* Company: <a href="https://github.com/ManuelGil">Manuel Gil</a></p>
29+
*
30+
* Problem: Configuration Project
31+
*
32+
* @author $Author: Manuel Gil $
33+
* @version $Revisión: 1.0.0.0001 $ $Date: 12/09/2017 $
34+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35+
*/
36+
package Configuration.Logic;
37+
38+
import java.io.IOException;
39+
import java.util.logging.FileHandler;
40+
import java.util.logging.Level;
41+
import java.util.logging.Logger;
42+
43+
/**
44+
* Clase Log
45+
*/
46+
public abstract class Log {
47+
48+
// -----------------------------------------------------------------
49+
// Constants
50+
// -----------------------------------------------------------------
51+
private final static Logger logger = Logger.getLogger(Log.class.getName());
52+
53+
// -----------------------------------------------------------------
54+
// Methods
55+
// -----------------------------------------------------------------
56+
/**
57+
* This method creates a LOG file and sets the formatter.
58+
*
59+
* @param strFile - the file name
60+
*/
61+
public static void loadLogger(String strFile) {
62+
try {
63+
// Loads the file in a handler
64+
FileHandler handler = new FileHandler(strFile);
65+
// Sets all error levels
66+
handler.setLevel(Level.ALL);
67+
// Sets the format
68+
handler.setFormatter(new Formatter());
69+
70+
// Records the handler
71+
logger.addHandler(handler);
72+
} catch (IOException ex) {
73+
Logger.getLogger(Log.class.getName()).log(Level.SEVERE, null, ex);
74+
}
75+
76+
}
77+
78+
/**
79+
* This method sets the level 'info' on the LOG.
80+
*
81+
* @param strMessage - the message error
82+
*/
83+
public static void info(String strMessage) {
84+
logger.logp(Level.INFO, null, null, strMessage);
85+
}
86+
87+
/**
88+
* This method sets the level 'error' on the LOG.
89+
*
90+
* @param level - the error level
91+
* @param strClass - the class name
92+
* @param strMethod - the method name
93+
* @param strMessage - the message error
94+
* @param thrown - the thrown
95+
*/
96+
public static void error(Level level, String strClass, String strMethod, String strMessage, Throwable thrown) {
97+
logger.logp(level, strClass, strMethod, strMessage, thrown);
98+
}
99+
100+
}

0 commit comments

Comments
 (0)