org.pushingpixels.flamingo.api.bcb.core
protected class BreadcrumbMultiSvnSelector.PathCallback extends BreadcrumbBarCallBack<String>
BreadcrumbBarCallBack
.
This is tricky. Unlike other implementations that connect in the setup
method, this implementation connects when the first path selection is
done. The code in
BasicBreadcrumbBar.PopupAction.actionPerformed(ActionEvent) adds two
items - the selected SVN repository and the matching choices. The first
addition requires connecting to the selected repository, which is done
off EDT (using SwingWorker
). The second addition must wait until
the connection has been established since otherwise the repository is not
yet available. In order to make the second addition wait, we use a
CountDownLatch
.
It is CountDownLatch.countDown()
in the
SwingWorker.done()
that wraps the connection. The
BreadcrumbBarCallBack#getPathChoices(BreadcrumbItem[])
and
BreadcrumbBarCallBack#getLeafs(BreadcrumbItem[])
call
CountDownLatch.await()
on the same latch that blocks until the
connection is done. Since both these methods should be wrapped off EDT in
a separate SwingWorker
, this doesn't block the UI.
Modifier and Type | Field and Description |
---|---|
protected List<BreadcrumbMultiSvnSelector.SvnRepositoryInfo> |
repositories
Information on all the configured SVN repositories.
|
throwsExceptions
Constructor and Description |
---|
BreadcrumbMultiSvnSelector.PathCallback(BreadcrumbMultiSvnSelector.SvnRepositoryInfo... repoList)
Creates a new callback.
|
Modifier and Type | Method and Description |
---|---|
void |
addSvnRepositoryInfo(BreadcrumbMultiSvnSelector.SvnRepositoryInfo repositoryInfo)
Adds information on a new SVN repository.
|
InputStream |
getLeafContent(String leaf)
Returns the input stream with the leaf content.
|
List<StringValuePair<String>> |
getLeafs(List<BreadcrumbItem<String>> path)
Returns the choice element that corresponds to the specified path.
|
List<StringValuePair<String>> |
getPathChoices(List<BreadcrumbItem<String>> path)
Returns the choice element that corresponds to the specified path.
|
void |
setup()
Sets up the callback.
|
setThrowsExceptions
protected List<BreadcrumbMultiSvnSelector.SvnRepositoryInfo> repositories
public BreadcrumbMultiSvnSelector.PathCallback(BreadcrumbMultiSvnSelector.SvnRepositoryInfo... repoList)
repoList
- List of all SVN repositories.public void addSvnRepositoryInfo(BreadcrumbMultiSvnSelector.SvnRepositoryInfo repositoryInfo)
repositoryInfo
- public void setup()
BreadcrumbBarCallBack
setup
in class BreadcrumbBarCallBack<String>
public List<StringValuePair<String>> getPathChoices(List<BreadcrumbItem<String>> path) throws BreadcrumbBarException
BreadcrumbBarCallBack
null
should be returned. If path is
null
, the "root" elements should be returnedgetPathChoices
in class BreadcrumbBarCallBack<String>
path
- Breadcrumb bar path.BreadcrumbBarException
- Runtime exception that wraps the cause. Is thrown only when
BreadcrumbBarCallBack.setThrowsExceptions(boolean)
has been called with
true
parameter.public List<StringValuePair<String>> getLeafs(List<BreadcrumbItem<String>> path) throws BreadcrumbBarException
BreadcrumbBarCallBack
null
should be returned. If path is
null
, the "root" elements should be returnedgetLeafs
in class BreadcrumbBarCallBack<String>
path
- Breadcrumb bar path.BreadcrumbBarException
- Runtime exception that wraps the cause. Is thrown only when
BreadcrumbBarCallBack.setThrowsExceptions(boolean)
has been called with
true
parameter.public InputStream getLeafContent(String leaf) throws BreadcrumbBarException
BreadcrumbBarCallBack
null
if this is not applicable.getLeafContent
in class BreadcrumbBarCallBack<String>
leaf
- Leaf.null
if
this is not applicable.BreadcrumbBarException
- Runtime exception that wraps the cause. Is thrown only when
BreadcrumbBarCallBack.setThrowsExceptions(boolean)
has been called with
true
parameter.