Skip to content

Commit

Permalink
#66 continuacao (painel client). Exibindo janela de configuração ao a…
Browse files Browse the repository at this point in the history
…brir pela primeira vez.
  • Loading branch information
rogeriolino committed Aug 8, 2013
1 parent d54dd51 commit 241a9a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 2 additions & 6 deletions src/painel/client/src/org/novosga/painel/client/Main.java
Expand Up @@ -80,12 +80,7 @@ public void start(Stage stage) throws Exception {
}

// Carrega a configuracao do painel
boolean configOk = false;
try {
config.load();
configOk = true;
} catch (Exception e) {
}
boolean configOk = config.load();

FontLoader.registerAll();

Expand Down Expand Up @@ -136,6 +131,7 @@ public void run() {
if (configOk) {
painel.show();
} else {
controller.update();
controller.show();
}
try {
Expand Down
Expand Up @@ -134,7 +134,9 @@ public void update() {
// servicos
servidor.setText(config.get(PainelConfig.KEY_SERVER).getValue());
unidadeAtual = config.get(PainelConfig.KEY_UNIDADE, Integer.class).getValue();
updateUnidades(main.getService().buscarUnidades());
if (unidadeAtual > 0) {
updateUnidades(main.getService().buscarUnidades());
}
// som e tema
vocalizar.setSelected(config.get(PainelConfig.KEY_SOUND_VOICE, Boolean.class).getValue());
corFundo.setValue(Color.web(config.get(PainelConfig.KEY_COR_FUNDO).getValue()));
Expand Down
Expand Up @@ -22,17 +22,19 @@ public final File file() {
return new File(dir(), filename());
}

public final void load() throws FileNotFoundException, IOException {
public final boolean load() throws FileNotFoundException, IOException {
Properties config = new Properties();
File file = file();
if (!file.exists()) {
boolean exists = file.exists();
if (!exists) {
file.createNewFile();
}
config.load(new FileInputStream(file));
for (ConfigParameter param : parameters()) {
String value = config.getProperty(param.getKey(), param.toString());
param.setValue(parseValue(value, param.getType()));
}
return exists;
}

public final void save() throws IOException {
Expand Down

0 comments on commit 241a9a0

Please sign in to comment.