gt:         if (OPEN_ICON == null) OPEN_ICON = loadIconResource("open.png");
context: // Copyright (C) 2002-2015 Tuma Solutions, LLC
  // Team Functionality Add-ons for the Process Dashboard
  //
  // This program is free software; you can redistribute it and/or
  // modify it under the terms of the GNU General Public License
  // as published by the Free Software Foundation; either version 3
  // of the License, or (at your option) any later version.
  //
  // Additional permissions also apply; see the README-license.txt
  // file in the project root directory for more information.
  //
  // This program is distributed in the hope that it will be useful,
  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  // GNU General Public License for more details.
  //
  // You should have received a copy of the GNU General Public License
  // along with this program; if not, see <http://www.gnu.org/licenses/>.
  //
  // The author(s) may be contacted at:
  //     processdash@tuma-solutions.com
  //     processdash-devel@lists.sourceforge.net
  
  
  package teamdash.wbs;
  
  import java.awt.Color;
  import java.awt.Component;
  import java.awt.GradientPaint;
  import java.awt.Graphics;
  import java.awt.Graphics2D;
  import java.awt.Image;
  import java.awt.RenderingHints;
  import java.awt.Toolkit;
  import java.awt.image.BufferedImage;
  import java.awt.image.FilteredImageSource;
  import java.awt.image.ImageProducer;
  import java.awt.image.RGBImageFilter;
  import java.util.HashMap;
  import java.util.Map;
  
  import javax.swing.GrayFilter;
  import javax.swing.Icon;
  import javax.swing.ImageIcon;
  
  /** Factory for icons used by the WBSEditor and its components.
   */
  public class IconFactory {
  
      private static final Color DEFAULT_COLOR = new Color(204, 204, 255);
  
      // This class is a singleton.
      private IconFactory() {}
  
  
  
      // Icons to depict various type of nodes in the work breakdown structure
  
      public static Icon getProjectIcon() {
          return new ProjectIcon(DEFAULT_COLOR);
      }
  
      public static Icon getCommonWorkflowsIcon() {
          return new CommonWorkflowsIcon(DEFAULT_COLOR);
      }
  
      public static Icon getWorkflowIcon() {
          return new WorkflowIcon(DEFAULT_COLOR);
      }
  
      public static Icon getWorkflowTaskIcon(Color fill) {
          return new WorkflowTaskIcon(fill);
      }
  
      public static Icon getComponentIcon() {
          return new ComponentIcon(DEFAULT_COLOR);
      }
  
      public static Icon getComponentIcon(Color fill) {
          return new ComponentIcon(fill);
      }
  
      public static Icon getSoftwareComponentIcon() {
          return new SoftwareComponentIcon(DEFAULT_COLOR);
      }
  
      public static Icon getDocumentIcon(Color highlight) {
          return new DocumentIcon(highlight);
      }
  
      public static Icon getTaskIcon(Color fill) {
          return new TaskIcon(fill);
      }
  
      public static Icon getPSPTaskIcon(Color fill) {
          return new PSPTaskIcon(fill);
      }
  
      public static Icon getProbeTaskIcon() {
          return new ProbeTaskIcon();
      }
  
      public static Icon getProxyListIcon() {
          return new CommonWorkflowsIcon(DEFAULT_COLOR);
      }
  
      public static Icon getProxyTableIcon() {
          return loadIconResource("proxy-table.png");
      }
  
      public static Icon getProxyBucketIcon(int height) {
          return new ProxyBucketIcon(height, new Color(230, 173, 124));
      }
  
      public static Icon getCopyProxyIcon() {
          return loadIconResource("proxy-copy.png");
      }
  
      public static Icon getPasteProxyIcon() {
          return loadIconResource("proxy-paste.png");
      }
  
      public static Icon getMilestoneIcon() {
          return new MilestoneIcon(DEFAULT_COLOR);
      }
  
      public static Icon getPlusIcon() {
          return PLUS_ICON;
      }
      private static final Icon PLUS_ICON = new PlusIcon();
  
      public static Icon getMinusIcon() {
          return MINUS_ICON;
      }
      private static final Icon MINUS_ICON = new MinusIcon();
  
      public static Icon getEmptyIcon(int width, int height) {
          return new EmptyIcon(width, height);
      }
  
  
  
      // Icons used in toolbars and menus
  
      public static Icon getUndoIcon() {
          if (UNDO_ICON == null) UNDO_ICON = loadIconResource("undo.png");
          return UNDO_ICON;
      }
      private static Icon UNDO_ICON = null;
  
      public static Icon getRedoIcon() {
          if (REDO_ICON == null) REDO_ICON = loadIconResource("redo.png");
          return REDO_ICON;
      }
      private static Icon REDO_ICON = null;
  
      public static Icon getPromoteIcon() {
          if (PROMOTE_ICON == null) PROMOTE_ICON = loadIconResource("promote.png");
          return PROMOTE_ICON;
      }
      private static Icon PROMOTE_ICON = null;
  
      public static Icon getDemoteIcon() {
          if (DEMOTE_ICON == null) DEMOTE_ICON = loadIconResource("demote.png");
          return DEMOTE_ICON;
      }
      private static Icon DEMOTE_ICON = null;
  
      public static Icon getMoveUpIcon() {
          if (MOVE_UP_ICON == null) MOVE_UP_ICON = loadIconResource("moveup.png");
          return MOVE_UP_ICON;
      }
      private static Icon MOVE_UP_ICON = null;
  
      public static Icon getMoveDownIcon() {
          if (MOVE_DOWN_ICON == null) MOVE_DOWN_ICON = loadIconResource("movedown.png");
          return MOVE_DOWN_ICON;
      }
      private static Icon MOVE_DOWN_ICON = null;
  
      public static Icon getCutIcon() {
          if (CUT_ICON == null) CUT_ICON = loadIconResource("cut.gif");
          return CUT_ICON;
      }
      private static Icon CUT_ICON = null;
  
      public static Icon getCopyIcon() {
          if (COPY_ICON == null) COPY_ICON = loadIconResource("copy.png");
          return COPY_ICON;
      }
      private static Icon COPY_ICON = null;
  
      public static Icon getCopyMilestoneIcon() {
          if (COPY_MS_ICON == null) COPY_MS_ICON = loadIconResource("copyms.png");
          return COPY_MS_ICON;
      }
      private static Icon COPY_MS_ICON = null;
  
      public static Icon getPasteIcon() {
          if (PASTE_ICON == null) PASTE_ICON = loadIconResource("paste.png");
          return PASTE_ICON;
      }
      private static Icon PASTE_ICON = null;
  
      public static Icon getPasteMilestoneIcon() {
          if (PASTE_MS_ICON == null) PASTE_MS_ICON = loadIconResource("pastems.png");
          return PASTE_MS_ICON;
      }
      private static Icon PASTE_MS_ICON = null;
  
      public static Icon getDeleteIcon() {
          if (DELETE_ICON == null) DELETE_ICON = loadIconResource("delete.png");
          return DELETE_ICON;
      }
      private static Icon DELETE_ICON = null;
  
      public static Icon getFindIcon() {
          if (FIND_ICON == null) FIND_ICON = loadIconResource("find.png");
          return FIND_ICON;
      }
      private static Icon FIND_ICON = null;
  
      public static Icon getFilterOnIcon() {
          if (FILTER_ON_ICON == null) FILTER_ON_ICON = loadIconResource("filter-on.png");
          return FILTER_ON_ICON;
      }
      private static Icon FILTER_ON_ICON = null;
  
      public static Icon getFilterOffIcon() {
          if (FILTER_OFF_ICON == null) FILTER_OFF_ICON = loadIconResource("filter-off.png");
          return FILTER_OFF_ICON;
      }
      private static Icon FILTER_OFF_ICON = null;
  
      public static Icon getFilterDeleteIcon() {
          if (FILTER_DELETE_ICON == null) FILTER_DELETE_ICON = loadIconResource("filter-delete.png");
          return FILTER_DELETE_ICON;
      }
      private static Icon FILTER_DELETE_ICON = null;
  
      public static Icon getInsertOnEnterIcon() {
          if (INSERT_ON_ENTER_ICON == null)
              INSERT_ON_ENTER_ICON = loadIconResource("enter-key-insert-on.png");
          return INSERT_ON_ENTER_ICON;
      }
      private static Icon INSERT_ON_ENTER_ICON = null;
  
      public static Icon getNoInsertOnEnterIcon() {
          if (NO_INSERT_ON_ENTER_ICON == null)
              NO_INSERT_ON_ENTER_ICON = loadIconResource("enter-key-insert-off.png");
          return NO_INSERT_ON_ENTER_ICON;
      }
      private static Icon NO_INSERT_ON_ENTER_ICON = null;
  
      public static Icon getNewTabIcon() {
          if (NEW_TAB_ICON == null) NEW_TAB_ICON = loadIconResource("tab-new.png");
          return NEW_TAB_ICON;
      }
      private static Icon NEW_TAB_ICON = null;
  
      public static Icon getAddTabIcon() {
          if (ADD_TAB_ICON == null) ADD_TAB_ICON = loadIconResource("tab-add.png");
          return ADD_TAB_ICON;
      }
      private static Icon ADD_TAB_ICON = null;
  
      public static Icon getRemoveTabIcon() {
          if (REMOVE_TAB_ICON == null) REMOVE_TAB_ICON = loadIconResource("tab-remove.png");
          return REMOVE_TAB_ICON;
      }
      private static Icon REMOVE_TAB_ICON = null;
  
      public static Icon getDuplicateTabIcon() {
          if (DUPLICATE_TAB_ICON == null) DUPLICATE_TAB_ICON = loadIconResource("tab-duplicate.png");
          return DUPLICATE_TAB_ICON;
      }
      private static Icon DUPLICATE_TAB_ICON = null;
  
      public static Icon getImportWorkflowsIcon() {
          if (IMPORT_WORKFLOWS_ICON == null) {
              IMPORT_WORKFLOWS_ICON = new ConcatenatedIcon(getWorkflowIcon(),
                      new EmptyIcon(2, 1), getLeftArrowIcon(),
                      new EmptyIcon(1, 1), getOpenIcon());
          }
          return IMPORT_WORKFLOWS_ICON;
      }
      private static Icon IMPORT_WORKFLOWS_ICON = null;
  
      public static Icon getImportOrgWorkflowsIcon() {
          return new ConcatenatedIcon(getWorkflowIcon(),
                      new EmptyIcon(2, 1), getLeftArrowIcon(),
                      new EmptyIcon(1, 1), getProcessAssetIcon());
      }
  
      public static Icon getExportWorkflowsIcon() {
          if (EXPORT_WORKFLOWS_ICON == null) {
              EXPORT_WORKFLOWS_ICON = new ConcatenatedIcon(getWorkflowIcon(),
                      new EmptyIcon(2, 1), getRightArrowIcon(),
                      new EmptyIcon(1, 1), getOpenIcon());
          }
          return EXPORT_WORKFLOWS_ICON;
      }
      private static Icon EXPORT_WORKFLOWS_ICON = null;
  
      public static Icon getImportProxiesIcon() {
          if (IMPORT_PROXIES_ICON == null) {
              IMPORT_PROXIES_ICON = new ConcatenatedIcon(getProxyTableIcon(),
                      new EmptyIcon(2, 1), getLeftArrowIcon(),
                      new EmptyIcon(1, 1), getOpenIcon());
          }
          return IMPORT_PROXIES_ICON;
      }
      private static Icon IMPORT_PROXIES_ICON = null;
  
      public static Icon getImportOrgProxiesIcon() {
          return new ConcatenatedIcon(getProxyTableIcon(),
                      new EmptyIcon(2, 1), getLeftArrowIcon(),
                      new EmptyIcon(1, 1), getProcessAssetIcon());
      }
  
      public static Icon getExportProxiesIcon() {
          if (EXPORT_PROXIES_ICON == null) {
              EXPORT_PROXIES_ICON = new ConcatenatedIcon(getProxyTableIcon(),
                      new EmptyIcon(2, 1), getRightArrowIcon(),
                      new EmptyIcon(1, 1), getOpenIcon());
          }
          return EXPORT_PROXIES_ICON;
      }
      private static Icon EXPORT_PROXIES_ICON = null;
  
      public static Icon getOpenIcon() {
  