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 import org.apache.pivot.wtk.Component;
020 import org.apache.pivot.wtk.Form;
021
022 /**
023 * @author Andres Almiray
024 * @since 2.0.0
025 */
026 public class FormAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.FormListener {
027 private CallableWithArgs<Void> sectionInserted;
028 private CallableWithArgs<Void> sectionsRemoved;
029 private CallableWithArgs<Void> sectionHeadingChanged;
030 private CallableWithArgs<Void> fieldInserted;
031 private CallableWithArgs<Void> fieldsRemoved;
032
033 public CallableWithArgs<Void> getSectionInserted() {
034 return this.sectionInserted;
035 }
036
037 public CallableWithArgs<Void> getSectionsRemoved() {
038 return this.sectionsRemoved;
039 }
040
041 public CallableWithArgs<Void> getSectionHeadingChanged() {
042 return this.sectionHeadingChanged;
043 }
044
045 public CallableWithArgs<Void> getFieldInserted() {
046 return this.fieldInserted;
047 }
048
049 public CallableWithArgs<Void> getFieldsRemoved() {
050 return this.fieldsRemoved;
051 }
052
053
054 public void setSectionInserted(CallableWithArgs<Void> sectionInserted) {
055 this.sectionInserted = sectionInserted;
056 }
057
058 public void setSectionsRemoved(CallableWithArgs<Void> sectionsRemoved) {
059 this.sectionsRemoved = sectionsRemoved;
060 }
061
062 public void setSectionHeadingChanged(CallableWithArgs<Void> sectionHeadingChanged) {
063 this.sectionHeadingChanged = sectionHeadingChanged;
064 }
065
066 public void setFieldInserted(CallableWithArgs<Void> fieldInserted) {
067 this.fieldInserted = fieldInserted;
068 }
069
070 public void setFieldsRemoved(CallableWithArgs<Void> fieldsRemoved) {
071 this.fieldsRemoved = fieldsRemoved;
072 }
073
074
075 public void sectionInserted(org.apache.pivot.wtk.Form arg0, int arg1) {
076 if (sectionInserted != null) {
077 sectionInserted.call(arg0, arg1);
078 }
079 }
080
081 public void sectionsRemoved(org.apache.pivot.wtk.Form arg0, int arg1, org.apache.pivot.collections.Sequence<Form.Section> arg2) {
082 if (sectionsRemoved != null) {
083 sectionsRemoved.call(arg0, arg1, arg2);
084 }
085 }
086
087 public void sectionHeadingChanged(org.apache.pivot.wtk.Form.Section arg0) {
088 if (sectionHeadingChanged != null) {
089 sectionHeadingChanged.call(arg0);
090 }
091 }
092
093 public void fieldInserted(org.apache.pivot.wtk.Form.Section arg0, int arg1) {
094 if (fieldInserted != null) {
095 fieldInserted.call(arg0, arg1);
096 }
097 }
098
099 public void fieldsRemoved(org.apache.pivot.wtk.Form.Section arg0, int arg1, org.apache.pivot.collections.Sequence<Component> arg2) {
100 if (fieldsRemoved != null) {
101 fieldsRemoved.call(arg0, arg1, arg2);
102 }
103 }
104
105 }
|