private void createAndAddRenderingChildConnector(AbstractCompositeValueConnector compositeValueConnector, String renderingConnectorId) { if (renderingConnectorId != null) { compositeValueConnector.addChildConnector(renderingConnectorId, createValueConnector(renderingConnectorId)); compositeValueConnector.setRenderingChildConnectorId(renderingConnectorId); } }
/** * {@inheritDoc} */ @Override public IValueConnector getRenderingConnector() { if (renderingChildConnectorId != null) { return getChildConnector(renderingChildConnectorId); } return null; }
/** * {@inheritDoc} */ @Override public AbstractCompositeValueConnector clone(String newConnectorId) { AbstractCompositeValueConnector clonedConnector = (AbstractCompositeValueConnector) super .clone(newConnectorId); clonedConnector.childConnectors = null; clonedConnector.childConnectorKeys = null; clonedConnector.itemSelectionSupport = null; for (String connectorKey : getChildConnectorKeys()) { clonedConnector.addChildConnector(connectorKey, getChildConnector(connectorKey).clone()); } return clonedConnector; }
/** * {@inheritDoc} */ @Override public void readabilityChange() { super.readabilityChange(); for (String key : getChildConnectorKeys()) { getChildConnector(key).readabilityChange(); } }
/** * Adds a new child connector to this composite. The key used as storage key * is the child connector id. * * @param childConnector * the added connector. */ @Override public final void addChildConnector(IValueConnector childConnector) { addChildConnector(childConnector.getId(), childConnector); }
/** * {@inheritDoc} */ @Override public boolean areChildrenReadable() { // overridden to remove model connector readability condition. /* if (getModelConnector() != null && !getModelConnector().isReadable()) { return false; } */ Boolean locallyReadable = isLocallyReadable(); if (getParentConnector() != null && !getParentConnector().areChildrenReadable()) { if (locallyReadable == null) { return false; } } return locallyReadable == null || locallyReadable; }
/** * {@inheritDoc} */ @Override public boolean areChildrenWritable() { // overridden to remove model connector writability condition. /* if (getModelConnector() != null && !getModelConnector().isWritable()) { return false; } */ Boolean locallyWritable = isLocallyWritable(); if (getParentConnector() != null && !getParentConnector().areChildrenWritable()) { if (locallyWritable == null) { return false; } } return locallyWritable == null || locallyWritable; }
/** * {@inheritDoc} */ @Override protected void propagateRollback() { Object badValue = getConnectorValue(); super.propagateRollback(); if (badValue == null) { IValueConnector renderingConnector = getRenderingConnector(); if (renderingConnector instanceof AbstractValueConnector) { ((AbstractValueConnector) renderingConnector) .fireValueChange(new ValueChangeEvent(renderingConnector, null, renderingConnector.getConnectorValue())); } } }
/** * Utility implementation to factorize method support. This should only be * used by subclasses which implement {@code IItemSelectable}. * * @param evt * the item selection event to propagate. */ protected void implFireSelectedItemChange(ItemSelectionEvent evt) { selectedItem = evt.getSelectedItem(); if (itemSelectionSupport != null && (evt.getSource() == this || isTrackingChildrenSelection())) { itemSelectionSupport.fireSelectedConnectorChange(evt); } IValueConnector parentConnector = getParentConnector(); while (parentConnector != null && !(parentConnector instanceof IItemSelectable)) { parentConnector = parentConnector.getParentConnector(); } if (parentConnector != null) { ((IItemSelectable) parentConnector).fireSelectedItemChange(evt); } }
/** * {@inheritDoc} */ @Override public BasicCompositeConnector clone(String newConnectorId) { BasicCompositeConnector clonedConnector = (BasicCompositeConnector) super .clone(newConnectorId); clonedConnector.connecteeValue = null; return clonedConnector; }
/** * Uses the value to compute the string representation. * <p> * {@inheritDoc} */ @Override public String toString() { return getDisplayValue(); }
/** * Gets the static icon or uses the icon provider to compute it based on the * connector value. * <p> * {@inheritDoc} */ @Override public Icon getDisplayIcon() { Icon icon; if (iconImageURLProvider != null) { icon = iconImageURLProvider.getIconForObject(getConnectorValue()); if (icon == null) { return displayIcon; } } else { icon = displayIcon; } return icon; }
/** * Gets the static display value or uses the rendering connector to compute * the string representation. * <p> * {@inheritDoc} */ @Override public String getDisplayValue() { IValueConnector renderingConnector = getRenderingConnector(); if (renderingConnector != null) { if (renderingConnector.getConnectorValue() != null) { return renderingConnector.getConnectorValue().toString(); } return displayValue; } return displayValue; }
/** * {@inheritDoc} */ @Override public void writabilityChange() { super.writabilityChange(); for (String key : getChildConnectorKeys()) { getChildConnector(key).writabilityChange(); } }
/** * Overrides to allow for duplicate Ids. When 2 connectors with the same id * are added, instead of replacing the old one, the new one is added with '#x' * appended to its id. * <p> * {@inheritDoc} */ @Override public void addChildConnector(String storageKey, IValueConnector connector) { Collection<String> childrenKeys = getChildConnectorKeys(); int n = 1; String dedupKey = storageKey; while (childrenKeys.contains(dedupKey)) { dedupKey = getRankedKey(storageKey, n); n++; } super.addChildConnector(dedupKey, connector); }
/** * {@inheritDoc} */ @Override public AbstractCollectionConnector clone(String newConnectorId) { AbstractCollectionConnector clonedConnector = (AbstractCollectionConnector) super.clone(newConnectorId); clonedConnector.selectionChangeSupport = null; clonedConnector.removedChildrenConnectors = null; clonedConnector.connectorTank = null; return clonedConnector; }
private void createAndAddRenderingChildConnector( AbstractCompositeValueConnector compositeValueConnector, String renderingConnectorId) { if (renderingConnectorId != null) { compositeValueConnector.addChildConnector(renderingConnectorId, createValueConnector(renderingConnectorId)); compositeValueConnector .setRenderingChildConnectorId(renderingConnectorId); } } }