Changeset 9708 in josm


Ignore:
Timestamp:
2016-02-01T21:26:21+01:00 (4 years ago)
Author:
simon04
Message:

fix #12477 - Selection/relation list: fall back to fast icons when displaying many items

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java

    r9705 r9708  
    4646            boolean isSelected, boolean cellHasFocus) {
    4747        Component def = defaultListCellRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    48         return renderer(def, value);
     48        return renderer(def, value, list.getModel().getSize() > 1000);
    4949    }
    5050
     
    5656        Component def = defaultTableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    5757        if (value instanceof OsmPrimitive)
    58             return renderer(def, (OsmPrimitive) value);
     58            return renderer(def, (OsmPrimitive) value, table.getModel().getRowCount() > 1000);
    5959        else if (value instanceof HistoryOsmPrimitive)
    6060            return renderer(def, (HistoryOsmPrimitive) value);
     
    6868     * @param def the rendering component
    6969     * @param value the OsmPrimitive to render
     70     * @param fast whether the icons should be loaded fast since many items are being displayed
    7071     * @return the modified rendering component
    7172     */
    72     private Component renderer(Component def, OsmPrimitive value) {
     73    private Component renderer(Component def, OsmPrimitive value, boolean fast) {
    7374        if (value != null && def instanceof JLabel) {
    7475            ((JLabel) def).setText(getComponentText(value));
    75             ImageIcon icon = ImageProvider.getPadded(value,
    76                 // Height of component no yet known, assume the default 16px.
    77                     ImageProvider.ImageSizes.SMALLICON.getImageDimension());
     76            final ImageIcon icon = fast
     77                    ? ImageProvider.get(value.getType())
     78                    : ImageProvider.getPadded(value,
     79                        // Height of component no yet known, assume the default 16px.
     80                        ImageProvider.ImageSizes.SMALLICON.getImageDimension());
    7881            if (icon != null) {
    7982                ((JLabel) def).setIcon(icon);
Note: See TracChangeset for help on using the changeset viewer.