model.getTreeView().sortNodes(index, (ImageDisplay) model.getBrowser().getUI());
TreeView tv = model.getTreeView(); if (tv != null) tv.sortNodes(index, (ImageDisplay) model.getBrowser().getUI());
    public void sortBy(int index)    {        model.getSorter().setByDate(SortByAction.BY_DATE == index);        view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));        Browser browser = getBrowser();        switch (browser.getSelectedLayout()) {            case LayoutFactory.SQUARY_LAYOUT:                browser.accept(LayoutFactory.createLayout(                        LayoutFactory.SQUARY_LAYOUT, model.getSorter()),                        ImageDisplayVisitor.IMAGE_SET_ONLY);                break;            case LayoutFactory.FLAT_LAYOUT:                browser.resetChildDisplay();                Layout l = LayoutFactory.createLayout(LayoutFactory.FLAT_LAYOUT,                                                         model.getSorter());                browser.accept(l);                l.doLayout();        }        model.getTreeView().sortNodes(index,                         (ImageDisplay) model.getBrowser().getUI());        view.setCursor(                Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));    }