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