ElementAdapter.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 import org.apache.pivot.wtk.text.Node;
022 
023 /**
024  @author Andres Almiray
025  @since 2.0.0
026  */
027 public class ElementAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.text.ElementListener {
028     private CallableWithArgs<Void> nodeInserted;
029     private CallableWithArgs<Void> nodesRemoved;
030     private CallableWithArgs<Void> fontChanged;
031     private CallableWithArgs<Void> foregroundColorChanged;
032     private CallableWithArgs<Void> backgroundColorChanged;
033     private CallableWithArgs<Void> underlineChanged;
034     private CallableWithArgs<Void> strikethroughChanged;
035 
036     public CallableWithArgs<Void> getNodeInserted() {
037         return this.nodeInserted;
038     }
039 
040     public CallableWithArgs<Void> getNodesRemoved() {
041         return this.nodesRemoved;
042     }
043 
044     public CallableWithArgs<Void> getFontChanged() {
045         return this.fontChanged;
046     }
047 
048     public CallableWithArgs<Void> getForegroundColorChanged() {
049         return this.foregroundColorChanged;
050     }
051 
052     public CallableWithArgs<Void> getBackgroundColorChanged() {
053         return this.backgroundColorChanged;
054     }
055 
056     public CallableWithArgs<Void> getUnderlineChanged() {
057         return this.underlineChanged;
058     }
059 
060     public CallableWithArgs<Void> getStrikethroughChanged() {
061         return this.strikethroughChanged;
062     }
063 
064 
065     public void setNodeInserted(CallableWithArgs<Void> nodeInserted) {
066         this.nodeInserted = nodeInserted;
067     }
068 
069     public void setNodesRemoved(CallableWithArgs<Void> nodesRemoved) {
070         this.nodesRemoved = nodesRemoved;
071     }
072 
073     public void setFontChanged(CallableWithArgs<Void> fontChanged) {
074         this.fontChanged = fontChanged;
075     }
076 
077     public void setForegroundColorChanged(CallableWithArgs<Void> foregroundColorChanged) {
078         this.foregroundColorChanged = foregroundColorChanged;
079     }
080 
081     public void setBackgroundColorChanged(CallableWithArgs<Void> backgroundColorChanged) {
082         this.backgroundColorChanged = backgroundColorChanged;
083     }
084 
085     public void setUnderlineChanged(CallableWithArgs<Void> underlineChanged) {
086         this.underlineChanged = underlineChanged;
087     }
088 
089     public void setStrikethroughChanged(CallableWithArgs<Void> strikethroughChanged) {
090         this.strikethroughChanged = strikethroughChanged;
091     }
092 
093 
094     public void nodeInserted(org.apache.pivot.wtk.text.Element arg0, int arg1) {
095         if (nodeInserted != null) {
096             nodeInserted.call(arg0, arg1);
097         }
098     }
099 
100     public void nodesRemoved(org.apache.pivot.wtk.text.Element arg0, int arg1, org.apache.pivot.collections.Sequence<Node> arg2) {
101         if (nodesRemoved != null) {
102             nodesRemoved.call(arg0, arg1, arg2);
103         }
104     }
105 
106     public void fontChanged(org.apache.pivot.wtk.text.Element arg0, java.awt.Font arg1) {
107         if (fontChanged != null) {
108             fontChanged.call(arg0, arg1);
109         }
110     }
111 
112     public void foregroundColorChanged(org.apache.pivot.wtk.text.Element arg0, java.awt.Color arg1) {
113         if (foregroundColorChanged != null) {
114             foregroundColorChanged.call(arg0, arg1);
115         }
116     }
117 
118     public void backgroundColorChanged(org.apache.pivot.wtk.text.Element arg0, java.awt.Color arg1) {
119         if (backgroundColorChanged != null) {
120             backgroundColorChanged.call(arg0, arg1);
121         }
122     }
123 
124     public void underlineChanged(org.apache.pivot.wtk.text.Element arg0) {
125         if (underlineChanged != null) {
126             underlineChanged.call(arg0);
127         }
128     }
129 
130     public void strikethroughChanged(org.apache.pivot.wtk.text.Element arg0) {
131         if (strikethroughChanged != null) {
132             strikethroughChanged.call(arg0);
133         }
134     }
135 
136 }