Package org.rat.free.security.makifx.base

Examples of org.rat.free.security.makifx.base.EncryptedNode


    }

    private void openTabbedEditor(final CellPropertiesManager EDITOR) {
        try {

            EncryptedNode NODE = EDITOR.getNode();
            String TITLE = NODE.getProperties().get("title");

            ObservableList<Tab> tabs = __tabbed.getTabs();
            if (tabs != null) {
                for (Tab t : tabs) {
                    if (t.getId() != null && t.getId().equals(EDITOR.getInstanceId())) {
                        __tabbed.getSelectionModel().select(t);
                        EDITOR.__tab_edit_title_txt.requestFocus();
                        return;
                    }
                }
            }

            EDITOR.initEditor();

            final Tab TAB = new Tab(!_IMPOSSIBLE_TITLE_.equals(TITLE) ? TITLE : "");

            TAB.setId(EDITOR.getInstanceId());

            BorderPane bpane = new BorderPane();

            SidePane tab_edit_panel = EDITOR.__sider;
            bpane.setCenter(tab_edit_panel);
            TAB.setContent(bpane);

            //****************************************************************//
            //*                  GESTIONE CLOSE TAB                          *//
            //****************************************************************//
            TAB.setOnCloseRequest((javafx.event.Event evt) -> {
                closeEditor(EDITOR, evt, TAB);
            });

            NODE.getProperties().put("is_open", "true");

            //----------------------------------------------------------------//
            //                  SETTO I CAMPI DELLA MASCHERA                  //
            //----------------------------------------------------------------//
            EDITOR.__tab = TAB;

            if (!_IMPOSSIBLE_TITLE_.equals(TITLE)) {
                EDITOR.__tab_edit_title_txt.setText(TITLE);
            } else {
                EDITOR.__tab_edit_title_txt.setPromptText(RBLoader.ll("Please enter your Title here."));
            }

            EDITOR.__tab_edit_email_txt.setText(NODE.getProperties().get("email_value"));
            EDITOR.__tab_edit_url_txt.setText(NODE.getProperties().get("url_value"));
            EDITOR.__tab_edit_area_comment.setText(escaper.unescapeValue(NODE.getProperties().get("comment_value")));

            initSensibleEditor(getSensibleType(NODE, "user_type"), EDITOR.__username_editor, NODE, "user_name_value");
            initSensibleEditor(getSensibleType(NODE, "password1_type"), EDITOR.__pass1_editor, NODE, "password1_value");
            initSensibleEditor(getSensibleType(NODE, "password2_type"), EDITOR.__pass2_editor, NODE, "password2_value");

            //----------------------------------------------------------------//
            //----------------------------------------------------------------//
            //----------------------------------------------------------------//
            EDITOR.__tab_edit_btn_copy_user.setOnAction((ActionEvent e) -> {
                try {
                    EncryptedNode NODE1 = EDITOR.getNode();
                    String value = null;
                    if (SensibleValueTypeListener.HIDDEN_VALUE_TYPE == EDITOR.__username_editor.getType()) {
                        value = getSensibleValue(NODE1, "user_name_value");
                    } else {
                        value = EDITOR.__username_editor.getValue();
                    }
                    manager.copyToScrambledClipboard(value);
                } catch (Exception exc) {
                    exc.printStackTrace();
                }
            });
            EDITOR.__tab_edit_btn_copy_pass1.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent e) {
                    try {

                        EncryptedNode NODE = EDITOR.getNode();

                        String value = null;

                        if (SensibleValueTypeListener.HIDDEN_VALUE_TYPE == EDITOR.__pass1_editor.getType()) {

                            value = getSensibleValue(NODE, "password1_value");

                        } else {
                            value = EDITOR.__pass1_editor.getValue();
                        }

                        manager.copyToScrambledClipboard(value);

                    } catch (Exception exc) {
                        exc.printStackTrace();
                    }
                }
            });
            EDITOR.__tab_edit_btn_copy_pass2.setOnAction((ActionEvent e) -> {
                try {
                    EncryptedNode NODE1 = EDITOR.getNode();
                    String value = null;
                    if (SensibleValueTypeListener.HIDDEN_VALUE_TYPE == EDITOR.__pass2_editor.getType()) {
                        value = getSensibleValue(NODE1, "password2_value");
                    } else {
                        value = EDITOR.__pass2_editor.getValue();
View Full Code Here


        if (editor == null) {
            return;
        }

        String tit = editor.__tab.getText();
        EncryptedNode node = editor.getNode();

        if (node == null) {
            Utility.log("node is null for " + editor + " editor: " + tit);
        }

        if (!isValidTitle(editor)) {

            evt.consume();

            showMessage("close_editor_invalid_title_message", "Invalid Title.",
                    "Press Ok to delete the account or Cancel to edit it.\nPlease, remember to save any change.",
                    "Ok", "Cancel", false, new AnswarePopupMessage() {
                        @Override
                        public void onOkAnsware() {

                            Utility.log("INVALID TITLE REMOVE! tit:" + tit);
                            deleteAccount(editor);
                        }

                        @Override
                        public void onCancelAnsware() {
                            editor.__tab_edit_title_txt.requestFocus();
                            EffectFX.arrowIndicationError(editor.__tab_edit_title_txt);
                        }
                    });
            return;
        }

        /**
         * Se il titolo era valido e i valori sono diversi da quelli salvati
         * allora si sta chiudendo un tab prima di salvare, mostro un mess
         * di avviso.
         * node.getProperties().put("url_value", "");
         * node.getProperties().put("comment_value", "");
         * node.getProperties().put("email_value", "");
         */
        boolean show_warning = false;

        String title_saved = editor.getNode().getProperties().get("title");
        String title_present = editor.__tab_edit_title_txt.getText();

        String url_value_saved = editor.getNode().getProperties().get("url_value");
        String url_value_present = editor.__tab_edit_url_txt.getText();

        String comment_value_saved = editor.getNode().getProperties().get("comment_value");
        String comment_value_present = editor.__tab_edit_area_comment.getText();

        String email_value_saved = editor.getNode().getProperties().get("email_value");
        String email_value_present = editor.__tab_edit_email_txt.getText();

        String val_saved_book = editor.getNode().getProperties().get("bookmark_value");
        String val_present_book = editor.__combo_book.getSelectionModel().getSelectedItem().toString();

        if ((val_present_book != null && !val_present_book.equals(val_saved_book))) {

            editor.getNode().getProperties().put("bookmark_value", Constants.NO_BOOKMARK);
            editor.__combo_book.getSelectionModel().selectFirst();

            show_warning = true;
        }

        if ((title_present != null && !title_present.equals(title_saved))
                || (url_value_present != null && !url_value_present.equals(url_value_saved))
                || (comment_value_present != null && !comment_value_present.equals(comment_value_saved))
                || (email_value_present != null && !email_value_present.equals(email_value_saved))) {

            show_warning = true;
        }

        if (show_warning) {
            manager.setStatusMessage(RBLoader.ll("Please, remember to save before close the editor."), 5000);
            EffectFX.beep();
        }

        Utility.log("CLOSE TAB.");
        editor.resetEditor();
        node.getProperties().put("is_open", "false");
        list_editors.remove(editor);
        updateTable();
    }
View Full Code Here

            TableCell cell = new TableCell() {
                @Override
                public void updateItem(Object item, boolean empty) {
                    if (item != null && !empty && item instanceof EncryptedNode) {
                        EncryptedNode node = (EncryptedNode) item;
                        Label label_cell = new Label();
                        label_cell.setId("generic_label");
                        try {
                            switch (column) {
                                case 0: {
                                    label_cell.setId("name_label");
                                    String t = node.getProperties().get("title");
                                    if (_IMPOSSIBLE_TITLE_.equals(t)) {
                                        label_cell.setText("...");
                                    } else {
                                        label_cell.setText(t);
                                    }
                                    break;
                                }
                                case 1: {
                                    sensibleInit(label_cell, node, "user_type", "user_name_value");
                                    break;
                                }
                                case 2: {
                                    label_cell.setText(node.getProperties().get("url_value"));
                                    break;
                                }
                                case 3: {
                                    label_cell.setText(node.getProperties().get("email_value"));
                                    break;
                                }
                                case 4: {
                                    sensibleInit(label_cell, node, "password1_type", "password1_value");
                                    break;
View Full Code Here

            col_names = new String[]{"Priority", "Name", "Source", "Action", "Destination"};

            data_table = FXCollections.observableArrayList();

            if (root_node == null) {
                root_node = new EncryptedNode();
                root_node.setId(getTabTitle());
                manager.putInStoredData(getId(), root_node);
            }

            if (root_node.getChilds() != null && !root_node.getChilds().isEmpty()) {
                for (int i = 0; i < root_node.getChilds().size(); i++) {
                    data_table.add(new CellPropertiesManager(root_node.getChilds().get(i)));
                }
            }

            Utility.log("Start Backup On Demand.");

            this.escaper = LooB.get().fromStock(Escaper.class);
            this.ini = LooB.get().fromStock(IniProperties.class);

            latest_bck_res.setVisible(true);

            __btn_bck_add = ToolBarAction.newButton("btn_bck_add", "Add Value",
                    "plus_24.png", (ActionEvent e) -> {
                        addBackupEntry();
                    });

            __btn_bck_remove = ToolBarAction.newButton("btn_bck_remove", "Delete Value",
                    "delete_24.png", (ActionEvent e) -> {
                        deleteSelectedEntry();
                    });

            __btn_bck_remove_all = ToolBarAction.newButton("btn_bck_remove_all", "Delete All Value",
                    "trash_24.png", (ActionEvent e) -> {
                        manager.createPopupMessage("bk_del_all_operation", new AnswarePopupMessage() {
                            @Override
                            public void onOkAnsware() {
                                deleteAllEntry();
                            }

                            @Override
                            public void onCancelAnsware() {
                            }
                        }).setHeader(RBLoader.ll("Delete All Backups."))
                        .setContent(RBLoader.ll("Confirm delete all backups ?"))
                        .setOkCancelButton(RBLoader.ll("Ok"),
                                RBLoader.ll("Cancel"))
                        .setIcon(Utility.getImage("help_24.png"))
                        .show();
                    });

            __btn_bck_start_backup = ToolBarAction.newButton("btn_bck_start_backup", "Start Backup",
                    "video_play_24.png", (ActionEvent e) -> {
                        manager.createPopupMessage("bk_start_operation", new AnswarePopupMessage() {
                            @Override
                            public void onOkAnsware() {
                                startBackup();
                            }

                            @Override
                            public void onCancelAnsware() {
                            }
                        }).setHeader("Start Backup.")
                        .setContent("Confirm run backup?\n\n"
                                + "Warning: this operation always overwrites every file in the target directory. "
                                + "Please, make sure that you have set the correct input value.")
                        .setOkCancelButton("Ok", "Cancel")
                        .setIcon(Utility.getImage("help_24.png"))
                        .show();
                    });

            __btn_bck_info = InfoButton.create("In this section you "
                    + "can set one or more actions to be performed for your backup. "
                    + "Please click the button insert and set a priority, "
                    + "select the source and destination and choose whether "
                    + "to perform a recursive zip all files or just a copy.", manager);

            registerTableButtons();

            __btn_bck_confirm_add = ToolBarAction.newButton("btn_bck_confirm_add", "Ok",
                    "checkmark_24.png", (ActionEvent e) -> {
                        String prio = (String) editor.priority_edit.getSelectionModel().getSelectedItem();
                        String name = editor.name_edit.getText();
                        String act = (String) editor.action_edit.getSelectionModel().getSelectedItem();
                        String source = editor.fileordir_edit.getText();
                        String destination = editor.dest_edit.getText();

                        if (source != null && source.length() > 0 && destination != null && destination.length() > 0) {

                            if (name == null) {
                                name = "";
                            }

                            EncryptedNode node = new EncryptedNode();
                            node.getProperties().put("priority", prio);
                            node.getProperties().put("name", name);
                            node.getProperties().put("action", act);
                            node.getProperties().put("source", source);
                            node.getProperties().put("destination", destination);
                            data_table.add(new CellPropertiesManager(node));

                            addMainTable();
                            updateTable();
View Full Code Here

                    int total = data_table.size();

                    for (int i = 0; i < total; i++) {

                        //----------------------------------------------------//
                        EncryptedNode node = data_table.get(i).getNode();
                        String source_path = node.getProperties().get("source");
                        String dest_path = node.getProperties().get("destination");
                        String action = node.getProperties().get("action");
                        //----------------------------------------------------//

                        File file_source = new File(source_path);
                        File file_dest = new File(dest_path);

                        if (!file_source.exists()) {
                            ini.store("last_result_bck", "Error - " + Utility.data());
                            message = "Can't find souce path: " + file_source + "\n";
                            showMessage(message);
                            return null;
                        }

                        if (!file_dest.exists()) {
                            ini.store("last_result_bck", "Error - " + Utility.data());
                            message = message + "Can't find dest. path: " + file_dest;
                            showMessage(message);
                            return null;
                        }
                    }

                    for (int i = 0; i < total; i++) {

                        //----------------------------------------------------//
                        EncryptedNode node = data_table.get(i).getNode();
                        String source_path = node.getProperties().get("source");
                        String dest_path = node.getProperties().get("destination");
                        String action = node.getProperties().get("action");
                        //----------------------------------------------------//

                        File file_source = new File(source_path);
                        File file_dest = new File(dest_path);
                        boolean exits_all = true;

                        if (!file_source.exists()) {
                            ini.store("last_result_bck", "Error - " + Utility.data());
                            message = "Can't find souce path: " + file_source + "\n";
                            exits_all = false;
                        }

                        if (!file_dest.exists()) {
                            ini.store("last_result_bck", "Error - " + Utility.data());
                            message = message + "Can't find dest. path: " + file_dest;
                            exits_all = false;
                        }

                        if (exits_all) {

                            //------------------------------------------------//
                            //------------------------------------------------//
                            //------------------------------------------------//
                            node.getProperties().put("status", "Running");
                            updateTable();

                            fileList.clear();

                            if (!fileList.isEmpty()) {
                                Utility.log("ERROR CAN'T CLEAR FILE LIST!");
                                showMessage("Application Error, can't clear file list.");
                                return null;
                            }

                            //------------------------------------------------//
                            //------------------------------------------------//
                            //------------------------------------------------//
                            /**
                             * Da ricordare che: 1) NIO nella copia dei file mi
                             * da' dei problemi su alcuni attributi per win7,
                             * quindi in caso di errore faccio la copia
                             * "normale" 2) Lo Zip mi dava problemi con le
                             * cartelle vuote quindi le creo io con il path
                             * "cartella/"
                             */
                            switch (action) {
                                case ACTION_ZIP: {
                                    visitor.setAction("Analyse");
                                    Utility.listFiles(file_source, fileList, visitor);
                                    File result = new File(file_dest + File.separator + file_source.getName() + ".zip");
                                    visitor.setAction("Processing");
                                    Utility.createZipFile(result, file_source, fileList, visitor);
                                    break;
                                }
                                case ACTION_COPY: {
                                    if (file_source.isFile()) {
                                        visitor.setAction("Processing");
                                        Utility.copyFile(file_source.toString(), file_dest + File.separator + file_source.getName(), visitor);
                                    } else {
                                        visitor.setAction("Processing");
                                        Utility.copyRecursively(file_source.toString(), file_dest + File.separator + file_source.getName(), visitor);
                                    }
                                    break;
                                }
                            }
                            node.getProperties().put("status", "Done");
                            updateTable();

                        } else {
                            showMessage(message);
                            return null;
View Full Code Here

                        String plugin_id = keys.next();
                        Readable item = map_read.get(plugin_id);

                        log("importData - json - plugin_id: " + plugin_id);

                        EncryptedNode root_node = new EncryptedNode();
                        enc_map.getMap().put(plugin_id, root_node);

                        root_node.setId(item.getId());
                        root_node.setDescription(item.getDescription());
                        root_node.setProperties(new HashMap(item.getProperties()));

                        log("importData - json - root_node.getProperties: " + root_node.getProperties());

                        if (item.getChilds() != null && item.getChilds().size() > 0) {
                            for (Readable r : item.getChilds()) {
                                EncryptedNode node = new EncryptedNode();
                                root_node.addChild(node);

                                node.setId(r.getId());
                                node.setDescription(r.getDescription());

                                Map<String, String> map = r.getProperties();

                                if (AbstractPlugin.DEF_ACCOUNT_TAB_ID.equals(plugin_id)) {

                                    node.getProperties().put("is_open", map.get("is_open"));
                                    node.getProperties().put("comment_value", map.get("comment_value"));
                                    node.getProperties().put("url_value", map.get("url_value"));
                                    node.getProperties().put("bookmark_value", map.get("bookmark_value"));
                                    node.getProperties().put("title", map.get("title"));
                                    node.getProperties().put("email_value", map.get("email_value"));

                                    setSensibleValue(node, "user_type", map.get("user_type"));
                                    setSensibleValue(node, "user_name_value", map.get("user_name_value"));

                                    setSensibleValue(node, "password1_type", map.get("password1_type"));
                                    setSensibleValue(node, "password1_value", map.get("password1_value"));

                                    setSensibleValue(node, "password2_type", map.get("password2_type"));
                                    setSensibleValue(node, "password2_value", map.get("password2_value"));

                                } else {
                                    node.setProperties(new HashMap(map));
                                }

                                log("importData - json - node.getProperties: " + node.getProperties());
                            }
                        }
                    }
                } catch (Exception exc) {
                    exc.printStackTrace();
View Full Code Here

            manager.registerToolBarItems(getId(), __btn_new_acc, __btn_home,
                    __btn_edit, __btn_undo, __btn_del_acc, __btn_explore);

            if (root_node == null) {
                root_node = new EncryptedNode();
                root_node.setId(_FIRST_TAB_TITLE_);
                manager.putInStoredData(getId(), root_node);
            }

            __tabbed = new TabPane();
View Full Code Here

        int size = data_table.size();

        for (int i = 0; i < size; i++) {
            CellPropertiesManager cpm = data_table.get(i);
            EncryptedNode node = cpm.getNode();

            if (node == null) {
                continue;
            }

            String t = node.getProperties().get("title");

            if (t != null && t.startsWith(title)) {
                return cpm;
            }
        }
View Full Code Here

    @Deprecated
    private boolean isAlreadyTitlePresent_OLD(String title) {
        if (data_table != null) {
            int size = data_table.size();
            for (int i = 0; i < size; i++) {
                EncryptedNode node = data_table.get(i).getNode();
                if (title.equals(node.getProperties().get("title"))) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

        }
    }

    private void makeNewAccount() {

        EncryptedNode node = null;

        int size = data_table.size();
        for (int i = 0; i < size; i++) {
            node = data_table.get(i).getNode();
            if (_IMPOSSIBLE_TITLE_.equals(node.getProperties().get("title"))) {
                openTabbedEditor(data_table.get(i));
                return;
            }
        }

        node = new EncryptedNode();
        node.getProperties().put("title", _IMPOSSIBLE_TITLE_);
        node.getProperties().put("is_open", "false");
        node.getProperties().put("url_value", "");
        node.getProperties().put("comment_value", "");
        node.getProperties().put("email_value", "");

        try {

            manager.setSensibleValue(node, "user_type", String.valueOf(SensibleValueTypeListener.CLEAR_VALUE_TYPE));
            manager.setSensibleValue(node, "password1_type", String.valueOf(SensibleValueTypeListener.PASS_VALUE_TYPE));
View Full Code Here

TOP

Related Classes of org.rat.free.security.makifx.base.EncryptedNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.