Package org.g4studio.core.mvc.xstruts.config

Examples of org.g4studio.core.mvc.xstruts.config.FormBeanConfig


  public ActionForm findOrCreateActionForm(String formName, String scopeName, ModuleConfig moduleConfig)
      throws IllegalAccessException, InstantiationException {
    Map scope = this.getScope(scopeName);

    ActionForm instance;
    FormBeanConfig formBeanConfig = moduleConfig.findFormBeanConfig(formName);

    if (formBeanConfig == null) {
      throw new IllegalArgumentException("No form config found under " + formName + " in module "
          + moduleConfig.getPrefix());
    }

    instance = (ActionForm) scope.get(formName);

    // ISSUE: Can we recycle the existing instance (if any)?
    if (instance != null) {
      getLogger().trace("Found an instance in scope " + scopeName + "; test for reusability");

      if (formBeanConfig.canReuse(instance)) {
        return instance;
      }
    }

    ActionForm form = formBeanConfig.createActionForm(this);

    // ISSUE: Should we check this call to put?
    scope.put(formName, form);

    return form;
View Full Code Here


      return (null);
    }

    // Look up the form bean configuration information to use
    String name = mapping.getName();
    FormBeanConfig config = moduleConfig.findFormBeanConfig(name);

    if (config == null) {
      log.warn("No FormBeanConfig found under '" + name + "'");

      return (null);
    }

    ActionForm instance = lookupActionForm(request, attribute, mapping.getScope());

    // Can we recycle the existing form bean instance (if there is one)?
    if ((instance != null) && config.canReuse(instance)) {
      return (instance);
    }

    return createActionForm(config, servlet);
  }
View Full Code Here

    // Process form bean extensions.
    FormBeanConfig[] formBeans = config.findFormBeanConfigs();

    for (int i = 0; i < formBeans.length; i++) {
      FormBeanConfig beanConfig = formBeans[i];

      processFormBeanExtension(beanConfig, config);
    }

    for (int i = 0; i < formBeans.length; i++) {
      FormBeanConfig formBean = formBeans[i];

      // Verify that required fields are all present for the form config
      if (formBean.getType() == null) {
        handleValueRequiredException("type", formBean.getName(), "form bean");
      }

      // ... and the property configs
      FormPropertyConfig[] fpcs = formBean.findFormPropertyConfigs();

      for (int j = 0; j < fpcs.length; j++) {
        FormPropertyConfig property = fpcs[j];

        if (property.getType() == null) {
          handleValueRequiredException("type", property.getName(), "form property");
        }
      }

      // Force creation and registration of DynaActionFormClass instances
      // for all dynamic form beans
      if (formBean.getDynamic()) {
        formBean.getDynaActionFormClass();
      }
    }
  }
View Full Code Here

      // Nothing to do, then
      return beanConfig;
    }

    // Make sure that this bean is of the right class
    FormBeanConfig baseConfig = moduleConfig.findFormBeanConfig(ancestor);

    if (baseConfig == null) {
      throw new UnavailableException("Unable to find " + "form bean '" + ancestor + "' to extend.");
    }

    // Was our bean's class overridden already?
    if (beanConfig.getClass().equals(FormBeanConfig.class)) {
      // Ensure that our bean is using the correct class
      if (!baseConfig.getClass().equals(beanConfig.getClass())) {
        // Replace the bean with an instance of the correct class
        FormBeanConfig newBeanConfig = null;
        String baseConfigClassName = baseConfig.getClass().getName();

        try {
          newBeanConfig = (FormBeanConfig) RequestUtils.applicationInstance(baseConfigClassName);

          // copy the values
          BeanUtils.copyProperties(newBeanConfig, beanConfig);

          FormPropertyConfig[] fpc = beanConfig.findFormPropertyConfigs();

          for (int i = 0; i < fpc.length; i++) {
            newBeanConfig.addFormPropertyConfig(fpc[i]);
          }
        } catch (Exception e) {
          handleCreationException(baseConfigClassName, e);
        }
View Full Code Here

    if (LOG.isTraceEnabled()) {
      LOG.trace("Look up form-bean " + name);
    }

    // Look up the corresponding FormBeanConfig (if any)
    FormBeanConfig formBeanConfig = actionConfig.getModuleConfig().findFormBeanConfig(name);

    if (formBeanConfig == null) {
      LOG.warn("No FormBeanConfig found in module " + actionConfig.getModuleConfig().getPrefix() + " under name "
          + name);
      actionCtx.setActionForm(null);

      return (false);
    }

    Map scope = actionCtx.getScope(actionConfig.getScope());

    ActionForm instance;

    instance = (ActionForm) scope.get(actionConfig.getAttribute());

    // Can we recycle the existing instance (if any)?
    if (!formBeanConfig.canReuse(instance)) {
      instance = formBeanConfig.createActionForm(actionCtx);
    }

    // TODO: Remove ServletActionContext when ActionForm no longer
    // directly depends on ActionServlet
    if (actionCtx instanceof ServletActionContext) {
View Full Code Here

    if (name == null) {
      return;
    }

    FormBeanConfig config = mapping.getModuleConfig().findFormBeanConfig(name);

    if (config == null) {
      return;
    }
View Full Code Here

    if (name == null) {
      return;
    }

    FormBeanConfig config = mapping.getModuleConfig().findFormBeanConfig(name);

    if (config == null) {
      return;
    }

    // look for properties we should reset
    FormPropertyConfig[] props = config.findFormPropertyConfigs();

    for (int i = 0; i < props.length; i++) {
      String resetValue = props[i].getReset();

      // skip this property if there's no reset value
View Full Code Here

TOP

Related Classes of org.g4studio.core.mvc.xstruts.config.FormBeanConfig

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.