/** * {@inheritDoc} */ @Override public IValueConnector getChildConnector(int index) { return getChildConnector(computeStorageKey(index)); }
ICollectionConnector modelConnector = (ICollectionConnector) getModelConnector(); Map<IValueConnector, List<IValueConnector>> existingConnectorsByModel = new HashMap<>(); for (String connectorKey : new ArrayList<>(getChildConnectorKeys())) { IValueConnector childConnector = getChildConnector(connectorKey); List<IValueConnector> existingConnectors = existingConnectorsByModel.get(childConnector.getModelConnector()); if (existingConnectors == null) { removeChildConnector(connectorKey); connector = existingConnectors.remove(0); } else { connector = createChildConnector(getId() + "Element"); try { ((AbstractValueConnector) connector).setMute(true); addChildConnector(computeStorageKey(i), connector); if (removedChildrenConnectors != null) { removedChildrenConnectors.remove(connector); cleanupConnector(obsoleteConnector); removedChildrenConnectors.add(obsoleteConnector);
/** * {@inheritDoc} */ @Override public void setSelectedIndices(int[] selectedIndices, int leadingIndex) { int[] newSelectedIndices = selectedIndices; if (newSelectedIndices != null && newSelectedIndices.length == 0) { newSelectedIndices = null; } int[] oldSelectedIndices = getSelectedIndices(); if (oldSelectedIndices != null && oldSelectedIndices.length == 0) { oldSelectedIndices = null; } if (selectionChangeSupport == null) { selectionChangeSupport = new SelectionChangeSupport(this); } selectionChangeSupport.setSelectedIndices(newSelectedIndices, leadingIndex); if ((oldSelectedIndices == null && newSelectedIndices != null) || (oldSelectedIndices != null && newSelectedIndices == null) || (oldSelectedIndices != null && !Arrays.equals(oldSelectedIndices, newSelectedIndices))) { if (newSelectedIndices == null) { implFireSelectedConnectorChange(null); } else { implFireSelectedConnectorChange(getChildConnector(leadingIndex)); } } }
/** * {@inheritDoc} */ @Override public String toString() { return getId(); }
/** * {@inheritDoc} */ @Override public BasicCollectionConnector clone(String newConnectorId) { BasicCollectionConnector clonedConnector = (BasicCollectionConnector) super .clone(newConnectorId); clonedConnector.connecteeValue = null; return clonedConnector; }
private String computeStorageKey(int i) { return CollectionConnectorHelper.computeStorageKey(getId(), i); } }