/** * {@inheritDoc} */ @Override public boolean isFocusRequired() { return backing.isFocusRequired(); }
@Test public void testFocusRequiredAccessors() { UIContext uic = createUIContext(); Assert.assertFalse("Focus required should be false by default", uic.isFocusRequired()); uic.setFocusRequired(true); Assert.assertTrue("Focus required should be true", uic.isFocusRequired()); }
/** * Override paint in order to perform processing specific to this interceptor. * * @param renderContext the renderContext to send the output to. */ @Override public void paint(final RenderContext renderContext) { getBackingComponent().paint(renderContext); // We don't want to remember the focus for the next render because on // a multi portlet page, we'd end up with multiple portlets trying to // set the focus. UIContext uic = UIContextHolder.getCurrent(); if (uic.isFocusRequired()) { boolean sticky = ConfigurationProperties.getStickyFocus(); if (!sticky) { uic.setFocussed(null, null); uic.setFocusRequired(false); } } } }
xml.appendTagOpen("ui:ajaxresponse"); xml.append(XMLUtil.STANDARD_NAMESPACES); xml.appendOptionalAttribute("defaultFocusId", uic.isFocusRequired() && !Util.empty(focusId), focusId); xml.appendClose();
xml.appendOptionalAttribute("unsavedChanges", application.hasUnsavedChanges(), "true"); xml.appendOptionalAttribute("title", application.getTitle()); xml.appendOptionalAttribute("defaultFocusId", uic.isFocusRequired() && !Util.empty(focusId), focusId); xml.appendOptionalUrlAttribute("icon", WApplication.getIcon());