예제 #1
0
 /**
  * When the 'about' toolbarButton is clicked.<br>
  *
  * @throws IOException
  * @throws InterruptedException
  */
 public void onClick$btnAbout(Event event) throws IOException, InterruptedException {
   /* get an instance of the borderlayout defined in the zul-file */
   Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
   /* get an instance of the searched CENTER layout area */
   Center center = bl.getCenter();
   Executions.createComponents("/WEB-INF/xhtml/pages/default.zul", null, null);
 }
예제 #2
0
 /**
  * Shows the welcome page in the borderlayouts CENTER area.<br>
  *
  * @throws InterruptedException
  */
 public void showWelcomePage() throws InterruptedException {
   // get an instance of the borderlayout defined in the zul-file
   Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
   // get an instance of the searched CENTER layout area
   Center center = bl.getCenter();
   // clear the center child comps
   center.getChildren().clear();
   // call the zul-file and put it in the center layout area
   Executions.createComponents("/WEB-INF/xhtml/pages/default.zul", center, null);
 }
예제 #3
0
  /**
   * Recalculates the container size for this controller and resize them.
   *
   * <p>Calculate how many rows have been place in the listbox. Get the currentDesktopHeight from a
   * hidden Intbox from the index.zul that are filled by onClientInfo() in the indexCtroller.
   *
   * @throws ParseException
   */
  public void doFitSize() throws ParseException {
    // normally 0 ! Or we have a i.e. a toolBar on top of the listBox.
    final int specialSize = 0;
    final int height =
        ((Intbox) Path.getComponent("/outerIndexWindow/currentDesktopHeight"))
            .getValue()
            .intValue();
    final int maxListBoxHeight = height - specialSize - 119;
    // setCountRows((int) Math.round((maxListBoxHeight) / 17.7));
    this.borderLayout_calendar.setHeight(String.valueOf(maxListBoxHeight) + "px");

    synchronizeModel();
  }
예제 #4
0
 /**
  * When the 'My Settings' toolbarButton is clicked.<br>
  *
  * @throws IOException
  * @throws InterruptedException
  */
 public void onClick$btnTestMain() throws InterruptedException {
   Window win = null;
   Window parentWin = (Window) Path.getComponent("/outerIndexWindow");
   try {
     win =
         (Window) Executions.createComponents("/WEB-INF/xhtml/pages/default.zul", parentWin, null);
   } catch (Exception e) {
     // TODO: handle exception
     e.printStackTrace();
     MensajeMultilinea.show(e.getLocalizedMessage(), Constants.MENSAJE_TIPO_ERROR);
     win.detach();
   }
 }
예제 #5
0
  /**
   * Recalculates the container size for this controller and resize them.
   *
   * <p>Calculate how many rows have been place in the listbox. Get the currentDesktopHeight from a
   * hidden Intbox from the index.zul that are filled by onClientInfo() in the indexCtroller.
   */
  public void doFitSize() {

    // normally 0 ! Or we have a i.e. a toolBar on top of the listBox.
    final int specialSize = 5;

    final int menuOffset = UserWorkspace.getInstance().getMenuOffset();
    int height =
        ((Intbox) Path.getComponent("/outerIndexWindow/currentDesktopHeight"))
            .getValue()
            .intValue();
    height = height - menuOffset;
    final int maxListBoxHeight = height - specialSize - 148;
    setCountRows((int) Math.round(maxListBoxHeight / 17.7));
    borderLayout_branchList.setHeight(String.valueOf(maxListBoxHeight) + "px");

    windowBranchList.invalidate();
  }
예제 #6
0
  /**
   * Changes the view for full width screen mode by collapsing the west borderlayout are, means the
   * menu.
   *
   * @param event
   */
  public void doViewInFullScreen(Event event) {

    final Borderlayout bl =
        ((Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain"));
    final West west = bl.getWest();

    if (west != null) {
      try {
        if (west.isOpen()) {
          west.setOpen(false);
        } else west.setOpen(true);
      } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
      }
    }
  }
예제 #7
0
  /** Creates the MainMenu as TreeMenu as default. <br> */
  private void createMainTreeMenu(Event event) {

    // get an instance of the borderlayout defined in the index.zul-file
    Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");

    // get an instance of the searched west layout area
    West west = bl.getWest();
    west.setFlex(true);
    west.setAutoscroll(true);
    // clear the WEST child comps
    west.getChildren().clear();

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("indexController", this);

    // create the components from the src/main/resources/mainmenu.xml and
    // put it in the WEST layout area
    // Overhand this controller self in a map
    Executions.createComponents("/WEB-INF/xhtml/mainTreeMenu.zul", west, map);
  }
예제 #8
0
  @Override
  public void onEvent(Event event) throws Exception {
    try {
      /* get an instance of the borderlayout defined in the zul-file */
      Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
      /* get an instance of the searched CENTER layout area */
      Center center = bl.getCenter();
      /* clear the center child comps */
      center.getChildren().clear();
      /*
       * create the page and put it in the center layout area
       */
      if (getZulNavigation().contains("?")) {
        String newZul = getZulNavigation().replace("?", ",");
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put(newZul.split(",")[1].split("=")[0], newZul.split(",")[1].split("=")[1]);
        Executions.createComponents(newZul.split(",")[0], center, map);
      } else Executions.createComponents(getZulNavigation(), center, null);

    } catch (Exception e) {
      Messagebox.show(e.toString());
    }
  }
  /**
   * Creates the Timer for the serverPush mechanism. In it we call to different DB methods for
   * showing different result sets.
   */
  private void createServerPushTimer() {

    this.moduleTimer = new Timer();
    // timer doesn't work without a page as parent
    Window win = (Window) Path.getComponent("/outerIndexWindow");
    this.moduleTimer.setPage(win.getPage());

    this.moduleTimer.setDelay(getDelay());
    this.moduleTimer.setRepeats(true);
    this.moduleTimer.addEventListener(
        "onTimer",
        new EventListener() {

          @Override
          public void onEvent(Event event) throws Exception {
            doReadData();
          }
        });

    // start the timer
    if (this.moduleTimer != null) {
      this.moduleTimer.setRunning(true);
    }
  }
예제 #10
0
 public void onClick$newTime() {
   System.out.println("newTime button");
   // wyslij eventa do ContentComposer'a
   Div div1 = (Div) Path.getComponent("//pindex/indexWin/content/div1");
   Events.sendEvent(new Event("onNewTime", div1)); // reload content div1	
 }
예제 #11
0
 public void onClick() {
   Path.getComponent("//zssUserGuide/showRoom/contentArea").invalidate();
 }
예제 #12
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()");
    }
  }
예제 #13
0
  public void onCreate$secLoginlogListWindow(Event event) throws Exception {
    /**
     * Calculate how many rows have been place in the listbox. Get the currentDesktopHeight from a
     * hidden Intbox from the index.zul that are filled by onClientInfo() in the indexCtroller
     */
    final int height =
        ((Intbox) Path.getComponent("/outerIndexWindow/currentDesktopHeight"))
            .getValue()
            .intValue();
    final int maxListBoxHeight = height - 150;
    setCountRows(Math.round(maxListBoxHeight / 17));
    // System.out.println("MaxListBoxHeight : " + maxListBoxHeight);
    // System.out.println("==========> : " + getCountRows());

    this.borderLayout_SecUserlogList.setHeight(String.valueOf(maxListBoxHeight) + "px");

    // init, show all rights
    this.checkbox_SecLoginlogList_ShowAll.setChecked(true);

    // not used listheaders must be declared like ->
    // lh.setSortAscending(""); lh.setSortDescending("")
    this.listheader_SecLoginlogList_lglLogtime.setSortAscending(
        new FieldComparator("lglLogtime", true));
    this.listheader_SecLoginlogList_lglLogtime.setSortDescending(
        new FieldComparator("lglLogtime", false));
    this.listheader_SecLoginlogList_lglLogtime.setSortDirection("descending");
    this.listheader_SecLoginlogList_lglLoginname.setSortAscending(
        new FieldComparator("lglLoginname", true));
    this.listheader_SecLoginlogList_lglLoginname.setSortDescending(
        new FieldComparator("lglLoginname", false));
    this.listheader_SecLoginlogList_lglStatusid.setSortAscending(
        new FieldComparator("lglStatusid", true));
    this.listheader_SecLoginlogList_lglStatusid.setSortDescending(
        new FieldComparator("lglStatusid", false));
    this.listheader_SecLoginlogList_lglIp.setSortAscending(new FieldComparator("lglIp", true));
    this.listheader_SecLoginlogList_lglIp.setSortDescending(new FieldComparator("lglIp", false));
    this.listheader_SecLoginlogList_CountryCode2.setSortAscending(
        new FieldComparator("ip2Country.countryCode.ccdCode2", true));
    this.listheader_SecLoginlogList_CountryCode2.setSortDescending(
        new FieldComparator("ip2Country.countryCode.ccdCode2", false));
    this.listheader_SecLoginlogList_lglSessionid.setSortAscending(
        new FieldComparator("lglSessionid", true));
    this.listheader_SecLoginlogList_lglSessionid.setSortDescending(
        new FieldComparator("lglSessionid", false));

    // ++ create the searchObject and init sorting ++//
    final HibernateSearchObject<SecLoginlog> soSecLoginlog =
        new HibernateSearchObject<SecLoginlog>(SecLoginlog.class);
    // deeper loading of the relations to prevent the lazy
    // loading problem.
    soSecLoginlog.addFetch("ip2Country.countryCode");
    soSecLoginlog.addSort("lglLogtime", true);

    // set the paging params
    this.paging_SecUserLogList.setPageSize(getCountRows());
    this.paging_SecUserLogList.setDetailed(true);

    // Set the ListModel
    getPagedListWrapper().init(soSecLoginlog, this.listBoxSecUserlog, this.paging_SecUserLogList);
    // set the itemRenderer
    this.listBoxSecUserlog.setItemRenderer(new SecLoginlogListModelItemRenderer());

    createServerPushTimer();
  }
예제 #14
0
  /**
   * Creates a page from a zul-file in a tab in the center area of the borderlayout. Checks if the
   * tab is opened before. If yes than it selects this tab.
   *
   * @param zulFilePathName The ZulFile Name with path.
   * @param tabName The tab name.
   * @throws InterruptedException
   */
  private void showPage(String zulFilePathName, String tabName) throws InterruptedException {

    try {
      // TODO get the parameter for working with tabs from the application
      // params
      final int workWithTabs = 1;
      if (workWithTabs == 1) {
        /* get an instance of the borderlayout defined in the zul-file */
        Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
        /* get an instance of the searched CENTER layout area */
        Center center = bl.getCenter();
        // get the tabs component
        Tabs tabs =
            (Tabs)
                center
                    .getFellow("divCenter")
                    .getFellow("tabBoxIndexCenter")
                    .getFellow("tabsIndexCenter");
        /**
         * Check if the tab is already opened than select them and<br>
         * go out of here. If not than create them.<br>
         */
        Tab checkTab = null;
        try {
          // checkTab = (Tab) tabs.getFellow(tabName);
          checkTab = (Tab) tabs.getFellow("tab_" + tabName.trim());
          checkTab.setSelected(true);
        } catch (final ComponentNotFoundException ex) {
          // Ignore if can not get tab.
        }
        if (checkTab == null) {
          Tab tab = new Tab();
          tab.setId("tab_" + tabName.trim());
          tab.setLabel(tabName.trim());
          tab.setClosable(true);
          tab.setParent(tabs);
          Tabpanels tabpanels =
              (Tabpanels)
                  center
                      .getFellow("divCenter")
                      .getFellow("tabBoxIndexCenter")
                      .getFellow("tabsIndexCenter")
                      .getFellow("tabpanelsBoxIndexCenter");
          Tabpanel tabpanel = new Tabpanel();
          tabpanel.setHeight("100%");
          tabpanel.setStyle("padding: 0px;");
          tabpanel.setParent(tabpanels);
          /**
           * Create the page and put it in the tabs area. If zul-file is not found, detach the
           * created tab
           */
          try {
            Executions.createComponents(zulFilePathName, tabpanel, null);
            tab.setSelected(true);
          } catch (final Exception e) {
            tab.detach();
          }
        }
      } else {
        /* get an instance of the borderlayout defined in the zul-file */
        Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
        /* get an instance of the searched CENTER layout area */
        Center center = bl.getCenter();
        /* clear the center child comps */
        center.getChildren().clear();
        /** create the page and put it in the center layout area */
        Executions.createComponents(zulFilePathName, center, null);
      }

      if (logger.isDebugEnabled()) {
        logger.debug("--> calling zul-file: " + zulFilePathName);
      }
    } catch (final Exception e) {
      Messagebox.show(e.toString());
    }
  }