Class FilteredDocument
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable
,Document
,Item
,MetadataProvider
,PermissionsProvider<Document>
,PropertiesProvider
,SerializableDocument
Document
implementation that allows to apply a filter on its Pages
.
Since the list of pages is represented by a Glazedlists FilterList, filtering is applied by setting a Matcher or a MatcherEditor, using the existing API of the FilterList.
The underlying original ("unfiltered") Document can be accessed by getDelegate() any time.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.levigo.jadice.document.Document
Document.BasicState, Document.State
-
Field Summary
Fields inherited from interface com.levigo.jadice.document.Document
BASE_RESOLUTION, PROPERTY_KEY_DISPLAY_NAME, PROPERTY_KEY_DOCUMENT_ID, PROPERTY_KEY_FILE_NAME, PROPERTY_NAME, PROPERTY_PREFIX_PAGE, PROPERTY_PREFIX_USER_PROPERTY, PROPERTY_STATE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDocumentInterceptor
(DocumentInterceptor interceptor) Register aDocumentInterceptor
to this document instance.void
addDocumentListener
(DocumentListener listener) Register aDocumentListener
to this document instance.boolean
close()
Closes aDocument
.void
dispose()
Disposes of aDocument
performing necessary clean-up tasks.com.levigo.jadice.web.shared.model.serveroperation.internal.ChangeSet<Page>
Access the underlying original ("unfiltered") Document.getDelegatePage
(int pageIndex) Finds a page in the original document, given by its page index.Return the exposed meta-data ornull
if no meta-data is available.getName()
Gets the document's name.com.levigo.jadice.web.shared.model.internal.ReadStructure
getPage
(int pageIndex) Convenience method: return the page at the given page index.getPage
(int pageIndex, boolean create) Return the page at the given page index.int
Convenience method: determine the number of pages in this document.int
getPageIndex
(Page page) Convenience method: determine the index of a page in this document.org.jadice.util.glazedlists.EventList<Page>
getPages()
Returns a list of pages in the document.Return a map of user properties.getState()
void
init()
boolean
Return whether or not thisDocument
has been disposed of.void
removeDocumentInterceptor
(DocumentInterceptor interceptor) Unregister aDocumentInterceptor
from this document.void
removeDocumentListener
(DocumentListener listener) Unregister aDocumentListener
from this document.void
setMatcher
(org.jadice.util.glazedlists.matchers.Matcher<? super Page> matcher) Since the list of Pages is represented by a Glazedlists FilterList, filtering is applied by setting a Matcher or a MatcherEditor, using the existing API of the FilterList.void
setMatcherEditor
(org.jadice.util.glazedlists.matchers.MatcherEditor<? super Page> editor) Since the list of Pages is represented by a Glazedlists FilterList, filtering is applied by setting a Matcher or a MatcherEditor, using the existing API of the FilterList.void
Sets the document's name.boolean
setState
(Document.State state) Sets the current state of theDocument
.
-
Constructor Details
-
Method Details
-
init
public void init() -
addDocumentListener
Description copied from interface:Document
Register aDocumentListener
to this document instance.- Specified by:
addDocumentListener
in interfaceDocument
- Parameters:
listener
- the listener to register
-
addDocumentInterceptor
Description copied from interface:Document
Register aDocumentInterceptor
to this document instance.- Specified by:
addDocumentInterceptor
in interfaceDocument
- Parameters:
interceptor
- the interceptor to register
-
close
public boolean close()Description copied from interface:Document
Closes aDocument
. This includes performing a state transition toDocument.BasicState.CLOSED
and cleaning up resources. Both will only happen if all registeredDocumentInterceptor
s agree with the state change. In usual cases, this method should be preferred to callingDocument.dispose()
. -
dispose
public void dispose()Description copied from interface:Document
Disposes of a
Document
performing necessary clean-up tasks. DisposedDocument
s will haveDocument.BasicState.CLOSED
as theirDocument.State
. This method is not expected to ask registeredDocumentInterceptor
s for their consent about the state transition.DocumentListener
s may or may not be informed about the state change. In most cases,Document.close()
should be used instead of this method.Since cleaning up releases any resources held by this
Document
, it will no longer be practically useful afterwards. ADocument
which has been disposed of will refuse further changes on itself and may throw Exceptions if methods are called.Before calling dispose it is for this reason important to make sure that the
Document
to be disposed of is not registered with any other (GUI or non-GUI) component which might call methods later on. -
isDisposed
public boolean isDisposed()Description copied from interface:Document
Return whether or not thisDocument
has been disposed of. DisposedDocument
s will refuse further changes on themselves. Method calls on them may result in Exceptions being thrown.- Specified by:
isDisposed
in interfaceDocument
- Returns:
true
if thisDocument
has been disposed of and all of its resources have been cleaned up.false
if thisDocument
has not yet been disposed of and is therefore fully usable.- See Also:
-
getName
Description copied from interface:Document
Gets the document's name. -
getPage
Description copied from interface:Document
Convenience method: return the page at the given page index. Equivalent to
. As an added convenience, callers need not lock the page list in order to be thread-safe.Document.getPages()
.get(pageNumber) -
getDelegatePage
Finds a page in the original document, given by its page index. Attention: The page index refers to the original document!- Parameters:
pageIndex
- The index of the page in the unfiltered document- Returns:
- The Page specified by the given index in the unfiltered document
-
getPage
Description copied from interface:Document
Return the page at the given page index. Create it, if there is no page at this index at this point. As an added convenience, callers need not lock the page list in order to be thread-safe. -
getPageCount
public int getPageCount()Description copied from interface:Document
Convenience method: determine the number of pages in this document. Equivalent to
. As an added convenience, callers need not lock the page list in order to be thread-safe.Document.getPages()
.size()- Specified by:
getPageCount
in interfaceDocument
- Returns:
- int the page number count
-
getPageIndex
Description copied from interface:Document
Convenience method: determine the index of a page in this document. Equivalent to
. As an added convenience, callers need not lock the page list in order to be thread-safe.Document.getPages()
.indexOf(page)- Specified by:
getPageIndex
in interfaceDocument
- Parameters:
page
- to search for- Returns:
- int the page number of the given page in this document, or -1 if this document does not contain the page
-
getPages
Description copied from interface:Document
Returns a list of pages in the document. Please note that, unless stated otherwise by implementors, this list is not thread-safe. Care must therefore be taken to manipulate the page list with appropriate locking as detailed in the documentation ofEventList
. As a convenience, a non-thread-safe page list may be wrapped usingGlazedLists.threadSafeList(EventList)
to obtain a thread-safe one. -
removeDocumentListener
Description copied from interface:Document
Unregister aDocumentListener
from this document.- Specified by:
removeDocumentListener
in interfaceDocument
- Parameters:
listener
- the listener to remove
-
removeDocumentInterceptor
Description copied from interface:Document
Unregister aDocumentInterceptor
from this document.- Specified by:
removeDocumentInterceptor
in interfaceDocument
- Parameters:
interceptor
- the interceptor to remove
-
setName
Description copied from interface:Document
Sets the document's name. -
getState
-
setState
Description copied from interface:Document
Sets the current state of the
Document
.The document
Document.State
is not only a simple information about a document instance, but also it provides the decision base of the enabled state for many document functionalities. If the document state is not set or is set to a wrong state, these functionalities may become disabled or fail to execute. Registered interceptors may disapprove state changes. Therefore the requested state is not necessarily the actual next state. -
getPermissions
- Specified by:
getPermissions
in interfacePermissionsProvider<Document>
-
getProperties
Description copied from interface:PropertiesProvider
Return a map of user properties. What to store and which keys to use is largely up to the user of classes implementing this interface, since those classes will generally be oblivious to the map's contents. There are no guarantees regarding the thread-safety of the returned map, unless otherwise specified by implementors.- Specified by:
getProperties
in interfacePropertiesProvider
- Returns:
- the map of user properties
-
getMetadata
Description copied from interface:MetadataProvider
Return the exposed meta-data ornull
if no meta-data is available. An object being a MetadataProvider is not required to provide a non-null
meta-data.- Specified by:
getMetadata
in interfaceMetadataProvider
- Returns:
- the metadata document or
null
-
getOriginalReadStructure
public com.levigo.jadice.web.shared.model.internal.ReadStructure getOriginalReadStructure()- Specified by:
getOriginalReadStructure
in interfaceSerializableDocument
-
getChangeSet
- Specified by:
getChangeSet
in interfaceSerializableDocument
-
setMatcher
Since the list of Pages is represented by a Glazedlists FilterList, filtering is applied by setting a Matcher or a MatcherEditor, using the existing API of the FilterList.- Parameters:
matcher
- The new Matcher to use- See Also:
-
setMatcherEditor
public void setMatcherEditor(org.jadice.util.glazedlists.matchers.MatcherEditor<? super Page> editor) Since the list of Pages is represented by a Glazedlists FilterList, filtering is applied by setting a Matcher or a MatcherEditor, using the existing API of the FilterList.- Parameters:
editor
- The new Editor to use- See Also:
-
getDelegate
Access the underlying original ("unfiltered") Document.- Returns:
- the original Document (without any filtering applied to the document)
-