Example #1
0
  @Override
  public void setDisabled(boolean disabled) {
    if (disabled && isChecked()) setChecked(false); // uncheck when button is disabled

    super.setDisabled(disabled);
    if (disabled) {
      LayoutUtils.addSclass("disableFilter", this);
      this.setSclass(getSclass().intern());
    } else {
      if (this.getSclass() != null && this.getSclass().indexOf("disableFilter") >= 0)
        this.setSclass(this.getSclass().replace("disableFilter", "").intern());
    }
  }
Example #2
0
  /**
   * Static Init
   *
   * @throws Exception
   */
  private void init() throws Exception {
    fResource.setMold("select");
    fResource.addEventListener(Events.ON_SELECT, this);
    delete.addEventListener(Events.ON_CLICK, this);
    confirmPanel.addComponentsLeft(delete);
    confirmPanel.addActionListener(Events.ON_CLICK, this);
    //
    this.appendChild(mainPanel);
    mainPanel.makeNoStrip();
    mainPanel.setStyle("background-color: transparent");

    Rows rows = new Rows();
    mainPanel.appendChild(rows);
    Row row = new Row();
    row.appendChild(LayoutUtils.makeRightAlign(lResource));
    row.appendChild(fResource);
    row.appendChild(new Label(" "));
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lDate));
    Div div = new Div();
    div.appendChild(fDateFrom);
    div.appendChild(fTimeFrom);
    fTimeFrom.setStyle("margin-left: 5px");
    row.appendChild(div);
    rows.appendChild(row);

    row = new Row();
    row.appendChild(LayoutUtils.makeRightAlign(lQty));
    row.appendChild(fQty);
    row.appendChild(lUOM);
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lName));
    row.appendChild(fName);
    fName.setStyle("width: 100%");
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lDescription));
    row.appendChild(fDescription);
    fDescription.setMultiline(true);
    fDescription.setRows(3);
    fDescription.setStyle("width: 100%");
    rows.appendChild(row);

    row = new Row();
    row.setSpans("3");
    row.appendChild(new Label(" "));
    rows.appendChild(row);

    row = new Row();
    row.setSpans("3");
    row.appendChild(confirmPanel);
    rows.appendChild(row);
    //
  } //	jbInit
Example #3
0
  public void onEvent(Event event) {
    Component comp = event.getTarget();
    String eventName = event.getName();

    if (eventName.equals(Events.ON_CLICK)) {
      if (comp == max) {
        if (layout.getNorth().isVisible()) {
          collapseHeader();
        } else {
          restoreHeader();
        }
      } else if (comp == showHeader) {
        showHeader.setPressed(true);
        if (pnlHead.getParent() != headerPopup) headerPopup.appendChild(pnlHead);
        LayoutUtils.openPopupWindow(showHeader, headerPopup, "after_start");
      } else if (comp == contextHelp) {
        layout.getEast().setVisible(true);
        layout.getEast().setOpen(true);
        contextHelp.setVisible(false);
        updateHelpCollapsedPreference(false);
      } else if (comp instanceof ToolBarButton) {
        ToolBarButton btn = (ToolBarButton) comp;

        if (btn.getAttribute("AD_Menu_ID") != null) {
          int menuId = (Integer) btn.getAttribute("AD_Menu_ID");
          if (menuId > 0) onMenuSelected(menuId);
        }
      }
    } else if (eventName.equals(ON_ACTIVITIES_CHANGED_EVENT)) {
      @SuppressWarnings("unchecked")
      Map<String, Object> map = (Map<String, Object>) event.getData();
      Integer notice = (Integer) map.get("notice");
      Integer request = (Integer) map.get("request");
      Integer workflow = (Integer) map.get("workflow");
      Integer unprocessed = (Integer) map.get("unprocessed");
      boolean change = false;
      if (notice != null && notice.intValue() != noOfNotice) {
        noOfNotice = notice.intValue();
        change = true;
      }
      if (request != null && request.intValue() != noOfRequest) {
        noOfRequest = request.intValue();
        change = true;
      }
      if (workflow != null && workflow.intValue() != noOfWorkflow) {
        noOfWorkflow = workflow.intValue();
        change = true;
      }
      if (unprocessed != null && unprocessed.intValue() != noOfUnprocessed) {
        noOfUnprocessed = unprocessed.intValue();
        change = true;
      }
      if (change) updateUI();
    } else if (event instanceof ZoomEvent) {
      Clients.clearBusy();
      ZoomEvent ze = (ZoomEvent) event;
      if (ze.getData() != null && ze.getData() instanceof MQuery) {
        AEnv.zoom((MQuery) ze.getData());
      }
    } else if (event instanceof DrillEvent) {
      Clients.clearBusy();
      DrillEvent de = (DrillEvent) event;
      if (de.getData() != null && de.getData() instanceof MQuery) {
        MQuery query = (MQuery) de.getData();
        executeDrill(query);
      }
    }
  }
Example #4
0
  /** execute export action */
  public void export() {
    exporterMap = new HashMap<String, IGridTabExporter>();
    extensionMap = new HashMap<String, String>();
    List<IGridTabExporter> exporterList =
        EquinoxExtensionLocator.instance().list(IGridTabExporter.class).getExtensions();
    for (IGridTabExporter exporter : exporterList) {
      String extension = exporter.getFileExtension();
      if (!extensionMap.containsKey(extension)) {
        extensionMap.put(extension, exporter.getFileExtensionLabel());
        exporterMap.put(extension, exporter);
      }
    }

    if (winExportFile == null) {
      winExportFile = new Window();
      winExportFile.setTitle(
          Msg.getMsg(Env.getCtx(), "Export") + ": " + panel.getActiveGridTab().getName());
      winExportFile.setWidth("450px");
      winExportFile.setClosable(true);
      winExportFile.setBorder("normal");
      winExportFile.setStyle("position:absolute");
      winExportFile.setSclass("popup-dialog");
      winExportFile.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "exportAction");

      cboType.setMold("select");

      cboType.getItems().clear();
      for (Map.Entry<String, String> entry : extensionMap.entrySet()) {
        cboType.appendItem(entry.getKey() + " - " + entry.getValue(), entry.getKey());
      }

      cboType.setSelectedIndex(0);
      cboType.addActionListener(this);

      Vbox vb = new Vbox();
      vb.setWidth("100%");
      winExportFile.appendChild(vb);

      Vlayout vlayout = new Vlayout();
      vlayout.setSclass("dialog-content");
      vb.appendChild(vlayout);

      Grid grid = GridFactory.newGridLayout();
      vlayout.appendChild(grid);

      Columns columns = new Columns();
      Column column = new Column();
      column.setHflex("min");
      columns.appendChild(column);
      column = new Column();
      column.setHflex("1");
      columns.appendChild(column);
      grid.appendChild(columns);

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

      Row row = new Row();
      rows.appendChild(row);
      row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "FilesOfType")));
      row.appendChild(cboType);
      cboType.setHflex("1");

      row = new Row();
      rows.appendChild(row);
      row.appendChild(new Space());
      chkCurrentRow.setLabel(Msg.getMsg(Env.getCtx(), "ExportCurrentRowOnly"));
      chkCurrentRow.setSelected(true);
      row.appendChild(chkCurrentRow);

      selectionTabRow = new Row();
      rows.appendChild(selectionTabRow);

      LayoutUtils.addSclass("dialog-footer", confirmPanel);
      vb.appendChild(confirmPanel);
      confirmPanel.addActionListener(this);
    }
    displayExportTabSelection();
    panel.getComponent().getParent().appendChild(winExportFile);
    panel.showBusyMask(winExportFile);
    LayoutUtils.openOverlappedWindow(panel.getComponent(), winExportFile, "middle_center");
    winExportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this);
    winExportFile.addEventListener("onExporterException", this);
  }