public class PaperCatalog extends Object implements PaperCatalogService
Constructor and Description |
---|
PaperCatalog()
Creates a new empty instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addFactory(PaperProvider factory)
Adds a factory (intended for use by the OSGi framework)
|
boolean |
addNewRollPaper(String name,
String desc,
Length across)
Adds a new roll paper to the collection.
|
boolean |
addNewSheetPaper(String name,
String desc,
Length width,
Length height)
Adds a new sheet paper to the collection.
|
boolean |
addNewTractorPaper(String name,
String desc,
Length across,
Length along)
Adds a new tractor paper to the collection.
|
Paper |
get(String identifier)
Gets a paper by identifier.
|
boolean |
isRemovable(Paper paper)
Returns true if the paper can be removed, false otherwise
|
Collection<Paper> |
list()
Lists all available papers.
|
Collection<Paper> |
list(PaperFilter filter)
Lists available papers that the filter accepts.
|
static PaperCatalog |
newInstance()
Creates a new PaperCatalog and populates it using the SPI
(java service provider interface).
|
boolean |
remove(Paper p)
Removes the specified paper from the collection.
|
void |
removeFactory(PaperProvider factory)
Removes a factory (intended for use by the OSGi framework)
|
boolean |
supportsUserPapers()
Returns true if user papers are supported, false otherwise.
|
public PaperCatalog()
public static PaperCatalog newInstance()
Creates a new PaperCatalog and populates it using the SPI (java service provider interface).
In an OSGi context, an instance should be retrieved using the service registry. It will be registered under the PaperCatalogService interface.
public void addFactory(PaperProvider factory)
factory
- the factory to addpublic void removeFactory(PaperProvider factory)
factory
- the factory to removepublic Paper get(String identifier)
PaperCatalogService
get
in interface PaperCatalogService
identifier
- the identifier of the paperpublic Collection<Paper> list()
PaperCatalogService
list
in interface PaperCatalogService
public Collection<Paper> list(PaperFilter filter)
PaperCatalogService
list
in interface PaperCatalogService
filter
- the filterpublic boolean supportsUserPapers()
PaperCatalogService
PaperCatalogService.addNewSheetPaper(String, String, Length, Length)
,
PaperCatalogService.addNewRollPaper(String, String, Length)
,
PaperCatalogService.addNewTractorPaper(String, String, Length, Length)
,
PaperCatalogService.isRemovable(Paper)
,
PaperCatalogService.remove(Paper)
should not be used.supportsUserPapers
in interface PaperCatalogService
public boolean addNewSheetPaper(String name, String desc, Length width, Length height)
PaperCatalogService
addNewSheetPaper
in interface PaperCatalogService
name
- the namedesc
- the descriptionwidth
- the widthheight
- the heightpublic boolean addNewTractorPaper(String name, String desc, Length across, Length along)
PaperCatalogService
addNewTractorPaper
in interface PaperCatalogService
name
- the namedesc
- the descriptionacross
- the length across the feedalong
- the length along the feedpublic boolean addNewRollPaper(String name, String desc, Length across)
PaperCatalogService
addNewRollPaper
in interface PaperCatalogService
name
- the namedesc
- the descriptionacross
- the length across the feedpublic boolean isRemovable(Paper paper)
PaperCatalogService
isRemovable
in interface PaperCatalogService
paper
- the paperpublic boolean remove(Paper p)
PaperCatalogService
remove
in interface PaperCatalogService
p
- the paper to remove