1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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 net.sf.jguiraffe.gui.builder.window;
17
18 /**
19 * <p>
20 * A very simple implementation of the <code>WindowClosingStrategy</code>
21 * interface.
22 * </p>
23 * <p>
24 * The {@link #canClose(Window)} method of this implementation returns always
25 * <b>true</b>. So an instance of this class can be used as a default window
26 * closing strategy that is used when no specific strategy was specified.
27 * </p>
28 *
29 * @author Oliver Heger
30 * @version $Id: InvariantWindowClosingStrategy.java 205 2012-01-29 18:29:57Z oheger $
31 */
32 public class InvariantWindowClosingStrategy implements WindowClosingStrategy
33 {
34 /**
35 * Stores the default instance of this class. Because this implementation is
36 * thread safe, it can be shared.
37 */
38 public static final InvariantWindowClosingStrategy DEFAULT_INSTANCE =
39 new InvariantWindowClosingStrategy();
40
41 /**
42 * Checks if the window can be closed. This implementation returns always
43 * <b>true</b>.
44 *
45 * @param window the affected window
46 * @return a flag if the window can be closed
47 */
48 public boolean canClose(Window window)
49 {
50 return true;
51 }
52 }