diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index 47277056a3..79acfcdad8 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -765,7 +765,7 @@ public class GridTabCSVImporter implements IGridTabImporter return new StringBuilder(Msg.getMsg(Env.getCtx(), "FieldNotDisplayed",new Object[] {header.get(i)})); MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID()); - if((field.isMandatory(true) || column.isMandatory()) && value == null && field.getDefault()==null){ + if((field.isMandatory(false) || column.isMandatory()) && value == null && field.getDefault()==null){ mandatoryColumns.append(" / "); mandatoryColumns.append(header.get(i)); } diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 2fa008600e..354e2ca333 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -180,13 +180,6 @@ public class GridField log.log(Level.SEVERE, "(" + m_vo.ColumnName + ") - No LookupInfo"); return; } - // Prevent loading of CreatedBy/UpdatedBy - if (m_vo.displayType == DisplayType.Table - && (m_vo.ColumnName.equals("CreatedBy") || m_vo.ColumnName.equals("UpdatedBy")) ) - { - m_vo.lookupInfo.IsCreadedUpdatedBy = true; - m_vo.lookupInfo.DisplayType = DisplayType.Search; - } // loadLookupNoValidate(); } @@ -220,6 +213,14 @@ public class GridField if (m_vo.lookupInfo == null) { return; } + // Prevent loading of CreatedBy/UpdatedBy + if (m_vo.displayType == DisplayType.Table + && (m_vo.ColumnName.equals("CreatedBy") || m_vo.ColumnName.equals("UpdatedBy")) ) + { + m_vo.lookupInfo.IsCreadedUpdatedBy = true; + m_vo.lookupInfo.DisplayType = DisplayType.Search; + m_vo.displayType = DisplayType.Search; + } m_vo.lookupInfo.IsKey = isKey(); loadLookupFromFactory(); } diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 6c7c5f846e..74ac2160b8 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -113,7 +113,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable /** * */ - private static final long serialVersionUID = 1377113168185797983L; + private static final long serialVersionUID = 1151723870943569774L; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; @@ -157,6 +157,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable // The window of this tab private GridWindow m_window; + public GridWindow getGridWindow() { + return m_window; + } + /** The Table Model for Query */ private GridTable m_mTable = null; diff --git a/org.adempiere.base/src/org/compiere/model/MMovementLine.java b/org.adempiere.base/src/org/compiere/model/MMovementLine.java index fc6af5ec14..118dac29b3 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovementLine.java +++ b/org.adempiere.base/src/org/compiere/model/MMovementLine.java @@ -211,11 +211,11 @@ public class MMovementLine extends X_M_MovementLine // Mandatory Instance MProduct product = getProduct(); if (getM_AttributeSetInstance_ID() == 0) { - if (product != null && product.getAttributeSet()==null) { - log.saveError("NoAttributeSet", product.getValue()); - return false; - } if (product != null && product.isASIMandatory(true)) { + if (product.getAttributeSet()==null) { + log.saveError("NoAttributeSet", product.getValue()); + return false; + } if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true /*outgoing*/)) { log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID)); return false; @@ -231,12 +231,12 @@ public class MMovementLine extends X_M_MovementLine setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID()); } - if (product != null && product.getAttributeSet()==null) { - log.saveError("NoAttributeSet", product.getValue()); - return false; - } if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0) { + if (product.getAttributeSet()==null) { + log.saveError("NoAttributeSet", product.getValue()); + return false; + } if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false /*incoming*/)) { log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstanceTo_ID)); return false; diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 7d7158835a..eaa222be18 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -660,8 +660,6 @@ public class MPayment extends X_C_Payment || is_ValueChanged(COLUMNNAME_C_Charge_ID) || is_ValueChanged(COLUMNNAME_C_Currency_ID) || is_ValueChanged(COLUMNNAME_C_DocType_ID) - || is_ValueChanged(COLUMNNAME_C_Invoice_ID) - || is_ValueChanged(COLUMNNAME_C_Order_ID) || is_ValueChanged(COLUMNNAME_DateAcct) || is_ValueChanged(COLUMNNAME_DateTrx) || is_ValueChanged(COLUMNNAME_DiscountAmt) diff --git a/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index c42aa653cd..0c639249dc 100644 --- a/org.adempiere.base/src/org/compiere/util/DisplayType.java +++ b/org.adempiere.base/src/org/compiere/util/DisplayType.java @@ -476,7 +476,7 @@ public final class DisplayType // if ( pattern != null && pattern.length() > 0) { - SimpleDateFormat format = (SimpleDateFormat)DateFormat.getInstance(); + SimpleDateFormat format = (SimpleDateFormat)DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, language.getLocale()); try { format.applyPattern(pattern); return format; diff --git a/org.adempiere.base/src/org/compiere/util/EMail.java b/org.adempiere.base/src/org/compiere/util/EMail.java index 70f25d0844..b0241e12ef 100644 --- a/org.adempiere.base/src/org/compiere/util/EMail.java +++ b/org.adempiere.base/src/org/compiere/util/EMail.java @@ -48,7 +48,6 @@ import javax.mail.internet.MimeMultipart; import org.compiere.model.MClient; import org.compiere.model.MSysConfig; - import com.sun.mail.smtp.SMTPMessage; /** @@ -338,7 +337,7 @@ public final class EMail implements Serializable m_msg.setHeader("Comments", "iDempiereMail"); // m_msg.setDescription("Description"); // SMTP specifics - m_msg.setAllow8bitMIME(true); + //m_msg.setAllow8bitMIME(true); // Send notification on Failure & Success - no way to set envid in Java yet // m_msg.setNotifyOptions (SMTPMessage.NOTIFY_FAILURE | SMTPMessage.NOTIFY_SUCCESS); // Bounce only header @@ -974,18 +973,34 @@ public final class EMail implements Serializable else // Multi part message *************************************** { // First Part - Message - MimeBodyPart mbp_1 = new MimeBodyPart(); - mbp_1.setText(""); - if (m_messageHTML == null || m_messageHTML.length () == 0) - mbp_1.setText (getMessageCRLF(), charSetName); - else - mbp_1.setDataHandler (new DataHandler - (new ByteArrayDataSource (m_messageHTML, charSetName, "text/html"))); + MimeBodyPart htmlPart= null; + MimeBodyPart planPart = new MimeBodyPart(); + //TODO: get plan text form html, i see getMessageCRLF just return empty string + planPart.setText (getMessageCRLF(), charSetName); + htmlPart = new MimeBodyPart(); + if (m_messageHTML == null){ + m_messageHTML = "" + getMessageCRLF() + ""; + } + htmlPart.setDataHandler (new DataHandler + (new ByteArrayDataSource (m_messageHTML, charSetName, "text/html"))); + // Create Multipart and its parts to it - Multipart mp = new MimeMultipart("related"); - mp.addBodyPart(mbp_1); - if (log.isLoggable(Level.FINE)) log.fine("(multi) " + getSubject() + " - " + mbp_1); + Multipart mainPart = new MimeMultipart("mixed"); + + Multipart viewContentPart = new MimeMultipart("related"); + MimeBodyPart viewBodyPart = new MimeBodyPart(); + viewBodyPart.setContent(viewContentPart); + mainPart.addBodyPart(viewBodyPart); + + Multipart textAlternativePart = new MimeMultipart("alternative"); + //textAlternativePart.addBodyPart(planPart); + textAlternativePart.addBodyPart(htmlPart); + MimeBodyPart alternativeBodyPart = new MimeBodyPart(); + alternativeBodyPart.setContent(textAlternativePart); + viewContentPart.addBodyPart(alternativeBodyPart); + + if (log.isLoggable(Level.FINE)) log.fine("(multi) " + getSubject() + " - " + htmlPart); // for all attachments for (int i = 0; i < m_attachments.size(); i++) @@ -1024,12 +1039,14 @@ public final class EMail implements Serializable if (m_messageHTML != null && m_messageHTML.contains("cid:"+ds.getName())) { mbp_2.setContentID("<" + ds.getName() + ">"); mbp_2.setDisposition(MimeBodyPart.INLINE); + viewContentPart.addBodyPart(mbp_2); + }else{ + mainPart.addBodyPart(mbp_2); } - mp.addBodyPart(mbp_2); } // Add to Message - m_msg.setContent(mp); + m_msg.setContent(mainPart); } // multi=part } // setContent diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index 7d74195772..b62e2ca110 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -1509,8 +1509,9 @@ public final class Env if (column.isSecure()) { outStr.append("********"); } else { - outStr.append(DB.getSQLValueString(trxName, - "SELECT " + columnName + " FROM " + tableName + " WHERE " + tableName + "_ID = ?", (Integer)v)); + String value = DB.getSQLValueString(trxName,"SELECT " + columnName + " FROM " + tableName + " WHERE " + tableName + "_ID = ?", (Integer)v); + if (value != null) + outStr.append(value); } } } diff --git a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java index d38fc37c96..d6185dcac8 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java @@ -1011,6 +1011,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable if (!m_po.save()) { success = false; + m_docStatus = null; processMsg = "SaveError"; } if (!success) diff --git a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java index d704ea1cde..0e3cd5f497 100644 --- a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java +++ b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java @@ -60,6 +60,7 @@ import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.design.JRDesignQuery; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.export.JRCsvExporter; +import net.sf.jasperreports.engine.export.JRCsvExporterParameter; import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.engine.export.JRPdfExporter; import net.sf.jasperreports.engine.export.JRPrintServiceExporter; @@ -714,8 +715,12 @@ public class ReportStarter implements ProcessCall, ClientProcess exporter = new JRPrintServiceExporter(ljrContext); else if (ext.equals("xml")) exporter = new JRXmlExporter(ljrContext); - else if (ext.equals("csv") || ext.equals("ssv")) + else if (ext.equals("csv")) exporter = new JRCsvExporter(ljrContext); + else if (ext.equals("ssv")) { + exporter = new JRCsvExporter(ljrContext); + exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ";"); + } else if (ext.equals("txt")) exporter = new JRTextExporter(ljrContext); else if (ext.equals("html") || ext.equals("htm")) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index d008c7d65b..7b921b7484 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -22,6 +22,8 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; @@ -43,11 +45,13 @@ import org.compiere.model.MRole; import org.compiere.model.MSession; import org.compiere.model.MSysConfig; import org.compiere.model.MSystem; +import org.compiere.model.MTable; import org.compiere.model.MUser; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Language; import org.compiere.util.Msg; +import org.compiere.util.Util; import org.zkforge.keylistener.Keylistener; import org.zkoss.web.Attributes; import org.zkoss.web.servlet.Servlets; @@ -77,7 +81,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb /** * */ - private static final long serialVersionUID = 5875869799688466929L; + private static final long serialVersionUID = 2030098494203345181L; private static final String SAVED_CONTEXT = "saved.context"; @@ -107,12 +111,16 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb private static boolean eventThreadEnabled = false; + private ConcurrentMap m_URLParameters; + public AdempiereWebUI() { this.addEventListener(Events.ON_CLIENT_INFO, this); this.setVisible(false); userPreference = new UserPreference(); + // preserve the original URL parameters as is destroyed later on loging + m_URLParameters = new ConcurrentHashMap(Executions.getCurrent().getParameterMap()); } public void onCreate() @@ -275,9 +283,54 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb } Env.setContext(ctx, "#LocalHttpAddr", localHttpAddr.toString()); Clients.response(new AuScript("zAu.cmd0.clearBusy()")); + + processParameters(); } - - /** + + private void processParameters() { + String action = getPrmString("Action"); + if ("Zoom".equalsIgnoreCase(action)) { + int tableID = getPrmInt("AD_Table_ID"); + if (tableID == 0) { + String tableName = getPrmString("TableName"); + if (!Util.isEmpty(tableName)) { + MTable table = MTable.get(Env.getCtx(), tableName); + if (table != null) { + tableID = table.getAD_Table_ID(); + } + } + } + int recordID = getPrmInt("Record_ID"); + if (tableID > 0) { + AEnv.zoom(tableID, recordID); + } + } + m_URLParameters = null; + } + + private String getPrmString(String prm) { + String retValue = ""; + if (m_URLParameters != null) { + String[] strs = m_URLParameters.get(prm); + if (strs != null && strs.length == 1 && strs[0] != null) + retValue = strs[0]; + } + return retValue; + } + + private int getPrmInt(String prm) { + int retValue = 0; + String str = getPrmString(prm); + try { + if (!Util.isEmpty(str)) + retValue = Integer.parseInt(str); + } catch (NumberFormatException e) { + // ignore + } + return retValue; + } + + /** * @return key listener */ @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index 0d9ea60ad5..fd8fd2a64c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -1622,8 +1622,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !isNewRow); toolbar.enableReport(!isNewRow); - toolbar.enableExport(!adTabbox.getSelectedGridTab().isSortTab()); - toolbar.enableFileImport(!changed && !adTabbox.getSelectedGridTab().isSortTab() && adTabbox.getSelectedGridTab().isInsertRecord()); + toolbar.enableExport(!isNewRow && !adTabbox.getSelectedGridTab().isSortTab()); + toolbar.enableFileImport(!isNewRow && !changed && !adTabbox.getSelectedGridTab().isSortTab() && adTabbox.getSelectedGridTab().isInsertRecord()); toolbar.enableTabNavigation(breadCrumb.hasParentLink(), adTabbox.getSelectedDetailADTabpanel() != null); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WReportCustomization.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WReportCustomization.java index d4f08a49ed..cf28bd4715 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WReportCustomization.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WReportCustomization.java @@ -468,12 +468,18 @@ public class WReportCustomization implements IFormController,EventListener readData(ResultSet rs, ColumnInfo[] p_layout) throws SQLException { + protected ArrayList readData(ResultSet rs, ColumnInfo[] p_layout) throws SQLException { int colOffset = 1; // columns start with 1 ArrayList data = new ArrayList(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/WInfoPAttributeEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/WInfoPAttributeEditor.java index c1f8e5f6de..7bfac16ad6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/WInfoPAttributeEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/WInfoPAttributeEditor.java @@ -123,7 +123,7 @@ public class WInfoPAttributeEditor extends WEditor implements IWhereClauseEditor * M_AttributeSet pa * */ - private void cmd_InfoPAttribute() + protected void cmd_InfoPAttribute() { int attributeSetId = Env.getContextAsInt(ctx, windowNo, Env.TAB_INFO, "M_AttributeSet_ID"); final InfoPAttributePanel ia = new InfoPAttributePanel(attributeSetId); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index 609cedd36a..01da1dedd1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -664,6 +664,9 @@ public class LoginPanel extends Window implements EventListener /** get default languages from the browser */ private List browserLanguages(String header) { List arrstr = new ArrayList(); + if (header == null) + return arrstr; + for (String str : header.split(",")){ String[] arr = str.trim().replace("-", "_").split(";"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java index e9027dfcae..faf221d837 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java @@ -400,12 +400,18 @@ public class ReportAction implements EventListener re.createXML(sw); data = sw.getBuffer().toString().getBytes(); } - else if (ext.equals("csv") || ext.equals("ssv")) + else if (ext.equals("csv")) { StringWriter sw = new StringWriter(); re.createCSV(sw, ',', re.getPrintFormat().getLanguage()); data = sw.getBuffer().toString().getBytes(); } + else if (ext.equals("ssv")) + { + StringWriter sw = new StringWriter(); + re.createCSV(sw, ';', re.getPrintFormat().getLanguage()); + data = sw.getBuffer().toString().getBytes(); + } else if (ext.equals("txt")) { StringWriter sw = new StringWriter(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java index bb0e92cc83..b197fa8baf 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java @@ -13,6 +13,9 @@ package org.adempiere.webui.part; +import java.util.List; + +import org.adempiere.webui.component.Menupopup; import org.adempiere.webui.component.Tab; import org.adempiere.webui.component.Tabbox; import org.adempiere.webui.component.Tabpanel; @@ -21,11 +24,14 @@ import org.adempiere.webui.component.Tabs; import org.adempiere.webui.panel.IHelpContext; import org.adempiere.webui.session.SessionManager; import org.compiere.model.X_AD_CtxHelp; +import org.compiere.util.Env; +import org.compiere.util.Msg; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.SwipeEvent; +import org.zkoss.zul.Menuitem; /** * @@ -127,7 +133,7 @@ public class WindowContainer extends AbstractUIPart */ public Tab insertBefore(Tab refTab, Component comp, String title, boolean closeable, boolean enable) { - Tab tab = new Tab(); + final Tab tab = new Tab(); if (title != null) { setTabTitle(title, tab); @@ -198,6 +204,63 @@ public class WindowContainer extends AbstractUIPart setSelectedTab(tab); } + Menupopup popupClose = new Menupopup(); + Menuitem mi; + if(tab.getIndex()!=0){ + mi = new Menuitem(Msg.getMsg(Env.getCtx(), "Close")); + popupClose.appendChild(mi); + mi.addEventListener(Events.ON_CLICK, new EventListener() { + public void onEvent(Event event) throws Exception { + int currentTabIndex = tab.getIndex(); + int tabsSizeBeforeClose = tabbox.getTabs().getChildren().size(); + + if ( tabsSizeBeforeClose == currentTabIndex + 1 ) { + currentTabIndex--; + } + if ( tab.getPreviousSibling() != null ) { + tab.onClose(); + // Update the current tab index. + if ( tabsSizeBeforeClose != tabbox.getTabs().getChildren().size() ) + tabbox.setSelectedIndex( currentTabIndex ); + } + } + }); + + mi = new Menuitem(Msg.getMsg(Env.getCtx(), "CloseOtherWindows")); + popupClose.appendChild(mi); + mi.addEventListener(Events.ON_CLICK, new EventListener() { + public void onEvent(Event event) throws Exception { + int focusTabIndex = 1; + List tabs = tabbox.getTabs().getChildren(); + for ( int i = tabs.size() - 1; i > 0; i-- ) { + if(!((Tab)tabs.get( i )).equals(tab)){ + ((Tab)tabs.get( i )).setSelected(false); + + ((Tab)tabs.get( i )).onClose(); + } + } + tabbox.setSelectedIndex(focusTabIndex); + } + }); + } + + mi = new Menuitem(Msg.getMsg(Env.getCtx(), "CloseAllWindows")); + mi.addEventListener(Events.ON_CLICK, new EventListener() { + public void onEvent(Event event) throws Exception { + int focusTabIndex = 0; + List tabs = tabbox.getTabs().getChildren(); + for ( int i = tabs.size() - 1; i > 0; i-- ) { + ((Tab)tabs.get( i )).setSelected(false); + ((Tab)tabs.get( i )).onClose(); + } + tabbox.setSelectedIndex( focusTabIndex ); + } + }); + popupClose.appendChild(mi); + popupClose.setWidth("auto"); + popupClose.setPage(tab.getPage()); + tab.setContext(popupClose); + return tab; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java index cc6a22d533..2c6ca507d1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java @@ -14,6 +14,7 @@ import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.export.JRCsvExporter; +import net.sf.jasperreports.engine.export.JRCsvExporterParameter; import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.engine.export.JRHtmlExporterParameter; import net.sf.jasperreports.engine.export.JRPdfExporter; @@ -57,7 +58,7 @@ public class ZkJRViewer extends Window implements EventListener, ITabOnCl /** * */ - private static final long serialVersionUID = -8378226782387071338L; + private static final long serialVersionUID = -1250003381099609830L; private JasperPrint jasperPrint; private Listbox previewType = new Listbox(); @@ -103,6 +104,7 @@ public class ZkJRViewer extends Window implements EventListener, ITabOnCl previewType.appendItem("HTML", "HTML"); previewType.appendItem("Excel", "XLS"); previewType.appendItem("CSV", "CSV"); + previewType.appendItem("SSV", "SSV"); if ("PDF".equals(defaultType)) { previewType.setSelectedIndex(0); } else if ("HTML".equals(defaultType)) { @@ -111,6 +113,8 @@ public class ZkJRViewer extends Window implements EventListener, ITabOnCl previewType.setSelectedIndex(2); } else if ("CSV".equals(defaultType)) { previewType.setSelectedIndex(3); + } else if ("SSV".equals(defaultType)) { + previewType.setSelectedIndex(4); } else { previewType.setSelectedIndex(0); log.info("Format not Valid: "+defaultType); @@ -126,6 +130,8 @@ public class ZkJRViewer extends Window implements EventListener, ITabOnCl previewType.setSelectedIndex(0); // default to PDF if cannot export } else if ("CSV".equals(defaultType)) { previewType.setSelectedIndex(0); // default to PDF if cannot export + } else if ("SSV".equals(defaultType)) { + previewType.setSelectedIndex(0); // default to PDF if cannot export } else { previewType.setSelectedIndex(0); log.info("Format not Valid: "+defaultType); @@ -293,6 +299,23 @@ public class ZkJRViewer extends Window implements EventListener, ITabOnCl exporter.exportReport(); media = new AMedia(m_title, "csv", "application/csv", file, true); + + }else if ("SSV".equals(reportType)) { + String path = System.getProperty("java.io.tmpdir"); + String prefix = makePrefix(jasperPrint.getName()); + if (log.isLoggable(Level.FINE)) + { + log.log(Level.FINE, "Path="+path + " Prefix="+prefix); + } + File file = File.createTempFile(prefix, ".ssv", new File(path)); + FileOutputStream fos = new FileOutputStream(file); + JRCsvExporter exporter= new JRCsvExporter(); + exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ";"); + exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); + exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, fos); + exporter.exportReport(); + + media = new AMedia(m_title, "ssv", "application/ssv", file, true); } } finally { Thread.currentThread().setContextClassLoader(cl); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index 84f62a0329..0d144fc391 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -949,12 +949,18 @@ public class ZkReportViewer extends Window implements EventListener, ITab m_reportEngine.createXML(sw); data = sw.getBuffer().toString().getBytes(); } - else if (ext.equals("csv") || ext.equals("ssv")) + else if (ext.equals("csv")) { StringWriter sw = new StringWriter(); m_reportEngine.createCSV(sw, ',', m_reportEngine.getPrintFormat().getLanguage()); data = sw.getBuffer().toString().getBytes(); } + else if (ext.equals("ssv")) + { + StringWriter sw = new StringWriter(); + m_reportEngine.createCSV(sw, ';', m_reportEngine.getPrintFormat().getLanguage()); + data = sw.getBuffer().toString().getBytes(); + } else if (ext.equals("txt")) { StringWriter sw = new StringWriter();