/**
   * Gets the list cell renderer component.
   *
   * @param list the instance of JList
   * @param value the value object
   * @param index the index value
   * @param isSelected the boolean of isSelected
   * @param cellHasFocus the boolean of cellHasFocus
   */
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

    IElementNode elementNode = (IElementNode) value;
    setText(elementNode.getText());
    setIcon(elementNode.getIcon());
    setToolTipText(elementNode.getToolTipText());

    return this;
  }
  /**
   * Gets the list cell renderer component.
   *
   * @param list the instance of JList
   * @param value the value object
   * @param index the index value
   * @param isSelected the boolean of isSelected
   * @param cellHasFocus the boolean of cellHasFocus
   */
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean isSelected, boolean hasFocus) {
    IElementNode elementNode = (IElementNode) value;
    checkBox.setSelected(elementNode.isSelected());
    cellLabel.setText(elementNode.getText());
    cellLabel.setIcon(elementNode.getIcon());
    cellLabel.setToolTipText(elementNode.getToolTipText());
    cellLabel.setSelected(isSelected);
    cellLabel.setFont(list.getFont());
    cellLabel.setFocus(hasFocus);
    cellLabel.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());
    cellLabel.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());

    setToolTipText(elementNode.getToolTipText());

    return this;
  }
 /** Adapts the selection. */
 private void adaptSelection() {
   int[] indexes = list.getSelectedIndices();
   if (indexes.length > 1) {
     boolean selected = false;
     for (int i = 0; i < indexes.length; i++) {
       int index = indexes[i];
       IElementNode elementNode = (IElementNode) list.getModel().getElementAt(index);
       if (i == 0) {
         selected = elementNode.isSelected();
       }
       elementNode.setSelected(selected);
       Rectangle rectangle = list.getCellBounds(index, index);
       list.repaint(rectangle);
     }
   } else {
     int index = list.getSelectedIndex();
     if (index > -1) {
       IElementNode elementNode = (IElementNode) list.getModel().getElementAt(index);
       elementNode.setSelected(!elementNode.isSelected());
       Rectangle rectangle = list.getCellBounds(index, index);
       list.repaint(rectangle);
     }
   }
 }