All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.squirrel_sql.client.gui.mainframe.WidgetUtils Maven / Gradle / Ivy

Go to download

This is the jar that contains the main application classes which are very specific to SQuirreLSQL.

There is a newer version: 3.5.0
Show newest version
package net.sourceforge.squirrel_sql.client.gui.mainframe;

import net.sourceforge.squirrel_sql.client.gui.desktopcontainer.IWidget;
import net.sourceforge.squirrel_sql.fw.gui.GUIUtils;

import java.util.List;
import java.util.ArrayList;

public class WidgetUtils extends GUIUtils
{
   /**
	 * Return an array containing all JInternalFrame objects
    * that were passed in frames that are tool windows.
    *
    * @param	frames	JInternalFrame objects to be checked.
    */
   public static IWidget[] getOpenToolWindows(IWidget[] frames)
   {
      if (frames == null)
      {
         throw new IllegalArgumentException("null JInternalFrame[] passed");
      }
      List framesList = new ArrayList();
      for (int i = 0; i < frames.length; ++i)
      {
         IWidget fr = frames[i];
         if (fr.isToolWindow() && !fr.isClosed())
         {
            framesList.add(frames[i]);
         }
      }
      return framesList.toArray(new IWidget[framesList.size()]);
   }

   /**
	 * Return an array containing all JInternalFrame objects
    * that were passed in frames that are not tool windows.
    *
    * @param	frames	JInternalFrame objects to be checked.
    */
   public static IWidget[] getOpenNonToolWindows(IWidget[] frames)
   {
      if (frames == null)
      {
         throw new IllegalArgumentException("null JInternalFrame[] passed");
      }
      List framesList = new ArrayList();
      for (int i = 0; i < frames.length; ++i)
      {
         if (!frames[i].isToolWindow() && !frames[i].isClosed())
         {
            framesList.add(frames[i]);
         }
      }
      return framesList.toArray(new IWidget[framesList.size()]);
   }

   /**
	 * Return an array containing all JInternalFrame objects
    * that were passed in frames that are not tool windows.
    * and are not minimized.
    *
    * @param	frames	JInternalFrame objects to be checked.
    */
   public static IWidget[] getNonMinimizedNonToolWindows(IWidget[] frames)
   {
      if (frames == null)
      {
         throw new IllegalArgumentException("null JInternalFrame[] passed");
      }
      List framesList = new ArrayList();
      for (int i = 0; i < frames.length; ++i)
      {
         IWidget fr = frames[i];
         if (!fr.isToolWindow() && !fr.isClosed() && !fr.isIcon())
         {
            framesList.add(frames[i]);
         }
      }
      return framesList.toArray(new IWidget[framesList.size()]);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy