Greg Sheremeta has uploaded a new change for review. Change subject: userportal, webadmin: fixed tabindexes for login pages ......................................................................
userportal, webadmin: fixed tabindexes for login pages Since PatternFly adoption, tabbing through fields on the login pages was erratic. Fixed to be in the proper, predictable order. As part of fixing this, added a "useManualTabIndex" property to disable setting of tabindex by UiCommonEditorVisitor. Change-Id: I434eb12b5efe003c0d1c139ad94d4d352668f403 Bug-Url: https://bugzilla.redhat.com/1154051 Signed-off-by: Greg Sheremeta <gsher...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractValidatedWidgetWithLabel.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/PatternflyUiCommandButton.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/WidgetWithLabelEditor.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/login/view/LoginFormView.ui.xml M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/login/view/LoginFormView.ui.xml 6 files changed, 50 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/34738/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java index f0051ac..a118989 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/editor/UiCommonEditorVisitor.java @@ -7,6 +7,7 @@ import org.ovirt.engine.ui.common.widget.HasEnabledWithHints; import org.ovirt.engine.ui.common.widget.HasValidation; import org.ovirt.engine.ui.common.widget.editor.TakesConstrainedValueEditor; +import org.ovirt.engine.ui.common.widget.editor.WidgetWithLabelEditor; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import org.ovirt.engine.ui.uicommonweb.models.ListModel; import org.ovirt.engine.ui.uicommonweb.models.Model; @@ -73,8 +74,14 @@ final UiCommonEditor<T> functionalEditor = getFunctionalEditor(currentLeafEditor); if (functionalEditor != null) { - // Set tab index - functionalEditor.setTabIndex(++tabIndexCounter); + + // Set tab index, unless it's being set manually (perhaps in a UIBinder file -- see login pages) + if (functionalEditor instanceof WidgetWithLabelEditor) { + WidgetWithLabelEditor widgetWithLabelEditor = (WidgetWithLabelEditor) functionalEditor; + if (!widgetWithLabelEditor.isUseManualTabIndex()) { + functionalEditor.setTabIndex(++tabIndexCounter); + } + } // Add key press handler functionalEditor.addKeyPressHandler(new KeyPressHandler() { diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractValidatedWidgetWithLabel.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractValidatedWidgetWithLabel.java index fa615b4..8a1999b 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractValidatedWidgetWithLabel.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/AbstractValidatedWidgetWithLabel.java @@ -83,6 +83,8 @@ private boolean usePatternFly; + private boolean useManualTabIndex = false; + public AbstractValidatedWidgetWithLabel(W contentWidget, VisibilityRenderer renderer) { this.contentWidget = contentWidget; this.renderer = renderer; @@ -131,6 +133,24 @@ } /** + * Disable auto-setting of the tabindex by an editor visitor. If this is set to true, + * you should then set the tabindex manually. + * @param use + */ + public void setUseManualTabIndex(final boolean use) { + this.useManualTabIndex = use; + } + + /** + * Returns true if this widget is configured to be ignored by the editor visitor and should + * have its tabindex set manually. + * @return + */ + public boolean isUseManualTabIndex() { + return useManualTabIndex; + } + + /** * Render widget more responsive, by firing {@link ValueChangeEvent} on each {@link KeyDownEvent}. */ public void fireValueChangeOnKeyDown() { diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/PatternflyUiCommandButton.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/PatternflyUiCommandButton.java index 1acc0b9..25e707c 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/PatternflyUiCommandButton.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/PatternflyUiCommandButton.java @@ -25,9 +25,13 @@ return button; } + public void setTabIndex(int tabIndex) { + button.getElement().setTabIndex(tabIndex); + } + @Override public int setTabIndexes(int nextTabIndex) { - //TODO: Implement focusable on the button so we can set tab index on this. - return nextTabIndex; + setTabIndex(nextTabIndex); + return nextTabIndex++; } } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/WidgetWithLabelEditor.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/WidgetWithLabelEditor.java index acb64f5..0972811 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/WidgetWithLabelEditor.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/WidgetWithLabelEditor.java @@ -129,4 +129,8 @@ widgetWithLabel.setTabIndex(index); } + public boolean isUseManualTabIndex() { + return widgetWithLabel.isUseManualTabIndex(); + } + } diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/login/view/LoginFormView.ui.xml b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/login/view/LoginFormView.ui.xml index 3c985fc..995e968 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/login/view/LoginFormView.ui.xml +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/login/view/LoginFormView.ui.xml @@ -88,22 +88,22 @@ <div class="form-group"> <div class="col-sm-8 col-md-8"></div> <div class="col-sm-4 col-md-4"> - <b:ListBox ui:field="localeBox"/> + <b:ListBox ui:field="localeBox" tabIndex="1" /> </div> </div> - <ge:StringEntityModelTextBoxEditor ui:field="userNameEditor" usePatternFly="true" /> + <ge:StringEntityModelTextBoxEditor ui:field="userNameEditor" usePatternFly="true" useManualTabIndex="true" tabIndex="2" /> - <ge:StringEntityModelPasswordBoxEditor ui:field="passwordEditor" usePatternFly="true" /> + <ge:StringEntityModelPasswordBoxEditor ui:field="passwordEditor" usePatternFly="true" useManualTabIndex="true" tabIndex="3" /> - <e:ListModelListBoxEditor ui:field="profileEditor" usePatternFly="true" /> + <e:ListModelListBoxEditor ui:field="profileEditor" usePatternFly="true" useManualTabIndex="true" tabIndex="4" /> <div> <div class="col-xs-8 col-sm-offset-2 col-sm-6 col-md-offset-2 col-md-6"> - <ge:EntityModelCheckBoxEditor ui:field="connectAutomaticallyEditor" usePatternFly="true" /> + <ge:EntityModelCheckBoxEditor ui:field="connectAutomaticallyEditor" usePatternFly="true" useManualTabIndex="true" tabIndex="5" /> </div> <div class="col-xs-4 col-sm-4 col-md-4 submit {style.loginButtonContainer}"> - <w:PatternflyUiCommandButton ui:field="loginButton" addStyleNames="btn-primary btn-lg" /> + <w:PatternflyUiCommandButton ui:field="loginButton" addStyleNames="btn-primary btn-lg" tabIndex="6" /> </div> </div> </form> diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/login/view/LoginFormView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/login/view/LoginFormView.ui.xml index 3ec6dd2..791ee7e 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/login/view/LoginFormView.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/login/view/LoginFormView.ui.xml @@ -77,15 +77,15 @@ <div class="form-group"> <div class="col-sm-8 col-md-8"></div> <div class="col-sm-4 col-md-4"> - <b:ListBox ui:field="localeBox"/> + <b:ListBox ui:field="localeBox" tabIndex="1" /> </div> </div> - <ge:StringEntityModelTextBoxEditor ui:field="userNameEditor" usePatternFly="true" /> + <ge:StringEntityModelTextBoxEditor ui:field="userNameEditor" usePatternFly="true" useManualTabIndex="true" tabIndex="2" /> - <ge:StringEntityModelPasswordBoxEditor ui:field="passwordEditor" usePatternFly="true" /> + <ge:StringEntityModelPasswordBoxEditor ui:field="passwordEditor" usePatternFly="true" useManualTabIndex="true" tabIndex="3" /> - <e:ListModelListBoxEditor ui:field="profileEditor" usePatternFly="true" /> + <e:ListModelListBoxEditor ui:field="profileEditor" usePatternFly="true" useManualTabIndex="true" tabIndex="4" /> <div class="form-group"> <div class="col-xs-8 col-sm-offset-2 col-sm-6 col-md-offset-2 col-md-6"> @@ -107,7 +107,7 @@ --> </div> <div class="col-xs-4 col-sm-4 col-md-4 submit"> - <w:PatternflyUiCommandButton ui:field="loginButton" addStyleNames="btn-primary btn-lg" /> + <w:PatternflyUiCommandButton ui:field="loginButton" addStyleNames="btn-primary btn-lg" tabIndex="5" /> </div> </div> </form> -- To view, visit http://gerrit.ovirt.org/34738 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I434eb12b5efe003c0d1c139ad94d4d352668f403 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Greg Sheremeta <gsher...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches