TabPaneAdapter.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 import org.apache.pivot.wtk.Component;
021 
022 /**
023  @author Andres Almiray
024  @since 2.0.0
025  */
026 public class TabPaneAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.TabPaneListener {
027     private CallableWithArgs<Void> tabInserted;
028     private CallableWithArgs<Vote> previewRemoveTabs;
029     private CallableWithArgs<Void> removeTabsVetoed;
030     private CallableWithArgs<Void> tabsRemoved;
031     private CallableWithArgs<Void> tabDataRendererChanged;
032     private CallableWithArgs<Void> closeableChanged;
033     private CallableWithArgs<Void> collapsibleChanged;
034     private CallableWithArgs<Void> cornerChanged;
035 
036     public CallableWithArgs<Void> getTabInserted() {
037         return this.tabInserted;
038     }
039 
040     public CallableWithArgs<Vote> getPreviewRemoveTabs() {
041         return this.previewRemoveTabs;
042     }
043 
044     public CallableWithArgs<Void> getRemoveTabsVetoed() {
045         return this.removeTabsVetoed;
046     }
047 
048     public CallableWithArgs<Void> getTabsRemoved() {
049         return this.tabsRemoved;
050     }
051 
052     public CallableWithArgs<Void> getTabDataRendererChanged() {
053         return this.tabDataRendererChanged;
054     }
055 
056     public CallableWithArgs<Void> getCloseableChanged() {
057         return this.closeableChanged;
058     }
059 
060     public CallableWithArgs<Void> getCollapsibleChanged() {
061         return this.collapsibleChanged;
062     }
063 
064     public CallableWithArgs<Void> getCornerChanged() {
065         return this.cornerChanged;
066     }
067 
068 
069     public void setTabInserted(CallableWithArgs<Void> tabInserted) {
070         this.tabInserted = tabInserted;
071     }
072 
073     public void setPreviewRemoveTabs(CallableWithArgs<Vote> previewRemoveTabs) {
074         this.previewRemoveTabs = previewRemoveTabs;
075     }
076 
077     public void setRemoveTabsVetoed(CallableWithArgs<Void> removeTabsVetoed) {
078         this.removeTabsVetoed = removeTabsVetoed;
079     }
080 
081     public void setTabsRemoved(CallableWithArgs<Void> tabsRemoved) {
082         this.tabsRemoved = tabsRemoved;
083     }
084 
085     public void setTabDataRendererChanged(CallableWithArgs<Void> tabDataRendererChanged) {
086         this.tabDataRendererChanged = tabDataRendererChanged;
087     }
088 
089     public void setCloseableChanged(CallableWithArgs<Void> closeableChanged) {
090         this.closeableChanged = closeableChanged;
091     }
092 
093     public void setCollapsibleChanged(CallableWithArgs<Void> collapsibleChanged) {
094         this.collapsibleChanged = collapsibleChanged;
095     }
096 
097     public void setCornerChanged(CallableWithArgs<Void> cornerChanged) {
098         this.cornerChanged = cornerChanged;
099     }
100 
101 
102     public void tabInserted(org.apache.pivot.wtk.TabPane arg0, int arg1) {
103         if (tabInserted != null) {
104             tabInserted.call(arg0, arg1);
105         }
106     }
107 
108     public org.apache.pivot.util.Vote previewRemoveTabs(org.apache.pivot.wtk.TabPane arg0, int arg1, int arg2) {
109         if (previewRemoveTabs != null) {
110             return previewRemoveTabs.call(arg0, arg1, arg2);
111         }
112         return Vote.APPROVE;
113     }
114 
115     public void removeTabsVetoed(org.apache.pivot.wtk.TabPane arg0, org.apache.pivot.util.Vote arg1) {
116         if (removeTabsVetoed != null) {
117             removeTabsVetoed.call(arg0, arg1);
118         }
119     }
120 
121     public void tabsRemoved(org.apache.pivot.wtk.TabPane arg0, int arg1, org.apache.pivot.collections.Sequence<Component> arg2) {
122         if (tabsRemoved != null) {
123             tabsRemoved.call(arg0, arg1, arg2);
124         }
125     }
126 
127     public void tabDataRendererChanged(org.apache.pivot.wtk.TabPane arg0, org.apache.pivot.wtk.Button.DataRenderer arg1) {
128         if (tabDataRendererChanged != null) {
129             tabDataRendererChanged.call(arg0, arg1);
130         }
131     }
132 
133     public void closeableChanged(org.apache.pivot.wtk.TabPane arg0) {
134         if (closeableChanged != null) {
135             closeableChanged.call(arg0);
136         }
137     }
138 
139     public void collapsibleChanged(org.apache.pivot.wtk.TabPane arg0) {
140         if (collapsibleChanged != null) {
141             collapsibleChanged.call(arg0);
142         }
143     }
144 
145     public void cornerChanged(org.apache.pivot.wtk.TabPane arg0, org.apache.pivot.wtk.Component arg1) {
146         if (cornerChanged != null) {
147             cornerChanged.call(arg0, arg1);
148         }
149     }
150 
151 }