Changeset 10542 in josm


Ignore:
Timestamp:
2016-07-16T23:57:24+02:00 (8 years ago)
Author:
wiktorn
Message:

Allow ButtonColumn to override rendered button text

File:
1 edited

Legend:

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

    r10536 r10542  
    2929    private final JButton editButton;
    3030    private Object editorValue;
     31    private String buttonName = null;
    3132
    3233    /**
     
    3637        this(null);
    3738    }
     39
     40    public ButtonColumn(Action action, String buttonName) {
     41        this(action);
     42        this.buttonName  = buttonName;
     43    }
     44
    3845
    3946    /**
     
    6471    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    6572        this.editorValue = value;
    66         if (value == null) {
     73        if (buttonName != null) {
     74            editButton.setText(buttonName);
     75            editButton.setIcon(null);
     76        } else if (value == null) {
    6777            editButton.setText("");
    6878            editButton.setIcon(null);
     
    91101        renderButton.setFocusPainted(hasFocus);
    92102
    93         if (value == null) {
     103        if (buttonName != null) {
     104            renderButton.setText(buttonName);
     105            renderButton.setIcon(null);
     106        } else if (value == null) {
    94107            renderButton.setText("");
    95108            renderButton.setIcon(null);
Note: See TracChangeset for help on using the changeset viewer.