/**
* Create the cell iterations control.
* @param controlDetails
*/
private void createCellIterationsControl(final ControlDetails controlDetails) {
final CellIterations cellIterations = new CellIterations(
controlDetails.attributesComposite);
final String supplementary = controlDetails.attributesDetails.
getSupplementaryValue(controlDetails.attribute);
cellIterations.setData(AttributesComposite.ATTRIBUTE_ACCESSOR_KEY,
new AttributesComposite.AttributeAccessor() {
public String getValue(String attribute) {
String result;
if (attribute.equals(supplementary)) {
result = cellIterations.getIterationsQualifier();
} else {
result = cellIterations.getIterations();
}
return result;
}
public void setValue(String attribute, String value) {
if (attribute.equals(supplementary)) {
cellIterations.setIterationQualifier(value);
} else {
cellIterations.getText().setText(value);
}
}
});
cellIterations.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
Object oldValue = null;
Object newValue = cellIterations.getIterationsQualifier();
PropertyChangeEvent propertyChange = new PropertyChangeEvent(
cellIterations, supplementary, oldValue, newValue);
controlDetails.attributesComposite.propertyChange(propertyChange);
}
});
// Add an accessible listener
addAccessibleListener(cellIterations, controlDetails);
// Add a modify listener to this control (for the text value).
cellIterations.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Object oldValue = null;
Object newValue = cellIterations.getIterations();
PropertyChangeEvent propertyChange = new PropertyChangeEvent(
cellIterations, controlDetails.attribute, oldValue, newValue);
controlDetails.attributesComposite.
propertyChange(propertyChange);
}
});
// Store the attribute name in the control's data map (test team request).
cellIterations.setData(ATTRIBUTE_NAME_KEY, controlDetails.attribute);
// For this attribute composite, associate the attribute with the control
// so that setting the visibility on or off may be easily achieved.
// See AttributesComposite.setVisible(..)
controlDetails.attributesComposite.setData(controlDetails.attribute,
cellIterations);
// Store the rows and columns controls too (used for updating the
// iteration qualifier).
if (supplementary != null) {
controlDetails.attributesComposite.setData(supplementary, cellIterations);
}
associateHandlerWithText(controlDetails.handler, cellIterations.getText());
associateHandlerWithCombo(controlDetails.handler, cellIterations.getCombo());
}