Package org.codinjutsu.tools.mongo.view.model

Examples of org.codinjutsu.tools.mongo.view.model.JsonTreeNode


    }


    public boolean isSelectedNodeId() {
        TreeTableTree tree = resultTableView.getTree();
        JsonTreeNode treeNode = (JsonTreeNode) tree.getLastSelectedPathComponent();
        if (treeNode == null) {
            return false;
        }

        MongoNodeDescriptor descriptor = treeNode.getDescriptor();
        if (descriptor instanceof MongoKeyValueDescriptor) {
            MongoKeyValueDescriptor keyValueDescriptor = (MongoKeyValueDescriptor) descriptor;
            return StringUtils.equals(keyValueDescriptor.getKey(), "_id");
        }
View Full Code Here


        TreeTableTree tree = resultTableView.getTree();
        TreeUtil.collapseAll(tree, 1);
    }

    public String getSelectedNodeStringifiedValue() {
        JsonTreeNode lastSelectedResultNode = (JsonTreeNode) resultTableView.getTree().getLastSelectedPathComponent();
        if (lastSelectedResultNode == null) {
            lastSelectedResultNode = (JsonTreeNode) resultTableView.getTree().getModel().getRoot();
        }
        MongoNodeDescriptor userObject = lastSelectedResultNode.getDescriptor();
        if (userObject instanceof MongoResultDescriptor) {
            return stringifyResult(lastSelectedResultNode);
        }

        return userObject.toString();
View Full Code Here


    @Override
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
        JTextField stringEditor = (JTextField) getComponent();
        final JsonTreeNode jsonNode = (JsonTreeNode) ((TreeTable) table).getTree().
                getPathForRow(row).getLastPathComponent();

        stringEditor.setText(String.valueOf(jsonNode.getDescriptor().getValue()));

        return stringEditor;
    }
View Full Code Here

        TreeUtil.expand(tree, 2);

        new TreeTableSpeedSearch(this, new Convertor<TreePath, String>() {
            @Override
            public String convert(final TreePath path) {
                final JsonTreeNode node = (JsonTreeNode) path.getLastPathComponent();
                MongoNodeDescriptor descriptor = node.getDescriptor();
                return descriptor.getFormattedKey();
            }
        });
    }
View Full Code Here

    @Override
    public TableCellRenderer getCellRenderer(int row, int column) {
        TreePath treePath = getTree().getPathForRow(row);
        if (treePath == null) return super.getCellRenderer(row, column);

        JsonTreeNode node = (JsonTreeNode) treePath.getLastPathComponent();

        TableCellRenderer renderer = this.columns[column].getRenderer(node);
        return renderer == null ? super.getCellRenderer(row, column) : renderer;
    }
View Full Code Here

    @Override
    public TableCellEditor getCellEditor(int row, int column) {
        TreePath treePath = getTree().getPathForRow(row);
        if (treePath == null) return super.getCellEditor(row, column);

        JsonTreeNode node = (JsonTreeNode) treePath.getLastPathComponent();
        TableCellEditor editor = columns[column].getEditor(node);
        return editor == null ? super.getCellEditor(row, column) : editor;
    }
View Full Code Here

    protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {

        TreeTableTree tree = ((TreeTable) table).getTree();
        TreePath pathForRow = tree.getPathForRow(row);

        final JsonTreeNode node = (JsonTreeNode) pathForRow.getLastPathComponent();

        node.getDescriptor().renderValue(this, tree.isExpanded(pathForRow));
    }
View Full Code Here

TOP

Related Classes of org.codinjutsu.tools.mongo.view.model.JsonTreeNode

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.