@Override
  @SuppressWarnings("unchecked")
  public void doAfterCompose(final org.zkoss.zk.ui.Component comp) throws Exception {
    super.doAfterCompose(comp);
    comp.setAttribute("ctl", this, Component.SPACE_SCOPE);

    // save masterController
    masterController = (DLListboxExtController) arg.get("master");

    // save model, which is setted in the main model
    final NormalFilterModel modelFilter =
        (NormalFilterModel) arg.get(DLNormalFilterKeys.FILTERS.toString());

    // load informations about columns and data types
    modelTemplates = (NormalFilterModel) arg.get(DLNormalFilterKeys.TEMPLATES.toString());

    // sort by column labels
    java.util.Collections.sort(
        modelTemplates,
        new java.util.Comparator<NormalFilterUnitModel>() {

          public int compare(final NormalFilterUnitModel unit1, final NormalFilterUnitModel unit2) {
            return unit1.getLabel().compareTo(unit2.getLabel());
          }
        });

    for (NormalFilterUnitModel unit : modelFilter) {

      // if column was added manally, template might not be set - enforce template
      if (unit.getTemplate() == null)
        unit.setTemplate(modelTemplates.findUnitModelByColumnName(unit.getColumn()));

      rows.add(new RowModel(unit));
    }
  }
 @Override
 public void doAfterCompose(Component comp) throws Exception {
   super.doAfterCompose(comp);
   comp.setAttribute("controller", this);
   Map<String, SessionInfo> args = Executions.getCurrent().getArg();
   SessionInfo _ses = args.get(Param.SESSION);
   sessionManager = SessionInfoManagerFactory.getInstance().getSession(_ses.getId());
   this.sessionInfo = sessionManager.getSessionInfo();
   selectedPhysicians = sessionInfo.getAlternateTreatmentProviders();
 }
  @Override
  public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);

    lb_user_org_list.setItemRenderer(new UserOrganizationSearchListitemRenderer());
    manageButtons();
    btn_back.setHref(globalUtils.getGlobalPropValue(Commons.URL_SECURITY_ADMIN));
    comp.setAttribute(comp.getId() + "Control", this, true);
    binder = new AnnotateDataBinder(comp);
    binder.loadAll();
  }
Ejemplo n.º 4
0
  /*package*/ void registerLoadEvents(Component comp) {
    if (isLoadable()) { // bug 1804356
      if (_loadWhenEvents != null) {
        for (String expr : _loadWhenEvents) {
          final Object[] objs = ComponentsCtrl.parseEventExpression(comp, expr, comp, false);
          // objs[0] component, objs[1] event name
          final Component target = (Component) objs[0];
          final String evtname = (String) objs[1];
          if (target == null) {
            throw new NullPointerException("component not found , expr is " + expr);
          }
          LoadEventListener listener =
              (LoadEventListener) target.getAttribute("zk.LoadEventListener." + evtname);
          if (listener == null) {
            listener = new LoadEventListener();
            target.setAttribute("zk.LoadEventListener." + evtname, listener);
            target.addEventListener(1000, evtname, listener);
          }
          listener.addDataTarget(this, comp);
        }
      }
      if (_loadAfterEvents != null) {
        for (String expr : _loadAfterEvents) {
          final Object[] objs = ComponentsCtrl.parseEventExpression(comp, expr, comp, false);
          // objs[0] component, objs[1] event name
          final Component target = (Component) objs[0];
          final String evtname = (String) objs[1];

          LoadAfterEventListener listener =
              (LoadAfterEventListener) target.getAttribute("zk.LoadAfterEventListener." + evtname);
          if (listener == null) {
            listener = new LoadAfterEventListener();
            target.setAttribute("zk.LoadAfterEventListener." + evtname, listener);
            target.addEventListener(evtname, listener);
            target.addEventListener(evtname + "LoadAfter", listener);
          }
          listener.addDataTarget(this, comp);
        }
      }
    }
  }
Ejemplo n.º 5
0
  /*package*/ void registerSaveEvents(Component comp) {
    if (isSavable()) { // bug 1804356
      if (_saveWhenEvents != null) {
        for (String expr : _saveWhenEvents) {
          final Object[] objs = ComponentsCtrl.parseEventExpression(comp, expr, comp, false);
          // objs[0] component, objs[1] event name
          final Component target = (Component) objs[0];
          final String evtname = (String) objs[1];

          SaveEventListener listener =
              (SaveEventListener) target.getAttribute("zk.SaveEventListener." + evtname);
          if (listener == null) {
            listener = new SaveEventListener();
            target.setAttribute("zk.SaveEventListener." + evtname, listener);
            target.addEventListener(1000, evtname, listener);
          }
          listener.addDataTarget(this, comp);
        }
      }
      if (_saveAfterEvents != null) {
        for (final Iterator it = _saveAfterEvents.iterator(); it.hasNext(); ) {
          final String expr = (String) it.next();
          final Object[] objs = ComponentsCtrl.parseEventExpression(comp, expr, comp, false);
          // objs[0] component, objs[1] event name
          final Component target = (Component) objs[0];
          final String evtname = (String) objs[1];

          SaveAfterEventListener listener =
              (SaveAfterEventListener) target.getAttribute("zk.SaveAfterEventListener." + evtname);
          if (listener == null) {
            listener = new SaveAfterEventListener();
            target.setAttribute("zk.SaveAfterEventListener." + evtname, listener);
            target.addEventListener(evtname, listener);
            target.addEventListener(evtname + "SaveAfter", listener);
          }
          listener.addDataTarget(this, comp);
        }
      }
    }
  }
 @Override
 public void doAfterCompose(Component comp) throws Exception {
   super.doAfterCompose(comp);
   comp.setAttribute(comp.getId() + "Ctrl", this, true);
   newCustomerRadio.addEventListener(
       Events.ON_SELECT,
       new EventListener<Event>() {
         @Override
         public void onEvent(Event arg0) throws Exception {
           newCustomerRadio.setSelected(false);
         }
       });
 }
Ejemplo n.º 7
0
  private Component getEmergente(String nombre, Map<String, Object> param) throws Exception {
    log.info("Ejecutando m�todo [ getEmergente().. ]");
    log.debug("nombre ==>" + nombre);
    log.debug("param ==>" + param);

    AATEjecutable detalle = Utilidades.obtenerDetalle(nombre);
    Component component =
        Executions.createComponentsDirectly(detalle.getFuente(), null, null, param);
    if (component instanceof Window) {
      // AGREGAMOS EL TITULO DE LAS NOTIFICACIONES COMO UN ATRIBUTO
      component.setAttribute("TITULO_NOTIFICACIONES_GRITTER", ((Window) component).getTitle());
    }

    return component;
  }
Ejemplo n.º 8
0
  /**
   * @type m�todo de la clase ActionStandardBorder.java
   * @name generarReporte
   * @param idMapper representa el identificador del DTO en el mapa de reportes disponibles
   * @param titulo representa el titulo del reporte en la plantilla definida.
   * @param subtitulo representa el subtitulo del reporte en la plantilla definida.
   * @param list debido los reportes pueden ser generados a partir de una lista de objetos ya
   *     cargados en memoria es decir no hay que ejecutar una consulta SQL a la base de datos, este
   *     par��metro representa esa lista de objetos los cuales son procesados internamente por el
   *     ReportBuilder que es el encargado de la generaci��n de reportes.
   * @param componente especifica el nombre del componente o m��dulo al cual pertenece la entidad
   *     (DTO) del reporte a generar
   * @throws Exception Cualquier Excepcion
   * @desc Eencapsula la funcionalidad de generaci��n din��mica de reportes para tablas b��sicas.
   *     Debe ser invocado en cada uno de los action que necesiten tener esta opci��n
   */
  public void generarReporte(String idMapper, String fuente, String modulo, Component component)
      throws Exception {
    log.info("Ejecutando m�todo [generarReporte]...");

    Map<String, Object> parametros = new HashMap<String, Object>();
    parametros.put("id", idMapper);
    parametros.put("fuente", fuente);
    parametros.put("modulo", modulo);
    parametros.put("SEC_EJECUTABLE_PADRE", component.getAttribute("SEC_EJECUTABLE"));

    Component emergente = getEmergente("SRZ_REPORTE", parametros);
    if (emergente instanceof Window) {
      Window win = (Window) emergente;
      win.setClosable(true);
      emergente.setAttribute("TITULO_NOTIFICACIONES_GRITTER", ((Window) emergente).getTitle());
      win.doModal();
    }
  }
Ejemplo n.º 9
0
 public void doAfterCompose(Component comp) throws Exception {
     super.doAfterCompose(comp);
     comp.setAttribute("projectImportController", this);
     messages = new MessagesForUser(messagesContainer);
 }
Ejemplo n.º 10
0
  private void myLoadAttribute(Component comp, Object bean) {
    try {
      // since 3.1, 20080416, support bindingArgs for non-supported tag
      // bug #2803575, merge bindingArgs together since a component can have
      // multiple bindings on different attributes.
      Map<Object, Object> bindArgs = cast((Map) comp.getAttribute(DataBinder.ARGS));
      if (bindArgs == null) {
        bindArgs = new HashMap<Object, Object>();
        comp.setAttribute(DataBinder.ARGS, bindArgs);
      }
      if (_args != null) {
        bindArgs.putAll(_args);
        comp.setAttribute(_attr + "_" + DataBinder.ARGS, _args);
      }

      if (_converter != null) {
        bean = _converter.coerceToUi(bean, comp);
        if (bean == TypeConverter.IGNORE) return; // ignore, so don't do Fields.set()
      }

      // Bug #1876198 Error msg appears when load page (databind+CustomConstraint)
      // catching WrongValueException no longer works, check special case and
      // use setRowValue() method directly
      if ((comp instanceof InputElement) && "value".equals(_attr)) {
        Object value = bean;
        Object oldv = null;
        try { // Bug 1879389
          final Method m = comp.getClass().getMethod("getValue");
          oldv = ((InputElement) comp).getRawValue();
          value = Classes.coerce(m.getReturnType(), bean);
        } catch (NoSuchMethodException ex) { // ignore it
        }

        // See both Bug 3000305 and 2874098
        Fields.set(comp, "rawValue", value, _converter == null);
      } else {
        Fields.set(comp, _attr, bean, _converter == null);
      }
    } catch (ClassCastException ex) {
      throw UiException.Aide.wrap(ex);
    } catch (NoSuchMethodException ex) {
      // Bug #1813278, Annotations do not work with xhtml tags
      if (comp instanceof DynamicPropertied) {
        final DynamicPropertied dpcomp = (DynamicPropertied) comp;
        if (dpcomp.hasDynamicProperty(_attr)) {
          // no way to know destination type of the property, use bean as is
          dpcomp.setDynamicProperty(_attr, bean);
        } else {
          throw UiException.Aide.wrap(ex);
        }
      } else { // Feature# 2855116. Save into component custom-attribute(also a variable in ZK5).
        comp.setAttribute(_attr, bean);
      }

      // Bug #1876198 Error msg appears when load page (databind+CustomConstraint)
      // catching WrongValueException no longer works, so mark it out
      /*} catch (WrongValueException ex) {
      	//Bug #1615371, try to use setRawValue()
      	if ("value".equals(_attr)) {
      		try {
      			Fields.set(comp, "rawValue", bean, _converter == null);
      		} catch (Exception ex1) {
      			//exception
      			throw ex;
      		}
      	} else {
      		throw ex;
      	}
      */
    }
  }