Example usage for javax.swing JTree isEnabled

List of usage examples for javax.swing JTree isEnabled

Introduction

In this page you can find the example usage for javax.swing JTree isEnabled.

Prototype

public boolean isEnabled() 

Source Link

Document

Determines whether this component is enabled.

Usage

From source file:Main.java

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    JLabel l = (JLabel) renderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
            hasFocus);/*from w  w  w  . j  av  a 2 s  .c o  m*/
    if (value instanceof DefaultMutableTreeNode) {
        check.setEnabled(tree.isEnabled());
        check.setFont(tree.getFont());
        Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
        if (userObject instanceof CheckBoxNode) {
            CheckBoxNode node = (CheckBoxNode) userObject;
            l.setText(node.text);
            check.setSelected(node.selected);
        }
        p.add(l);
        return p;
    }
    return l;
}

From source file:CheckBoxNodeTreeSample.java

public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {

    Component returnValue;//from  w w  w.  j a  va  2s.  c  o m
    if (leaf) {

        String stringValue = tree.convertValueToText(value, selected, expanded, leaf, row, false);
        leafRenderer.setText(stringValue);
        leafRenderer.setSelected(false);

        leafRenderer.setEnabled(tree.isEnabled());

        if (selected) {
            leafRenderer.setForeground(selectionForeground);
            leafRenderer.setBackground(selectionBackground);
        } else {
            leafRenderer.setForeground(textForeground);
            leafRenderer.setBackground(textBackground);
        }

        if ((value != null) && (value instanceof DefaultMutableTreeNode)) {
            Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
            if (userObject instanceof CheckBoxNode) {
                CheckBoxNode node = (CheckBoxNode) userObject;
                leafRenderer.setText(node.getText());
                leafRenderer.setSelected(node.isSelected());
            }
        }
        returnValue = leafRenderer;
    } else {
        returnValue = nonLeafRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                hasFocus);
    }
    return returnValue;
}

From source file:TreeNodeVectorA.java

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    Component returnValue = null;
    if ((value != null) && (value instanceof DefaultMutableTreeNode)) {
        Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
        if (userObject instanceof Employee) {
            Employee e = (Employee) userObject;
            firstNameLabel.setText(e.firstName);
            lastNameLabel.setText(e.lastName);
            salaryLabel.setText("" + e.salary);
            if (selected) {
                renderer.setBackground(backgroundSelectionColor);
            } else {
                renderer.setBackground(backgroundNonSelectionColor);
            }//ww  w .jav  a  2  s . co  m
            renderer.setEnabled(tree.isEnabled());
            returnValue = renderer;
        }
    }
    if (returnValue == null) {
        returnValue = defaultRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                hasFocus);
    }
    return returnValue;
}

From source file:TreeNodeVector.java

public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    Component returnValue = null;
    if ((value != null) && (value instanceof DefaultMutableTreeNode)) {
        Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
        if (userObject instanceof Employee) {
            Employee e = (Employee) userObject;
            firstNameLabel.setText(e.firstName);
            lastNameLabel.setText(e.lastName);
            salaryLabel.setText("" + e.salary);
            if (selected) {
                renderer.setBackground(backgroundSelectionColor);
            } else {
                renderer.setBackground(backgroundNonSelectionColor);
            }/*from  w w  w.j a  va  2 s. c o m*/
            renderer.setEnabled(tree.isEnabled());
            returnValue = renderer;
        }
    }
    if (returnValue == null) {
        returnValue = defaultRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                hasFocus);
    }
    return returnValue;
}

From source file:BookTree.java

public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    Component returnValue = null;
    if ((value != null) && (value instanceof DefaultMutableTreeNode)) {
        Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
        if (userObject instanceof Book) {
            Book book = (Book) userObject;
            titleLabel.setText(book.getTitle());
            authorsLabel.setText(book.getAuthors());
            priceLabel.setText("" + book.getPrice());
            if (selected) {
                renderer.setBackground(backgroundSelectionColor);
            } else {
                renderer.setBackground(backgroundNonSelectionColor);
            }// ww w  .  jav a2 s . c  om
            renderer.setEnabled(tree.isEnabled());
            returnValue = renderer;
        }
    }
    if (returnValue == null) {
        returnValue = defaultRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                hasFocus);
    }
    return returnValue;
}

From source file:org.fhaes.gui.AnalysisResultsPanel.java

/**
 * Set up the AnalysisResults GUI//w w  w  .  jav a2s  .  c  o  m
 */
private void initGUI() {

    setLayout(new BorderLayout(0, 0));
    if (Platform.isOSX())
        setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    ImageIcon iconMultipleTables = Builder.getImageIcon("multipletables16.png");
    ImageIcon iconTable = Builder.getImageIcon("table16.png");

    // ImageIcon iconChart = Builder.getImageIcon("chart16.png");

    // Categories
    rootNode = new FHAESCategoryTreeNode("FHAES analysis results");
    categoryGeneral = new FHAESCategoryTreeNode("Descriptive summaries",
            Builder.getImageIcon("interval16.png"));
    categoryInterval = new FHAESCategoryTreeNode("Interval analysis", Builder.getImageIcon("interval16.png"));
    categorySeasonality = new FHAESCategoryTreeNode("Seasonality", Builder.getImageIcon("seasonality16.png"));
    categoryBinarySummaryMatrices = new FHAESCategoryTreeNode("Binary summary matrices",
            Builder.getImageIcon("matrix16.png"));
    categoryBinaryMatrices = new FHAESCategoryTreeNode("Binary comparison matrices",
            Builder.getImageIcon("matrix16.png"));
    categorySimMatrices = new FHAESCategoryTreeNode("Similarity matrices",
            Builder.getImageIcon("matrix16.png"));
    categoryDisSimMatrices = new FHAESCategoryTreeNode("Dissimilarity matrices",
            Builder.getImageIcon("matrix16.png"));

    // Menu actions

    // Results

    itemJaccard = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX, iconMultipleTables);
    itemJaccard.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(SJACFile, new CSVFileFilter());
        }
    });

    itemCohen = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX, iconMultipleTables);
    itemCohen.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(SCOHFile, new CSVFileFilter());
        }
    });

    itemJaccardD = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX_D, iconMultipleTables);
    itemJaccardD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(DSJACFile, new CSVFileFilter());
        }
    });

    itemCohenD = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX_D, iconMultipleTables);
    itemCohenD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(DSCOHFile, new CSVFileFilter());
        }
    });

    itemIntervalSummary = new FHAESResultTreeNode(FHAESResult.INTERVAL_SUMMARY, iconMultipleTables);
    itemIntervalSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(intervalsSummaryFile, new CSVFileFilter());
        }
    });

    itemExceedence = new FHAESResultTreeNode(FHAESResult.INTERVAL_EXCEEDENCE_TABLE, iconMultipleTables);
    itemExceedence.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(intervalsExceedenceFile, new CSVFileFilter());
        }
    });

    itemSeasonalitySummary = new FHAESResultTreeNode(FHAESResult.SEASONALITY_SUMMARY, iconMultipleTables);
    itemSeasonalitySummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(seasonalitySummaryFile, new CSVFileFilter());
        }
    });

    itemBin00 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_00, iconMultipleTables);
    itemBin00.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin00File, new CSVFileFilter());
        }
    });

    itemBin01 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_01, iconMultipleTables);
    itemBin01.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin01File, new CSVFileFilter());
        }
    });

    itemBin10 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_10, iconMultipleTables);
    itemBin10.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin10File, new CSVFileFilter());
        }
    });

    itemBin11 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_11, iconMultipleTables);
    itemBin11.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin11File, new CSVFileFilter());
        }
    });

    itemBinSum = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SUM, iconMultipleTables);
    itemBinSum.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(binSumFile, new CSVFileFilter());
        }

    });
    itemBinSiteSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SITE, iconMultipleTables);
    itemBinSiteSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(siteSummaryFile, new CSVFileFilter());
        }
    });
    itemBinSiteSummary.addAction(new FHAESAction("Export to shapefile", "formatshp.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            new ShapeFileDialog(App.mainFrame, fhm);

        }
    });

    itemBinTreeSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_TREE, iconMultipleTables);
    itemBinTreeSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(treeSummaryFile, new CSVFileFilter());
        }
    });

    itemNTP = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_NTP, iconMultipleTables);
    itemNTP.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(NTPFile, new CSVFileFilter());
        }
    });

    this.itemGeneralSummary = new FHAESResultTreeNode(FHAESResult.GENERAL_SUMMARY, iconMultipleTables);
    itemGeneralSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(generalSummaryFile, new CSVFileFilter());
        }

    });

    this.itemSingleFileSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_FILE_SUMMARY, iconTable);
    itemSingleFileSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(singleFileSummaryFile, new CSVFileFilter());
        }

    });

    this.itemSingleEventSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_EVENT_SUMMARY, iconTable);
    itemSingleEventSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(singleEventSummaryFile, new CSVFileFilter());
        }

    });

    // Add results to categories
    categoryGeneral.add(itemGeneralSummary);
    categoryGeneral.add(itemSingleFileSummary);
    categoryGeneral.add(itemSingleEventSummary);
    categorySimMatrices.add(itemJaccard);
    categorySimMatrices.add(itemCohen);
    categoryDisSimMatrices.add(itemJaccardD);
    categoryDisSimMatrices.add(itemCohenD);
    categoryInterval.add(itemIntervalSummary);
    categoryInterval.add(itemExceedence);
    categorySeasonality.add(itemSeasonalitySummary);
    categoryBinaryMatrices.add(itemBin11);
    categoryBinaryMatrices.add(itemBin01);
    categoryBinaryMatrices.add(itemBin10);
    categoryBinaryMatrices.add(itemBin00);
    categoryBinaryMatrices.add(itemBinSum);
    categoryBinarySummaryMatrices.add(itemBinSiteSummary);
    categoryBinarySummaryMatrices.add(itemBinTreeSummary);
    categoryBinarySummaryMatrices.add(itemNTP);

    // Add categories to root of tree
    rootNode.add(categoryGeneral);
    rootNode.add(categoryInterval);
    rootNode.add(categorySeasonality);
    rootNode.add(categoryBinarySummaryMatrices);
    rootNode.add(categoryBinaryMatrices);
    rootNode.add(categorySimMatrices);
    rootNode.add(categoryDisSimMatrices);

    treeModel = new DefaultTreeModel(rootNode);

    splitPane = new JSplitPane();
    if (Platform.isOSX())
        splitPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    splitPane.setResizeWeight(0.9);
    add(splitPane, BorderLayout.CENTER);

    JPanel panelTree = new JPanel();
    splitPane.setRightComponent(panelTree);
    panelTree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelTree.setLayout(new BorderLayout(0, 0));

    // Build tree
    treeResults = new JTree();
    panelTree.add(treeResults);
    treeResults.setModel(treeModel);

    treeResults.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    treeResults.setCellRenderer(new FHAESResultTreeRenderer());

    pickResultPanel = new PickResultPanel();
    runAnalysisPanel = new RunAnalysisPanel();

    cards = new JPanel();
    cl = new CardLayout();
    cards.setLayout(cl);
    cards.add(pickResultPanel, PICKRESULTPANEL);
    cards.add(runAnalysisPanel, RUNANALYSIS);
    cards.add(emptyPanel, EMPTYPANEL);

    splitPane.setLeftComponent(cards);

    cl.show(cards, RUNANALYSIS);

    splitPaneResult = new JSplitPane();
    splitPaneResult.setOneTouchExpandable(true);
    splitPaneResult.setOrientation(JSplitPane.VERTICAL_SPLIT);
    cards.add(splitPaneResult, RESULTSPANEL);

    panelResult = new JPanel();

    panelResult.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelResult.setLayout(new BorderLayout(0, 0));

    goldFishPanel = new GoldFishPanel();
    splitPaneResult.setRightComponent(goldFishPanel);

    // Build table
    scrollPane = new JScrollPane();

    panelResult.add(scrollPane);
    table = new JXTable();
    adapter = new JTableSpreadsheetByRowAdapter(table);

    table.setModel(new DefaultTableModel());
    table.setHorizontalScrollEnabled(true);
    scrollPane.setViewportView(table);
    splitPaneResult.setLeftComponent(panelResult);

    // OSX Style hack
    if (Platform.isOSX())
        panelResult.setBackground(MainWindow.MAC_BACKGROUND_COLOR);
    if (Platform.isOSX())
        scrollPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    // Expand all nodes
    for (int i = 0; i < treeResults.getRowCount(); i++) {
        treeResults.expandRow(i);
    }

    treeResults.addTreeSelectionListener(this);

    treeResults.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {

            if (SwingUtilities.isRightMouseButton(e)) {
                int x = e.getX();
                int y = e.getY();
                JTree tree = (JTree) e.getSource();
                TreePath path = tree.getPathForLocation(x, y);
                if (path == null)
                    return;
                if (!tree.isEnabled())
                    return;

                tree.setSelectionPath(path);
                Component mc = e.getComponent();

                if (path != null && path.getLastPathComponent() instanceof FHAESResultTreeNode) {
                    FHAESResultTreeNode node = (FHAESResultTreeNode) path.getLastPathComponent();

                    if (!node.isEnabled())
                        return;

                    FHAESResultPopupMenu popupMenu = new FHAESResultPopupMenu(node.getArrayOfActions());
                    popupMenu.show(mc, e.getX(), e.getY());
                }
            }
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {

        }

        @Override
        public void mouseExited(MouseEvent arg0) {

        }

        @Override
        public void mousePressed(MouseEvent arg0) {

        }

        @Override
        public void mouseReleased(MouseEvent arg0) {

        }

    });

    this.splitPaneResult.setDividerLocation(10000);
    this.splitPaneResult.setDividerSize(3);
    this.splitPaneResult.setResizeWeight(1);
}

From source file:org.tinymediamanager.ui.moviesets.MovieSetTreeCellRenderer.java

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    Component returnValue = null;

    // paint movie set node
    if (value != null && value instanceof MovieSetTreeNode) {
        Object userObject = ((MovieSetTreeNode) value).getUserObject();
        if (userObject instanceof MovieSet) {
            MovieSet movieSet = (MovieSet) userObject;

            if (StringUtils.isNotBlank(movieSet.getTitle())) {
                movieSetTitle.setText(movieSet.getTitle());
            } else {
                movieSetTitle.setText(BUNDLE.getString("tmm.unknowntitle")); //$NON-NLS-1$
            }//  ww  w. jav a 2  s  . c om
            movieSetInfo.setText(movieSet.getMovies().size() + " Movies");
            movieSetImageLabel.setIcon(movieSet.getHasImages() ? IconManager.CHECKMARK : IconManager.CROSS);

            movieSetPanel.setEnabled(tree.isEnabled());
            movieSetPanel.invalidate();
            returnValue = movieSetPanel;
        }
    }

    // paint movie node
    if (value != null && value instanceof MovieTreeNode) {
        Object userObject = ((MovieTreeNode) value).getUserObject();
        if (userObject instanceof Movie) {
            Movie movie = (Movie) userObject;

            if (StringUtils.isNotBlank(movie.getTitle())) {
                movieTitle.setText(movie.getTitle());
            } else {
                movieTitle.setText(BUNDLE.getString("tmm.unknowntitle")); //$NON-NLS-1$
            }
            movieNfoLabel.setIcon(movie.getHasNfoFile() ? IconManager.CHECKMARK : IconManager.CROSS);
            movieImageLabel.setIcon(movie.getHasImages() ? IconManager.CHECKMARK : IconManager.CROSS);

            moviePanel.setEnabled(tree.isEnabled());
            moviePanel.invalidate();
            returnValue = moviePanel;
        }
    }

    if (returnValue == null) {
        returnValue = defaultRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                hasFocus);
    }

    // paint background
    if (selected) {
        returnValue.setBackground(defaultRenderer.getBackgroundSelectionColor());
    } else {
        returnValue.setBackground(row % 2 == 0 ? EVEN_ROW_COLOR : Color.WHITE);
        // rendererPanel.setBackground(defaultRenderer.getBackgroundNonSelectionColor());
    }

    return returnValue;
}

From source file:org.tinymediamanager.ui.tvshows.TvShowTreeCellRenderer.java

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    Component returnValue = null;
    // paint tv show node
    if (value != null && value instanceof TvShowTreeNode) {
        Object userObject = ((TvShowTreeNode) value).getUserObject();
        if (userObject instanceof TvShow) {
            TvShow tvShow = (TvShow) userObject;

            if (StringUtils.isBlank(tvShow.getYear()) || "0".equals(tvShow.getYear())) {
                tvShowTitle.setText(tvShow.getTitleSortable());
            } else {
                tvShowTitle.setText(tvShow.getTitleSortable() + " (" + tvShow.getYear() + ")");
            }//w  ww  .j a  va 2  s . com
            if (StringUtils.isBlank(tvShowTitle.getText())) {
                tvShowTitle.setText(BUNDLE.getString("tmm.unknowntitle")); //$NON-NLS-1$
            }

            if (tvShow.isNewlyAdded() || tvShow.hasNewlyAddedEpisodes()) {
                tvShowTitle.setIcon(IconManager.NEW);
            } else {
                tvShowTitle.setIcon(null);
            }

            tvShowInfo.setText(tvShow.getSeasons().size() + " " + BUNDLE.getString("metatag.seasons") + " - " //$NON-NLS-1$
                    + tvShow.getEpisodes().size() + " " + BUNDLE.getString("metatag.episodes"));
            tvShowNfoLabel.setIcon(tvShow.getHasNfoFile() ? IconManager.CHECKMARK : IconManager.CROSS);
            tvShowImageLabel.setIcon(tvShow.getHasImages() ? IconManager.CHECKMARK : IconManager.CROSS);

            tvShowPanel.setEnabled(tree.isEnabled());
            tvShowPanel.invalidate();
            returnValue = tvShowPanel;
        }
    }

    // paint tv show season node
    if (value != null && value instanceof TvShowSeasonTreeNode) {
        Object userObject = ((TvShowSeasonTreeNode) value).getUserObject();
        if (userObject instanceof TvShowSeason) {
            TvShowSeason season = (TvShowSeason) userObject;
            tvShowSeasonTitle.setText(BUNDLE.getString("metatag.season") + " " + season.getSeason());//$NON-NLS-1$
            tvShowSeasonPanel.setEnabled(tree.isEnabled());

            if (season.isNewlyAdded()) {
                tvShowSeasonTitle.setIcon(IconManager.NEW);
            } else {
                tvShowSeasonTitle.setIcon(null);
            }

            tvShowSeasonPanel.invalidate();
            returnValue = tvShowSeasonPanel;
        }
    }

    // paint tv show episode node
    if (value != null && value instanceof TvShowEpisodeTreeNode) {
        Object userObject = ((TvShowEpisodeTreeNode) value).getUserObject();
        if (userObject instanceof TvShowEpisode) {
            TvShowEpisode episode = (TvShowEpisode) userObject;
            if (episode.getEpisode() > 0) {
                tvShowEpisodeTitle.setText(episode.getEpisode() + ". " + episode.getTitle());
            } else {
                tvShowEpisodeTitle.setText(episode.getTitle());
            }
            if (StringUtils.isBlank(tvShowTitle.getText())) {
                tvShowEpisodeTitle.setText(BUNDLE.getString("tmm.unknowntitle")); //$NON-NLS-1$
            }

            if (episode.isNewlyAdded()) {
                tvShowEpisodeTitle.setIcon(IconManager.NEW);
            } else {
                tvShowEpisodeTitle.setIcon(null);
            }

            tvShowEpisodePanel.setEnabled(tree.isEnabled());

            tvShowEpisodeNfoLabel.setIcon(episode.getHasNfoFile() ? IconManager.CHECKMARK : IconManager.CROSS);
            tvShowEpisodeImageLabel.setIcon(episode.getHasImages() ? IconManager.CHECKMARK : IconManager.CROSS);
            tvShowEpisodeSubtitleLabel
                    .setIcon(episode.hasSubtitles() ? IconManager.CHECKMARK : IconManager.CROSS);

            tvShowEpisodePanel.invalidate();
            returnValue = tvShowEpisodePanel;
        }
    }

    if (returnValue == null) {
        returnValue = defaultRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row,
                hasFocus);
    }

    // paint background
    if (selected) {
        returnValue.setBackground(defaultRenderer.getBackgroundSelectionColor());
    } else {
        returnValue.setBackground(row % 2 == 0 ? EVEN_ROW_COLOR : Color.WHITE);
        // rendererPanel.setBackground(defaultRenderer.getBackgroundNonSelectionColor());
    }

    return returnValue;
}