Class PathInputPart
- java.lang.Object
-
- net.sf.okapi.common.uidescription.AbstractPart
-
- net.sf.okapi.common.uidescription.PathInputPart
-
- All Implemented Interfaces:
IParameterDescriptor
public class PathInputPart extends AbstractPart
UI part descriptor for a path. This UI part supports the following types: String and URI.Use
setForSaveAs(boolean)to specify if the path is for saving a file (by default it is assumed the path is for saving a file). That choice affect which browsing dialog is invoked when using the browse button.
-
-
Field Summary
-
Fields inherited from class net.sf.okapi.common.uidescription.AbstractPart
container, enabledOnSelection, labelFlushed, labelNextToInput, masterPart, paramDescriptor, vertical, withLabel
-
-
Constructor Summary
Constructors Constructor Description PathInputPart(ParameterDescriptor paramDescriptor, String browseTitle, boolean forSaveAs)Creates a new PathInputPart object with a given parameter descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckType()Checks the types supported by this UI part.StringgetBrowseTitle()Gets the title of the path browsing dialog.StringgetFilterExtensions()Gets the extensions to use for the browse filter.StringgetFilterNames()Gets the names to used for the browse filter.booleanisAllowEmpty()Indicates if the input text can be empty.booleanisForSaveAs()Indicates if the path is to save a file (vs to open one).voidsetAllowEmpty(boolean allowEmpty)Sets the flag indicating if the input text can be empty.voidsetBrowseFilters(String filterNames, String filterExtensions)Sets the names and extensions to use for the browse filter.voidsetBrowseTitle(String browseTitle)Sets the title of the path browsing dialog.voidsetForSaveAs(boolean forSaveAs)Sets the flag indicating if the path is to save a file (vs to open one).-
Methods inherited from class net.sf.okapi.common.uidescription.AbstractPart
getContainer, getDisplayName, getMasterPart, getName, getParent, getReadMethod, getShortDescription, getType, getWriteMethod, isEnabledOnSelection, isLabelFlushed, isLabelNextToInput, isVertical, isWithLabel, setContainer, setDisplayName, setLabelFlushed, setLabelNextToInput, setMasterPart, setShortDescription, setVertical, setWithLabel
-
-
-
-
Constructor Detail
-
PathInputPart
public PathInputPart(ParameterDescriptor paramDescriptor, String browseTitle, boolean forSaveAs)
Creates a new PathInputPart object with a given parameter descriptor.- Parameters:
paramDescriptor- the parameter descriptor for this UI part.browseTitle- the title to use for the path browsing dialog.forSaveAs- true if the path is to save a file (vs to open one).
-
-
Method Detail
-
checkType
protected void checkType()
Description copied from class:AbstractPartChecks the types supported by this UI part.- Overrides:
checkTypein classAbstractPart
-
getFilterNames
public String getFilterNames()
Gets the names to used for the browse filter.- Returns:
- the names to used for the browse filter.
-
getFilterExtensions
public String getFilterExtensions()
Gets the extensions to use for the browse filter.- Returns:
- the extensions to use for the browse filter.
-
setBrowseFilters
public void setBrowseFilters(String filterNames, String filterExtensions)
Sets the names and extensions to use for the browse filter. Both strings must have the same number of names/extensions parts separated by a \t. Use a semi-colon (;) to separate multiple extensions. For example:"Documents (*.txt;*.odt)\tAll Files (*.*)"and*.txt;*.odt\t*.*".- Parameters:
filterNames- the names to use for the browse filter.filterExtensions- the extensions to use for the browse filter.
-
getBrowseTitle
public String getBrowseTitle()
Gets the title of the path browsing dialog.- Returns:
- the title of the path browsing dialog.
-
setBrowseTitle
public void setBrowseTitle(String browseTitle)
Sets the title of the path browsing dialog.- Parameters:
browseTitle- the new title of the path browsing dialog.
-
isForSaveAs
public boolean isForSaveAs()
Indicates if the path is to save a file (vs to open one).- Returns:
- true if the path is to save a file (vs to open one).
-
setForSaveAs
public void setForSaveAs(boolean forSaveAs)
Sets the flag indicating if the path is to save a file (vs to open one).- Parameters:
forSaveAs- true if the path is to save a file (vs to open one).
-
isAllowEmpty
public boolean isAllowEmpty()
Indicates if the input text can be empty.- Returns:
- true if the input text can be empty, false otherwise.
-
setAllowEmpty
public void setAllowEmpty(boolean allowEmpty)
Sets the flag indicating if the input text can be empty.- Parameters:
allowEmpty- true if the input text can be empty, false otherwise.
-
-