Ticket #2236: propd.patch

File propd.patch, 2.3 KB (added by singularita, 16 years ago)

patch

  • src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

     
    718711            propertyData.addRow(new Object[]{e.getKey(), e.getValue()});
    719712        }
    720713
    721         boolean hasTags = !newSelection.isEmpty() && propertyData.getRowCount() > 0;
    722         boolean hasSelection = !newSelection.isEmpty();
    723         btnAdd.setEnabled(hasSelection);
    724         btnEdit.setEnabled(hasTags);
    725         btnDel.setEnabled(hasTags);
    726         propertyTable.setVisible(hasSelection);
    727         propertyTable.getTableHeader().setVisible(hasSelection);
    728         selectSth.setVisible(!hasSelection);
    729         if(hasTags) propertyTable.changeSelection(0, 0, false, false);
    730 
    731         checkPresets(nodes, ways, relations, closedways);
    732 
    733714        // re-load membership data
    734715        // this is rather expensive since we have to walk through all members of all existing relationships.
    735716        // could use back references here for speed if necessary.
     
    759740        membershipTable.getTableHeader().setVisible(membershipData.getRowCount() > 0);
    760741        membershipTable.setVisible(membershipData.getRowCount() > 0);
    761742
     743        boolean hasSelection = !newSelection.isEmpty();
     744        boolean hasTags = hasSelection && propertyData.getRowCount() > 0;
     745        boolean hasMemberships = hasSelection && membershipData.getRowCount() > 0;
     746        btnAdd.setEnabled(hasSelection);
     747        btnEdit.setEnabled(hasTags || hasMemberships);
     748        btnDel.setEnabled(hasTags || hasMemberships);
     749        propertyTable.setVisible(hasSelection);
     750        propertyTable.getTableHeader().setVisible(hasSelection);
     751        selectSth.setVisible(!hasSelection);
     752        if(hasTags) propertyTable.changeSelection(0, 0, false, false);
     753        else if(hasMemberships) membershipTable.changeSelection(0, 0, false, false);
     754
     755        checkPresets(nodes, ways, relations, closedways);
     756
    762757        if(propertyData.getRowCount() != 0 || membershipData.getRowCount() != 0) {
    763758            setTitle(tr("Properties: {0} / Memberships: {1}",
    764759                propertyData.getRowCount(), membershipData.getRowCount()), true);