4740 |
05 Feb 09 |
nicklas |
1 |
/** |
4740 |
05 Feb 09 |
nicklas |
$Id$ |
4740 |
05 Feb 09 |
nicklas |
3 |
|
4740 |
05 Feb 09 |
nicklas |
Copyright (C) 2008 Nicklas Nordborg |
4740 |
05 Feb 09 |
nicklas |
5 |
|
4740 |
05 Feb 09 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
4740 |
05 Feb 09 |
nicklas |
Available at http://base.thep.lu.se/ |
4740 |
05 Feb 09 |
nicklas |
8 |
|
4740 |
05 Feb 09 |
nicklas |
BASE is free software; you can redistribute it and/or |
4740 |
05 Feb 09 |
nicklas |
modify it under the terms of the GNU General Public License |
4740 |
05 Feb 09 |
nicklas |
as published by the Free Software Foundation; either version 3 |
4740 |
05 Feb 09 |
nicklas |
of the License, or (at your option) any later version. |
4740 |
05 Feb 09 |
nicklas |
13 |
|
4740 |
05 Feb 09 |
nicklas |
BASE is distributed in the hope that it will be useful, |
4740 |
05 Feb 09 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4740 |
05 Feb 09 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4740 |
05 Feb 09 |
nicklas |
GNU General Public License for more details. |
4740 |
05 Feb 09 |
nicklas |
18 |
|
4740 |
05 Feb 09 |
nicklas |
You should have received a copy of the GNU General Public License |
4740 |
05 Feb 09 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4740 |
05 Feb 09 |
nicklas |
21 |
*/ |
4740 |
05 Feb 09 |
nicklas |
22 |
package net.sf.basedb.util.overview.loader; |
4740 |
05 Feb 09 |
nicklas |
23 |
|
4740 |
05 Feb 09 |
nicklas |
24 |
import net.sf.basedb.core.DbControl; |
4740 |
05 Feb 09 |
nicklas |
25 |
import net.sf.basedb.core.ItemNotFoundException; |
4740 |
05 Feb 09 |
nicklas |
26 |
import net.sf.basedb.util.overview.OverviewContext; |
4740 |
05 Feb 09 |
nicklas |
27 |
import net.sf.basedb.util.overview.Node; |
4740 |
05 Feb 09 |
nicklas |
28 |
|
4740 |
05 Feb 09 |
nicklas |
29 |
/** |
4740 |
05 Feb 09 |
nicklas |
A node loader implementation that doesn't load any nodes. |
4740 |
05 Feb 09 |
nicklas |
This may be useful for {@link NodeLoaderFactory} implementations |
4740 |
05 Feb 09 |
nicklas |
that wish to handle missing node loaders in the {@link |
4740 |
05 Feb 09 |
nicklas |
NodeLoaderFactory#createNodeLoader(Object)} method differently. Normally this should |
4740 |
05 Feb 09 |
nicklas |
result in an {@link ItemNotFoundException}, but an alternative approach may |
4740 |
05 Feb 09 |
nicklas |
be to return this loader which will effectively make an end-point in the |
4740 |
05 Feb 09 |
nicklas |
node tree. This node loader can't be used for root nodes and will throw |
4740 |
05 Feb 09 |
nicklas |
an {@link UnsupportedOperationException} if {@link |
4740 |
05 Feb 09 |
nicklas |
#createRootNode(DbControl, OverviewContext, Object)} is called. |
4740 |
05 Feb 09 |
nicklas |
39 |
|
4740 |
05 Feb 09 |
nicklas |
@author Nicklas |
4740 |
05 Feb 09 |
nicklas |
@version 2.10 |
4740 |
05 Feb 09 |
nicklas |
@base.modified $Date$ |
4740 |
05 Feb 09 |
nicklas |
43 |
*/ |
4740 |
05 Feb 09 |
nicklas |
44 |
public class NullNodeLoader<I> |
4740 |
05 Feb 09 |
nicklas |
45 |
implements NodeLoader<I> |
4740 |
05 Feb 09 |
nicklas |
46 |
{ |
4740 |
05 Feb 09 |
nicklas |
47 |
|
4740 |
05 Feb 09 |
nicklas |
48 |
public NullNodeLoader() |
4740 |
05 Feb 09 |
nicklas |
49 |
{} |
4740 |
05 Feb 09 |
nicklas |
50 |
|
4740 |
05 Feb 09 |
nicklas |
51 |
/* |
4740 |
05 Feb 09 |
nicklas |
From the NodeLoader interface |
4740 |
05 Feb 09 |
nicklas |
53 |
----------------------------- |
4740 |
05 Feb 09 |
nicklas |
54 |
*/ |
4740 |
05 Feb 09 |
nicklas |
55 |
/** |
4740 |
05 Feb 09 |
nicklas |
@return Always "null" |
4740 |
05 Feb 09 |
nicklas |
57 |
*/ |
4740 |
05 Feb 09 |
nicklas |
58 |
@Override |
4740 |
05 Feb 09 |
nicklas |
59 |
public Node createForwardNode(DbControl dc, OverviewContext context, Node parentNode) |
4740 |
05 Feb 09 |
nicklas |
60 |
{ |
4740 |
05 Feb 09 |
nicklas |
61 |
return null; |
4740 |
05 Feb 09 |
nicklas |
62 |
} |
4740 |
05 Feb 09 |
nicklas |
63 |
|
4740 |
05 Feb 09 |
nicklas |
64 |
/** |
4740 |
05 Feb 09 |
nicklas |
@return Always "null" |
4740 |
05 Feb 09 |
nicklas |
66 |
*/ |
4740 |
05 Feb 09 |
nicklas |
67 |
@Override |
4740 |
05 Feb 09 |
nicklas |
68 |
public Node createPropertyNode(DbControl dc, OverviewContext context, Node parentNode) |
4740 |
05 Feb 09 |
nicklas |
69 |
{ |
4740 |
05 Feb 09 |
nicklas |
70 |
return null; |
4740 |
05 Feb 09 |
nicklas |
71 |
} |
4740 |
05 Feb 09 |
nicklas |
72 |
|
4740 |
05 Feb 09 |
nicklas |
73 |
/** |
4740 |
05 Feb 09 |
nicklas |
@return Always "null" |
4740 |
05 Feb 09 |
nicklas |
75 |
*/ |
4740 |
05 Feb 09 |
nicklas |
76 |
@Override |
4740 |
05 Feb 09 |
nicklas |
77 |
public Node createReverseNode(DbControl dc, OverviewContext context, Node childNode) |
4740 |
05 Feb 09 |
nicklas |
78 |
{ |
4740 |
05 Feb 09 |
nicklas |
79 |
return null; |
4740 |
05 Feb 09 |
nicklas |
80 |
} |
4740 |
05 Feb 09 |
nicklas |
81 |
|
4740 |
05 Feb 09 |
nicklas |
82 |
/** |
4740 |
05 Feb 09 |
nicklas |
@throws UnsupportedOperationException Always |
4740 |
05 Feb 09 |
nicklas |
84 |
*/ |
4740 |
05 Feb 09 |
nicklas |
85 |
@Override |
4740 |
05 Feb 09 |
nicklas |
86 |
public Node createRootNode(DbControl dc, OverviewContext context, I item) |
4740 |
05 Feb 09 |
nicklas |
87 |
{ |
4740 |
05 Feb 09 |
nicklas |
88 |
throw new UnsupportedOperationException(); |
4740 |
05 Feb 09 |
nicklas |
89 |
} |
4740 |
05 Feb 09 |
nicklas |
90 |
|
4740 |
05 Feb 09 |
nicklas |
91 |
/** |
4740 |
05 Feb 09 |
nicklas |
@return Always "false" |
4740 |
05 Feb 09 |
nicklas |
93 |
*/ |
4740 |
05 Feb 09 |
nicklas |
94 |
@Override |
4740 |
05 Feb 09 |
nicklas |
95 |
public boolean loadChildNodes(DbControl dc, OverviewContext context, Node node) |
4740 |
05 Feb 09 |
nicklas |
96 |
{ |
6046 |
17 Apr 12 |
nicklas |
97 |
node.setChildrenLoaded(); |
4740 |
05 Feb 09 |
nicklas |
98 |
return false; |
4740 |
05 Feb 09 |
nicklas |
99 |
} |
4740 |
05 Feb 09 |
nicklas |
100 |
// ------------------------------------- |
4740 |
05 Feb 09 |
nicklas |
101 |
|
4740 |
05 Feb 09 |
nicklas |
102 |
} |