ExpanderAdapter.java
001 /*
002  * Copyright 2008-2016 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.util.Vote;
020 
021 /**
022  @author Andres Almiray
023  @since 2.0.0
024  */
025 public class ExpanderAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.ExpanderListener {
026     private CallableWithArgs<Void> titleChanged;
027     private CallableWithArgs<Void> contentChanged;
028     private CallableWithArgs<Void> collapsibleChanged;
029     private CallableWithArgs<Vote> previewExpandedChange;
030     private CallableWithArgs<Void> expandedChangeVetoed;
031     private CallableWithArgs<Void> expandedChanged;
032 
033     public CallableWithArgs<Void> getTitleChanged() {
034         return this.titleChanged;
035     }
036 
037     public CallableWithArgs<Void> getContentChanged() {
038         return this.contentChanged;
039     }
040 
041     public CallableWithArgs<Void> getCollapsibleChanged() {
042         return this.collapsibleChanged;
043     }
044 
045     public CallableWithArgs<Vote> getPreviewExpandedChange() {
046         return this.previewExpandedChange;
047     }
048 
049     public CallableWithArgs<Void> getExpandedChangeVetoed() {
050         return this.expandedChangeVetoed;
051     }
052 
053     public CallableWithArgs<Void> getExpandedChanged() {
054         return this.expandedChanged;
055     }
056 
057 
058     public void setTitleChanged(CallableWithArgs<Void> titleChanged) {
059         this.titleChanged = titleChanged;
060     }
061 
062     public void setContentChanged(CallableWithArgs<Void> contentChanged) {
063         this.contentChanged = contentChanged;
064     }
065 
066     public void setCollapsibleChanged(CallableWithArgs<Void> collapsibleChanged) {
067         this.collapsibleChanged = collapsibleChanged;
068     }
069 
070     public void setPreviewExpandedChange(CallableWithArgs<Vote> previewExpandedChange) {
071         this.previewExpandedChange = previewExpandedChange;
072     }
073 
074     public void setExpandedChangeVetoed(CallableWithArgs<Void> expandedChangeVetoed) {
075         this.expandedChangeVetoed = expandedChangeVetoed;
076     }
077 
078     public void setExpandedChanged(CallableWithArgs<Void> expandedChanged) {
079         this.expandedChanged = expandedChanged;
080     }
081 
082 
083     public void titleChanged(org.apache.pivot.wtk.Expander arg0, java.lang.String arg1) {
084         if (titleChanged != null) {
085             titleChanged.call(arg0, arg1);
086         }
087     }
088 
089     public void contentChanged(org.apache.pivot.wtk.Expander arg0, org.apache.pivot.wtk.Component arg1) {
090         if (contentChanged != null) {
091             contentChanged.call(arg0, arg1);
092         }
093     }
094 
095     public void collapsibleChanged(org.apache.pivot.wtk.Expander arg0) {
096         if (collapsibleChanged != null) {
097             collapsibleChanged.call(arg0);
098         }
099     }
100 
101     public org.apache.pivot.util.Vote previewExpandedChange(org.apache.pivot.wtk.Expander arg0) {
102         if (previewExpandedChange != null) {
103             return previewExpandedChange.call(arg0);
104         }
105         return Vote.APPROVE;
106     }
107 
108     public void expandedChangeVetoed(org.apache.pivot.wtk.Expander arg0, org.apache.pivot.util.Vote arg1) {
109         if (expandedChangeVetoed != null) {
110             expandedChangeVetoed.call(arg0, arg1);
111         }
112     }
113 
114     public void expandedChanged(org.apache.pivot.wtk.Expander arg0) {
115         if (expandedChanged != null) {
116             expandedChanged.call(arg0);
117         }
118     }
119 
120 }