public final class DocumentSelectionOption extends Options.Option<DocumentSelectionOption.FolderOrDocuments,JPanel>
getDocuments() to get the list of selected documents because this will get the correct child documents
if a folder is selected.
A DocumentSelectionOption can be created using
Options.addDocumentSelectionOption
or
Options.addPrimerOption| Modifier and Type | Class and Description |
|---|---|
static interface |
DocumentSelectionOption.DoNotRememberInPreferences
An interface that documents used in a DocumentSelectionOption may implement so that the option doesn't cache their instance
and reuse it on future instances of these options.
|
static class |
DocumentSelectionOption.FolderOrDocuments
The value type for DocumentSelectionOption which represents either a list of selected documents or a single selected
folder which contains some documents of the correct type.
|
static class |
DocumentSelectionOption.OptionValueCreator
|
XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeROOT_ELEMENT_NAME| Modifier and Type | Method and Description |
|---|---|
protected JPanel |
createComponent()
Create a graphical component representing this option.
|
boolean |
getAllDocumentsUsedWhenNothingSelected()
Get whether all documents of the given type are used when nothing is selected.
|
List<AnnotatedPluginDocument> |
getDocuments()
Get the list of selected documents.
|
String |
getValueAsString(DocumentSelectionOption.FolderOrDocuments value)
Converts this value to a String suitable for returning from
Options.getValueAsString(String). |
DocumentSelectionOption.FolderOrDocuments |
getValueFromString(String value)
Convert a String into an instance of the object type used by this option.
|
protected void |
handleSetEnabled(JPanel component,
boolean enabled)
Set the enabled state of a component.
|
void |
setAllDocumentsUsedWhenNothingSelected(boolean allDocumentsUsedWhenNothingSelected)
Set whether all documents of the given type are used when nothing is selected.
|
void |
setAllowSearchCache(boolean allowSearchCache)
Set whether or not it is feasible for this document selection option to cache all potential documents from all databases in memory.
|
void |
setCanChooseNone(boolean canChooseNone)
Sets whether or not "None" is available as an option for the user to choose.
|
void |
setOptionValueCreator(DocumentSelectionOption.OptionValueCreator optionValueCreator)
Used to override the look of the OptionValues displayed in the combo box.
|
void |
setPreferenceKeyForChooserDialog(String preferenceKeyForChooserDialog)
Sets the preference key used for storing the user's preferred folder in the popup dialog for choosing documents.
|
protected void |
setValueOnComponent(JPanel component,
DocumentSelectionOption.FolderOrDocuments value)
Set the value on this component.
|
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
addChangeListener, addChildOptionsDependent, addDependent, fromXML, generateValidValue, getComponent, getDefaultValue, getDescription, getDescriptionAndState, getDisplayedLabel, getExtraPersistentInformation, getLabel, getName, getParentOptions, getPossibleValues, getValue, getValueAsString, getVerticalWeight, hideWarningMessage, isAdvanced, isEnabled, isFillHorizontalSpace, isProOnly, isRestoreDefaultApplies, isRestorePreferenceApplies, isSpanningComponent, isVisible, moveToOptions, removeChangeListener, restoreDefault, setAdvanced, setAlwaysUsesDefaultPreferenceLocation, setDefaultValue, setDescription, setDisabledValue, setEnabled, setExtraPersistentInformation, setFillHorizontalSpace, setHidden, setLabelComponent, setPreferredHeight, setPreferredWidth, setProOnly, setRestoreDefaultApplies, setRestorePreferenceApplies, setShouldSaveValue, setSpanningComponent, setValue, setValue, setValueFromString, setVerticalWeight, setVisible, setWarningMessage, shouldSaveValue, toStringpublic void setAllowSearchCache(boolean allowSearchCache)
allowSearchCache - whether or not it is feasible for this document selection option to cache all potential documents from all databases in memory.public void setPreferenceKeyForChooserDialog(String preferenceKeyForChooserDialog)
preferenceKeyForChooserDialog - a preference key used for storing the user's preferred folder in the popup dialog for choosing documentspublic void setAllDocumentsUsedWhenNothingSelected(boolean allDocumentsUsedWhenNothingSelected)
allowMultipleSelections is true
Defaults to falseallDocumentsUsedWhenNothingSelected - true if having no documents selected means that all documents will be usedpublic void setCanChooseNone(boolean canChooseNone)
canChooseNone - true if the user can choose "None" as an optionpublic void setOptionValueCreator(DocumentSelectionOption.OptionValueCreator optionValueCreator)
optionValueCreator - the optionValueCreatorpublic boolean getAllDocumentsUsedWhenNothingSelected()
getDocuments() will still return empty even if there are documents and this field is set to true.
It is up to calling code to interpret what the "empty" means.protected void handleSetEnabled(JPanel component, boolean enabled)
Options.OptionhandleSetEnabled in class Options.Option<DocumentSelectionOption.FolderOrDocuments,JPanel>component - the component to set the enabled state ofenabled - true if it should be enabledpublic String getValueAsString(DocumentSelectionOption.FolderOrDocuments value)
Options.OptionOptions.getValueAsString(String).
The String representation is also used for serialization of option values.
The default implementation just calls #Object#toString().
Options.Option.getValueFromString(String).getValueAsString in class Options.Option<DocumentSelectionOption.FolderOrDocuments,JPanel>value - the value to convert to a string.public DocumentSelectionOption.FolderOrDocuments getValueFromString(String value)
Options.OptionOptions.Option.getValueAsString(Object) .getValueFromString in class Options.Option<DocumentSelectionOption.FolderOrDocuments,JPanel>value - the string representation of the object valuepublic List<AnnotatedPluginDocument> getDocuments()
setAllDocumentsUsedWhenNothingSelected(boolean) has been called. It is up to the caller
to determine what an "empty" selection means.#protected void setValueOnComponent(JPanel component, DocumentSelectionOption.FolderOrDocuments value)
Options.OptionsetValueOnComponent in class Options.Option<DocumentSelectionOption.FolderOrDocuments,JPanel>component - a component return from Options.Option.createComponent()value - the value to set.protected JPanel createComponent()
Options.OptionOptions.Option.getValue().
The implementation is also responsible for making sure that the returned component
listens to any changes made to itself and
reflects those changes in the value of this option
using the Options.Option.setValue(Object) method.
This method will only be called once for each instance of an Option.
After it has been called, getComponent() will return a cached copy of it.createComponent in class Options.Option<DocumentSelectionOption.FolderOrDocuments,JPanel>public org.jdom.Element toXML()
XMLSerializableXMLSerializable.fromXML(org.jdom.Element) can completely
restore the objects representation.
It is recommended that the returned element use XMLSerializable.ROOT_ELEMENT_NAME as its name,
in which case it must not define an attribute called "type". In this case,
fromXML, will be called with an element whose name may differ from the element
return from this function. This recommendation allows a more compact representation
of the XML can be stored.
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally.
PluginDocument implementations of this method may choose to throw an XMLSerializationException,
enclosed in a RuntimeException.toXML in interface XMLSerializabletoXML in class Options.Option<DocumentSelectionOption.FolderOrDocuments,JPanel>