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