public void initComponents() { lblDocumentNo = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo"))); lblDescription = new Label(Msg.translate(Env.getCtx(), "Description")); lblDateOrdered = new Label(Msg.translate(Env.getCtx(), "DateOrdered")); lblOrderRef = new Label(Msg.translate(Env.getCtx(), "POReference")); lblGrandTotal = new Label(Msg.translate(Env.getCtx(), "GrandTotal")); txtDocumentNo = new Textbox(); txtDescription = new Textbox(); txtOrderRef = new Textbox(); dateFrom = new Datebox(); dateTo = new Datebox(); amountFrom = new NumberBox(false); amountTo = new NumberBox(false); isSoTrx = new Checkbox(); isSoTrx.setLabel(Msg.translate(Env.getCtx(), "IsSOTrx")); isSoTrx.setChecked(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx"))); MLookup lookupBP = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search); editorBPartner = new WSearchEditor( lookupBP, Msg.translate(Env.getCtx(), "C_BPartner_ID"), "", true, false, true); editorBPartner.addValueChangeListener(this); }
/** Show list tab can export for user selection */ protected void displayExportTabSelection() { initTabInfo(); exporter = getExporter(); if (exporter == null) { Events.echoEvent("onExporterException", winExportFile, null); } // clear list checkbox selection to recreate with new reporter selectionTabRow.getChildren().clear(); Vlayout vlayout = new Vlayout(); selectionTabRow.appendChild(new Space()); selectionTabRow.appendChild(vlayout); vlayout.appendChild(new Label(Msg.getMsg(Env.getCtx(), "SelectTabToExport"))); chkSelectionTabForExport = new ArrayList<Checkbox>(); boolean isHasSelectionTab = false; boolean isSelectTabDefault = false; // with 2Pack, default is export all child tab if (exporter.getClass().getName().equals("org.adempiere.pipo2.GridTab2PackExporter")) { isSelectTabDefault = true; } // for to make each export tab with one checkbox for (GridTab child : childs) { Checkbox chkSelectionTab = new Checkbox(); chkSelectionTab.setLabel(child.getName()); // just allow selection tab can export if (!exporter.isExportableTab(child)) { continue; } if (child.getTabNo() == indxDetailSelected || isSelectTabDefault) { chkSelectionTab.setSelected(true); } chkSelectionTab.setAttribute("tabBinding", child); vlayout.appendChild(chkSelectionTab); chkSelectionTabForExport.add(chkSelectionTab); isHasSelectionTab = true; } // in case no child tab can export. clear selection area if (isHasSelectionTab == false) { selectionTabRow.getChildren().clear(); } }
/** 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); }