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 import org.apache.pivot.wtk.text.Node;
020
021 /**
022 * @author Andres Almiray
023 * @since 2.0.0
024 */
025 public class NodeAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.text.NodeListener {
026 private CallableWithArgs<Void> rangeInserted;
027 private CallableWithArgs<Void> rangeRemoved;
028 private CallableWithArgs<Void> nodeInserted;
029 private CallableWithArgs<Void> nodesRemoved;
030 private CallableWithArgs<Void> offsetChanged;
031 private CallableWithArgs<Void> parentChanged;
032
033 public CallableWithArgs<Void> getRangeInserted() {
034 return this.rangeInserted;
035 }
036
037 public CallableWithArgs<Void> getRangeRemoved() {
038 return this.rangeRemoved;
039 }
040
041 public CallableWithArgs<Void> getNodeInserted() {
042 return this.nodeInserted;
043 }
044
045 public CallableWithArgs<Void> getNodesRemoved() {
046 return this.nodesRemoved;
047 }
048
049 public CallableWithArgs<Void> getOffsetChanged() {
050 return this.offsetChanged;
051 }
052
053 public CallableWithArgs<Void> getParentChanged() {
054 return this.parentChanged;
055 }
056
057
058 public void setRangeInserted(CallableWithArgs<Void> rangeInserted) {
059 this.rangeInserted = rangeInserted;
060 }
061
062 public void setRangeRemoved(CallableWithArgs<Void> rangeRemoved) {
063 this.rangeRemoved = rangeRemoved;
064 }
065
066 public void setNodeInserted(CallableWithArgs<Void> nodeInserted) {
067 this.nodeInserted = nodeInserted;
068 }
069
070 public void setNodesRemoved(CallableWithArgs<Void> nodesRemoved) {
071 this.nodesRemoved = nodesRemoved;
072 }
073
074 public void setOffsetChanged(CallableWithArgs<Void> offsetChanged) {
075 this.offsetChanged = offsetChanged;
076 }
077
078 public void setParentChanged(CallableWithArgs<Void> parentChanged) {
079 this.parentChanged = parentChanged;
080 }
081
082
083 public void rangeInserted(org.apache.pivot.wtk.text.Node arg0, int arg1, int arg2) {
084 if (rangeInserted != null) {
085 rangeInserted.call(arg0, arg1, arg2);
086 }
087 }
088
089 public void rangeRemoved(org.apache.pivot.wtk.text.Node arg0, int arg1, int arg2) {
090 if (rangeRemoved != null) {
091 rangeRemoved.call(arg0, arg1, arg2);
092 }
093 }
094
095 public void nodeInserted(org.apache.pivot.wtk.text.Node arg0, int arg1) {
096 if (nodeInserted != null) {
097 nodeInserted.call(arg0, arg1);
098 }
099 }
100
101 public void nodesRemoved(org.apache.pivot.wtk.text.Node arg0, org.apache.pivot.collections.Sequence<Node> arg1, int arg2) {
102 if (nodesRemoved != null) {
103 nodesRemoved.call(arg0, arg1, arg2);
104 }
105 }
106
107 public void offsetChanged(org.apache.pivot.wtk.text.Node arg0, int arg1) {
108 if (offsetChanged != null) {
109 offsetChanged.call(arg0, arg1);
110 }
111 }
112
113 public void parentChanged(org.apache.pivot.wtk.text.Node arg0, org.apache.pivot.wtk.text.Element arg1) {
114 if (parentChanged != null) {
115 parentChanged.call(arg0, arg1);
116 }
117 }
118
119 }
|