You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2015/07/02 09:16:23 UTC
svn commit: r1688770 - in /pdfbox/trunk/pdfbox/src:
main/java/org/apache/pdfbox/pdmodel/interactive/form/
test/java/org/apache/pdfbox/pdmodel/interactive/form/
Author: msahyoun
Date: Thu Jul 2 07:16:23 2015
New Revision: 1688770
URL: http://svn.apache.org/r1688770
Log:
PDFBOX-2841: remove misleading getOptions() method
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java
pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java?rev=1688770&r1=1688769&r2=1688770&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java Thu Jul 2 07:16:23 2015
@@ -118,55 +118,6 @@ public abstract class PDButton extends P
}
/**
- * This will get the option values - the "Opt" entry.
- *
- * <p>The option values are used to define the export values
- * for the field to
- * <ul>
- * <li>hold values in non-Latin writing systems as name objects, which represent the field value, are limited
- * to PDFDocEncoding
- * </li>
- * <li>allow radio buttons having the same export value to be handled independently
- * </li>
- * </ul>
- * </p>
- *
- * @return List containing all possible options. If there is no Opt entry an empty list will be returned.
- */
- public List<String> getOptions()
- {
- COSBase value = getInheritableAttribute(COSName.OPT);
- if (value instanceof COSString)
- {
- List<String> array = new ArrayList<String>();
- array.add(((COSString) value).getString());
- return array;
- }
- else if (value instanceof COSArray)
- {
- return COSArrayList.convertCOSStringCOSArrayToList((COSArray)value);
- }
- return Collections.emptyList();
- }
-
- /**
- * This will set the options.
- *
- * @see #getOptions()
- * @param values List containing all possible options. Supplying null list will remove the Opt entry.
- */
- public void setOptions(List<String> values)
- {
- COSArray cosValues = null;
- if (values != null)
- {
- cosValues = COSArrayList.convertStringListToCOSStringCOSArray(values);
- }
- dictionary.setItem(COSName.OPT, cosValues);
- }
-
-
- /**
* This will get the export values.
*
* <p>The export values are defined in the field dictionaries /Opt key.</p>
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java?rev=1688770&r1=1688769&r2=1688770&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDPushButton.java Thu Jul 2 07:16:23 2015
@@ -51,21 +51,6 @@ public class PDPushButton extends PDButt
{
super(acroForm, field, parent);
}
-
- @Override
- public List<String> getOptions()
- {
- return Collections.emptyList();
- }
-
- @Override
- public void setOptions(List<String> values)
- {
- if (values != null && !values.isEmpty())
- {
- throw new IllegalArgumentException("A PDPushButton shall not use the Opt entry in the field dictionary");
- }
- }
@Override
public List<String> getExportValues()
Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java?rev=1688770&r1=1688769&r2=1688770&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java Thu Jul 2 07:16:23 2015
@@ -81,14 +81,14 @@ public class TestCheckBox extends TestCa
// test that there are no nulls returned for an empty field
// only specific methods are tested here
- assertNotNull(checkBox.getOptions());
+ assertNotNull(checkBox.getExportValues());
assertNotNull(checkBox.getValue());
// Test setting/getting option values - the dictionaries Opt entry
List<String> options = new ArrayList<String>();
options.add("Value01");
options.add("Value02");
- checkBox.setOptions(options);
+ checkBox.setExportValues(options);
COSArray optItem = (COSArray) checkBox.getCOSObject().getItem(COSName.OPT);
@@ -98,15 +98,15 @@ public class TestCheckBox extends TestCa
assertEquals(options.get(0), optItem.getString(0));
// assert that the values can be retrieved correctly
- List<String> retrievedOptions = checkBox.getOptions();
+ List<String> retrievedOptions = checkBox.getExportValues();
assertEquals(retrievedOptions.size(),2);
assertEquals(retrievedOptions, options);
// assert that the Opt entry is removed
- checkBox.setOptions(null);
+ checkBox.setExportValues(null);
assertNull(checkBox.getCOSObject().getItem(COSName.OPT));
// if there is no Opt entry an empty List shall be returned
- assertEquals(checkBox.getOptions(), new ArrayList<String>());
+ assertEquals(checkBox.getExportValues(), new ArrayList<String>());
}
finally
{
Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java?rev=1688770&r1=1688769&r2=1688770&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java Thu Jul 2 07:16:23 2015
@@ -83,14 +83,14 @@ public class TestRadioButtons extends Te
// only specific methods are tested here
assertNotNull(radioButton.getDefaultValue());
assertNotNull(radioButton.getExportValue());
- assertNotNull(radioButton.getOptions());
+ assertNotNull(radioButton.getExportValues());
assertNotNull(radioButton.getValue());
// Test setting/getting option values - the dictionaries Opt entry
List<String> options = new ArrayList<String>();
options.add("Value01");
options.add("Value02");
- radioButton.setOptions(options);
+ radioButton.setExportValues(options);
COSArray optItem = (COSArray) radioButton.getCOSObject().getItem(COSName.OPT);
@@ -100,15 +100,15 @@ public class TestRadioButtons extends Te
assertEquals(options.get(0), optItem.getString(0));
// assert that the values can be retrieved correctly
- List<String> retrievedOptions = radioButton.getOptions();
+ List<String> retrievedOptions = radioButton.getExportValues();
assertEquals(retrievedOptions.size(),2);
assertEquals(retrievedOptions, options);
// assert that the Opt entry is removed
- radioButton.setOptions(null);
+ radioButton.setExportValues(null);
assertNull(radioButton.getCOSObject().getItem(COSName.OPT));
// if there is no Opt entry an empty List shall be returned
- assertEquals(radioButton.getOptions(), new ArrayList<String>());
+ assertEquals(radioButton.getExportValues(), new ArrayList<String>());
}
finally
{