001/*
002 * Copyright 2010-2015 Institut Pasteur.
003 * 
004 * This file is part of Icy.
005 * 
006 * Icy is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 * 
011 * Icy is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 * 
016 * You should have received a copy of the GNU General Public License
017 * along with Icy. If not, see <http://www.gnu.org/licenses/>.
018 */
019// ImageWindowMethods.java
020//
021
022/*
023 * ImageJ software for multidimensional image processing and analysis.
024 * 
025 * Copyright (c) 2010, ImageJDev.org.
026 * All rights reserved.
027 * 
028 * Redistribution and use in source and binary forms, with or without
029 * modification, are permitted provided that the following conditions are met:
030 * Redistributions of source code must retain the above copyright
031 * notice, this list of conditions and the following disclaimer.
032 * Redistributions in binary form must reproduce the above copyright
033 * notice, this list of conditions and the following disclaimer in the
034 * documentation and/or other materials provided with the distribution.
035 * Neither the names of the ImageJDev.org developers nor the
036 * names of its contributors may be used to endorse or promote products
037 * derived from this software without specific prior written permission.
038 * 
039 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
040 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
041 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
042 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
043 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
044 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
045 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
046 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
047 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
048 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
049 * POSSIBILITY OF SUCH DAMAGE.
050 */
051
052package icy.imagej.patches;
053
054import icy.imagej.ImageJWrapper;
055import icy.main.Icy;
056
057import java.awt.event.WindowEvent;
058
059import ij.WindowManager;
060import ij.gui.ImageWindow;
061
062/**
063 * Overrides {@link ImageWindow} methods.
064 * 
065 * @author Curtis Rueden
066 * @author Barry DeZonia
067 */
068public final class ImageWindowMethods
069{
070    private ImageWindowMethods()
071    {
072        // prevent instantiation of utility class
073    }
074
075    /** Replaces {@link ImageWindow#setVisible(boolean)}. */
076    public static void setVisible(final ImageWindow obj, final boolean visible)
077    {
078
079    }
080
081    /** Replaces {@link ImageWindow#show()}. */
082    public static void show(final ImageWindow obj)
083    {
084
085    }
086
087    /** Appends {@link ImageWindow#close()}. */
088    public static void close(final ImageWindow obj)
089    {
090
091    }
092
093    /** Appends {@link ImageWindow#windowActivated(WindowEvent)}. */
094    public static void windowActivated(final ImageWindow obj, WindowEvent e)
095    {
096        final ImageJWrapper ij = Icy.getMainInterface().getImageJ();
097
098        if (ij != null)
099            ij.setActiveImage(obj);
100    }
101
102    /** Appends {@link ImageWindow#windowClosed(WindowEvent)}. */
103    public static void windowClosed(final ImageWindow obj, WindowEvent e)
104    {
105        final ImageJWrapper ij = Icy.getMainInterface().getImageJ();
106
107        if (ij != null)
108            ij.setActiveImage(WindowManager.getCurrentWindow());
109    }
110}