| 
01 /*02  * Copyright 2008-2015 the original author or authors.
 03  *
 04  * Licensed under the Apache License, Version 2.0 (the "License");
 05  * you may not use this file except in compliance with the License.
 06  * You may obtain a copy of the License at
 07  *
 08  *     http://www.apache.org/licenses/LICENSE-2.0
 09  *
 10  * Unless required by applicable law or agreed to in writing, software
 11  * distributed under the License is distributed on an "AS IS" BASIS,
 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  * See the License for the specific language governing permissions and
 14  * limitations under the License.
 15  */
 16 package griffon.pivot.support.adapters;
 17
 18 import griffon.core.CallableWithArgs;
 19 import org.apache.pivot.util.Vote;
 20
 21 /**
 22  * @author Andres Almiray
 23  * @since 2.0.0
 24  */
 25 public class DialogStateAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.DialogStateListener {
 26     private CallableWithArgs<Vote> previewDialogClose;
 27     private CallableWithArgs<Void> dialogCloseVetoed;
 28     private CallableWithArgs<Void> dialogClosed;
 29
 30     public CallableWithArgs<Vote> getPreviewDialogClose() {
 31         return this.previewDialogClose;
 32     }
 33
 34     public CallableWithArgs<Void> getDialogCloseVetoed() {
 35         return this.dialogCloseVetoed;
 36     }
 37
 38     public CallableWithArgs<Void> getDialogClosed() {
 39         return this.dialogClosed;
 40     }
 41
 42
 43     public void setPreviewDialogClose(CallableWithArgs<Vote> previewDialogClose) {
 44         this.previewDialogClose = previewDialogClose;
 45     }
 46
 47     public void setDialogCloseVetoed(CallableWithArgs<Void> dialogCloseVetoed) {
 48         this.dialogCloseVetoed = dialogCloseVetoed;
 49     }
 50
 51     public void setDialogClosed(CallableWithArgs<Void> dialogClosed) {
 52         this.dialogClosed = dialogClosed;
 53     }
 54
 55
 56     public org.apache.pivot.util.Vote previewDialogClose(org.apache.pivot.wtk.Dialog arg0, boolean arg1) {
 57         if (previewDialogClose != null) {
 58             return previewDialogClose.call(arg0, arg1);
 59         }
 60         return Vote.APPROVE;
 61     }
 62
 63     public void dialogCloseVetoed(org.apache.pivot.wtk.Dialog arg0, org.apache.pivot.util.Vote arg1) {
 64         if (dialogCloseVetoed != null) {
 65             dialogCloseVetoed.call(arg0, arg1);
 66         }
 67     }
 68
 69     public void dialogClosed(org.apache.pivot.wtk.Dialog arg0, boolean arg1) {
 70         if (dialogClosed != null) {
 71             dialogClosed.call(arg0, arg1);
 72         }
 73     }
 74
 75 }
 |