001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.gwt.client.ui; 029 030import org.opencms.gwt.client.Messages; 031import org.opencms.gwt.client.ui.css.I_CmsLayoutBundle; 032 033/** 034 * Interface to hold button related enumerations. To be used with {@link org.opencms.gwt.client.ui.CmsPushButton} 035 * and {@link org.opencms.gwt.client.ui.CmsToggleButton}.<p> 036 */ 037public interface I_CmsButton { 038 039 /** Available button colors. */ 040 public enum ButtonColor { 041 042 /** Button color. */ 043 BLUE(I_CmsLayoutBundle.INSTANCE.buttonCss().blue()), 044 045 /** Button color. */ 046 GRAY(I_CmsLayoutBundle.INSTANCE.buttonCss().gray()), 047 048 /** Button color. */ 049 GREEN(I_CmsLayoutBundle.INSTANCE.buttonCss().green()), 050 051 /** Button color. */ 052 RED(I_CmsLayoutBundle.INSTANCE.buttonCss().red()); 053 054 /** The list of additional style class names for this button style. */ 055 private String m_className; 056 057 /** 058 * Constructor.<p> 059 * 060 * @param className the additional classes 061 */ 062 private ButtonColor(String className) { 063 064 m_className = className; 065 } 066 067 /** 068 * Returns the additional classes.<p> 069 * 070 * @return the additional classes 071 */ 072 public String getClassName() { 073 074 return m_className; 075 } 076 } 077 078 /** Available button icons. */ 079 public enum ButtonData { 080 081 /** Shows formerly hidden elements. */ 082 ADD("opencms-icon-add", Messages.get().key(Messages.GUI_TOOLBAR_ADD_0)), 083 084 /** Toolbar button. */ 085 ADD_TO_FAVORITES("opencms-icon-favorite", Messages.get().key(Messages.GUI_TOOLBAR_ADD_TO_FAVORITES_0)), 086 087 /** Toolbar button. */ 088 BACK(EXIT, Messages.get().key(Messages.GUI_TOOLBAR_BACK_0)), 089 090 /** Toolbar button. */ 091 BOOKMARKS_BUTTON(BOOKMARKS, Messages.get().key(Messages.GUI_TOOLBAR_FAVORITES_0)), 092 093 /** Toolbar button. */ 094 CLIPBOARD_BUTTON(CLIPBOARD, Messages.get().key(Messages.GUI_TOOLBAR_CLIPBOARD_0)), 095 096 /** Toolbar button. */ 097 CONTEXT(CONTEXT_MENU, Messages.get().key(Messages.GUI_TOOLBAR_CONTEXT_0)), 098 099 /** Toolbar button. */ 100 COPY_LOCALE_BUTTON(COPY_LOCALE, Messages.get().key(Messages.GUI_TOOLBAR_COPY_LOCALE_0)), 101 102 /** Toolbar button. */ 103 EDIT(PEN, Messages.get().key(Messages.GUI_TOOLBAR_EDIT_0)), 104 105 /** Toolbar button. */ 106 ELEMENT_INFO(INFO, Messages.get().key(Messages.GUI_TOOLBAR_ELEMENT_INFO_0)), 107 108 /** Toolbar button. */ 109 GALLERY_BUTTON(GALLERY, Messages.get().key(Messages.GUI_TOOLBAR_GALLERY_0)), 110 111 /** Toolbar button. */ 112 INFO_BUTTON(INFO, Messages.get().key(Messages.GUI_TOOLBAR_INFO_0)), 113 114 /** Inherited element button. */ 115 INHERITED(SITEMAP, Messages.get().key(Messages.GUI_TOOLBAR_INHERITED_0)), 116 117 /** The list manager button. */ 118 LIST("opencms-icon-list", Messages.get().key(Messages.GUI_TOOLBAR_LIST_0)), 119 120 /** Toolbar button. */ 121 MOVE("opencms-icon-move", Messages.get().key(Messages.GUI_TOOLBAR_MOVE_IN_0)), 122 123 /** Toolbar button. */ 124 PUBLISH_BUTTON(PUBLISH, Messages.get().key(Messages.GUI_TOOLBAR_PUBLISH_0)), 125 126 /** Toolbar button. */ 127 REMOVE("opencms-icon-cut", Messages.get().key(Messages.GUI_TOOLBAR_REMOVE_0)), 128 129 /** Toolbar button. */ 130 RESET_BUTTON(EXIT, Messages.get().key(Messages.GUI_TOOLBAR_RESET_0)), 131 132 /** Toolbar button. */ 133 SAVE_BUTTON(SAVE, Messages.get().key(Messages.GUI_TOOLBAR_SAVE_0)), 134 135 /** Toolbar button. */ 136 SELECTION(EDIT_POINT, Messages.get().key(Messages.GUI_TOOLBAR_SELECTION_0)), 137 138 /** Toolbar button. */ 139 SETTINGS_BUTTON(SETTINGS, Messages.get().key(Messages.GUI_TOOLBAR_PROPERTIES_0)), 140 141 /** Toolbar button. */ 142 SITEMAP_BUTTON(SITEMAP, Messages.get().key(Messages.GUI_TOOLBAR_SITEMAP_0)), 143 144 /** Toolbar button. */ 145 TOGGLE_HELP(HELP, Messages.get().key(Messages.GUI_TOOLBAR_TOGGLE_HELP_0)), 146 147 /** Toolbar button. */ 148 WAND_BUTTON(WAND, Messages.get().key(Messages.GUI_TOOLBAR_ADD_0)); 149 150 /** The icon class name. */ 151 private String m_iconClass; 152 153 /** The title. */ 154 private String m_title; 155 156 /** 157 * Constructor.<p> 158 * 159 * @param iconClass the icon class name 160 * @param title the title 161 */ 162 private ButtonData(String iconClass, String title) { 163 164 m_iconClass = iconClass; 165 m_title = title; 166 } 167 168 /** 169 * Returns the CSS class name.<p> 170 * 171 * @return the CSS class name 172 */ 173 public String getIconClass() { 174 175 return m_iconClass; 176 } 177 178 /** 179 * Returns the icon class for small icons of 20x20.<p> 180 * 181 * @return the small icon class 182 */ 183 public String getSmallIconClass() { 184 185 return m_iconClass + "-20"; 186 } 187 188 /** 189 * Returns the title.<p> 190 * 191 * @return the title 192 */ 193 public String getTitle() { 194 195 return m_title; 196 } 197 } 198 199 /** Available button styles. */ 200 public enum ButtonStyle { 201 202 /** Font icon button. */ 203 FONT_ICON(I_CmsLayoutBundle.INSTANCE.buttonCss().cmsFontIconButton(), 204 I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll(), ICON_FONT), 205 206 /** Menu button. */ 207 MENU(I_CmsLayoutBundle.INSTANCE.buttonCss().cmsMenuButton(), 208 I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll()), 209 210 /** Default button. */ 211 TEXT(I_CmsLayoutBundle.INSTANCE.buttonCss().cmsTextButton(), 212 I_CmsLayoutBundle.INSTANCE.generalCss().buttonCornerAll()), 213 214 /** Transparent button. */ 215 TRANSPARENT(I_CmsLayoutBundle.INSTANCE.buttonCss().cmsTransparentButton(), 216 I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll()); 217 218 /** The list of additional style class names for this button style. */ 219 private String[] m_additionalClasses; 220 221 /** 222 * Constructor.<p> 223 * 224 * @param additionalClasses the additional classes 225 */ 226 private ButtonStyle(String... additionalClasses) { 227 228 m_additionalClasses = additionalClasses; 229 } 230 231 /** 232 * Returns the additional classes.<p> 233 * 234 * @return the additional classes 235 */ 236 public String[] getAdditionalClasses() { 237 238 return m_additionalClasses; 239 } 240 241 /** 242 * Returns the classes stored in the array as space separated list.<p> 243 * 244 * @return the classes stored in the array as space separated list 245 */ 246 public String getCssClassName() { 247 248 StringBuffer sb = new StringBuffer(); 249 for (String addClass : m_additionalClasses) { 250 sb.append(addClass + " "); 251 } 252 return sb.toString(); 253 } 254 } 255 256 /** CSS style variants. */ 257 public static enum Size { 258 259 /** Big button style. */ 260 big(I_CmsLayoutBundle.INSTANCE.buttonCss().cmsButtonBig()), 261 262 /** Medium button style. */ 263 medium(I_CmsLayoutBundle.INSTANCE.buttonCss().cmsButtonMedium()), 264 265 /** Small button style. */ 266 small(I_CmsLayoutBundle.INSTANCE.buttonCss().cmsButtonSmall()); 267 268 /** The CSS class name. */ 269 private String m_cssClassName; 270 271 /** 272 * Constructor.<p> 273 * 274 * @param cssClassName the CSS class name 275 */ 276 Size(String cssClassName) { 277 278 m_cssClassName = cssClassName; 279 } 280 281 /** 282 * Returns the CSS class name of this style.<p> 283 * 284 * @return the CSS class name 285 */ 286 public String getCssClassName() { 287 288 return m_cssClassName; 289 } 290 } 291 292 /** Small font icon using a 20x20 grid. */ 293 String ADD_SMALL = "opencms-icon-add-20"; 294 295 /** Font icon using a 32x32 grid. */ 296 String APPS = "opencms-icon-apps"; 297 298 /** Font icon using a 32x32 grid. */ 299 String BOOKMARKS = "opencms-icon-bookmarks"; 300 301 /** Small font icon using a 20x20 grid. */ 302 String CHECK_SMALL = "opencms-icon-check-20"; 303 304 /** Font icon using a 32x32 grid. */ 305 String CIRCLE = "opencms-icon-circle"; 306 307 /** Font icon using a 32x32 grid. */ 308 String CIRCLE_CANCEL = "opencms-icon-circle-cancel"; 309 310 /** Font icon using a 32x32 grid. */ 311 String CIRCLE_CANCEL_INV = "opencms-icon-circle-inv-cancel"; 312 313 /** Font icon using a 32x32 grid. */ 314 String CIRCLE_CHECK = "opencms-icon-circle-check"; 315 316 /** Font icon using a 32x32 grid. */ 317 String CIRCLE_CHECK_INV = "opencms-icon-circle-inv-check"; 318 319 /** Font icon using a 32x32 grid. */ 320 String CIRCLE_INFO = "opencms-icon-circle-info"; 321 322 /** Font icon using a 32x32 grid. */ 323 String CIRCLE_INV = "opencms-icon-circle-inv"; 324 325 /** Font icon using a 32x32 grid. */ 326 String CIRCLE_MINUS = "opencms-icon-circle-minus"; 327 328 /** Font icon using a 32x32 grid. */ 329 String CIRCLE_MINUS_INV = "opencms-icon-circle-inv-minus"; 330 331 /** Font icon using a 32x32 grid. */ 332 String CIRCLE_PAUSE = "opencms-icon-circle-pause"; 333 334 /** Font icon using a 32x32 grid. */ 335 String CIRCLE_PAUSE_INV = "opencms-icon-circle-inv-pause"; 336 337 /** Font icon using a 32x32 grid. */ 338 String CIRCLE_PLAY = "opencms-icon-circle-play"; 339 340 /** Font icon using a 32x32 grid. */ 341 String CIRCLE_PLAY_INV = "opencms-icon-circle-inv-play"; 342 343 /** Font icon using a 32x32 grid. */ 344 String CIRCLE_PLUS = "opencms-icon-circle-plus"; 345 346 /** Font icon using a 32x32 grid. */ 347 String CIRCLE_PLUS_INV = "opencms-icon-circle-inv-plus"; 348 349 /** Font icon using a 32x32 grid. */ 350 String CLIPBOARD = "opencms-icon-clipboard"; 351 352 /** Small font icon using a 20x20 grid. */ 353 String CLOSE = "opencms-icon-close-20"; 354 355 /** Font icon using a 32x32 grid. */ 356 String CONTEXT_MENU = "opencms-icon-context-menu"; 357 358 /** Small font icon using a 20x20 grid. */ 359 String CONTEXT_MENU_SMALL = "opencms-icon-context-menu-20"; 360 361 /** Font icon using a 32x32 grid. */ 362 String COPY_LOCALE = "opencms-icon-copy-locale"; 363 364 /** Font icon using a 32x32 grid. */ 365 String CROP = "opencms-icon-crop"; 366 367 /** Font icon using a 32x32 grid. */ 368 String CROP_REMOVE = "opencms-icon-crop-remove"; 369 370 /** Small font icon using a 20x20 grid. */ 371 String CUT_SMALL = "opencms-icon-cut-20"; 372 373 /** Small font icon using a 20x20 grid. */ 374 String DELETE_SMALL = "opencms-icon-delete-20"; 375 376 /** Font icon using a 32x32 grid. */ 377 String DOWNLOAD = "opencms-icon-download"; 378 379 /** Small font icon using a 20x20 grid. */ 380 String EDIT_DOWN_SMALL = "opencms-icon-edit-down-20"; 381 382 /** Font icon using a 32x32 grid. */ 383 String EDIT_POINT = "opencms-icon-edit-point"; 384 385 /** Small font icon using a 20x20 grid. */ 386 String EDIT_POINT_SMALL = "opencms-icon-edit-point-20"; 387 388 /** Small font icon using a 20x20 grid. */ 389 String EDIT_SMALL = "opencms-icon-pen-20"; 390 391 /** Small font icon using a 20x20 grid. */ 392 String EDIT_UP_SMALL = "opencms-icon-edit-up-20"; 393 394 /** Font icon using a 32x32 grid. */ 395 String ERROR = "opencms-icon-error"; 396 397 /** Font icon using a 32x32 grid. */ 398 String EXIT = "opencms-icon-exit"; 399 400 /** Small font icon using a 20x20 grid. */ 401 String FAVORITE_SMALL = "opencms-icon-favorite-20"; 402 403 /** Font icon using a 32x32 grid. */ 404 String FILTER = "opencms-icon-filter"; 405 406 /** Font icon using a 32x32 grid. */ 407 String GALLERY = "opencms-icon-gallery"; 408 409 /** Font icon using a 32x32 grid. */ 410 String HELP = "opencms-icon-help"; 411 412 /** Small font icon using a 20x20 grid. */ 413 String HELP_SMALL = "opencms-icon-help-20"; 414 415 /** Font icon using a 32x32 grid. */ 416 String HIDE = "opencms-icon-hide"; 417 418 /** Font icon using a 32x32 grid. */ 419 String ICON_CIRCLE_HELP = "opencms-icon-circle-help"; 420 421 /** Icon font CSS class. */ 422 String ICON_FONT = "opencms-icon"; 423 424 /** Font icon using a 32x32 grid. */ 425 String INFO = "opencms-icon-info"; 426 427 /** Small font icon using a 20x20 grid. */ 428 String INFO_SMALL = "opencms-icon-info-20"; 429 430 /** Font icon using a 32x32 grid. */ 431 String LOCK_CLOSED = "opencms-icon-lock-closed"; 432 433 /** Font icon using a 32x32 grid. */ 434 String LOCK_OPEN = "opencms-icon-lock-open"; 435 436 /** Small font icon using a 20x20 grid. */ 437 String LOCK_SMALL = "opencms-icon-lock-20"; 438 439 /** Small font icon using a 20x20 grid. */ 440 String MOVE_SMALL = "opencms-icon-move-20"; 441 442 /** Font icon using a 32x32 grid. */ 443 String PEN = "opencms-icon-pen"; 444 445 /** Small font icon using a 20x20 grid. */ 446 String PEN_SMALL = "opencms-icon-pen-20"; 447 448 /** Small font icon using a 20x20 grid. */ 449 String PREVIEW_SMALL = "opencms-icon-preview-20"; 450 451 /** Font icon using a 32x32 grid. */ 452 String PUBLISH = "opencms-icon-publish"; 453 454 /** Font icon using a 32x32 grid. */ 455 String REDO = "opencms-icon-redo"; 456 457 /** Font icon using a 32x32 grid. */ 458 String REMOVE_LOCALE = "opencms-icon-remove-locale"; 459 460 /** Font icon using a 32x32 grid. */ 461 String RESET = "opencms-icon-reset"; 462 463 /** Font icon using a 32x32 grid. */ 464 String SAVE = "opencms-icon-save"; 465 466 /** Font icon using a 32x32 grid. */ 467 String SAVE_EXIT = "opencms-icon-save-exit"; 468 469 /** Font icon using a 32x32 grid. */ 470 String SEARCH = "opencms-icon-search"; 471 472 /** Small font icon using a 20x20 grid. */ 473 String SEARCH_SMALL = "opencms-icon-search-20"; 474 475 /** Font icon using a 32x32 grid. */ 476 String SETTINGS = "opencms-icon-settings"; 477 478 /** Small font icon using a 20x20 grid. */ 479 String SETTINGS_SMALL = "opencms-icon-settings-20"; 480 481 /** Font icon using a 32x32 grid. */ 482 String SHOW = "opencms-icon-show"; 483 484 /** Font icon using a 32x32 grid. */ 485 String SITEMAP = "opencms-icon-sitemap"; 486 487 /** Small font icon using a 20x20 grid. */ 488 String SITEMAP_SMALL = "opencms-icon-sitemap-20"; 489 490 /** Small font icon using a 20x20 grid. */ 491 String TRASH_SMALL = "opencms-icon-trash-20"; 492 493 /** Font icon using a 32x32 grid. */ 494 String TREE_MINUS = "opencms-icon-tree-minus"; 495 496 /** Font icon using a 32x32 grid. */ 497 String TREE_PLUS = "opencms-icon-tree-plus"; 498 499 /** Font icon using a 32x32 grid. */ 500 String TRIANGLE_DOWN = "opencms-icon-triangle-down"; 501 502 /** Font icon using a 32x32 grid. */ 503 String TRIANGLE_RIGHT = "opencms-icon-triangle-right"; 504 505 /** Font icon using a 32x32 grid. */ 506 String UNDO = "opencms-icon-undo"; 507 508 /** Font icon using a 32x32 grid. */ 509 String UPLOAD = "opencms-icon-upload"; 510 511 /** Special icon class for list upload buttons. */ 512 String UPLOAD_SELECTION = "opencms-icon-upload-selection"; 513 514 /** Small font icon using a 20x20 grid. */ 515 String UPLOAD_SMALL = "opencms-icon-upload-20"; 516 517 /** Font icon using a 32x32 grid. */ 518 String WAND = "opencms-icon-wand"; 519 520 /** Font icon using a 32x32 grid. */ 521 String WARNING = "opencms-icon-warning"; 522 523}