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