/** Initialize component & values from m_mAssignment */
  private void setDisplay() {
    m_setting = true;

    //	Set Resource
    int S_Resource_ID = m_mAssignment.getS_Resource_ID();

    for (ListItem item : fResource.getItems()) {
      if ((Integer) item.getValue() == S_Resource_ID) {
        fResource.setSelectedItem(item);
        break;
      }
    }

    ListItem listItem = fResource.getSelectedItem();
    KeyNamePair check = new KeyNamePair((Integer) listItem.getValue(), listItem.getLabel());
    if (check == null || check.getKey() != S_Resource_ID) {
      if (m_mAssignment.getS_ResourceAssignment_ID() == 0) // 	new record select first
      fResource.setSelectedItem(fResource.getSelectedItem()); // 	initiates UOM display
      else log.log(Level.SEVERE, "Resource not found ID=" + S_Resource_ID);
    }

    //	Set Date, Qty
    fDateFrom.setValue(m_mAssignment.getAssignDateFrom());
    fTimeFrom.setValue(m_mAssignment.getAssignDateFrom());
    fQty.setValue(m_mAssignment.getQty());

    //	Name, Description
    fName.setValue(m_mAssignment.getName());
    fDescription.setValue(m_mAssignment.getDescription());

    //	Set Editor to R/O if confirmed
    boolean readWrite = true;
    if (m_mAssignment.isConfirmed()) readWrite = false;
    confirmPanel.getButton("Cancel").setVisible(readWrite);
    fResource.setEnabled(readWrite);
    fDateFrom.setReadonly(!readWrite);
    fQty.setEnabled(readWrite);

    m_setting = false;
  } //	dynInit
Ejemplo n.º 2
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);
  }