Ignore:
Timestamp:
13.02.2010 17:45:10 (2 years ago)
Author:
Gubaer
Message:

fixed #4506: relation-editor: tag-delete-button does not work
removed duplicated code
fixed selection behaviour for tags tag in RelationEditor and UploadDialog

File:
1 edited

Legend:

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

    r2512 r2974  
    44import static org.openstreetmap.josm.tools.I18n.tr; 
    55 
    6 import java.awt.Color; 
    76import java.awt.Component; 
    87import java.awt.Font; 
    98import java.util.logging.Logger; 
    109 
    11 import javax.swing.BorderFactory; 
    12 import javax.swing.ImageIcon; 
    1310import javax.swing.JLabel; 
    1411import javax.swing.JTable; 
    15 import javax.swing.border.Border; 
     12import javax.swing.UIManager; 
    1613import javax.swing.border.EmptyBorder; 
    1714import javax.swing.table.TableCellRenderer; 
     
    2522public class TagCellRenderer extends JLabel implements TableCellRenderer  { 
    2623 
    27     private static Logger logger = Logger.getLogger(TagCellRenderer.class.getName()); 
    28  
    29     public static final Color BG_COLOR_SELECTED = new Color(143,170,255); 
    30     public static final Color BG_COLOR_HIGHLIGHTED = new Color(255,255,204); 
    31  
    32     public static final Border BORDER_EMPHASIZED = BorderFactory.createLineBorder(new Color(253,75,45)); 
    33  
    34     /** the icon displayed for deleting a tag */ 
    35     private ImageIcon deleteIcon = null; 
     24    private static final Logger logger = Logger.getLogger(TagCellRenderer.class.getName()); 
    3625 
    3726    private Font fontStandard = null; 
     
    3928 
    4029    public TagCellRenderer() { 
    41         fontStandard = getFont(); 
     30        fontStandard = UIManager.getFont("Table.font"); 
    4231        fontItalic = fontStandard.deriveFont(Font.ITALIC); 
    4332        setOpaque(true); 
     
    6756            setText(tag.getValues().get(0)); 
    6857        } else if (tag.getValueCount() >  1) { 
    69             setText(tr("<multiple>")); 
     58            setText(tr("multiple")); 
    7059            setFont(fontItalic); 
    7160        } 
     
    8675 
    8776    /** 
    88      * renders the background color. The default color is white. It is 
    89      * set to {@see TableCellRenderer#BG_COLOR_HIGHLIGHTED} if this cell 
    90      * displays the tag which is suggested by the currently selected 
    91      * preset. 
    92      * 
     77     * renders the background color. 
     78     *  
    9379     * @param tagModel the tag model 
    9480     * @param model the tag editor model 
    9581     */ 
    9682    protected void renderBackgroundColor(TagModel tagModel, TagEditorModel model) { 
    97         setBackground(Color.WHITE); // standard color 
     83        setBackground(UIManager.getColor("Table.background")); // standard color 
    9884    } 
    9985 
     
    117103        // 
    118104        if (isSelected){ 
    119             setBackground(BG_COLOR_SELECTED); 
     105            setBackground(UIManager.getColor("Table.selectionBackground")); 
     106            setForeground(UIManager.getColor("Table.selectionForeground")); 
    120107        } else { 
    121108            renderBackgroundColor(getModel(table).get(rowIndex), getModel(table)); 
     
    130117        if (hasFocus && isSelected) { 
    131118            if (table.getSelectedColumnCount() == 1 && table.getSelectedRowCount() == 1) { 
    132                 boolean success = table.editCellAt(rowIndex, vColIndex); 
    133  
    134119                if (table.getEditorComponent() != null) { 
    135120                    table.getEditorComponent().requestFocusInWindow(); 
Note: See TracChangeset for help on using the changeset viewer.