Package com.opensymphony.xwork2

Examples of com.opensymphony.xwork2.Validateable


    //  ------- Singleton getInstance -------
   
    public static TextProvider getInstance(Class clazz, LocaleProvider provider)
    {
        TextProvider instance=new TextProviderActionSupport(provider);
        if (instance instanceof ResourceBundleTextProvider)
        {
            ((ResourceBundleTextProvider) instance).setClazz(clazz);
        }
        return instance;
View Full Code Here


    //  ------- Singleton getInstance -------
   
    public static TextProvider getInstance(Class<?> clazz, LocaleProvider provider)
    {
        TextProvider instance=new TextProviderActionSupport(provider);
        if (instance instanceof ResourceBundleTextProvider)
        {
            ((ResourceBundleTextProvider) instance).setClazz(clazz);
        }
        return instance;
View Full Code Here

    }

    protected String getTranslationFromKey(String key)
    {
        Object action = getAction();
        TextProvider tp = getTextProvider(action);
        if (tp!=null)
        {   // Text Provider found
            String locale = getLocale(action).toString()
            String result = tp.getText(key);
            if (result==null)
            {
                if (log.isErrorEnabled())
                    log.error("No translation found for key=[" + key + "] on page " + getPageName() + " --> locale=" + locale);
            }
View Full Code Here

    else {
      OgnlValueStack stack = (OgnlValueStack) TagUtils.getStack(pageContext);
     
      for (Object o : stack.getRoot()) {
        if (o instanceof TextProvider) {
          TextProvider tp = (TextProvider) o;
          message = tp.getText(messageKey, UNDEFINED_KEY + messageKey + UNDEFINED_KEY);
          break;
        }
      }
    }
View Full Code Here

   *
   * @return reference to field with TextProvider
   */
  private TextProvider getTextProvider() {
    if (textProvider == null) {
      TextProviderFactory tpf = new TextProviderFactory();
      if (container != null) {
        container.inject(tpf);
      }
      textProvider = tpf.createInstance(getClass(), this);
    }
    return textProvider;
  }
View Full Code Here

    private void performProgrammaticValidation(ActionInvocation invocation, Object action) throws Exception {
        if (action instanceof Validateable && programmatic) {
            // keep exception that might occured in validateXXX or validateDoXXX
            Exception exception = null;

            Validateable validateable = (Validateable) action;
            if (LOG.isDebugEnabled()) {
                LOG.debug("Invoking validate() on action [#0]", validateable.toString());
            }

            try {
                PrefixMethodInvocationUtil.invokePrefixMethod(
                        invocation,
                        new String[]{VALIDATE_PREFIX, ALT_VALIDATE_PREFIX});
            } catch (Exception e) {
                // If any exception occurred while doing reflection, we want
                // validate() to be executed
                if (LOG.isWarnEnabled()) {
                    LOG.warn("An exception occured while executing the prefix method", e);
                }
                exception = e;
            }

            if (alwaysInvokeValidate) {
                validateable.validate();
            }

            if (exception != null) {
                // rethrow if something is wrong while doing validateXXX / validateDoXXX
                throw exception;
View Full Code Here

    private void performProgrammaticValidation(ActionInvocation invocation, Object action) throws Exception {
        if (action instanceof Validateable && programmatic) {
            // keep exception that might occured in validateXXX or validateDoXXX
            Exception exception = null;

            Validateable validateable = (Validateable) action;
            if (LOG.isDebugEnabled()) {
                LOG.debug("Invoking validate() on action [#0]", validateable.toString());
            }

            try {
                PrefixMethodInvocationUtil.invokePrefixMethod(
                        invocation,
                        new String[]{VALIDATE_PREFIX, ALT_VALIDATE_PREFIX});
            } catch (Exception e) {
                // If any exception occurred while doing reflection, we want
                // validate() to be executed
                if (LOG.isWarnEnabled()) {
                    LOG.warn("An exception occured while executing the prefix method", e);
                }
                exception = e;
            }

            if (alwaysInvokeValidate) {
                validateable.validate();
            }

            if (exception != null) {
                // rethrow if something is wrong while doing validateXXX / validateDoXXX
                throw exception;
View Full Code Here

    private void performProgrammaticValidation(ActionInvocation invocation, Object action) throws Exception {
        if (action instanceof Validateable && programmatic) {
            // keep exception that might occured in validateXXX or validateDoXXX
            Exception exception = null;

            Validateable validateable = (Validateable) action;
            if (LOG.isDebugEnabled()) {
                LOG.debug("Invoking validate() on action [#0]", validateable.toString());
            }

            try {
                PrefixMethodInvocationUtil.invokePrefixMethod(
                        invocation,
                        new String[]{VALIDATE_PREFIX, ALT_VALIDATE_PREFIX});
            } catch (Exception e) {
                // If any exception occurred while doing reflection, we want
                // validate() to be executed
                LOG.warn("An exception occured while executing the prefix method", e);
                exception = e;
            }

            if (alwaysInvokeValidate) {
                validateable.validate();
            }

            if (exception != null) {
                // rethrow if something is wrong while doing validateXXX / validateDoXXX
                throw exception;
View Full Code Here

       
        if (action instanceof Validateable && programmatic) {
            // keep exception that might occured in validateXXX or validateDoXXX
            Exception exception = null;
           
            Validateable validateable = (Validateable) action;
            if (LOG.isDebugEnabled()) {
                LOG.debug("Invoking validate() on action "+validateable);
            }
           
            try {
                PrefixMethodInvocationUtil.invokePrefixMethod(
                                invocation,
                                new String[] { VALIDATE_PREFIX, ALT_VALIDATE_PREFIX });
            }
            catch(Exception e) {
                // If any exception occurred while doing reflection, we want
                // validate() to be executed
                LOG.warn("an exception occured while executing the prefix method", e);
                exception = e;
            }
           
           
            if (alwaysInvokeValidate) {
                validateable.validate();
            }
           
            if (exception != null) {
                // rethrow if something is wrong while doing validateXXX / validateDoXXX
                throw exception;
View Full Code Here

    private void performProgrammaticValidation(ActionInvocation invocation, Object action) throws Exception {
        if (action instanceof Validateable && programmatic) {
            // keep exception that might occured in validateXXX or validateDoXXX
            Exception exception = null;

            Validateable validateable = (Validateable) action;
            if (LOG.isDebugEnabled()) {
                LOG.debug("Invoking validate() on action [#0]", validateable.toString());
            }

            try {
                PrefixMethodInvocationUtil.invokePrefixMethod(
                        invocation,
                        new String[]{VALIDATE_PREFIX, ALT_VALIDATE_PREFIX});
            } catch (Exception e) {
                // If any exception occurred while doing reflection, we want
                // validate() to be executed
                LOG.warn("An exception occured while executing the prefix method", e);
                exception = e;
            }

            if (alwaysInvokeValidate) {
                validateable.validate();
            }

            if (exception != null) {
                // rethrow if something is wrong while doing validateXXX / validateDoXXX
                throw exception;
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.Validateable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.