001 /* 002 * Sonar, open source software quality management tool. 003 * Copyright (C) 2009 SonarSource SA 004 * mailto:contact AT sonarsource DOT com 005 * 006 * Sonar is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * Sonar 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 GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with Sonar; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 019 */ 020 package org.sonar.gwt.ui; 021 022 import com.google.gwt.core.client.GWT; 023 import com.google.gwt.user.client.ui.AbstractImagePrototype; 024 import com.google.gwt.user.client.ui.ImageBundle; 025 026 /** 027 * All icons are 16x16 pixels 028 */ 029 public final class Icons { 030 private static IconBundle INSTANCE; 031 032 private Icons() { 033 // only static methods 034 } 035 036 public static IconBundle get() { 037 if (INSTANCE == null) { 038 INSTANCE = GWT.create(IconBundle.class); 039 } 040 return INSTANCE; 041 } 042 043 public static AbstractImagePrototype forQualifier(final String qualifier) { 044 AbstractImagePrototype image; 045 if ("FIL".equals(qualifier)) { 046 image = get().qualifierFile(); 047 } else if ("CLA".equals(qualifier)) { 048 image = get().qualifierClass(); 049 050 } else if ("PAC".equals(qualifier)) { 051 image = get().qualifierPackage(); 052 053 } else if ("DIR".equals(qualifier)) { 054 image = get().qualifierDirectory(); 055 056 } else if ("BRC".equals(qualifier)) { 057 image = get().qualifierModule(); 058 059 } else if ("TRK".equals(qualifier)) { 060 image = get().qualifierProject(); 061 062 } else if ("UTS".equals(qualifier)) { 063 image = get().qualifierUnitTest(); 064 065 } else if ("FLD".equals(qualifier)) { 066 image = get().qualifierField(); 067 068 } else if ("MET".equals(qualifier)) { 069 image = get().qualifierMethod(); 070 071 } else if ("LIB".equals(qualifier)) { 072 image = get().qualifierLibrary(); 073 074 } else { 075 image = get().empty(); 076 } 077 return image; 078 } 079 080 public static interface IconBundle extends ImageBundle { 081 AbstractImagePrototype empty(); 082 083 AbstractImagePrototype zoom(); 084 085 AbstractImagePrototype information(); 086 087 AbstractImagePrototype help(); 088 089 AbstractImagePrototype qualifierField(); 090 091 AbstractImagePrototype qualifierMethod(); 092 093 AbstractImagePrototype qualifierClass(); 094 095 AbstractImagePrototype qualifierFile(); 096 097 AbstractImagePrototype qualifierUnitTest(); 098 099 AbstractImagePrototype qualifierDirectory(); 100 101 AbstractImagePrototype qualifierPackage(); 102 103 AbstractImagePrototype qualifierProject(); 104 105 AbstractImagePrototype qualifierModule(); 106 107 AbstractImagePrototype qualifierLibrary(); 108 109 AbstractImagePrototype statusOk(); 110 111 AbstractImagePrototype statusError(); 112 113 AbstractImagePrototype statusWarning(); 114 } 115 }