border_root.setRight(temp);
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
Scene scene = new Scene(border_root);
scene.getStylesheets().add(Login.class.getResource("/resources/css/main_small.css").toExternalForm());
stage.initStyle(TRANSPARENT);
stage.getIcons().add(getImage(ICN_OFFICIAL32));
scene.setFill(null);
// Uso Injector per caricare le gui preimpostate. Vi e' anche la
// possibilita' di caricare gui specifiche passando il percorso del
// file .fxml.
Parent root_login = LooB.get().loadLogin();
root_login.setId("root_login");
main_pane.setCenterNode(root_login);
// Imposto il primo scene, la GUI NON E' RIDIMENSIONABILE
stage.setScene(scene);
stage.setResizable(false);
stage.setTitle(TITLE);
ImageView icn_login_tips = (ImageView) getFromCacheNode("icn_login_tips");
icn_login_tips.setVisible(false);
/**
* Con l'utility getFromCacheNode e' possibile caricare un oggetto
* grafico, precedentemente inserito tramite l'apposita classe
* controller.
*/
Label username_lbl = (Label) getFromCacheNode("username_lbl");
Label masterpwd_lbl = (Label) getFromCacheNode("masterpwd_lbl");
EffectFX.neonEffect(username_lbl, Color.WHITE);
EffectFX.neonEffect(masterpwd_lbl, Color.WHITE);
/**
* Se e' possibile per default il campo username e' impostato con il
* valore della property "user.name".
*/
final TextField USER_TXT = (TextField) getFromCacheNode("user_txt");
String def_user = "";
try {
def_user = System.getProperty("user.name");
if (def_user == null || def_user.length() == 0) {
def_user = "";
}
} catch (Exception exc) {
}
USER_TXT.setText(def_user);
/**
* Carico i vari vaori del login, ed imposto gli eventi da gestire.
*/
final PasswordField PASS_TXT = (PasswordField) getFromCacheNode("pass_txt");
PASS_TXT.setText("");
PASS_TXT.requestFocus();
if (DEBUG) {
PASS_TXT.setText("1234567890");
}
btn_exit = (Button) getFromCacheNode("exit_btn");
btn_exit.setFocusTraversable(false);
btn_exit.setOnAction((ActionEvent e) -> {
__sysExit(__EXIT_NO_ERROR__);
});
login_btn = (Button) getFromCacheNode("login_btn");
login_btn.setFocusTraversable(false);
EventHandler<ActionEvent> eh = (ActionEvent event) -> {
try {
checkLogin(USER_TXT, PASS_TXT);
} catch (Exception ex) {
ex.printStackTrace();
}
};
login_btn.setOnAction(eh);
USER_TXT.setOnAction(eh);
PASS_TXT.setOnAction(eh);
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
Label tips_login = (Label) getFromCacheNode("tips_login");
tips_login.setText("");
/**
* Effetti grafici per rendere la GUI piu' gradevole.
*/
stage.show();
EffectFX.fadeOut(root_login, 1500).play();
initial_x = stage.getX();
initial_y = stage.getY();
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
//--------------------------------------------------------------------//
tips_login.setText("Tips: " + tips());
EffectFX.fadeOut(tips_login, 2200).play();
log("SCENE initial_x: " + initial_x);
log("SCENE initial_y: " + initial_y);
log("SCENE Width : " + scene.getWidth());
log("SCENE Height : " + scene.getHeight());
if (!isValidMakiDirectory()) {
Label message_lbl = (Label) getFromCacheNode("message_lbl");
message_lbl.setText(RBLoader.ll(
"First run please type your username (min 3 chars) and password (min 8 chars)."));