From b6f3d8ac6a836464a8f2501d286047e729bb4bcf Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Thu, 21 Nov 2013 14:03:41 +0800 Subject: [PATCH 1/2] IDEMPIERE-724 Zk: Make iDempiere theme more easily customizable - Fix import file loader layout --- .../webui/apps/form/WFileImport.java | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFileImport.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFileImport.java index 10c8ae394a..36bb3128f7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFileImport.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFileImport.java @@ -64,6 +64,7 @@ import org.zkoss.zul.Hbox; import org.zkoss.zul.North; import org.zkoss.zul.Separator; import org.zkoss.zul.South; +import org.zkoss.zul.Vbox; /** * Fixed length file import @@ -113,7 +114,7 @@ public class WFileImport extends ADForm implements EventListener private Div previewPanel = new Div(); - private Hbox northPanel = new Hbox(); + private Vbox northPanel = new Vbox(); private Div centerPanel = new Div(); @@ -173,6 +174,7 @@ public class WFileImport extends ADForm implements EventListener fCharset.appendItem(charsets[i].displayName(), charsets[i]); bFile.setLabel(Msg.getMsg(Env.getCtx(), "FileImportFile")); + bFile.setSclass("txt-btn"); bFile.setTooltiptext(Msg.getMsg(Env.getCtx(), "FileImportFileInfo")); bFile.setUpload(AdempiereWebUI.getUploadSetting()); bFile.addEventListener(Events.ON_UPLOAD, this); @@ -197,29 +199,34 @@ public class WFileImport extends ADForm implements EventListener bPrevious.setTooltiptext(Msg.getMsg(Env.getCtx(), "Previous")); bPrevious.setLabel("<"); bPrevious.addEventListener(Events.ON_CLICK, this); - - northPanel.appendChild(bFile); - northPanel.appendChild(fCharset); - northPanel.appendChild(info); - northPanel.appendChild(labelFormat); - northPanel.appendChild(pickFormat); - northPanel.appendChild(bPrevious); - northPanel.appendChild(record); - northPanel.appendChild(bNext); - - rawData.setWidth("100%"); - rawData.setCols(80); + + Hbox hbox = new Hbox(); + hbox.setAlign("center"); + hbox.appendChild(bFile); + hbox.appendChild(fCharset); + hbox.appendChild(info); + hbox.appendChild(labelFormat); + hbox.appendChild(pickFormat); + hbox.appendChild(bPrevious); + hbox.appendChild(record); + hbox.appendChild(bNext); + + rawData.setHflex("1"); rawData.setRows(MAX_SHOWN_LINES); - rawData.setHeight("40%"); + rawData.setHeight("100%"); - previewPanel.setWidth("100%"); - previewPanel.setHeight("58%"); + northPanel.setHflex("1"); + northPanel.setVflex("0"); + northPanel.appendChild(hbox); + northPanel.appendChild(rawData); + northPanel.appendChild(new Separator()); + + previewPanel.setHflex("1"); + previewPanel.setVflex("1"); previewPanel.setStyle("overflow: auto"); - centerPanel.setWidth("100%"); // Elaine 2008/11/07 - fix text area is not expanded in IE7 - centerPanel.setHeight("100%"); - centerPanel.appendChild(rawData); - centerPanel.appendChild(new Separator()); + centerPanel.setHflex("1"); + centerPanel.setVflex("1"); centerPanel.appendChild(previewPanel); confirmPanel.addActionListener(Events.ON_CLICK, this); @@ -483,6 +490,7 @@ public class WFileImport extends ADForm implements EventListener m_labels[i] = new Label(row.getColumnName()); Hbox hbox = new Hbox(); + hbox.setAlign("center"); hbox.setWidth("100%"); hbox.setStyle("padding-bottom: 3px"); Cell cell = new Cell(); @@ -501,6 +509,7 @@ public class WFileImport extends ADForm implements EventListener m_fields[i] = new Textbox(); m_fields[i].setStyle("margin-left: 2px"); + m_fields[i].setWidth("300px"); cell.appendChild(m_fields[i]); hbox.appendChild(cell); From feb76efeeb131a97b7baaec1a5471f7c4279cf7a Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Thu, 21 Nov 2013 14:07:57 +0800 Subject: [PATCH 2/2] Handle NumberFormatException in parse number when import format --- .../src/org/compiere/impexp/ImpFormatRow.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/impexp/ImpFormatRow.java b/org.adempiere.base/src/org/compiere/impexp/ImpFormatRow.java index a77e26fff7..9b2ebcc989 100644 --- a/org.adempiere.base/src/org/compiere/impexp/ImpFormatRow.java +++ b/org.adempiere.base/src/org/compiere/impexp/ImpFormatRow.java @@ -485,7 +485,19 @@ public final class ImpFormatRow if (sb.length() == 0) return "0"; - BigDecimal bd = new BigDecimal(sb.toString()); + + BigDecimal bd = null; + try + { + bd = new BigDecimal(sb.toString()); + } + catch (NumberFormatException pe) + { + log.log(Level.SEVERE, "ImpFormatRow.parseNumber - " + info, pe); + } + if (bd == null) + bd = BigDecimal.ZERO; + if (m_divideBy100) // assumed two decimal scale bd = bd.divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP); return bd.toString();