// CraigM:15/10/2008 - If we are a grid field in an array field
if (focusedComponent.getParent() instanceof GridField && ArrayFieldCellHelper.getArrayField(focusedComponent.getParent()) != null) {
// We should have a FocusTraversalPolicy somewhere on a gridfield (setup in GridFieldCellEditor)
FocusTraversalPolicy traversal = null;
Component componentWithTraveralPolicy = focusedComponent;
while (componentWithTraveralPolicy != null && traversal == null) {
componentWithTraveralPolicy = componentWithTraveralPolicy.getParent();
if (componentWithTraveralPolicy instanceof Container) {
traversal = ((Container)componentWithTraveralPolicy).getFocusTraversalPolicy();
}
}
// If this is null, it means we didn't find the FocusTraversalPolicy manager.
if (traversal != null && componentWithTraveralPolicy instanceof Container) {
if (!e.isShiftDown()) {
Component comp = traversal.getComponentAfter((Container)componentWithTraveralPolicy, focusedComponent);
// If we can transfer the focus inside the GridField, do it
if (comp != null && comp != traversal.getFirstComponent((Container)componentWithTraveralPolicy)) {
comp.requestFocus();
e.consume();
}
}
else {
Component comp = traversal.getComponentBefore((Container)componentWithTraveralPolicy, focusedComponent);
// If we can transfer the focus inside the GridField, do it
if (comp != null && comp != traversal.getLastComponent((Container)componentWithTraveralPolicy)) {
comp.requestFocus();
e.consume();
}
}
}