Exemplo n.º 1
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);
 }
Exemplo n.º 2
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());
    }
  }
  /**
   * Static Setup - add fields to parameterPanel.
   *
   * <pre>
   * 		ResourceType	Resource	DateTimeFrom	DateTimeTo	New
   *  </pre>
   */
  private void statInit() {
    fieldFrom.setWidth("180px");
    fieldTo.setWidth("180px");

    bNew.addEventListener(Events.ON_CLICK, this);

    Grid grid = GridFactory.newGridLayout();

    Rows rows = new Rows();
    grid.appendChild(rows);

    Row row = new Row();
    rows.appendChild(row);
    row.appendChild(fieldResourceType.getLabel().rightAlign());
    row.appendChild(fieldResource.getLabel().rightAlign());
    row.appendChild(labelFrom.rightAlign());
    row.appendChild(labelTo.rightAlign());
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    row.appendChild(fieldResourceType.getComponent());
    row.appendChild(fieldResource.getComponent());
    Div div = new Div();
    div.setStyle("text-align: right;");
    div.appendChild(fieldFrom);
    row.appendChild(div);
    div = new Div();
    div.setStyle("text-align: right;");
    div.appendChild(fieldTo);
    row.appendChild(div);
    row.appendChild(bNew);

    layout = new Borderlayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    if (!isLookup()) {
      layout.setStyle("position: absolute");
    }
    this.appendChild(layout);

    North north = new North();
    layout.appendChild(north);
    north.appendChild(grid);

    Center center = new Center();
    layout.appendChild(center);
    div = new Div();
    div.appendChild(contentPanel);
    if (isLookup()) contentPanel.setWidth("99%");
    else contentPanel.setStyle("width: 99%; margin: 0px auto;");
    contentPanel.setVflex(true);
    div.setStyle("width :100%; height: 100%");
    center.appendChild(div);
    div.setVflex("1");
    div.setHflex("1");

    South south = new South();
    layout.appendChild(south);
    southBody = new Vbox();
    southBody.setWidth("100%");
    south.appendChild(southBody);
    southBody.appendChild(confirmPanel);
    southBody.appendChild(new Separator());
    southBody.appendChild(statusBar);
  }
  /** Creates the components..<br> */
  private void createComponents() {

    /**
     * !! Windows as NameSpaceContainer to prevent not unique id's error from other dashboard module
     * buttons or other used components.
     */
    Window win = new Window();
    win.setBorder("none");
    win.setParent(this);

    Groupbox gb = new Groupbox();
    gb.setMold("3d");
    gb.setClosable(false);
    gb.setParent(win);
    Caption cap = new Caption();
    cap.setImage("/images/icons/new_icons_10.gif");
    cap.setLabel(Labels.getLabel("common.Application.History"));
    cap.setStyle("padding: 0px;");
    cap.setParent(gb);

    // Buttons Toolbar/Timer
    Div div = new Div();
    div.setSclass("z-toolbar");
    div.setStyle("padding: 0px");
    div.setParent(cap);
    Hbox hbox = new Hbox();
    hbox.setPack("stretch");
    hbox.setSclass("hboxRemoveWhiteStrips");
    hbox.setWidth("100%");
    hbox.setParent(div);
    Toolbar toolbarRight = new Toolbar();
    toolbarRight.setAlign("end");
    toolbarRight.setStyle("float:right; border-style: none;");
    toolbarRight.setParent(hbox);

    Hbox hboxBtn = new Hbox();
    hboxBtn.setSclass("hboxRemoveWhiteStrips");
    hboxBtn.setWidth("100%");
    hboxBtn.setParent(toolbarRight);

    //		Paging paging = new Paging();
    //		paging.setParent(hboxBtn);
    //		paging.setDetailed(true);

    if (isTimerControl()) {
      Button btnTimer = new Button();
      btnTimer.setId("btnTimer");
      btnTimer.setHeight("22px");
      btnTimer.setImage("/images/icons/clock1_16x16.gif");

      // convert to seconds
      int seconds = (int) Math.round(getDelay() / 1000);

      if (seconds > 60) {
        // convert to minutes and set localization to minutes
        int minutes = (int) Math.round((getDelay() / 1000) / 60);
        btnTimer.setTooltiptext(
            Labels.getLabel("btnTimer.tooltiptext")
                + " "
                + minutes
                + " "
                + Labels.getLabel("common.Minutes"));
      } else
        // set localization to seconds
        btnTimer.setTooltiptext(
            Labels.getLabel("btnTimer.tooltiptext")
                + " "
                + seconds
                + " "
                + Labels.getLabel("common.Seconds"));

      btnTimer.addEventListener("onClick", new BtnClickListener());
      btnTimer.setParent(hboxBtn);
    }

    Button btnRefresh = new Button();
    btnRefresh.setId("btnRefresh");
    btnRefresh.setHeight("22px");
    btnRefresh.setLabel("!");
    btnRefresh.setTooltiptext(Labels.getLabel("btnRefresh.tooltiptext"));
    btnRefresh.addEventListener("onClick", new BtnClickListener());
    btnRefresh.setParent(hboxBtn);
    // END Buttons Toolbar/Timer

    // body
    Borderlayout bl = new Borderlayout();
    bl.setHeight(getModulHeight() + "px");
    bl.setParent(gb);
    Center ct = new Center();
    ct.setSclass("FDCenterNoBorder");
    ct.setStyle("background-color: white");
    ct.setFlex(true);
    ct.setParent(bl);

    // Listbox
    listbox = new Listbox();
    listbox.setStyle("border: none;");
    listbox.setHeight("100%");
    listbox.setVisible(true);
    listbox.setParent(ct);
    listbox.setItemRenderer(new ItemRenderer());

    Listhead listhead = new Listhead();
    listhead.setParent(listbox);

    Listheader listheader1 = new Listheader();
    listheader1.setWidth("100px");
    listheader1.setHeight("0px");
    listheader1.setParent(listhead);

    Listheader listheader2 = new Listheader();
    listheader2.setWidth("100%");
    listheader1.setHeight("0px");
    listheader2.setParent(listhead);

    doReadData();
  }
Exemplo n.º 5
0
  /** Ststic Init */
  void jbInit() throws Exception {
    label.setText("Label");

    Tabs tabs = new Tabs();
    tabbox.appendChild(tabs);

    Tabpanels tabpanels = new Tabpanels();
    tabbox.appendChild(tabpanels);

    tabs.appendChild(new Tab(Msg.getMsg(Env.getCtx(), "PriceHistory")));
    tabs.appendChild(new Tab(Msg.translate(Env.getCtx(), "QtyReserved")));
    tabs.appendChild(new Tab(Msg.translate(Env.getCtx(), "QtyOrdered")));
    tabs.appendChild(new Tab(Msg.getMsg(Env.getCtx(), "QtyUnconfirmed")));

    if (m_M_Product_ID != 0) tabs.appendChild(new Tab(Msg.getMsg(Env.getCtx(), "ATP")));

    pricePane.setHeight("100%");
    pricePane.appendChild(m_tablePrice);
    tabpanels.appendChild(pricePane);

    reservedPane.setHeight("100%");
    reservedPane.appendChild(m_tableReserved);
    tabpanels.appendChild(reservedPane);

    orderedPane.setHeight("100%");
    orderedPane.appendChild(m_tableOrdered);
    tabpanels.appendChild(orderedPane);

    unconfirmedPane.setHeight("100%");
    unconfirmedPane.appendChild(m_tableUnconfirmed);
    tabpanels.appendChild(unconfirmedPane);

    if (m_M_Product_ID != 0) {
      atpPane.setHeight("100%");
      atpPane.appendChild(m_tableAtp);
      tabpanels.appendChild(atpPane);
    }

    tabbox.setSelectedIndex(0);
    tabbox.addEventListener(Events.ON_SELECT, this);
    confirmPanel.addActionListener(this);

    Borderlayout borderlayout = new Borderlayout();
    this.setWidth("700px");
    this.setHeight("400px");
    borderlayout.setStyle("border: none; position: relative");
    this.appendChild(borderlayout);
    this.setClosable(true);

    North north = new North();
    north.setStyle("border: none");
    borderlayout.appendChild(north);
    north.appendChild(label);

    Center center = new Center();
    center.setSclass("dialog-content");
    center.setAutoscroll(true);
    borderlayout.appendChild(center);
    center.appendChild(tabbox);
    tabbox.setVflex("1");
    tabbox.setHflex("1");

    South south = new South();
    south.setSclass("dialog-footer");
    borderlayout.appendChild(south);
    south.appendChild(confirmPanel);
  } //	jbInit
Exemplo n.º 6
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());
    }
  }