Package com.mucommander.ui.main.table

Examples of com.mucommander.ui.main.table.CellLabel


        /**
         * Creates a new preview cell renderer.
         */
        public PreviewCellRenderer() {
            label = new CellLabel();
            icon  = new CellLabel();
        }
View Full Code Here


        /**
         * Returns the object used to render the specified cell.
         */
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            CellLabel currentLabel;

            // Icon label foreground.
            if(column == 0) {
                currentLabel = icon;
                if(row == FOLDER)
                    currentLabel.setIcon(IconManager.getIcon(IconManager.FILE_ICON_SET, CustomFileIconProvider.FOLDER_ICON_NAME));
                else if(row == ARCHIVE)
                    currentLabel.setIcon(IconManager.getIcon(IconManager.FILE_ICON_SET, CustomFileIconProvider.ARCHIVE_ICON_NAME));
                else if(row == SYMLINK)
                    currentLabel.setIcon(symlinkIcon);
                else
                    currentLabel.setIcon(IconManager.getIcon(IconManager.FILE_ICON_SET, CustomFileIconProvider.FILE_ICON_NAME));
            }
            // Text label foreground.
            else {
                currentLabel = label;
                currentLabel.setFont(data.getFont(ThemeData.FILE_TABLE_FONT));
                currentLabel.setText((String)value);
                currentLabel.setForeground(getForegroundColor(row, isSelected));
            }

            // Foreground.
            if(isSelected)
                currentLabel.setOutline(isActive ? data.getColor(ThemeData.FILE_TABLE_SELECTED_OUTLINE_COLOR) :
                                        data.getColor(ThemeData.FILE_TABLE_INACTIVE_SELECTED_OUTLINE_COLOR));
            else
                currentLabel.setOutline(null);

            // Background.
            if(FilePreviewPanel.this.isActive) {
                if(isSelected)
                    currentLabel.setBackground(FilePreviewPanel.this.data.getColor(ThemeData.FILE_TABLE_SELECTED_BACKGROUND_COLOR));
                else
                    currentLabel.setBackground(FilePreviewPanel.this.data.getColor((row % 2 == 0) ? ThemeData.FILE_TABLE_BACKGROUND_COLOR :
                                                                                   ThemeData.FILE_TABLE_ALTERNATE_BACKGROUND_COLOR));
            }
            else {
                if(isSelected)
                    currentLabel.setBackground(FilePreviewPanel.this.data.getColor(ThemeData.FILE_TABLE_INACTIVE_SELECTED_BACKGROUND_COLOR));
                else
                    currentLabel.setBackground(FilePreviewPanel.this.data.getColor((row % 2 == 0) ? ThemeData.FILE_TABLE_INACTIVE_BACKGROUND_COLOR :
                                                                                   ThemeData.FILE_TABLE_INACTIVE_ALTERNATE_BACKGROUND_COLOR));
            }

            return currentLabel;
        }
View Full Code Here

      }

      QuickSearch<T> search = QuickListDataList.this.getQuickSearch();
      boolean matches = search.isActive() ? search.matches(getItemAsString(item)) : true;

      CellLabel label = new CellLabel();
      label.setFont(itemFont);

      label.setText(getItemAsString(item));
      //label.setToolTipText(""+item);

      // Set background color depending on whether the row is selected or not, and whether the table has focus or not
      if (isSelected) {
        label.setBackground(selectedItemBackgound);
        label.setForeground(selectedItemForeground);
      }
      else {
        label.setBackground(matches ? itemBackgound : ThemeCache.unmatchedBackground);
        label.setForeground(matches ? itemForeground : ThemeCache.unmatchedForeground);
      }
     
      return label;
    }
View Full Code Here

  protected class DataListItemWithIconRenderer extends DataListItemRenderer {
   
    @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      // Let superclass deal with most of it...
      CellLabel label = (CellLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

      // Add its icon
      T item = getListItem(index);
      Icon icon = getImageIconOfItem(item, this.getPreferredSize());
      label.setIcon(icon);

      return label;
    }
View Full Code Here

TOP

Related Classes of com.mucommander.ui.main.table.CellLabel

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.