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 import java.io.File;
021
022 /**
023 * @author Andres Almiray
024 * @since 2.0.0
025 */
026 public class FileBrowserAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.FileBrowserListener {
027 private CallableWithArgs<Void> rootDirectoryChanged;
028 private CallableWithArgs<Void> selectedFileAdded;
029 private CallableWithArgs<Void> selectedFileRemoved;
030 private CallableWithArgs<Void> selectedFilesChanged;
031 private CallableWithArgs<Void> multiSelectChanged;
032 private CallableWithArgs<Void> disabledFileFilterChanged;
033
034 public CallableWithArgs<Void> getRootDirectoryChanged() {
035 return this.rootDirectoryChanged;
036 }
037
038 public CallableWithArgs<Void> getSelectedFileAdded() {
039 return this.selectedFileAdded;
040 }
041
042 public CallableWithArgs<Void> getSelectedFileRemoved() {
043 return this.selectedFileRemoved;
044 }
045
046 public CallableWithArgs<Void> getSelectedFilesChanged() {
047 return this.selectedFilesChanged;
048 }
049
050 public CallableWithArgs<Void> getMultiSelectChanged() {
051 return this.multiSelectChanged;
052 }
053
054 public CallableWithArgs<Void> getDisabledFileFilterChanged() {
055 return this.disabledFileFilterChanged;
056 }
057
058
059 public void setRootDirectoryChanged(CallableWithArgs<Void> rootDirectoryChanged) {
060 this.rootDirectoryChanged = rootDirectoryChanged;
061 }
062
063 public void setSelectedFileAdded(CallableWithArgs<Void> selectedFileAdded) {
064 this.selectedFileAdded = selectedFileAdded;
065 }
066
067 public void setSelectedFileRemoved(CallableWithArgs<Void> selectedFileRemoved) {
068 this.selectedFileRemoved = selectedFileRemoved;
069 }
070
071 public void setSelectedFilesChanged(CallableWithArgs<Void> selectedFilesChanged) {
072 this.selectedFilesChanged = selectedFilesChanged;
073 }
074
075 public void setMultiSelectChanged(CallableWithArgs<Void> multiSelectChanged) {
076 this.multiSelectChanged = multiSelectChanged;
077 }
078
079 public void setDisabledFileFilterChanged(CallableWithArgs<Void> disabledFileFilterChanged) {
080 this.disabledFileFilterChanged = disabledFileFilterChanged;
081 }
082
083
084 public void rootDirectoryChanged(org.apache.pivot.wtk.FileBrowser arg0, java.io.File arg1) {
085 if (rootDirectoryChanged != null) {
086 rootDirectoryChanged.call(arg0, arg1);
087 }
088 }
089
090 public void selectedFileAdded(org.apache.pivot.wtk.FileBrowser arg0, java.io.File arg1) {
091 if (selectedFileAdded != null) {
092 selectedFileAdded.call(arg0, arg1);
093 }
094 }
095
096 public void selectedFileRemoved(org.apache.pivot.wtk.FileBrowser arg0, java.io.File arg1) {
097 if (selectedFileRemoved != null) {
098 selectedFileRemoved.call(arg0, arg1);
099 }
100 }
101
102 public void selectedFilesChanged(org.apache.pivot.wtk.FileBrowser arg0, org.apache.pivot.collections.Sequence<File> arg1) {
103 if (selectedFilesChanged != null) {
104 selectedFilesChanged.call(arg0, arg1);
105 }
106 }
107
108 public void multiSelectChanged(org.apache.pivot.wtk.FileBrowser arg0) {
109 if (multiSelectChanged != null) {
110 multiSelectChanged.call(arg0);
111 }
112 }
113
114 public void disabledFileFilterChanged(org.apache.pivot.wtk.FileBrowser arg0, org.apache.pivot.util.Filter<File> arg1) {
115 if (disabledFileFilterChanged != null) {
116 disabledFileFilterChanged.call(arg0, arg1);
117 }
118 }
119
120 }
|