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