use of com.servoy.j2db.util.ISupplyFocusChildren in project servoy-client by Servoy.
the class WebForm method setTabSeqComponents.
public void setTabSeqComponents(List<Component> tabSequence) {
boolean defaultSequence = true;
if (tabSequence != null && tabSequence.size() > 0) {
defaultSequence = false;
IDataRenderer formEditorRenderer = formController.getDataRenderers()[FormController.FORM_EDITOR];
if (formEditorRenderer instanceof WebCellBasedView && !tabSequence.contains(formEditorRenderer)) {
// this means that we have to identify components that are part of the table view and based on where these are located set the view's tabIndex;
// when called from JS tabSequence will only contain table columns, not table view as opposed to initialization when tabSequence only contains the view
int i;
for (i = 0; i < tabSequence.size(); i++) {
if (((WebCellBasedView) formEditorRenderer).isColumnIdentifierComponent(tabSequence.get(i))) {
// table view should be added to tab sequence
((WebCellBasedView) formEditorRenderer).setTabSeqComponents(tabSequence);
tabSequence = new ArrayList<Component>(tabSequence);
tabSequence.add(i, (Component) formEditorRenderer);
break;
}
}
i++;
while (i < tabSequence.size()) {
if (((WebCellBasedView) formEditorRenderer).isColumnIdentifierComponent(tabSequence.get(i))) {
tabSequence.remove(i);
} else {
i++;
}
}
}
int tabIndex = 1;
for (Component comp : tabSequence) {
if (comp instanceof IWebFormContainer) {
((IWebFormContainer) comp).setTabSequenceIndex(tabIndex);
tabIndex = WebDataRendererFactory.getContainerGapIndex(tabIndex + WebDataRendererFactory.CONTAINER_RESERVATION_GAP, tabIndex);
TabIndexHelper.setUpTabIndexAttributeModifier(comp, ISupportWebTabSeq.SKIP);
} else if (comp instanceof WebCellBasedView) {
WebCellBasedView tableView = (WebCellBasedView) comp;
tableView.setTabSequenceIndex(tabIndex);
tabIndex += WebDataRendererFactory.MAXIMUM_TAB_INDEXES_ON_TABLEVIEW;
TabIndexHelper.setUpTabIndexAttributeModifier(comp, ISupportWebTabSeq.SKIP);
} else {
TabIndexHelper.setUpTabIndexAttributeModifier(comp, tabIndex);
tabIndex++;
}
}
}
IDataRenderer[] dataRenderers = formController.getDataRenderers();
for (IDataRenderer dr : dataRenderers) {
if (dr != null) {
// set attributeModifiers for all components
if (dr instanceof WebCellBasedView) {
if (defaultSequence) {
// normal focus
((WebCellBasedView) dr).setTabSequenceIndex(ISupportWebTabSeq.DEFAULT);
((WebCellBasedView) dr).setTabSeqComponents(null);
} else if (!tabSequence.contains(dr)) {
// it shouldn't gain focus when tabbing ...
((WebCellBasedView) dr).setTabSequenceIndex(-1);
((WebCellBasedView) dr).setTabSeqComponents(null);
}
} else {
Iterator compIt = dr.getComponentIterator();
if (compIt != null) {
while (compIt.hasNext()) {
Object obj = compIt.next();
if (obj instanceof ISupplyFocusChildren) {
for (Component c : ((ISupplyFocusChildren<Component>) obj).getFocusChildren()) {
checkIfDefaultOrSkipFocus(defaultSequence, tabSequence, c);
}
} else if (obj instanceof Component) {
checkIfDefaultOrSkipFocus(defaultSequence, tabSequence, (Component) obj);
}
}
}
}
}
}
tabSeqComponentList = tabSequence;
}
use of com.servoy.j2db.util.ISupplyFocusChildren in project servoy-client by Servoy.
the class DataRendererFactory method extendTabSequence.
public void extendTabSequence(List<Component> tabSequence, IFormUIInternal containerImpl) {
SwingForm sf = (SwingForm) containerImpl;
JComponent west = sf.getWest();
if (west != null) {
if (west instanceof ISupplyFocusChildren) {
ISupplyFocusChildren<Component> s = (ISupplyFocusChildren<Component>) west;
Component[] fchilds = s.getFocusChildren();
for (Component element : fchilds) {
tabSequence.add(element);
}
}
}
}
Aggregations