Package org.exoplatform.webui.config

Examples of org.exoplatform.webui.config.Component


    @Override
    public <S extends UIComponent> S create(Class<S> type, Map<FieldModel<? super S, ?>, ?> state) throws CreateException {
        //
        try {
            Component config = (Component) getFieldValue("config", state);

            S instance = Util.createObject(type, config != null ? config.getInitParams() : null);

            // Now set state
            for (Map.Entry<FieldModel<? super S, ?>, ?> entry : state.entrySet()) {
                FieldModel<? super S, ?> fieldModel = entry.getKey();
                Object value = entry.getValue();
View Full Code Here


   }

   public <T extends UIComponent> T createUIComponent(Class<T> type, String configId, String id,
      WebuiRequestContext context) throws Exception
   {
      Component config = configManager_.getComponentConfig(type, configId);
      if (config == null)
      {
         throw new Exception("Cannot find the configuration for the component " + type.getName() + ", configId "
            + configId);
      }
      T uicomponent = Util.createObject(type, config.getInitParams());
      uicomponent.setComponentConfig(id, config);
      return type.cast(uicomponent);
   }
View Full Code Here

   public Component getComponentConfig(Class<?> type, String id)
   {
      String key = type.getName();
      if (id != null)
         key = key + ":" + id;
      Component config = configs_.get(key);
      if (config != null)
         return config;
      try
      {
         Component[] components = annotationToComponents(type);
View Full Code Here

      return new Component[]{};
   }

   private Component toComponentConfig(ComponentConfig annotation, Class<?> clazz) throws Exception
   {
      Component config = new Component();
      if (annotation.id().length() > 0)
         config.setId(annotation.id());

      Class<?> type = annotation.type() == void.class ? clazz : annotation.type();
      config.setType(type.getName());
      if (annotation.template().length() > 0)
         config.setTemplate(annotation.template());
      if (annotation.lifecycle() != void.class)
         config.setLifecycle(annotation.lifecycle().getName());
      if (annotation.decorator().length() > 0)
         config.setDecorator(annotation.decorator());
      config.setInitParams(toInitParams(annotation.initParams()));

      EventConfig[] eventAnnotations = annotation.events();
      ArrayList<Event> events = new ArrayList<Event>();
      for (EventConfig eventAnnotation : eventAnnotations)
      {
         events.add(toEventConfig(eventAnnotation));
      }
      config.setEvents(events);

      EventInterceptorConfig[] eventInterceptorAnnotations = annotation.eventInterceptors();
      ArrayList<EventInterceptor> eventInterceptors = new ArrayList<EventInterceptor>();
      for (EventInterceptorConfig eventAnnotation : eventInterceptorAnnotations)
      {
         eventInterceptors.add(toEventInterceptorConfig(eventAnnotation));
      }
      config.setEventInterceptors(eventInterceptors);

      ValidatorConfig[] validatorAnnotations = annotation.validators();
      ArrayList<Validator> validators = new ArrayList<Validator>();
      for (ValidatorConfig ele : validatorAnnotations)
      {
         validators.add(toValidator(ele));
      }
      config.setValidators(validators);

      return config;
   }
View Full Code Here

            listener.execute(event);
    }

    public <T extends UIComponent> T createUIComponent(Class<T> type, String configId, String id, WebuiRequestContext context)
            throws Exception {
        Component config = configManager_.getComponentConfig(type, configId);
        if (config == null) {
            throw new Exception("Cannot find the configuration for the component " + type.getName() + ", configId " + configId);
        }
        T uicomponent = Util.createObject(type, config.getInitParams());
        uicomponent.setComponentConfig(id, config);
        return uicomponent;
    }
View Full Code Here

            for (ComponentMetaData componentMetaData : config.getComponents()) {
                String key = componentMetaData.getType();
                if (componentMetaData.getId() != null) {
                    key = key + ":" + componentMetaData.getId();
                }
                configs_.put(key, new Component(componentMetaData));
            }
        }

        application_ = config.getApplication();
    }
View Full Code Here

        }
        return configs;
    }

    public Component getComponentConfig(ComponentHandle handle) {
        Component component = configs_.get(handle.getKey());

        //
        if (component == null) {
            Class<?> owner = handle.getOwner();
            process(owner);
View Full Code Here

        if (id != null) {
            key = key + ":" + id;
        }

        //
        Component config = configs_.get(key);
        if (config != null) {
            return config;
        }

        //
View Full Code Here

        } else {
            validators = new ArrayList<Validator>();
        }

        //
        return new Component(clazz, id, type.getName(), lifecycle, template, decorator, toInitParams(annotation.initParams()),
                validators, events, eventInterceptors);
    }
View Full Code Here

   }

   public <T extends UIComponent> T createUIComponent(Class<T> type, String configId, String id,
      WebuiRequestContext context) throws Exception
   {
      Component config = configManager_.getComponentConfig(type, configId);
      if (config == null)
      {
         throw new Exception("Cannot find the configuration for the component " + type.getName() + ", configId "
            + configId);
      }
      T uicomponent = Util.createObject(type, config.getInitParams());
      uicomponent.setComponentConfig(id, config);
      return uicomponent;
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.webui.config.Component

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.