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