Ticket #11686: 11686.patch

File 11686.patch, 5.7 KB (added by simon04, 9 years ago)
  • src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanel.java

    diff --git a/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanel.java b/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanel.java
    index 69e6860..4f540ec 100644
    a b protected void build() {  
    2525        setLayout(new BorderLayout());
    2626        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    2727        model = new TagEditorModel();
    28         TagTable tblTags = new TagTable(model);
     28        TagTable tblTags = new TagTable(model, 0);
    2929        tblTags.setEnabled(false);
    3030        add(new JScrollPane(tblTags), BorderLayout.CENTER);
    3131    }
  • src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java

    diff --git a/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java b/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
    index 3eee75d..4537314 100644
    a b  
    2121public class TagSettingsPanel extends JPanel implements TableModelListener {
    2222
    2323    /** checkbox for selecting whether an atomic upload is to be used  */
    24     private final TagEditorPanel pnlTagEditor = new TagEditorPanel(null);
     24    private final TagEditorPanel pnlTagEditor = new TagEditorPanel(null, null, Changeset.MAX_CHANGESET_TAG_LENGTH);
    2525    /** the model for the changeset comment */
    2626    private final transient ChangesetCommentModel changesetCommentModel;
    2727    private final transient ChangesetCommentModel changesetSourceModel;
  • src/org/openstreetmap/josm/gui/tagging/TagCellEditor.java

    diff --git a/src/org/openstreetmap/josm/gui/tagging/TagCellEditor.java b/src/org/openstreetmap/josm/gui/tagging/TagCellEditor.java
    index caf2312..9d22738 100644
    a b  
    2929
    3030    /**
    3131     * constructor
     32     * @param maxCharacters maximum number of characters allowed, 0 for unlimited
    3233     */
    33     public TagCellEditor() {
     34    public TagCellEditor(int maxCharacters) {
    3435        editor = new AutoCompletingTextField(0, false);
     36        if (maxCharacters > 0) {
     37            editor.setMaxChars(maxCharacters);
     38        }
    3539        editor.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    3640    }
    3741
  • src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java

    diff --git a/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java b/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java
    index fe4eaf1..88b4742 100644
    a b  
    3535    /** the tag editor model */
    3636    private TagEditorModel model;
    3737    /** the tag table */
    38     private TagTable tagTable;
     38    private final TagTable tagTable;
    3939
    4040    private PresetListPanel presetListPanel;
    4141    private final transient PresetHandler presetHandler;
     
    4747     */
    4848    protected JPanel buildTagTableEditorPanel() {
    4949        JPanel pnl = new JPanel();
    50         tagTable = new TagTable(model);
    5150        pnl.setLayout(new BorderLayout());
    5251        pnl.add(new JScrollPane(tagTable), BorderLayout.CENTER);
    5352        if (presetHandler != null) {
    public void tableChanged(TableModelEvent e) {  
    141140     * internally and can be retrieved with {@link #getModel()}.
    142141     */
    143142    public TagEditorPanel(PresetHandler presetHandler) {
    144         this(null, presetHandler);
     143        this(null, presetHandler, 0);
    145144    }
    146145
    147146    /**
    public TagEditorPanel(PresetHandler presetHandler) {  
    149148     * {@code model} is null, a new model is created.
    150149     *
    151150     * @param model the tag editor model
     151     * @param maxCharacters maximum number of characters allowed, 0 for unlimited
    152152     */
    153     public TagEditorPanel(TagEditorModel model, PresetHandler presetHandler) {
     153    public TagEditorPanel(TagEditorModel model, PresetHandler presetHandler, int maxCharacters) {
    154154        this.model = model;
    155155        this.presetHandler = presetHandler;
    156156        if (this.model == null) {
    157157            this.model = new TagEditorModel();
    158158        }
     159        this.tagTable = new TagTable(this.model, maxCharacters);
    159160        build();
    160161    }
    161162
  • src/org/openstreetmap/josm/gui/tagging/TagTable.java

    diff --git a/src/org/openstreetmap/josm/gui/tagging/TagTable.java b/src/org/openstreetmap/josm/gui/tagging/TagTable.java
    index 98c91bb..0193f21 100644
    a b public RunnableAction getPasteAction() {  
    392392
    393393    /**
    394394     * initialize the table
     395     * @param maxCharacters maximum number of characters allowed for keys and values, 0 for unlimited
    395396     */
    396     protected final void init() {
     397    protected final void init(int maxCharacters) {
    397398        setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    398399        setRowSelectionAllowed(true);
    399400        setColumnSelectionAllowed(true);
    protected final void init() {  
    425426
    426427        // create the table cell editor and set it to key and value columns
    427428        //
    428         TagCellEditor tmpEditor = new TagCellEditor();
     429        TagCellEditor tmpEditor = new TagCellEditor(maxCharacters);
    429430        setRowHeight(tmpEditor.getEditor().getPreferredSize().height);
    430431        setTagCellEditor(tmpEditor);
    431432    }
    protected final void init() {  
    434435     * Creates a new tag table
    435436     *
    436437     * @param model the tag editor model
     438     * @param maxCharacters maximum number of characters allowed for keys and values, 0 for unlimited
    437439     */
    438     public TagTable(TagEditorModel model) {
     440    public TagTable(TagEditorModel model, int maxCharacters) {
    439441        super(model, new TagTableColumnModel(model.getColumnSelectionModel()), model.getRowSelectionModel());
    440442        this.model = model;
    441         init();
     443        init(maxCharacters);
    442444    }
    443445
    444446    @Override