SPARK-2410: Correct the bookmark button state in the room browser

Selecting a room in the conference room browser labelled the bookmark button
with the opposite of the room's actual state: an unbookmarked room offered
"Remove bookmark" with the delete icon, and a bookmarked one offered to
bookmark it again. Clicking still did the right thing, so the button simply
described the wrong action.

addBookmarkUI() means "the room is bookmarked, so offer to remove it" — which
is how bookmarkRoom() already calls it, passing the state that results from
the toggle it has just performed. Only the selection listener negated the
value. Drop the negation there, and pass false rather than true when nothing
is selected, so the disabled button rests on "Bookmark room" instead of
"Remove bookmark".

Rename the parameter to isBookmarked and correct its javadoc, which described
the inverted meaning.
This commit is contained in:
Marcelo H. Terres
2026-08-17 09:39:45 +01:00
committed by Sergey Ponomarev
parent 8d261913e6
commit 9722494adb

View File

@ -457,13 +457,13 @@ public class ConferenceRoomBrowser extends JPanel implements ActionListener, Com
joinRoomItem.setEnabled(true);
addRoomButton.setEnabled(true);
addRoomItem.setEnabled(true);
addBookmarkUI(!isBookmarked(roomInfo.getRoom()));
addBookmarkUI(isBookmarked(roomInfo.getRoom()));
} else {
joinRoomButton.setEnabled(false);
addRoomButton.setEnabled(false);
joinRoomItem.setEnabled(false);
addRoomItem.setEnabled(false);
addBookmarkUI(true);
addBookmarkUI(false);
}
});
}
@ -717,10 +717,10 @@ public class ConferenceRoomBrowser extends JPanel implements ActionListener, Com
/**
* Toggles the bookmark room button depending on it's state.
*
* @param addBookmark true if the button should display itself as bookmarkable :)
* @param isBookmarked true if the selected room is already bookmarked, in which case the button offers to remove it.
*/
private void addBookmarkUI(boolean addBookmark) {
if (addBookmark) {
private void addBookmarkUI(boolean isBookmarked) {
if (isBookmarked) {
ResourceUtils.resButton(addRoomButton, Res.getString("button.remove.bookmark"));
addRoomButton.setIcon(SparkRes.getImageIcon(SparkRes.Icon.DELETE_BOOKMARK_ICON));
} else {