Example usage for java.text DecimalFormatSymbols DecimalFormatSymbols

List of usage examples for java.text DecimalFormatSymbols DecimalFormatSymbols

Introduction

In this page you can find the example usage for java.text DecimalFormatSymbols DecimalFormatSymbols.

Prototype

public DecimalFormatSymbols() 

Source Link

Document

Create a DecimalFormatSymbols object for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:com.insightaction.util.DataLoader.java

private static BigDecimal getBigDecimal(String value) {
    DecimalFormatSymbols symbols = new DecimalFormatSymbols();
    symbols.setGroupingSeparator(',');
    symbols.setDecimalSeparator('.');
    String pattern = "#,##0.0#";
    DecimalFormat decimalFormat = new DecimalFormat(pattern, symbols);
    decimalFormat.setParseBigDecimal(true);

    BigDecimal bigDecimal = null;
    try {/*from w  w w.  j a v  a 2 s.c o  m*/
        bigDecimal = (BigDecimal) decimalFormat.parse(value);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return bigDecimal;
}

From source file:be.ibridge.kettle.trans.step.xmlinput.XMLInputData.java

/**
 * /* w  w w  .  j a  va2s. c  o  m*/
 */
public XMLInputData() {
    super();

    thisline = null;
    nextline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previousRow = null;
    filenr = 0;

    fr = null;
    zi = null;
    is = null;
}

From source file:org.pentaho.di.trans.steps.xmlinput.XMLInputData.java

public XMLInputData() {
    super();/* w ww  . j ava 2s.co  m*/

    thisline = null;
    nextline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previousRow = null;
    filenr = 0;

    fr = null;
    zi = null;
    is = null;
}

From source file:com.panet.imeta.trans.steps.propertyinput.PropertyInputData.java

/**
 * // w ww. ja v a 2  s . co  m
 */
public PropertyInputData() {
    super();
    previousRow = null;
    thisline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previousRow = null;
    filenr = 0;

    fr = null;
    is = null;
    rw = null;
    totalpreviousfields = 0;
    indexOfFilenameField = -1;
    readrow = null;
    pro = new Properties();
    it = null;
}

From source file:CommonServlets.EditUser.java

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String email = null, userName = null, job = null, address = null, password = null, img = null, role = null;
    BigDecimal creditLimit = new BigDecimal(0);

    try {/*  w  w w . jav a2  s . c  o  m*/
        // Create a factory for disk-based file items
        DiskFileItemFactory factory = new DiskFileItemFactory();
        // Create a new file upload handler
        ServletFileUpload upload = new ServletFileUpload(factory);

        // Parse the request
        List<FileItem> items = upload.parseRequest(request);
        Iterator<FileItem> iter = items.iterator();
        while (iter.hasNext()) {
            FileItem item = iter.next();
            if (item.isFormField()) {
                //processFormField(item);
                String name = item.getFieldName();
                String value = item.getString();

                if (name.equalsIgnoreCase("email")) {
                    email = value;
                } else if (name.equalsIgnoreCase("userName")) {
                    userName = value;
                } else if (name.equalsIgnoreCase("creditLimit")) {
                    DecimalFormatSymbols symbols = new DecimalFormatSymbols();
                    symbols.setGroupingSeparator(',');
                    symbols.setDecimalSeparator('.');
                    String pattern = "#,##0.0#";
                    DecimalFormat decimalFormat = new DecimalFormat(pattern, symbols);
                    decimalFormat.setParseBigDecimal(true);
                    creditLimit = (BigDecimal) decimalFormat.parse(value);
                } else if (name.equalsIgnoreCase("job")) {
                    job = value;

                } else if (name.equalsIgnoreCase("address")) {
                    address = value;
                } else if (name.equalsIgnoreCase("password")) {
                    password = value;
                }
            } else if (!item.isFormField() && !item.getName().equals("")) {
                System.out.println(new File(AddProduct.class.getClassLoader().getResource("").getPath()
                        .replace("%20", " ")
                        .substring(0, AddProduct.class.getClassLoader().getResource("").getPath()
                                .replace("%20", " ").length() - 27)
                        + "/web/Resources/users_pics/" + item.getName()));
                item.write(new File(AddProduct.class.getClassLoader().getResource("").getPath()
                        .replace("%20", " ")
                        .substring(0, AddProduct.class.getClassLoader().getResource("").getPath()
                                .replace("%20", " ").length() - 27)
                        + "/web/Resources/users_pics/" + item.getName()));
                img = item.getName();
            }
        }

        User u = new User(email, userName, password, creditLimit, job, address, img, role);
        controlServlet.editUserDate(u);
        HttpSession session = request.getSession(true);
        session.setAttribute("done", "1");
        ControlServlet c = new ControlServlet();
        User myUser = c.getUser(userName);
        session.setAttribute("user", myUser);
        response.sendRedirect("UserHome.jsp");

    } catch (Exception ex) {
        Logger.getLogger(AddProduct.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.panet.imeta.trans.steps.getfilenames.GetFileNamesData.java

/**
 * // w w  w.j  a v  a2  s . com
 */
public GetFileNamesData() {
    super();

    lineBuffer = new ArrayList<String>();
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previous_row = null;
    filenr = 0;
    filessize = 0;

    nrLinesOnPage = 0;

    fr = null;
    zi = null;
    file = null;
    totalpreviousfields = 0;
    indexOfFilenameField = -1;
    indexOfWildcardField = -1;
    readrow = null;
    nrStepFields = 0;
}

From source file:com.panet.imeta.trans.steps.ldifinput.LDIFInputData.java

/**
 * /*  ww  w. j  a  v a  2 s  . c  o m*/
 */
public LDIFInputData() {
    super();
    nrInputFields = -1;
    thisline = null;
    nextline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    filenr = 0;

    fr = null;
    zi = null;
    is = null;
    InputLDIF = null;
    recordLDIF = null;
    multiValueSeparator = ",";
    totalpreviousfields = 0;
    readrow = null;
    indexOfFilenameField = -1;
}

From source file:org.pentaho.di.trans.steps.getfilenames.GetFileNamesData.java

public GetFileNamesData() {
    super();/* w  w w. j a v a 2  s  .c o  m*/

    lineBuffer = new ArrayList<String>();
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previous_row = null;
    filenr = 0;
    filessize = 0;

    nrLinesOnPage = 0;

    fr = null;
    zi = null;
    file = null;
    totalpreviousfields = 0;
    indexOfFilenameField = -1;
    indexOfWildcardField = -1;
    readrow = null;
    nrStepFields = 0;
    indexOfExcludeWildcardField = -1;
}

From source file:be.ibridge.kettle.trans.step.textfileinput.TextFileInputData.java

/**
 * //from  www.  java  2s . c  o  m
 */
public TextFileInputData() {
    super();

    thisline = null;
    nextline = null;

    lineBuffer = new ArrayList();
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previous_row = null;
    filenr = 0;

    nrLinesOnPage = 0;

    fr = null;
    zi = null;

    filterProcessor = null;
}

From source file:org.pentaho.di.trans.steps.propertyinput.PropertyInputData.java

public PropertyInputData() {
    super();/*from w  w w.j av  a2s  .  c  o  m*/
    previousRow = null;
    thisline = null;
    nf = NumberFormat.getInstance();
    df = (DecimalFormat) nf;
    dfs = new DecimalFormatSymbols();
    daf = new SimpleDateFormat();
    dafs = new DateFormatSymbols();

    nr_repeats = 0;
    previousRow = null;
    filenr = 0;

    fr = null;
    is = null;
    rw = null;
    totalpreviousfields = 0;
    indexOfFilenameField = -1;
    readrow = null;

    pro = null;
    it = null;
    iniSection = null;
    wini = null;
    itSection = null;
    realEncoding = null;
    realSection = null;
    propfiles = true;
    iniIt = null;
}