/******************************************************************************* * ALMA - Atacama Large Millimeter Array * Copyright (c) UKATC - UK Astronomy Technology Centre, Science and Technology Facilities Council, 2011 * (in the framework of the ALMA collaboration). * All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *******************************************************************************/ package alma.obsprep.ot.gui.resources; import java.io.File; import java.net.URL; import javax.swing.Icon; import javax.swing.ImageIcon; import alma.obsprep.util.MiscUtils; /** * A collection of static GUI resources, like icons, images, etc. * * @author amchavan */ public class Icons { /** Where are our images kept? */ private static final File PATH_TO_IMAGES = new File("alma/obsprep/ot/gui/resources"); /** * Retrieve an icon from the resources available to the system in the images * directory. * * @param name * Name of the icon (e.g. "home.gif") * @return The retrieved icon, if it was found. * @throws RuntimeException * If the indicated icon was not found. */ public static ImageIcon getIcon(String name) { URL imageURL = MiscUtils.findResource(Icons.PATH_TO_IMAGES, name); if (imageURL != null) return new ImageIcon(imageURL); throw new RuntimeException("Image " + name + " not found"); } /** */ // TODO MSC remove this duplicated quick-and-dirty code public static Icon getIcon2(String name) { URL imageURL = MiscUtils.findResource(null, name); if (imageURL != null) return new ImageIcon(imageURL); throw new RuntimeException("Image " + name + " not found"); } // Project icons public static final Icon phase1Project = Icons.getIcon("phase1_inv_16x16.png"); public static final Icon phase1DDTProject = Icons.getIcon("ddt_phase1_inv_16x16.png"); public static final Icon phase2Project = Icons.getIcon("phase2_inv_16x16.png"); public static final Icon commissionProject = Icons.getIcon("commission_inv_16x16.png"); // Inline editor icons public static final Icon plus = Icons.getIcon("plus14x14.png"); public static final Icon minus = Icons.getIcon("minus14x14.png"); public static final Icon question = Icons.getIcon("question14x14.png"); public static final Icon sendToArchive = Icons.getIcon("sendToArchive.gif"); public static final Icon retrieveFromArchive = Icons.getIcon("retrieveFromArchive.gif"); public static final Icon newScienceGoalPhase2 = Icons.getIcon("newScienceGoalPhase2.png"); public static final Icon newGenerateSB = Icons.getIcon("newGenerateSB2.png"); // ICT-3519 Added a clock public static final Icon clock = Icons.getIcon("clock.gif"); public static final Icon project = Icons.getIcon("obs-project.gif"); public static final Icon proposal = Icons.getIcon("obs-program.gif"); public static final Icon program = Icons.getIcon("obs-program.gif"); public static final Icon circle = Icons.getIcon("circle3.GIF"); public static final Icon rectangle = Icons.getIcon("rectangle2.GIF"); public static final Icon ellipse = Icons.getIcon("ellipse.GIF"); public static final Icon polygon = Icons.getIcon("polygon.GIF"); public static final Icon schedBlock = Icons.getIcon("SB.gif"); public static final Icon obsUnitSet = Icons.getIcon("OUS.gif"); public static final Icon calibratorFolder = Icons.getIcon("calibratorFolder.gif"); public static final Icon targetFolder = Icons.getIcon("targetFolder.gif"); public static final Icon spectralSetupElement = Icons.getIcon("spectral-setup-element2.GIF"); // public static final Icon plus = Icons.getIcon( "plus_s.gif" ); // public static final Icon minus = Icons.getIcon( "minus_s.gif" ); public static final Icon observingGroup = Icons.getIcon("observingGroup.gif"); public static final Icon target = Icons.getIcon("target.gif"); public static final Icon calibrator = Icons.getIcon("calibrator.gif"); public static final Icon warning = Icons.getIcon("warning.gif"); public static final Icon error = Icons.getIcon("error.gif"); public static final Icon info = Icons.getIcon("info.gif"); public static final Icon warning_overlay = Icons.getIcon("warning_co.gif"); public static final Icon error_overlay = Icons.getIcon("error_co.gif"); public static final Icon magnify = Icons.getIcon("Magnifier.png"); public static final Icon importProject = Icons.getIcon2("etool16/import_wiz.gif"); public static final Icon exportProject = Icons.getIcon2("etool16/export_wiz.gif"); public static final Icon newProposal = Icons.getIcon2("obj16/file_obj.gif"); public static final Icon newProject = Icons.getIcon2("elcl16/add_as_source_folder.gif"); public static final Icon save = Icons.getIcon2("etool16/save_edit.gif"); public static final Icon open = Icons.getIcon2("obj16/fldr_obj.gif"); public static final Icon runCalTool = Icons.getIcon2("obj16/impc_obj.gif"); // public static final Icon runETC = GUIUtilities.getIcon2( "obj16/nls_search_obj.gif"); public static final Icon runETC = Icons.getIcon("calculator.png"); public static final Icon runMapper = Icons.getIcon2("eview16/source.gif"); public static final Icon help = Icons.getIcon2("elcl16/help.gif"); public static final Icon library = Icons.getIcon2("obj16/library_obj.gif"); public static final Icon validateProject = Icons.getIcon2("obj16/translate.gif"); public static final Icon seePreviousProblem = Icons.getIcon2("etool16/shift_l_edit.gif"); public static final Icon seeNextProblem = Icons.getIcon2("etool16/shift_r_edit.gif"); public static final Icon optical = Icons.getIcon("optical.gif"); public static final Icon scienceGoal = Icons.getIcon("ScienceGoal.gif"); public static final Icon attach = Icons.getIcon("attach.gif"); public static final Icon minimizeView = Icons.getIcon2("elcl16/thin_min_view.gif"); public static final Icon restoreView = Icons.getIcon2("elcl16/thin_restore_view.GIF"); public static final Icon closeView = Icons.getIcon2("elcl16/thin_close_view.gif"); public static final ImageIcon otIcon = Icons.getIcon("ot-icon.gif"); public static final ImageIcon okay = Icons.getIcon("green-okay.gif"); public static final Icon delete = Icons.getIcon2("obj16/delete_obj.gif"); public static final Icon destroy = Icons.getIcon2("elcl16/trash.gif"); public static final Icon close = Icons.getIcon2("elcl16/close_view.gif"); public static final Icon rangeSliderThumb = Icons.getIcon("filter_slide_knob.png"); public static final Icon filterDisabled = Icons.getIcon("delete-gray.png"); public static final Icon filterEnabled = Icons.getIcon("add.png"); }