Changeset 4112 in josm for trunk/src/org


Ignore:
Timestamp:
2011-06-01T21:29:32+02:00 (13 years ago)
Author:
stoecker
Message:

fix #4162 - patch by Hojoe - Mouseover in combine tags dialog wrong

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellRenderer.java

    r4072 r4112  
    6565        case UNDECIDED:
    6666            model.addElement(tr("Choose a value"));
    67             setFont(getFont().deriveFont(Font.ITALIC));
    68             setToolTipText(tr("Please decide which values to keep"));
     67            cbDecisionRenderer.setFont(getFont().deriveFont(Font.ITALIC));
    6968            cbDecisionRenderer.setSelectedIndex(0);
    7069            break;
    7170        case KEEP_ONE:
    7271            model.addElement(decision.getChosenValue());
    73             setToolTipText(tr("Value ''{0}'' is going to be applied for key ''{1}''", decision.getChosenValue(), decision.getKey()));
     72            cbDecisionRenderer.setFont(getFont());
    7473            cbDecisionRenderer.setSelectedIndex(0);
    7574            break;
    7675        case KEEP_NONE:
    7776            model.addElement(tr("deleted"));
    78             setFont(getFont().deriveFont(Font.ITALIC));
    79             setToolTipText(tr("The key ''{0}'' and all its values are going to be removed", decision.getKey()));
     77            cbDecisionRenderer.setFont(getFont().deriveFont(Font.ITALIC));
    8078            cbDecisionRenderer.setSelectedIndex(0);
    8179            break;
    8280        case KEEP_ALL:
    8381            model.addElement(decision.getChosenValue());
    84             setToolTipText(tr("All values joined as ''{0}'' are going to be applied for key ''{1}''", decision.getChosenValue(), decision.getKey()));
     82            cbDecisionRenderer.setFont(getFont());
    8583            cbDecisionRenderer.setSelectedIndex(0);
     84            break;
     85        }
     86    }
     87
     88    /**
     89     * Sets the text of the tooltip for both renderers, this (the JLabel) and the combobox renderer.
     90     */
     91    protected void renderToolTipText(MultiValueResolutionDecision decision) {
     92        switch(decision.getDecisionType()) {
     93        case UNDECIDED:
     94        {
     95            String toolTipText = tr("Please decide which values to keep");
     96            setToolTipText(toolTipText);
     97            cbDecisionRenderer.setToolTipText(toolTipText);
     98            break;
     99        }
     100        case KEEP_ONE:
     101        {
     102            String toolTipText = tr("Value ''{0}'' is going to be applied for key ''{1}''", decision.getChosenValue(), decision.getKey());
     103            setToolTipText(toolTipText);
     104            cbDecisionRenderer.setToolTipText(toolTipText);
     105            break;
     106        }
     107        case KEEP_NONE:
     108        {
     109            String toolTipText = tr("The key ''{0}'' and all its values are going to be removed", decision.getKey());
     110            setToolTipText(toolTipText);
     111            cbDecisionRenderer.setToolTipText(toolTipText);
     112            break;
     113        }
     114        case KEEP_ALL:
     115            String toolTipText = tr("All values joined as ''{0}'' are going to be applied for key ''{1}''", decision.getChosenValue(), decision.getKey());
     116            setToolTipText(toolTipText);
     117            cbDecisionRenderer.setToolTipText(toolTipText);
    86118            break;
    87119        }
     
    103135        MultiValueResolutionDecision decision = (MultiValueResolutionDecision)value;
    104136        renderColors(decision,isSelected);
     137        renderToolTipText(decision);
    105138        switch(column) {
    106139        case 0:
Note: See TracChangeset for help on using the changeset viewer.