01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.wicket.extensions.markup.html.tree.table;
18:
19: import javax.swing.tree.TreeNode;
20:
21: import org.apache.wicket.Component;
22: import org.apache.wicket.MarkupContainer;
23:
24: /**
25: * Convenience class for building tree columns, i.e. columns that contain the
26: * actual tree.
27: *
28: * @author Matej Knopp
29: */
30: public abstract class AbstractTreeColumn extends AbstractColumn {
31: /**
32: * Creates new column. Checks if the column is not aligned in middle. In
33: * case it is, throws an exception.
34: *
35: * @param location
36: * Specifies how the column should be aligned and what his size
37: * should be
38: *
39: * @param header
40: * Header caption
41: *
42: */
43: public AbstractTreeColumn(ColumnLocation location, String header) {
44: super (location, header);
45: }
46:
47: /**
48: * @see IColumn#newCell(MarkupContainer, String, TreeNode, int)
49: */
50: public Component newCell(MarkupContainer parent, String id,
51: TreeNode node, int level) {
52: return TreeTable.newTreeCell(parent, id, node, level,
53: new TreeTable.IRenderNodeCallback() {
54: private static final long serialVersionUID = 1L;
55:
56: public String renderNode(TreeNode node) {
57: return AbstractTreeColumn.this .renderNode(node);
58: }
59: }, getTreeTable());
60: }
61:
62: /**
63: * @see IColumn#newCell(TreeNode, int)
64: */
65: public IRenderable newCell(TreeNode node, int level) {
66: return null;
67: }
68:
69: /**
70: * Returns the string representation of the node.
71: *
72: * @param node
73: * The node
74: * @return The string representation of the node
75: */
76: public abstract String renderNode(TreeNode node);
77: }
|