public void doAfterCompose(Component EditSalaryHeadWindow) throws Exception {
    super.doAfterCompose(EditSalaryHeadWindow);

    GenericDelegator delegator =
        HrmsInfrastructure.getDelegator(); // GenericDelegator.getGenericDelegator("default");
    /*
     * EntityCondition condition = EntityCondition.makeCondition("enumTypeId",
     * EntityOperator.EQUALS, "CLAIM_TYPE");
     */
    EntityCondition currencyCondition =
        EntityCondition.makeCondition("uomTypeId", EntityOperator.EQUALS, "CURRENCY_MEASURE");

    Set<String> SalaryHeadTypeToDisplay = new HashSet();
    Set<String> currencyTypeToDisplay = new HashSet();
    Set<String> SalaryComputationTypeToDisplay = new HashSet();

    SalaryHeadTypeToDisplay.add("salaryHeadTypeId");
    SalaryHeadTypeToDisplay.add("description");

    currencyTypeToDisplay.add("uomId");
    currencyTypeToDisplay.add("description");

    SalaryComputationTypeToDisplay.add("salaryComputationTypeId");
    SalaryComputationTypeToDisplay.add("description");
    // =====================SalaryHeadType==============================
    List<GenericValue> salaryHeadType =
        delegator.findList("SalaryHeadType", null, SalaryHeadTypeToDisplay, null, null, false);
    salaryHeadType.add(0, null);
    SimpleListModel salaryHeadTypeList = new SimpleListModel(salaryHeadType);

    Listbox applySalaryHeadType = (Listbox) EditSalaryHeadWindow.getFellow("applySalaryHeadType");
    applySalaryHeadType.setModel(salaryHeadTypeList);
    applySalaryHeadType.setItemRenderer(new SalaryHeadTypeRenderer());
    // =====================UOM===CURRENCY==============================
    List<GenericValue> currency =
        delegator.findList("Uom", currencyCondition, currencyTypeToDisplay, null, null, false);
    currency.add(0, null);
    SimpleListModel currencyList = new SimpleListModel(currency);

    Listbox currencyListBox = (Listbox) EditSalaryHeadWindow.getFellow("applyCurrencyUomId");
    currencyListBox.setModel(currencyList);
    currencyListBox.setItemRenderer(new CurrencyRenderer());
    // =====================SalaryComputationType==============================
    List<GenericValue> SalaryComputationType =
        delegator.findList(
            "SalaryComputationType", null, SalaryComputationTypeToDisplay, null, null, false);
    SalaryComputationType.add(0, null);
    SimpleListModel SalaryComputationTypeList = new SimpleListModel(SalaryComputationType);

    Listbox SalaryComputationTypeListBox =
        (Listbox) EditSalaryHeadWindow.getFellow("applyComputationType");
    SalaryComputationTypeListBox.setModel(SalaryComputationTypeList);
    SalaryComputationTypeListBox.setItemRenderer(new SalaryComputationTypeRenderer());
    // ========================================================================
  }
    @Override
    public void doAfterCompose(org.zkoss.zk.ui.Component comp) {
        planner = (Planner) comp;
        String zoomLevelParameter = null;
        if ((parameters != null) && (parameters.get("zoom") != null)
                && !(parameters.isEmpty())) {
            zoomLevelParameter = parameters.get("zoom")[0];
        }
        if (zoomLevelParameter != null) {
            planner.setInitialZoomLevel(ZoomLevel
                    .getFromString(zoomLevelParameter));
        }
        planner.setAreContainersExpandedByDefault(Planner
                .guessContainersExpandedByDefault(parameters));

        initializeListboxProgressTypes();

        planner.setAreShownAdvancesByDefault(Planner
                .guessShowAdvancesByDefault(parameters));

        planner.setAreShownReportedHoursByDefault(Planner
                .guessShowReportedHoursByDefault(parameters));
        planner.setAreShownMoneyCostBarByDefault(Planner
                .guessShowMoneyCostBarByDefault(parameters));

        orderFilter = (Vbox) planner.getFellow("orderFilter");
        // Configuration of the order filter
        Component filterComponent = Executions.createComponents(
                "/orders/_orderFilter.zul", orderFilter,
                new HashMap<String, String>());
        filterComponent.setVariable("orderFilterController", this, true);
        filterStartDate = (Datebox) filterComponent
                .getFellow("filterStartDate");
        filterFinishDate = (Datebox) filterComponent
                .getFellow("filterFinishDate");
        bdFilters = (BandboxMultipleSearch) filterComponent
                .getFellow("bdFilters");
        bdFilters.setFinder("taskGroupsMultipleFiltersFinder");
        loadPredefinedBandboxFilter();

        checkIncludeOrderElements = (Checkbox) filterComponent
                .getFellow("checkIncludeOrderElements");
        filterComponent.setVisible(true);
        checkCreationPermissions();

    }
 public Datebox getDateboxFecha(
     String pcodigo_historia, String tipo_examen, String codigo_examen) {
   Datebox datebox_fecha = null;
   if (contenedor.hasFellow(
       "datebox_fecha_" + tipo_examen + "_" + pcodigo_historia + "_" + codigo_examen)) {
     datebox_fecha =
         (Datebox)
             contenedor.getFellow(
                 "datebox_fecha_" + tipo_examen + "_" + pcodigo_historia + "_" + codigo_examen);
   }
   return datebox_fecha;
 }
 public Textbox getTextboxFecha(
     String pcodigo_historia, String tipo_examen, String codigo_examen) {
   Textbox textbox_fecha = null;
   if (contenedor.hasFellow(
       "datebox_fecha_" + tipo_examen + "_" + pcodigo_historia + "_" + codigo_examen)) {
     textbox_fecha =
         (Textbox)
             contenedor.getFellow(
                 "textbox_resultado_"
                     + tipo_examen
                     + "_"
                     + pcodigo_historia
                     + "_"
                     + codigo_examen);
   }
   return textbox_fecha;
 }
 public void onEvent(Event event) {
   try {
     GenericValue userLogin =
         (GenericValue)
             Executions.getCurrent().getDesktop().getSession().getAttribute("userLogin");
     Component EditSalaryHeadWindow = event.getTarget();
     GenericDelegator delegator = (GenericDelegator) userLogin.getDelegator();
     String hrName = ((Textbox) EditSalaryHeadWindow.getFellow("applyHrName")).getValue();
     String geoId =
         (String)
             ((com.ndz.zkoss.CountryBox) EditSalaryHeadWindow.getFellow("countrybandbox"))
                 .getSelectedItem()
                 .getValue();
     Listitem isCreditInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyCredit")).getSelectedItem();
     String isCredit = (String) isCreditInput.getValue();
     Listitem salaryHeadTypeInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applySalaryHeadType")).getSelectedItem();
     String salaryHeadType = (String) salaryHeadTypeInput.getValue();
     Listitem isTaxableInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyTaxable")).getSelectedItem();
     String isTaxable = (String) isTaxableInput.getValue();
     Listitem isMandatoryInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyMandatory")).getSelectedItem();
     String isMandatory = (String) isMandatoryInput.getValue();
     Listitem currencyUomIdInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyCurrencyUomId")).getSelectedItem();
     String currencyUomId = (String) currencyUomIdInput.getValue();
     Listitem salaryComputationTypeIdInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyComputationType")).getSelectedItem();
     String salaryComputationTypeId = (String) salaryComputationTypeIdInput.getValue();
     Map<String, Object> context =
         UtilMisc.toMap(
             "salaryHeadId",
             delegator.getNextSeqId("salaryHeadId"),
             "hrName",
             hrName,
             "isCr",
             isCredit,
             "salaryHeadTypeId",
             salaryHeadType,
             "isTaxable",
             isTaxable,
             "isMandatory",
             isMandatory,
             "geoId",
             geoId,
             "currencyUomId",
             currencyUomId,
             "salaryComputationTypeId",
             salaryComputationTypeId);
     delegator.create(delegator.makeValue("SalaryHead", context));
     Component searchPanelComponent = EditSalaryHeadWindow.getPage().getFellowIfAny("searchPanel");
     if (searchPanelComponent != null)
       Events.postEvent("onClick$searchButton", searchPanelComponent, null);
     Messagebox.show("Created successfully", "Success", 1, null);
     EditSalaryHeadWindow.detach();
   } catch (Exception e) {
     try {
       Messagebox.show("Created unsuccessfully", "Error", 1, null);
     } catch (Exception e1) {
       e1.printStackTrace();
     }
     e.printStackTrace();
   }
 }
  public static void EditSalaryHead(Event event) {

    System.out.println("****************SubmitClaim Event Called*********");
    try {
      Component salaryHeadWindow = event.getTarget();
      GenericValue userLogin =
          (GenericValue)
              Executions.getCurrent().getDesktop().getSession().getAttribute("userLogin");
      GenericDelegator delegator =
          HrmsInfrastructure.getDelegator(); // GenericDelegator.getGenericDelegator("default");
      LocalDispatcher dispatcher =
          HrmsInfrastructure
              .getDispatcher(); // GenericDispatcher.getLocalDispatcher("default", delegator);
      Map submitUpdate = null;
      String salaryHeadId =
          (String) ((Textbox) salaryHeadWindow.getFellow("salaryHeadId")).getValue();

      String hrName = (String) ((Textbox) salaryHeadWindow.getFellow("applyHrName")).getValue();

      Listitem isCrListItem =
          (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyCredit")).getSelectedItem();
      String isCr = (String) isCrListItem.getValue();

      Listitem salaryHeadTypeIdListItem =
          (Listitem)
              ((Listbox) salaryHeadWindow.getFellow("applySalaryHeadType")).getSelectedItem();
      String salaryHeadTypeId = (String) salaryHeadTypeIdListItem.getValue();

      /*
       * String geoId = (String) ((Bandbox) salaryHeadWindow
       * .getFellow("searchPanel")).getValue();
       */
      Combobox countryBox = ((Combobox) salaryHeadWindow.getFellow("countrybandbox"));
      String geoId =
          (String)
              (countryBox.getSelectedItem() == null
                  ? countryBox.getValue()
                  : countryBox.getSelectedItem().getValue());

      Listitem isTaxableListItem =
          (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyTaxable")).getSelectedItem();
      String isTaxable = (String) isTaxableListItem.getValue();

      Listitem isMandatoryListItem =
          (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyMandatory")).getSelectedItem();
      String isMandatory = (String) isMandatoryListItem.getValue();

      Listitem currencyUomIdListItem =
          (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyCurrencyUomId")).getSelectedItem();
      String currencyUomId = (String) currencyUomIdListItem.getValue();

      Listitem salaryComputationTypeIdListItem =
          (Listitem)
              ((Listbox) salaryHeadWindow.getFellow("applyComputationType")).getSelectedItem();
      String salaryComputationTypeId = (String) salaryComputationTypeIdListItem.getValue();

      submitUpdate =
          UtilMisc.toMap(
              "userLogin",
              userLogin,
              "salaryHeadId",
              salaryHeadId,
              "hrName",
              hrName,
              "isCr",
              isCr,
              "salaryHeadTypeId",
              salaryHeadTypeId,
              "geoId",
              geoId,
              "isTaxable",
              isTaxable,
              "isMandatory",
              isMandatory,
              "currencyUomId",
              currencyUomId,
              "salaryComputationTypeId",
              salaryComputationTypeId);

      Map<String, Object> result = dispatcher.runSync("updateSalaryHead", submitUpdate);

      Messagebox messageBox = new Messagebox();
      String err = "";
      err = (String) result.get("responseMessage");
      if (err != null && err.equals("error"))
        messageBox.show((String) result.get("errorMessage"), "Error", 1, null);
      else
        messageBox.show(
            "Salary Head" + " " + hrName + " " + "Successfully Updated", "Success", 1, null);

      Events.postEvent(
          "onClick$searchButton", salaryHeadWindow.getPage().getFellow("searchPanel"), null);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 7
0
  @SuppressWarnings("serial")
  protected Component doCreatePart(Component parent) {
    PageDefinition pagedef =
        Executions.getCurrent()
            .getPageDefinition(ThemeManager.getThemeResource("zul/desktop/desktop.zul"));
    Component page = Executions.createComponents(pagedef, parent, null);
    layout = (Borderlayout) page.getFellow("layout");
    headerContainer = page.getFellow("northBody");
    pnlHead = (HeaderPanel) headerContainer.getFellow("header");

    layout.addEventListener("onZoom", this);
    layout.addEventListener(DrillEvent.ON_DRILL_DOWN, this);

    West w = layout.getWest();
    w.addEventListener(
        Events.ON_OPEN,
        new EventListener<Event>() {
          @Override
          public void onEvent(Event event) throws Exception {
            OpenEvent oe = (OpenEvent) event;
            updateMenuCollapsedPreference(!oe.isOpen());
          }
        });
    w.addEventListener(
        Events.ON_SWIPE,
        new EventListener<SwipeEvent>() {

          @Override
          public void onEvent(SwipeEvent event) throws Exception {
            if ("left".equals(event.getSwipeDirection())) {
              West w = (West) event.getTarget();
              if (w.isOpen()) {
                w.setOpen(false);
                updateMenuCollapsedPreference(true);
              }
            }
          }
        });

    w.addEventListener(
        Events.ON_SIZE,
        new EventListener<Event>() {

          @Override
          public void onEvent(Event event) throws Exception {
            West west = (West) event.getTarget();
            updateSideControllerWidthPreference(west.getWidth());
          }
        });

    UserPreference pref = SessionManager.getSessionApplication().getUserPreference();
    boolean menuCollapsed = pref.isPropertyBool(UserPreference.P_MENU_COLLAPSED);
    w.setOpen(!menuCollapsed);

    East e = layout.getEast();
    e.addEventListener(
        Events.ON_OPEN,
        new EventListener<Event>() {
          @Override
          public void onEvent(Event event) throws Exception {
            OpenEvent oe = (OpenEvent) event;
            updateHelpCollapsedPreference(!oe.isOpen());
            HtmlBasedComponent comp = windowContainer.getComponent();
            if (comp != null) {
              contextHelp.setVisible(!oe.isOpen());
              if (!oe.isOpen()) layout.getEast().setVisible(false);
            }
          }
        });

    e.addEventListener(
        Events.ON_SWIPE,
        new EventListener<SwipeEvent>() {

          @Override
          public void onEvent(SwipeEvent event) throws Exception {
            if ("right".equals(event.getSwipeDirection())) {
              East e = (East) event.getTarget();
              if (e.isOpen()) {
                e.setOpen(false);
                updateHelpCollapsedPreference(true);
              }
            }
          }
        });

    e.addEventListener(
        Events.ON_SIZE,
        new EventListener<Event>() {

          @Override
          public void onEvent(Event event) throws Exception {
            East east = (East) event.getTarget();
            updateHelpWidthPreference(east.getWidth());
          }
        });

    String westWidth = getWestWidthPreference();
    String eastWidth = getEastWidthPreference();

    // Set preference width
    if (westWidth != null || eastWidth != null) {

      // If both panels have prefered size check that the sum is not bigger than the browser
      if (westWidth != null && eastWidth != null) {
        ClientInfo browserInfo = getClientInfo();
        int browserWidth = browserInfo.desktopWidth;
        int wWidth = Integer.valueOf(westWidth.replace("px", ""));
        int eWidth = Integer.valueOf(eastWidth.replace("px", ""));

        if (eWidth + wWidth <= browserWidth) {
          w.setWidth(westWidth);
          e.setWidth(eastWidth);
        }

      } else if (westWidth != null) w.setWidth(westWidth);
      else if (eastWidth != null) e.setWidth(eastWidth);
    }

    boolean helpCollapsed = pref.isPropertyBool(UserPreference.P_HELP_COLLAPSED);
    e.setVisible(!helpCollapsed);

    helpController.render(e, this);

    Center windowArea = layout.getCenter();

    windowContainer.createPart(windowArea);

    homeTab = new Tabpanel();
    windowContainer.addWindow(
        homeTab, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Home")), false, null);
    homeTab.getLinkedTab().setSclass("desktop-hometab");
    homeTab.setSclass("desktop-home-tabpanel");
    BusyDialog busyDialog = new BusyDialog();
    busyDialog.setShadow(false);
    homeTab.appendChild(busyDialog);

    // register as 0
    registerWindow(homeTab);

    BroadcastMessageWindow messageWindow = new BroadcastMessageWindow(pnlHead);
    BroadcastMsgUtil.showPendingMessage(Env.getAD_User_ID(Env.getCtx()), messageWindow);

    if (!layout.getDesktop().isServerPushEnabled()) {
      layout.getDesktop().enableServerPush(true);
    }

    Runnable runnable =
        new Runnable() {
          public void run() {
            try {
              Thread.sleep(100);
            } catch (InterruptedException e) {
            }

            IServerPushCallback callback =
                new IServerPushCallback() {
                  public void updateUI() {
                    Properties ctx =
                        (Properties)
                            layout
                                .getDesktop()
                                .getSession()
                                .getAttribute(SessionContextListener.SESSION_CTX);
                    try {
                      ServerContext.setCurrentInstance(ctx);
                      renderHomeTab();
                    } finally {
                      ServerContext.dispose();
                    }
                  }
                };
            ServerPushTemplate template = new ServerPushTemplate(layout.getDesktop());
            template.executeAsync(callback);
          }
        };

    Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(runnable, layout.getDesktop()));

    ToolBar toolbar = new ToolBar();
    windowContainer.getComponent().appendChild(toolbar);

    showHeader =
        new ToolBarButton() {
          @Override
          public void onPageDetached(Page page) {
            super.onPageDetached(page);
            if (DefaultDesktop.this.headerPopup != null) {
              DefaultDesktop.this.headerPopup.setPage(null);
            }
          }
        };
    toolbar.appendChild(showHeader);
    showHeader.setImage(ThemeManager.getThemeResource(IMAGES_THREELINE_MENU_PNG));
    showHeader.addEventListener(Events.ON_CLICK, this);
    showHeader.setSclass("window-container-toolbar-btn");
    showHeader.setStyle("cursor: pointer; border: 1px solid transparent; padding: 2px;");
    showHeader.setVisible(false);

    max = new ToolBarButton();
    toolbar.appendChild(max);
    max.setImage(ThemeManager.getThemeResource(IMAGES_UPARROW_PNG));
    max.addEventListener(Events.ON_CLICK, this);
    max.setSclass("window-container-toolbar-btn");
    max.setStyle("cursor: pointer; border: 1px solid transparent; padding: 2px;");

    contextHelp = new ToolBarButton();
    toolbar.appendChild(contextHelp);
    contextHelp.setImage(ThemeManager.getThemeResource(IMAGES_CONTEXT_HELP_PNG));
    contextHelp.addEventListener(Events.ON_CLICK, this);
    contextHelp.setSclass("window-container-toolbar-btn context-help-btn");
    contextHelp.setStyle("cursor: pointer; border: 1px solid transparent; padding: 2px;");
    contextHelp.setTooltiptext(Util.cleanAmp(Msg.getElement(Env.getCtx(), "AD_CtxHelp_ID")));
    contextHelp.setVisible(!e.isVisible());

    boolean headerCollapsed = pref.isPropertyBool(UserPreference.P_HEADER_COLLAPSED);
    if (headerCollapsed) {
      collapseHeader();
    }

    return layout;
  }
Esempio n. 8
0
  public void loginOk(boolean bootstrap) throws Exception {

    LoginUsuario lu = new LoginUsuario();
    LoginUsuarioDTO uDto = lu.log(this.user, this.pass);

    this.setAtributoSession(Config.LOGEADO, uDto.isLogeado());
    this.setAtributoSession(Config.USUARIO, uDto);

    this.setUs(uDto);
    this.poneCarita(uDto.isLogeado());

    Component compTool = Path.getComponent("/templateInicio");
    Control vm = (Control) compTool.getAttribute("vm");
    vm.setUs(uDto);

    if (uDto.isLogeado() == true) {

      // registrar el login
      this.registrarLogin();

      try {
        // recupero el control de esta sesion y lo pongo a escuchar
        // eventos para este login

        ControlInicio miCi = (ControlInicio) this.getAtributoSession(Config.MI_ALERTAS);

        EventQueues.lookup(this.getLoginNombre(), EventQueues.APPLICATION, true)
            .subscribe(new AlertaEvento(miCi));

        // ================

        this.m.ejecutarMetoto(Config.INIT_CLASE, Config.INIT_AFTER_LOGIN);
      } catch (Exception e) {
        e.printStackTrace();
        uDto.setLogeado(false);
        System.out.println(
            "Error: Metodo afterLogin\n "
                + "   InitClase:"
                + Config.INIT_CLASE
                + "\n    metodo:"
                + Config.INIT_AFTER_LOGIN);
        this.msg = "Configuración incorrecta";
        Clients.evalJavaScript("loginFaild()");
        return;
      }

      Include inc = (Include) compTool.getFellow("menu");
      inc.invalidate(); // esto hace un refresh del menu

      if (this.isSiPiePagina() == true) {
        Include incS = (Include) compTool.getFellow("menuSistema");
        incS.invalidate(); // esto hace un refresh del menu
      }

      Object menuBar = inc.getFellow("menubar");
      habilitarDeshabilitarMenuBar(menuBar);

      BindUtils.postGlobalCommand(null, null, "habilitarMenu", null);

      this.setTextoFormularioCorriente(" ");
      this.saltoDePagina(bootstrap ? Archivo.okLoginBootstrap : Archivo.okLogin);

    } else {
      this.msg = "Usuario o clave incorrecta";
      Clients.evalJavaScript("loginFaild()");
    }
  }