001 /*
002 * Copyright 2008-2014 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package griffon.pivot.support.adapters;
017
018 import griffon.core.CallableWithArgs;
019
020 /**
021 * @author Andres Almiray
022 * @since 2.0.0
023 */
024 public class TreeViewNodeAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.TreeViewNodeListener {
025 private CallableWithArgs<Void> nodeInserted;
026 private CallableWithArgs<Void> nodesRemoved;
027 private CallableWithArgs<Void> nodeUpdated;
028 private CallableWithArgs<Void> nodesSorted;
029 private CallableWithArgs<Void> nodesCleared;
030
031 public CallableWithArgs<Void> getNodeInserted() {
032 return this.nodeInserted;
033 }
034
035 public CallableWithArgs<Void> getNodesRemoved() {
036 return this.nodesRemoved;
037 }
038
039 public CallableWithArgs<Void> getNodeUpdated() {
040 return this.nodeUpdated;
041 }
042
043 public CallableWithArgs<Void> getNodesSorted() {
044 return this.nodesSorted;
045 }
046
047 public CallableWithArgs<Void> getNodesCleared() {
048 return this.nodesCleared;
049 }
050
051
052 public void setNodeInserted(CallableWithArgs<Void> nodeInserted) {
053 this.nodeInserted = nodeInserted;
054 }
055
056 public void setNodesRemoved(CallableWithArgs<Void> nodesRemoved) {
057 this.nodesRemoved = nodesRemoved;
058 }
059
060 public void setNodeUpdated(CallableWithArgs<Void> nodeUpdated) {
061 this.nodeUpdated = nodeUpdated;
062 }
063
064 public void setNodesSorted(CallableWithArgs<Void> nodesSorted) {
065 this.nodesSorted = nodesSorted;
066 }
067
068 public void setNodesCleared(CallableWithArgs<Void> nodesCleared) {
069 this.nodesCleared = nodesCleared;
070 }
071
072
073 public void nodeInserted(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1, int arg2) {
074 if (nodeInserted != null) {
075 nodeInserted.call(arg0, arg1, arg2);
076 }
077 }
078
079 public void nodesRemoved(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1, int arg2, int arg3) {
080 if (nodesRemoved != null) {
081 nodesRemoved.call(arg0, arg1, arg2, arg3);
082 }
083 }
084
085 public void nodeUpdated(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1, int arg2) {
086 if (nodeUpdated != null) {
087 nodeUpdated.call(arg0, arg1, arg2);
088 }
089 }
090
091 public void nodesSorted(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1) {
092 if (nodesSorted != null) {
093 nodesSorted.call(arg0, arg1);
094 }
095 }
096
097 public void nodesCleared(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.collections.Sequence.Tree.Path arg1) {
098 if (nodesCleared != null) {
099 nodesCleared.call(arg0, arg1);
100 }
101 }
102
103 }
|