/** * Add a roster group, notifying all listeners of the change. * * <p>This method fires the property change notification {@value #ROSTER_GROUP_ADDED}. * * @param rg The group to be added */ public void addRosterGroup(RosterGroup rg) { if (this.rosterGroups.containsKey(rg.getName())) { return; } this.rosterGroups.put(rg.getName(), rg); firePropertyChange(ROSTER_GROUP_ADDED, null, rg.getName()); }
/** * Delete a roster group, notifying all listeners of the change. * * <p>This method fires the property change notification "{@value #ROSTER_GROUP_REMOVED}". * * @param rg The group to be deleted */ public void delRosterGroupList(String rg) { RosterGroup group = this.rosterGroups.remove(rg); String str = Roster.getRosterGroupProperty(rg); group .getEntries() .stream() .forEach( (re) -> { re.deleteAttribute(str); }); firePropertyChange(ROSTER_GROUP_REMOVED, rg, null); }
/** * Create a table model for a Roster group. * * @param group the roster group to show; if null, behaves the same as {@link #RosterTableModel()} */ public RosterTableModel(@Nullable RosterGroup group) { this(false); if (group != null) { this.setRosterGroup(group.getName()); } }
/** * Changes the key used to lookup a RosterGroup by name. This is a helper method that does not * fire a notification to any propertyChangeListeners. * * <p>To rename a RosterGroup, use {@link * jmri.jmrit.roster.rostergroup.RosterGroup#setName(java.lang.String)}. * * @param group The group being associated with newKey and will be disassociated with the key * matching {@link RosterGroup#getName()}. * @param newKey The new key by which group can be found in the map of RosterGroups. This should * match the intended new name of group. */ public void remapRosterGroup(RosterGroup group, String newKey) { this.rosterGroups.remove(group.getName()); this.rosterGroups.put(newKey, group); }
public void removeRosterGroup(RosterGroup rg) { this.delRosterGroupList(rg.getName()); }