Changeset 19014 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
- Timestamp:
- 2024-03-08T10:58:03+01:00 (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r18968 r19014 56 56 import org.openstreetmap.josm.data.UndoRedoHandler.CommandQueueListener; 57 57 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 58 import org.openstreetmap.josm.data.osm.IRelation;59 58 import org.openstreetmap.josm.data.osm.OsmPrimitive; 60 59 import org.openstreetmap.josm.data.osm.Relation; … … 406 405 * builds the panel with the OK and the Cancel button 407 406 * @param okAction OK action 407 * @param deleteAction Delete action 408 408 * @param cancelAction Cancel action 409 409 * … … 422 422 // Keep users from saving invalid relations -- a relation MUST have at least a tag with the key "type" 423 423 // AND must contain at least one other OSM object. 424 final TableModelListener listener = l -> updateOkPanel( this.actionAccess.getChangedRelation(),okButton, deleteButton);424 final TableModelListener listener = l -> updateOkPanel(okButton, deleteButton); 425 425 listener.tableChanged(null); 426 426 this.memberTableModel.addTableModelListener(listener); … … 430 430 431 431 /** 432 * Update the OK panel area 433 * @param newRelation What the new relation would "look" like if it were to be saved now 432 * Update the OK panel area with a temporary relation that looks if it were to be saved now. 434 433 * @param okButton The OK button 435 434 * @param deleteButton The delete button 436 435 */ 437 private void updateOkPanel(IRelation<?> newRelation, JButton okButton, JButton deleteButton) { 438 okButton.setVisible(newRelation.isUseful() || this.getRelationSnapshot() == null); 439 deleteButton.setVisible(!newRelation.isUseful() && this.getRelationSnapshot() != null); 440 if (this.getRelationSnapshot() == null && !newRelation.isUseful()) { 436 private void updateOkPanel(JButton okButton, JButton deleteButton) { 437 boolean useful = this.actionAccess.wouldRelationBeUseful(); 438 okButton.setVisible(useful || this.getRelationSnapshot() == null); 439 deleteButton.setVisible(!useful && this.getRelationSnapshot() != null); 440 if (this.getRelationSnapshot() == null && !useful) { 441 441 okButton.setText(tr("Delete")); 442 442 } else {
Note:
See TracChangeset
for help on using the changeset viewer.