Class AutoLinkFormatter
- java.lang.Object
-
- net.sf.basedb.clients.web.formatter.AutoLinkFormatter
-
public class AutoLinkFormatter extends Object implements Formatter<BasicItem>
Formatter implementation that generates a HTML output trying to link items with best supported method depending on their type. Files are linked withBase.getLinkedFile(String, File, boolean, boolean, boolean, String)
and with aFileViewerUtil
if it is available Nameable items are linked withBase.getLinkedName(String, Nameable, boolean, boolean)
Other items are linked withBase.getLink(String, String, Item, int, boolean)
- Since:
- 3.17
- Author:
- nicklas
- See Also:
Base.getLinkedFile(String, File, boolean, boolean, boolean, String)
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
enableEditLink
private boolean
enableViewDownload
private FileViewerUtil
fileViewer
-
Constructor Summary
Constructors Constructor Description AutoLinkFormatter()
AutoLinkFormatter(boolean enableEditLink, boolean enableViewDownload)
AutoLinkFormatter(FileViewerUtil fileViewer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(BasicItem item)
Format a value by converting it to a string.File
parseString(String value)
Parse a string and return a value of the correct type.
-
-
-
Field Detail
-
enableEditLink
private final boolean enableEditLink
-
enableViewDownload
private final boolean enableViewDownload
-
fileViewer
private final FileViewerUtil fileViewer
-
-
Constructor Detail
-
AutoLinkFormatter
public AutoLinkFormatter()
-
AutoLinkFormatter
public AutoLinkFormatter(FileViewerUtil fileViewer)
-
AutoLinkFormatter
public AutoLinkFormatter(boolean enableEditLink, boolean enableViewDownload)
-
-
Method Detail
-
format
public String format(BasicItem item)
Description copied from interface:Formatter
Format a value by converting it to a string.
-
parseString
public File parseString(String value)
Description copied from interface:Formatter
Parse a string and return a value of the correct type. A null input string should (unless otherwise documented by a specific formatter implementation) be allowed and may return null or any other "default" value.- Specified by:
parseString
in interfaceFormatter<BasicItem>
- Parameters:
value
- The string to parse- Returns:
- An object
-
-