Package com.dci.intellij.dbn.browser.model

Examples of com.dci.intellij.dbn.browser.model.BrowserTreeNode


        browserTree.getModel().getRoot().rebuildTreeChildren();
    }

    public void rebuild() {
        BrowserTreeModel treeModel = browserTree.getModel();
        BrowserTreeNode rootNode = treeModel.getRoot();
        treeModel.notifyListeners(rootNode, TreeEventType.STRUCTURE_CHANGED);
    }
View Full Code Here


            Font font = super.getFont();
            return font == null ? UIUtil.getTreeFont() : font;
        }

        public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            BrowserTreeNode treeNode = (BrowserTreeNode) value;
            setIcon(treeNode.getIcon(0));

            boolean isLoading = false;
            String displayName;
            if (treeNode instanceof ModuleConnectionBundle) {
                ModuleConnectionBundle connectionManager = (ModuleConnectionBundle) treeNode;
                displayName = connectionManager.getModule().getName();
            } else if (treeNode instanceof ProjectConnectionBundle) {
                displayName = "PROJECT";
            } else {
                displayName = treeNode.getPresentableText();
            }

            if (treeNode instanceof DBObjectList) {
                DBObjectList objectsList = (DBObjectList) treeNode;
                boolean isEmpty = objectsList.getTreeChildCount() == 0;
                isLoading = objectsList.isLoading();
                SimpleTextAttributes textAttributes =
                        isLoading ? SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES :
                        isEmpty ? SimpleTextAttributes.REGULAR_ATTRIBUTES :
                        SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;

                append(displayName, textAttributes);

                // todo display load error
                /*
                            SimpleTextAttributes descriptionTA = objectsList.getErrorMessage() == null ?
                                    SimpleTextAttributes.GRAY_ATTRIBUTES : SimpleTextAttributes.ERROR_ATTRIBUTES;
                            append(" " + displayDetails, descriptionTA);

                            if (objectsList.getErrorMessage() != null) {
                                String msg = "Could not load " + displayName + ". Cause: " + objectsList.getErrorMessage();
                                setToolTipText(msg);
                            }  else {
                                setToolTipText(null);
                            }
                */
            } else {
                boolean showBold = false;
                boolean isError = false;
                if (treeNode instanceof DBObject) {
                    DBObject object = (DBObject) treeNode;
                    if (object.isOfType(DBObjectType.SCHEMA)) {
                        DBSchema schema = (DBSchema) object;
                        showBold = schema.isUserSchema();
                    }

                    isError = !object.isValid();
                }

                SimpleTextAttributes textAttributes =
                        isError ? SimpleTextAttributes.ERROR_ATTRIBUTES :
                        showBold ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES :
                        SimpleTextAttributes.REGULAR_ATTRIBUTES;

                if (displayName == null) displayName = "displayName null!!";

                append(displayName, textAttributes);
            }
            String displayDetails = treeNode.getPresentableTextDetails();
            if (!StringUtil.isEmptyOrSpaces(displayDetails)) {
                append(" " + displayDetails, isLoading ? SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES);
            }


            if (browserSettings.getGeneralSettings().getShowObjectDetails().value()) {
                String conditionalDetails = treeNode.getPresentableTextConditionalDetails();
                if (!StringUtil.isEmptyOrSpaces(conditionalDetails)) {
                    append(" - " + conditionalDetails, SimpleTextAttributes.GRAY_ATTRIBUTES);
                }

            }
View Full Code Here

import javax.swing.JList;

public class ModuleListCellRenderer extends ColoredListCellRenderer {

    protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
        BrowserTreeNode treeNode = (BrowserTreeNode) value;
        setIcon(treeNode.getIcon(0));

        String displayName;
        if (treeNode instanceof ModuleConnectionBundle) {
            ModuleConnectionBundle connectionManager = (ModuleConnectionBundle) treeNode;
            displayName = connectionManager.getModule().getName();
        } else if (treeNode instanceof ProjectConnectionBundle) {
            displayName = "PROJECT";
        } else {
            displayName = treeNode.getPresentableText();
        }

        append(displayName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }
View Full Code Here

    public synchronized void scrollToSelectedElement() {
        if (getProject().isOpen() && targetSelection != null) {
            targetSelection = (BrowserTreeNode) targetSelection.getUndisposedElement();
            TreePath treePath = DatabaseBrowserUtils.createTreePath(targetSelection);
            for (Object object : treePath.getPath()) {
                BrowserTreeNode treeNode = (BrowserTreeNode) object;
                if (treeNode == null || treeNode.isDisposed()) {
                    targetSelection = null;
                    return;
                }


                if (treeNode.equals(targetSelection)) {
                    break;
                }

                if (!treeNode.isLeafTreeElement() && !treeNode.isTreeStructureLoaded()) {
                    selectPath(DatabaseBrowserUtils.createTreePath(treeNode));
                    treeNode.getTreeChildren();
                    return;
                }
            }

            targetSelection = null;
View Full Code Here

        }
        return null;
    }

    public void navigateBack() {
        BrowserTreeNode treeNode = navigationHistory.previous();
        selectPathSilently(DatabaseBrowserUtils.createTreePath(treeNode));
    }
View Full Code Here

        BrowserTreeNode treeNode = navigationHistory.previous();
        selectPathSilently(DatabaseBrowserUtils.createTreePath(treeNode));
    }

    public void navigateForward() {
        BrowserTreeNode treeNode = navigationHistory.next();
        selectPathSilently(DatabaseBrowserUtils.createTreePath(treeNode));
    }
View Full Code Here

    }

    private boolean listenersEnabled = true;

    public void expandAll() {
        BrowserTreeNode root = getModel().getRoot();
        expand(root);
    }
View Full Code Here

    public void expand(BrowserTreeNode treeNode) {
        if (treeNode.canExpand()) {
            expandPath(DatabaseBrowserUtils.createTreePath(treeNode));
            for (int i = 0; i < treeNode.getTreeChildCount(); i++) {
                BrowserTreeNode childTreeNode = treeNode.getTreeChild(i);
                expand(childTreeNode);
            }
        }
    }
View Full Code Here

            }
        }
    }

    public void collapseAll() {
        BrowserTreeNode root = getModel().getRoot();
        collapse(root);
    }
View Full Code Here

    }

    public void collapse(BrowserTreeNode treeNode) {
        if (!treeNode.isLeafTreeElement() && treeNode.isTreeStructureLoaded()) {
            for (int i = 0; i < treeNode.getTreeChildCount(); i++) {
                BrowserTreeNode childTreeNode = treeNode.getTreeChild(i);
                collapse(childTreeNode);
                collapsePath(DatabaseBrowserUtils.createTreePath(childTreeNode));
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.browser.model.BrowserTreeNode

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.