PromptAdapter.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 
022 /**
023  @author Andres Almiray
024  @since 2.0.0
025  */
026 public class PromptAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.PromptListener {
027     private CallableWithArgs<Void> messageTypeChanged;
028     private CallableWithArgs<Void> messageChanged;
029     private CallableWithArgs<Void> bodyChanged;
030     private CallableWithArgs<Void> optionInserted;
031     private CallableWithArgs<Void> optionsRemoved;
032     private CallableWithArgs<Void> selectedOptionChanged;
033 
034     public CallableWithArgs<Void> getMessageTypeChanged() {
035         return this.messageTypeChanged;
036     }
037 
038     public CallableWithArgs<Void> getMessageChanged() {
039         return this.messageChanged;
040     }
041 
042     public CallableWithArgs<Void> getBodyChanged() {
043         return this.bodyChanged;
044     }
045 
046     public CallableWithArgs<Void> getOptionInserted() {
047         return this.optionInserted;
048     }
049 
050     public CallableWithArgs<Void> getOptionsRemoved() {
051         return this.optionsRemoved;
052     }
053 
054     public CallableWithArgs<Void> getSelectedOptionChanged() {
055         return this.selectedOptionChanged;
056     }
057 
058 
059     public void setMessageTypeChanged(CallableWithArgs<Void> messageTypeChanged) {
060         this.messageTypeChanged = messageTypeChanged;
061     }
062 
063     public void setMessageChanged(CallableWithArgs<Void> messageChanged) {
064         this.messageChanged = messageChanged;
065     }
066 
067     public void setBodyChanged(CallableWithArgs<Void> bodyChanged) {
068         this.bodyChanged = bodyChanged;
069     }
070 
071     public void setOptionInserted(CallableWithArgs<Void> optionInserted) {
072         this.optionInserted = optionInserted;
073     }
074 
075     public void setOptionsRemoved(CallableWithArgs<Void> optionsRemoved) {
076         this.optionsRemoved = optionsRemoved;
077     }
078 
079     public void setSelectedOptionChanged(CallableWithArgs<Void> selectedOptionChanged) {
080         this.selectedOptionChanged = selectedOptionChanged;
081     }
082 
083 
084     public void messageTypeChanged(org.apache.pivot.wtk.Prompt arg0, org.apache.pivot.wtk.MessageType arg1) {
085         if (messageTypeChanged != null) {
086             messageTypeChanged.call(arg0, arg1);
087         }
088     }
089 
090     public void messageChanged(org.apache.pivot.wtk.Prompt arg0, java.lang.String arg1) {
091         if (messageChanged != null) {
092             messageChanged.call(arg0, arg1);
093         }
094     }
095 
096     public void bodyChanged(org.apache.pivot.wtk.Prompt arg0, org.apache.pivot.wtk.Component arg1) {
097         if (bodyChanged != null) {
098             bodyChanged.call(arg0, arg1);
099         }
100     }
101 
102     public void optionInserted(org.apache.pivot.wtk.Prompt arg0, int arg1) {
103         if (optionInserted != null) {
104             optionInserted.call(arg0, arg1);
105         }
106     }
107 
108     public void optionsRemoved(org.apache.pivot.wtk.Prompt arg0, int arg1, org.apache.pivot.collections.Sequence<?> arg2) {
109         if (optionsRemoved != null) {
110             optionsRemoved.call(arg0, arg1, arg2);
111         }
112     }
113 
114     public void selectedOptionChanged(org.apache.pivot.wtk.Prompt arg0, int arg1) {
115         if (selectedOptionChanged != null) {
116             selectedOptionChanged.call(arg0, arg1);
117         }
118     }
119 
120 }