/** Get the editor component for the specified data displayer. */
 public DataDisplayerEditor getEditor(DataDisplayer target) {
   DataDisplayerType type = target.getDataDisplayerType();
   String beanName = type.getUid() + "_editor";
   DataDisplayerEditor editor = (DataDisplayerEditor) CDIBeanLocator.getBeanByName(beanName);
   editor.setDataDisplayer(target);
   return editor;
 }
 protected PanelInstanceNode getNewInstanceNode(PanelInstance instance) {
   PanelInstanceNode instanceNode = CDIBeanLocator.getBeanByType(PanelInstanceNode.class);
   instanceNode.setWorkspaceId(instance.getWorkspace().getId());
   instanceNode.setPanelInstanceId(instance.getInstanceId());
   instanceNode.setParent(this);
   instanceNode.setTree(getTree());
   return instanceNode;
 }
 /** Get the viewer component for the specified data displayer. */
 public DataDisplayerViewer getViewer(DataDisplayer target) {
   DataDisplayerType type = target.getDataDisplayerType();
   DataDisplayerRenderer lib = target.getDataDisplayerRenderer();
   String beanName = lib.getUid() + "_" + type.getUid() + "_viewer";
   DataDisplayerViewer viewer = (DataDisplayerViewer) CDIBeanLocator.getBeanByName(beanName);
   viewer.setDataDisplayer(target);
   return viewer;
 }
 protected PanelInstancesGroupNode getNewGroupNode(String workspaceId, String groupName) {
   PanelInstancesGroupNode groupNode = CDIBeanLocator.getBeanByType(PanelInstancesGroupNode.class);
   groupNode.setWorkspaceId(workspaceId);
   groupNode.setGroupName(groupName);
   groupNode.setParent(this);
   groupNode.setTree(getTree());
   groupNode.setProviderId(providerId);
   return groupNode;
 }
  /**
   * Get a permanent link to a given action on a bean
   *
   * @param bean Bean handler that will perform the action
   * @param action Bean's method that will be invoked
   * @param params Extra parameters for link
   * @return A link url to a bean action, independent on the page.
   */
  public String getPermanentLink(String bean, String action, Map params) {
    try {
      BeanHandler element = (BeanHandler) CDIBeanLocator.getBeanByNameOrType(bean);
      if (element == null) throw new RuntimeException("Bean '" + bean + "' not found.");

      StringBuffer sb = new StringBuffer();
      String base =
          RequestContext.lookup().getRequest().getRequestObject().getContextPath()
              + "/"
              + COMMAND_RUNNER;
      sb.append(base).append("?");
      params.put(FactoryURL.PARAMETER_BEAN, element.getBeanName());
      params.put(FactoryURL.PARAMETER_ACTION, action);
      sb.append(getParamsMarkup(params));
      element.setEnabledForActionHandling(true);
      return postProcessURL(sb).toString();
    } catch (ClassCastException cce) {
      log.error("Bean " + bean + " is not a BeanHandler.");
      return "#";
    }
  }
  /**
   * Generate a link to a factory component action
   *
   * @param beanName Factory component that will perform the action
   * @param action Bean's property (method) that will be invoked
   * @param params Extra parameters for link
   * @return A link url to a bean action
   */
  public String getMarkup(String beanName, String action, Map params) {
    try {
      if (params == null) params = new HashMap();
      Panel panel = RequestContext.lookup().getActivePanel();
      if (panel != null) {
        params.put(Parameters.DISPATCH_IDPANEL, panel.getPanelId());
        params.put(Parameters.DISPATCH_ACTION, "_factory");
      }

      StringBuffer sb = new StringBuffer();
      sb.append(_getServletMapping()).append("?");
      BeanHandler bean = (BeanHandler) CDIBeanLocator.getBeanByNameOrType(beanName);
      params.put(FactoryURL.PARAMETER_BEAN, bean.getBeanName());
      params.put(FactoryURL.PARAMETER_ACTION, bean.getActionName(action));
      sb.append(getParamsMarkup(params));
      bean.setEnabledForActionHandling(true);
      return postProcessURL(sb).toString();
    } catch (ClassCastException cce) {
      log.error("Bean " + beanName + " is not a BeanHandler.");
      return "#";
    }
  }
 public static AjaxRefreshManager lookup() {
   return CDIBeanLocator.getBeanByType(AjaxRefreshManager.class);
 }
 /** Get the editor component for the specified data provider. */
 public DataProviderEditor getEditor(DataProviderType target) {
   String beanName = target.getUid() + "_editor";
   return (DataProviderEditor) CDIBeanLocator.getBeanByName(beanName);
 }
 public static UIBeanLocator lookup() {
   return (UIBeanLocator) CDIBeanLocator.getBeanByName("UIBeanLocator");
 }
 public static ModalDialogStatusSaver lookup() {
   return CDIBeanLocator.getBeanByType(ModalDialogStatusSaver.class);
 }