Hi,

Are there any plans to add multiselect listbox support in XfdfReader and
FdfReader? Below are xfdf related changes in case you would like to review
or use. 

Thanks,
Dajana


--- XfdfReader changes ---

change property 'fields'  to  'HashMap<String, List<String>> fields'

change method endElement:

public void endElement(String tag) {
        if ( tag.equals("value") ) {
            String      fName = "";
            for (int k = 0; k < fieldNames.size(); ++k) {
                fName += "." + (String)fieldNames.elementAt(k);
            }
            if (fName.startsWith("."))
                fName = fName.substring(1);
            String      fVal = (String) fieldValues.pop();
            List<String> values;
            if (fields.containsKey(fName))
            {
                values = fields.get(fName);
            }
            else
            {
                values = new ArrayList<String>();
            }
            values.add(fVal);
            fields.put( fName, values );
        }
        else if (tag.equals("field") ) {
            if (!fieldNames.isEmpty())
                fieldNames.pop();
        }
    }

--- AcroFields changes ---

change method setFields:

public void setFields(XfdfReader xfdf) throws IOException, DocumentException
{
        HashMap fd = xfdf.getFields();
        for (Iterator i = fd.keySet().iterator(); i.hasNext();) {
            String f = (String)i.next();
            List<String> v = xfdf.getFieldValue(f);
            if (v != null)
                if (v.size() == 1)
                {
                    setField(f, v.get(0));
                }
                else if (getFieldType(f) == AcroFields.FIELD_TYPE_LIST)
                {
                    String[] values = new String[v.size()];
                    setListSelection(f, v.toArray(values));
                }
        }
    }
-- 
View this message in context: 
http://www.nabble.com/setField-for-multi-select-lists--tp20144923p20210142.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to