@Override public void executeOnValid(final ActionEvent event) { UIContextHolder.getCurrent().setLocale(locale); } });
/** * @return the primary context for the current context */ public static UIContext getCurrentPrimaryUIContext() { return getPrimaryUIContext(getCurrent()); }
/** * {@inheritDoc} */ @Override public Environment getEnvironment() { UIContext uic = UIContextHolder.getCurrent(); return uic == null ? null : uic.getEnvironment(); }
/** * {@inheritDoc} */ @Override public void invokeLater(final Runnable runnable) { UIContext uic = UIContextHolder.getCurrent(); if (uic != null) { uic.invokeLater(runnable); } }
/** * {@inheritDoc} */ @Override public void setFocussed() { UIContext uic = UIContextHolder.getCurrent(); if (uic != null) { uic.setFocussed(this, uic); } }
/** * {@inheritDoc} */ @Override public Headers getHeaders() { UIContext uic = UIContextHolder.getCurrent(); return uic == null ? null : uic.getHeaders(); }
/** * This can be used by column components on a {@link WTable} to determine the current row key. * * @return the row key for the current row, or null if no row details */ public static Object getCurrentRowKey() { UIContext uic = UIContextHolder.getCurrent(); if (uic instanceof SubUIContext) { return ((SubUIContext) uic).getRowId(); } return null; }
@Override public String getData() { UIContext uic = UIContextHolder.getCurrent(); int row = getRowIndex((SubUIContext) uic); return table.getDataModel().getRowHeader(row); } });
/** * Sets the focus back to this button unless explicity set elsewhere. */ protected void focusMe() { if (UIContextHolder.getCurrent().getFocussed() == null) { setFocussed(); } }
/** * Remove a contact from the list. */ private void removeRow() { UIContext uic = UIContextHolder.getCurrent(); if (!(uic instanceof WRepeater.SubUIContext)) { return; } List list = new ArrayList(repeater.getBeanList()); list.remove((ContactDetails) repeater.getRowBeanForSubcontext((WRepeater.SubUIContext) uic)); repeater.setData(list); }
/** * {@inheritDoc} */ @Override public void preparePaint(final Request request) { // Increment the step counter UIContext uic = UIContextHolder.getCurrent(); StepCountUtil.incrementSessionStep(uic); super.preparePaint(request); }
/** * Throw the default error code. */ private void handleError() { String msg = I18nUtilities.format(UIContextHolder.getCurrent().getLocale(), InternalMessages.DEFAULT_CONTENT_ERROR); throw new ErrorCodeEscape(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); } }
/** * Throw the default error code. */ private void handleError() { String msg = I18nUtilities .format(UIContextHolder.getCurrent().getLocale(), InternalMessages.DEFAULT_STEP_ERROR); throw new ErrorCodeEscape(HttpServletResponse.SC_BAD_REQUEST, msg); } }
/** * Throw the default error code. */ private void handleError() { String msg = I18nUtilities.format(UIContextHolder.getCurrent().getLocale(), InternalMessages.DEFAULT_SESSION_TOKEN_ERROR); throw new ErrorCodeEscape(HttpServletResponse.SC_BAD_REQUEST, msg); }
/** * Throw the default error code. */ private void handleErrorCode() { String msg = I18nUtilities .format(UIContextHolder.getCurrent().getLocale(), InternalMessages.DEFAULT_STEP_ERROR); throw new ErrorCodeEscape(HttpServletResponse.SC_BAD_REQUEST, msg); }
/** * Override preparePaint in order to perform processing specific to this interceptor. * * @param request the request being responded to. */ @Override public void preparePaint(final Request request) { // Reset the form encoding type before painting the content. UIContext uic = UIContextHolder.getCurrent(); uic.getEnvironment().setFormEncType(null); super.preparePaint(request); }
/** * Handle the error. */ private void handleError() { String msg = I18nUtilities.format(UIContextHolder.getCurrent().getLocale(), InternalMessages.DEFAULT_SESSION_TOKEN_ERROR); throw new ErrorCodeEscape(HttpServletResponse.SC_BAD_REQUEST, msg); }
/** * When the window is targetted, we need to run the "laters". If we don't do this, they will not run because a * targetted request bypasses the root component that would normally have run them. */ @Override protected void invokeLaters() { if (getState() == ACTIVE_STATE && isTargeted()) { UIContextHolder.getCurrent().doInvokeLaters(); } else { super.invokeLaters(); } }
@Override public void run() { getActionOnChange().execute(event); if (isCAT && UIContextHolder.getCurrent().getFocussed() == null) { setFocussed(); } } };
/** * {@inheritDoc} */ @Override public void writeHeader(final PrintWriter writer) { UIContext uic = UIContextHolder.getCurrent(); addHeadlines(writer, uic.getHeaders().getHeadLines()); addJsHeadlines(writer, uic.getHeaders().getHeadLines(Headers.JAVASCRIPT_HEADLINE)); addCssHeadlines(writer, uic.getHeaders().getHeadLines(Headers.CSS_HEADLINE)); }