01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.model.tree;
14:
15: import javax.swing.JPopupMenu;
16:
17: import com.eviware.soapui.model.ModelItem;
18: import com.eviware.soapui.support.action.swing.ActionList;
19: import com.eviware.soapui.support.action.swing.ActionListBuilder;
20: import com.eviware.soapui.support.action.swing.ActionSupport;
21:
22: /**
23: * Base implementation of SoapUITreeNode interface
24: *
25: * @author Ole.Matzura
26: */
27:
28: public abstract class AbstractTreeNode<T extends ModelItem> implements
29: SoapUITreeNode {
30: private T modelItem;
31:
32: public AbstractTreeNode(T modelItem) {
33: this .modelItem = modelItem;
34: }
35:
36: public boolean valueChanged(Object newValue) {
37: return false;
38: }
39:
40: public boolean isLeaf() {
41: return getChildCount() == 0;
42: }
43:
44: public JPopupMenu getPopup() {
45: return ActionSupport.buildPopup(getActions());
46: }
47:
48: public ActionList getActions() {
49: return ActionListBuilder.buildActions(modelItem);
50: }
51:
52: public T getModelItem() {
53: return modelItem;
54: }
55:
56: public String toString() {
57: return modelItem.getName();
58: }
59:
60: public void reorder(boolean notify) {
61: }
62: }
|