public CStationContainer getContainer(CStation<?> child) { for (CStationContainer container : getStationContainers()) { for (int i = 0, n = container.getStationCount(); i < n; i++) { if (container.getStation(i) == child) { return container; } } } return null; }
public boolean removeStationContainer(CStationContainer container) { if (containers.remove(container)) { container.removeStationContainerListener(containerListener); for (int i = 0, n = container.getStationCount(); i < n; i++) { control.removeStation(container.getStation(i)); } return true; } return false; }
public void addStationContainer(CStationContainer container) { if (container == null) throw new NullPointerException("container is null"); if (containers.contains(container)) throw new IllegalArgumentException("container already registered"); for (CStationContainer child : containers) { if (child.getUniqueId().equals(container.getUniqueId())) { throw new IllegalArgumentException( "A container with unique id '" + container.getUniqueId() + "' is already registered"); } } containers.add(container); try { settingDefaultStations = container == content; for (int i = 0, n = container.getStationCount(); i < n; i++) { control.addStation(container.getStation(i), true); } } finally { settingDefaultStations = false; } container.addStationContainerListener(containerListener); }