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