| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -3,11 +3,13 @@ package info.bukova.isspst.ui;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.math.BigDecimal;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.text.DecimalFormat;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.text.ParseException;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.util.Locale;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.slf4j.Logger;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.slf4j.LoggerFactory;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.zkoss.bind.BindContext;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.zkoss.bind.Converter;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.zkoss.util.Locales;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.zkoss.zk.ui.Component;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				public class BigDecimalConverter implements Converter<String, BigDecimal, Component>
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -23,7 +25,8 @@ public class BigDecimalConverter implements Converter<String, BigDecimal, Compon
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							try
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								DecimalFormat format = new DecimalFormat();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Locale loc = Locales.getCurrent();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(loc);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								format.setParseBigDecimal(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								val = (BigDecimal) format.parse(str);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -43,6 +46,9 @@ public class BigDecimalConverter implements Converter<String, BigDecimal, Compon
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					public String coerceToUi(BigDecimal val, Component component, BindContext cx)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						// String lang = Executions.getCurrent().getHeader("accept-language");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						Locale loc = Locales.getCurrent();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if (val == null)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							val = BigDecimal.ZERO;
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -50,13 +56,13 @@ public class BigDecimalConverter implements Converter<String, BigDecimal, Compon
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						val = val.setScale(2, BigDecimal.ROUND_DOWN);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						DecimalFormat format = new DecimalFormat();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(loc);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						format.setMaximumFractionDigits(2);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						format.setMinimumFractionDigits(2);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						format.setGroupingUsed(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						format.setGroupingSize(3);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return format.format(val);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						String formatted = format.format(val);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return formatted;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |