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 GmbH & Co. KG, 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.workplace.explorer; 029 030import org.opencms.file.CmsObject; 031import org.opencms.file.CmsResource; 032import org.opencms.main.CmsLog; 033import org.opencms.main.OpenCms; 034import org.opencms.security.CmsPermissionSet; 035import org.opencms.security.CmsRole; 036import org.opencms.util.CmsStringUtil; 037import org.opencms.workplace.CmsWorkplaceManager; 038 039import java.io.Serializable; 040import java.util.ArrayList; 041import java.util.Collections; 042import java.util.HashMap; 043import java.util.List; 044import java.util.Map; 045 046import org.apache.commons.logging.Log; 047 048/** 049 * Holds all information to build the explorer context menu of a resource type 050 * and information for the new resource dialog.<p> 051 * 052 * Objects of this type are sorted by their order value which specifies the order 053 * in the new resource dialog.<p> 054 * 055 * @since 6.0.0 056 */ 057public class CmsExplorerTypeSettings implements Comparable<CmsExplorerTypeSettings>, Serializable { 058 059 /** The default big file type icon style class. */ 060 public static final String ICON_STYLE_DEFAULT_BIG = "oc-icon-24-default"; 061 062 /** The default small file type icon style class. */ 063 public static final String ICON_STYLE_DEFAULT_SMALL = "oc-icon-16-default"; 064 065 /** The model group reuse big file type icon style class. */ 066 public static final String ICON_STYLE_MODEL_GROUP_COPY_BIG = "oc-icon-24-modelgroup_copy"; 067 068 /** The model group reuse small file type icon style class. */ 069 public static final String ICON_STYLE_MODEL_GROUP_COPY_SMALL = "oc-icon-16-modelgroup_copy"; 070 071 /** The nav level big file type icon style class. */ 072 public static final String ICON_STYLE_NAV_LEVEL_BIG = "oc-icon-24-navlevel"; 073 074 /** The nav level small file type icon style class. */ 075 public static final String ICON_STYLE_NAV_LEVEL_SMALL = "oc-icon-16-navlevel"; 076 077 /** The default order start value for context menu entries. */ 078 public static final int ORDER_VALUE_DEFAULT_START = 100000; 079 080 /** The default order value for context menu separator entries without order attribute. */ 081 public static final String ORDER_VALUE_SEPARATOR_DEFAULT = "999999"; 082 083 /** The log object for this class. */ 084 private static final Log LOG = CmsLog.getLog(CmsExplorerTypeSettings.class); 085 086 /** Default view orders. */ 087 private static Map<String, Integer> m_defaultViewOrders = new HashMap<String, Integer>() { 088 089 /** Serial version id. */ 090 private static final long serialVersionUID = 1L; 091 092 { 093 put("folder", new Integer(50)); 094 put("plain", new Integer(200)); 095 put("jsp", new Integer(300)); 096 put("htmlredirect", new Integer(400)); 097 put("containerpage", new Integer(500)); 098 099 put("imagegallery", new Integer(100)); 100 put("downloadgallery", new Integer(200)); 101 put("linkgallery", new Integer(300)); 102 put("subsitemap", new Integer(400)); 103 put("content_folder", new Integer(500)); 104 put("formatter_config", new Integer(100)); 105 106 put("xmlvfsbundle", new Integer(200)); 107 put("propertyvfsbundle", new Integer(300)); 108 put("bundledescriptor", new Integer(350)); 109 put("sitemap_config", new Integer(400)); 110 put("sitemap_master_config", new Integer(500)); 111 put("module_config", new Integer(600)); 112 put("elementview", new Integer(700)); 113 put("seo_file", new Integer(800)); 114 put("containerpage_template", new Integer(900)); 115 put("inheritance_config", new Integer(1000)); 116 117 put("xmlcontent", new Integer(100)); 118 put("pointer", new Integer(200)); 119 120 put("modelgroup", new Integer(100)); 121 } 122 }; 123 124 /** The serial version id. */ 125 private static final long serialVersionUID = 7014251115525259136L; 126 127 /** The explorer type access. */ 128 private CmsExplorerTypeAccess m_access; 129 130 /** Flag for showing that this is an additional resource type which defined in a module. */ 131 private boolean m_addititionalModuleExplorerType; 132 133 /** The auto set navigation flag. */ 134 private boolean m_autoSetNavigation; 135 136 /** The auto set title flag. */ 137 private boolean m_autoSetTitle; 138 139 /** The name of the big icon for this explorer type. */ 140 private String m_bigIcon; 141 142 /** The big icon CSS style class. */ 143 private String m_bigIconStyle; 144 145 /** The element view for this explorer type. */ 146 private String m_elementView; 147 148 /**The edit options flag. */ 149 private boolean m_hasEditOptions; 150 151 /** The icon. */ 152 private String m_icon; 153 154 /** The icon rules for this explorer type. */ 155 private Map<String, CmsIconRule> m_iconRules; 156 157 /** The info. */ 158 private String m_info; 159 160 /** Flag indicating whether this explorer type represents a view. */ 161 private boolean m_isView; 162 163 /** The key. */ 164 private String m_key; 165 166 /** The name. */ 167 private String m_name; 168 169 /** The name pattern. */ 170 private String m_namePattern; 171 172 /** The new resource order value. */ 173 private Integer m_newResourceOrder; 174 175 /** The creatable flag, <code>false</code> for types that can not be created through the workplace UI. */ 176 private boolean m_creatable; 177 178 /** The properties. */ 179 private List<String> m_properties; 180 181 /** The enabled properties. */ 182 private boolean m_propertiesEnabled; 183 184 /** The reference. */ 185 private String m_reference; 186 187 /** The show in navigation flag. */ 188 private boolean m_showNavigation; 189 190 /** The small icon CSS style class. */ 191 private String m_smallIconStyle; 192 193 /** The title key. */ 194 private String m_titleKey; 195 196 /** The configured view order. */ 197 private Integer m_viewOrder; 198 199 /** 200 * Default constructor.<p> 201 */ 202 public CmsExplorerTypeSettings() { 203 204 m_access = new CmsExplorerTypeAccess(); 205 m_properties = new ArrayList<String>(); 206 m_creatable = true; 207 m_hasEditOptions = false; 208 m_propertiesEnabled = false; 209 m_showNavigation = false; 210 m_addititionalModuleExplorerType = false; 211 m_newResourceOrder = new Integer(0); 212 m_iconRules = new HashMap<String, CmsIconRule>(); 213 214 } 215 216 /** 217 * Gets the default view order for the given type name (or null, if there is no default view order).<p> 218 * 219 * @param typeName the type name 220 * 221 * @return the default view order for the type 222 */ 223 public static Integer getDefaultViewOrder(String typeName) { 224 225 return m_defaultViewOrders.get(typeName); 226 } 227 228 /** 229 * Adds a new icon rule to this explorer type.<p> 230 * 231 * @param extension the extension for the icon rule 232 * @param icon the small icon 233 * @param bigIcon the big icon 234 * @param smallIconStyle the small icon CSS style class 235 * @param bigIconStyle the big icon CSS style class 236 */ 237 public void addIconRule(String extension, String icon, String bigIcon, String smallIconStyle, String bigIconStyle) { 238 239 CmsIconRule rule = new CmsIconRule(extension, icon, bigIcon, smallIconStyle, bigIconStyle); 240 m_iconRules.put(extension, rule); 241 } 242 243 /** 244 * Adds a property definition name to the list of editable properties.<p> 245 * 246 * @param propertyName the name of the property definition to add 247 * @return true if the property definition was added properly 248 */ 249 public boolean addProperty(String propertyName) { 250 251 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(propertyName)) { 252 if (LOG.isDebugEnabled()) { 253 LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_PROP_1, propertyName)); 254 } 255 return m_properties.add(propertyName); 256 } else { 257 return false; 258 } 259 } 260 261 /** 262 * @see java.lang.Object#clone() 263 */ 264 @Override 265 public Object clone() { 266 267 CmsExplorerTypeSettings result = new CmsExplorerTypeSettings(); 268 result.m_access = m_access; 269 result.m_addititionalModuleExplorerType = m_addititionalModuleExplorerType; 270 result.m_autoSetNavigation = m_autoSetNavigation; 271 result.m_autoSetTitle = m_autoSetTitle; 272 result.m_bigIcon = m_bigIcon; 273 result.m_bigIconStyle = m_bigIconStyle; 274 result.m_elementView = m_elementView; 275 result.m_hasEditOptions = m_hasEditOptions; 276 result.m_icon = m_icon; 277 result.m_info = m_info; 278 result.m_isView = m_isView; 279 result.m_key = m_key; 280 result.m_name = m_name; 281 result.m_namePattern = m_namePattern; 282 result.m_newResourceOrder = m_newResourceOrder; 283 result.m_properties = new ArrayList<String>(m_properties); 284 result.m_propertiesEnabled = m_propertiesEnabled; 285 result.m_reference = m_reference; 286 result.m_showNavigation = m_showNavigation; 287 result.m_smallIconStyle = m_smallIconStyle; 288 result.m_titleKey = m_titleKey; 289 result.m_viewOrder = m_viewOrder; 290 result.m_iconRules = new HashMap<String, CmsIconRule>(); 291 for (Map.Entry<String, CmsIconRule> rule : m_iconRules.entrySet()) { 292 result.m_iconRules.put(rule.getKey(), (CmsIconRule)rule.getValue().clone()); 293 } 294 return result; 295 } 296 297 /** 298 * @see java.lang.Comparable#compareTo(java.lang.Object) 299 */ 300 public int compareTo(CmsExplorerTypeSettings other) { 301 302 if (other == this) { 303 return 0; 304 } 305 if (other != null) { 306 return m_newResourceOrder.compareTo(other.m_newResourceOrder); 307 } 308 return 0; 309 } 310 311 /** 312 * @see java.lang.Object#equals(java.lang.Object) 313 */ 314 @Override 315 public boolean equals(Object o) { 316 317 if (!(o instanceof CmsExplorerTypeSettings)) { 318 return false; 319 } 320 CmsExplorerTypeSettings other = (CmsExplorerTypeSettings)o; 321 return getName().equals(other.getName()); 322 } 323 324 /** 325 * Gets the access object of the type settings.<p> 326 * 327 * @return access object of the type settings 328 */ 329 public CmsExplorerTypeAccess getAccess() { 330 331 if (m_access.isEmpty()) { 332 CmsWorkplaceManager workplaceManager = OpenCms.getWorkplaceManager(); 333 if (workplaceManager != null) { 334 m_access = workplaceManager.getDefaultAccess(); 335 } 336 } 337 return m_access; 338 } 339 340 /** 341 * Returns the big icon.<p> 342 * 343 * @return an icon name 344 */ 345 public String getBigIcon() { 346 347 return m_bigIcon; 348 } 349 350 /** 351 * Returns the big icon CSS style class.<p> 352 * 353 * @return the big icon style 354 */ 355 public String getBigIconStyle() { 356 357 return m_bigIconStyle; 358 } 359 360 /** 361 * Gets the element view name.<p> 362 * 363 * @return the element view name 364 */ 365 public String getElementView() { 366 367 return m_elementView; 368 } 369 370 /** 371 * Returns the icon path and file name of the explorer type setting.<p> 372 * 373 * @return the icon path and file name of the explorer type setting 374 */ 375 public String getIcon() { 376 377 return m_icon; 378 } 379 380 /** 381 * Returns a map from file extensions to icon rules for this explorer type.<p> 382 * 383 * @return a map from file extensions to icon rules 384 */ 385 public Map<String, CmsIconRule> getIconRules() { 386 387 return Collections.unmodifiableMap(m_iconRules); 388 } 389 390 /** 391 * Returns the info.<p> 392 * 393 * @return the info 394 */ 395 public String getInfo() { 396 397 return m_info; 398 } 399 400 /** 401 * Returns the key name of the explorer type setting.<p> 402 * 403 * @return the key name of the explorer type setting 404 */ 405 public String getKey() { 406 407 return m_key; 408 } 409 410 /** 411 * Returns the name of the explorer type setting.<p> 412 * 413 * @return the name of the explorer type setting 414 */ 415 public String getName() { 416 417 return m_name; 418 } 419 420 /** 421 * Gets the name pattern.<p> 422 * 423 * @return the name pattern 424 */ 425 public String getNamePattern() { 426 427 return m_namePattern; 428 } 429 430 /** 431 * Returns the order for the new resource dialog of the explorer type setting.<p> 432 * 433 * @return the order for the new resource dialog of the explorer type setting 434 */ 435 public String getNewResourceOrder() { 436 437 return String.valueOf(m_newResourceOrder); 438 } 439 440 /** 441 * Gets the original icon name from the configuration.<p> 442 * 443 * @return an icon name 444 */ 445 public String getOriginalIcon() { 446 447 return m_icon; 448 } 449 450 /** 451 * Returns the list of properties of the explorer type setting.<p> 452 * @return the list of properties of the explorer type setting 453 */ 454 public List<String> getProperties() { 455 456 return m_properties; 457 } 458 459 /** 460 * Returns the reference of the explorer type setting.<p> 461 * 462 * @return the reference of the explorer type setting 463 */ 464 public String getReference() { 465 466 return m_reference; 467 } 468 469 /** 470 * Returns the small icon CSS style class.<p> 471 * 472 * @return the small icon style 473 */ 474 public String getSmallIconStyle() { 475 476 return m_smallIconStyle; 477 } 478 479 /** 480 * Returns the titleKey.<p> 481 * 482 * @return the titleKey 483 */ 484 public String getTitleKey() { 485 486 return m_titleKey; 487 } 488 489 /** 490 * Gets the view order, optionally using a default value if the view order is not configured.<p> 491 * 492 * @param useDefault true if a default should be returned in the case where the view order is not configured 493 * 494 * @return the view order 495 */ 496 public Integer getViewOrder(boolean useDefault) { 497 498 Integer defaultViewOrder = getDefaultViewOrder(m_name); 499 Integer result = null; 500 if (m_viewOrder != null) { 501 result = m_viewOrder; 502 } else if (useDefault) { 503 if (defaultViewOrder != null) { 504 result = defaultViewOrder; 505 } else { 506 result = new Integer(9999); 507 } 508 } 509 return result; 510 } 511 512 /** 513 * Returns true if this explorer type entry has explicit edit options set.<p> 514 * 515 * @return true if this explorer type entry has explicit edit options set 516 */ 517 public boolean hasEditOptions() { 518 519 return m_hasEditOptions; 520 } 521 522 /** 523 * @see java.lang.Object#hashCode() 524 */ 525 @Override 526 public int hashCode() { 527 528 return getName().hashCode(); 529 } 530 531 /** 532 * Indicates that this is an additional explorer type which is defined in a module.<p> 533 * 534 * @return true or false 535 */ 536 public boolean isAddititionalModuleExplorerType() { 537 538 return m_addititionalModuleExplorerType; 539 } 540 541 /** 542 * Returns true if navigation properties should automatically be added on resource creation.<p> 543 * 544 * @return true if navigation properties should automatically be added on resource creation, otherwise false 545 */ 546 public boolean isAutoSetNavigation() { 547 548 return m_autoSetNavigation; 549 } 550 551 /** 552 * Returns true if the title property should automatically be added on resource creation.<p> 553 * 554 * @return true if the title property should automatically be added on resource creation, otherwise false 555 */ 556 public boolean isAutoSetTitle() { 557 558 return m_autoSetTitle; 559 } 560 561 /** 562 * Returns if this type is creatable.<p> 563 * 564 * @return <code>true</code> in case this type is creatable 565 */ 566 public boolean isCreatable() { 567 568 return m_creatable; 569 } 570 571 /** 572 * Checks if the current user has write permissions on the given resource.<p> 573 * 574 * @param cms the current cms context 575 * @param resource the resource to check 576 * 577 * @return <code>true</code> if the current user has write permissions on the given resource 578 */ 579 public boolean isEditable(CmsObject cms, CmsResource resource) { 580 581 if (!cms.getRequestContext().getCurrentProject().isOnlineProject() 582 && OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN)) { 583 return true; 584 } 585 // determine if this resource type is editable for the current user 586 CmsPermissionSet permissions = getAccess().getPermissions(cms, resource); 587 return permissions.requiresWritePermission(); 588 } 589 590 /** 591 * Returns if this explorer type setting uses a special properties dialog.<p> 592 * 593 * @return true, if this explorer type setting uses a special properties dialog 594 */ 595 public boolean isPropertiesEnabled() { 596 597 return m_propertiesEnabled; 598 } 599 600 /** 601 * Returns if this explorer type setting displays the navigation properties in the special properties dialog.<p> 602 * 603 * @return true, if this explorer type setting displays the navigation properties in the special properties dialog 604 */ 605 public boolean isShowNavigation() { 606 607 return m_showNavigation; 608 } 609 610 /** 611 * Returns true if this explorer type represents a view.<p> 612 * 613 * @return true if this explorer type represents a view 614 */ 615 public boolean isView() { 616 617 return m_isView; 618 } 619 620 /** 621 * Sets the access object of the type settings.<p> 622 * 623 * @param access access object 624 */ 625 public void setAccess(CmsExplorerTypeAccess access) { 626 627 m_access = access; 628 } 629 630 /** 631 * Sets the additional explorer type flag.<p> 632 * 633 * @param addititionalModuleExplorerType true or false 634 */ 635 public void setAddititionalModuleExplorerType(boolean addititionalModuleExplorerType) { 636 637 m_addititionalModuleExplorerType = addititionalModuleExplorerType; 638 } 639 640 /** 641 * Sets if navigation properties should automatically be added on resource creation.<p> 642 * 643 * @param autoSetNavigation true if properties should be added, otherwise false 644 */ 645 public void setAutoSetNavigation(String autoSetNavigation) { 646 647 m_autoSetNavigation = Boolean.valueOf(autoSetNavigation).booleanValue(); 648 if (LOG.isDebugEnabled()) { 649 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_AUTO_NAV_1, autoSetNavigation)); 650 } 651 } 652 653 /** 654 * Sets if the title property should automatically be added on resource creation.<p> 655 * 656 * @param autoSetTitle true if title should be added, otherwise false 657 */ 658 public void setAutoSetTitle(String autoSetTitle) { 659 660 m_autoSetTitle = Boolean.valueOf(autoSetTitle).booleanValue(); 661 if (LOG.isDebugEnabled()) { 662 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_AUTO_TITLE_1, autoSetTitle)); 663 } 664 } 665 666 /** 667 * Sets the file name of the big icon for this explorer type.<p> 668 * 669 * @param bigIcon the file name of the big icon 670 */ 671 public void setBigIcon(String bigIcon) { 672 673 m_bigIcon = bigIcon; 674 } 675 676 /** 677 * Sets the big icon CSS style class.<p> 678 * 679 * @param bigIconStyle the big icon style to set 680 */ 681 public void setBigIconStyle(String bigIconStyle) { 682 683 m_bigIconStyle = bigIconStyle; 684 } 685 686 /** 687 * Sets the creatable flag.<p> 688 * 689 * @param creatable the non creatable flag to set 690 */ 691 public void setCreatable(boolean creatable) { 692 693 m_creatable = creatable; 694 } 695 696 /** 697 * Sets the creatable flag.<p> 698 * 699 * @param creatable the creatable flag to set 700 */ 701 public void setCreatable(String creatable) { 702 703 m_creatable = Boolean.parseBoolean(creatable); 704 } 705 706 /** 707 * Sets the flag if this explorer type entry has explicit edit options set.<p> 708 * 709 * This is determined by the presence of the <editoptions> node in the Cms workplace configuration.<p> 710 */ 711 public void setEditOptions() { 712 713 m_hasEditOptions = true; 714 } 715 716 /** 717 * Sets the reference of the explorer type setting.<p> 718 * 719 * @param elementView the element view 720 */ 721 public void setElementView(String elementView) { 722 723 m_elementView = elementView; 724 if (LOG.isDebugEnabled()) { 725 LOG.debug("Setting element view to " + elementView); 726 727 } 728 } 729 730 /** 731 * Sets the icon path and file name of the explorer type setting.<p> 732 * 733 * @param icon the icon path and file name of the explorer type setting 734 */ 735 public void setIcon(String icon) { 736 737 m_icon = icon; 738 if (LOG.isDebugEnabled()) { 739 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_ICON_1, icon)); 740 } 741 } 742 743 /** 744 * Sets the info.<p> 745 * 746 * @param info the info to set 747 */ 748 public void setInfo(String info) { 749 750 m_info = info; 751 if (LOG.isDebugEnabled()) { 752 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_INFO_1, info)); 753 } 754 } 755 756 /** 757 * Sets the key name of the explorer type setting.<p> 758 * 759 * @param key the key name of the explorer type setting 760 */ 761 public void setKey(String key) { 762 763 m_key = key; 764 if (LOG.isDebugEnabled()) { 765 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_KEY_1, key)); 766 } 767 } 768 769 /** 770 * Sets the name of the explorer type setting.<p> 771 * 772 * @param name the name of the explorer type setting 773 */ 774 public void setName(String name) { 775 776 m_name = name; 777 if (LOG.isDebugEnabled()) { 778 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_NAME_1, name)); 779 } 780 } 781 782 /** 783 * Sets the order for the new resource dialog of the explorer type setting.<p> 784 * 785 * @param newResourceOrder the order for the new resource dialog of the explorer type setting 786 */ 787 public void setNewResourceOrder(String newResourceOrder) { 788 789 try { 790 m_newResourceOrder = Integer.valueOf(newResourceOrder); 791 if (LOG.isDebugEnabled()) { 792 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_NEW_RESOURCE_ORDER_1, newResourceOrder)); 793 } 794 } catch (Exception e) { 795 // can usually be ignored 796 if (LOG.isInfoEnabled()) { 797 LOG.info(e); 798 } 799 m_newResourceOrder = new Integer(0); 800 } 801 } 802 803 /** 804 * Sets the list of properties of the explorer type setting.<p> 805 * 806 * @param properties the list of properties of the explorer type setting 807 */ 808 public void setProperties(List<String> properties) { 809 810 m_properties = properties; 811 } 812 813 /** 814 * Sets if this explorer type setting uses a special properties dialog.<p> 815 * 816 * @param enabled true, if this explorer type setting uses a special properties dialog 817 */ 818 public void setPropertiesEnabled(boolean enabled) { 819 820 m_propertiesEnabled = enabled; 821 } 822 823 /** 824 * Sets the default settings for the property display dialog.<p> 825 * 826 * @param enabled true, if this explorer type setting uses a special properties dialog 827 * @param showNavigation true, if this explorer type setting displays the navigation properties in the special properties dialog 828 */ 829 public void setPropertyDefaults(String enabled, String showNavigation) { 830 831 setPropertiesEnabled(Boolean.valueOf(enabled).booleanValue()); 832 setShowNavigation(Boolean.valueOf(showNavigation).booleanValue()); 833 if (LOG.isDebugEnabled()) { 834 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_PROP_DEFAULTS_2, enabled, showNavigation)); 835 } 836 } 837 838 /** 839 * Sets the reference of the explorer type setting.<p> 840 * 841 * @param reference the reference of the explorer type setting 842 */ 843 public void setReference(String reference) { 844 845 m_reference = reference; 846 if (LOG.isDebugEnabled()) { 847 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_REFERENCE_1, m_reference)); 848 } 849 } 850 851 /** 852 * Sets if this explorer type setting displays the navigation properties in the special properties dialog.<p> 853 * 854 * @param navigation true, if this explorer type setting displays the navigation properties in the special properties dialog 855 */ 856 public void setShowNavigation(boolean navigation) { 857 858 m_showNavigation = navigation; 859 } 860 861 /** 862 * Sets the small icon CSS style class.<p> 863 * 864 * @param smallIconStyle the small icon CSS style class to set 865 */ 866 public void setSmallIconStyle(String smallIconStyle) { 867 868 m_smallIconStyle = smallIconStyle; 869 } 870 871 /** 872 * Sets the titleKey.<p> 873 * 874 * @param titleKey the titleKey to set 875 */ 876 public void setTitleKey(String titleKey) { 877 878 m_titleKey = titleKey; 879 if (LOG.isDebugEnabled()) { 880 LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_TITLE_KEY_1, titleKey)); 881 } 882 } 883 884 /** 885 * Sets the basic attributes of the type settings.<p> 886 * 887 * @param name the name of the type setting 888 * @param key the key name of the explorer type setting 889 * @param icon the icon path and file name of the explorer type setting 890 */ 891 public void setTypeAttributes(String name, String key, String icon) { 892 893 setName(name); 894 setKey(key); 895 setIcon(icon); 896 } 897 898 /** 899 * Sets the basic attributes of the type settings.<p> 900 * 901 * @param name the name of the type setting 902 * @param key the key name of the explorer type setting 903 * @param icon the icon path and file name of the explorer type setting 904 * @param bigIcon the file name of the big icon 905 * @param smallIconStyle the small icon CSS style class 906 * @param bigIconStyle the big icon CSS style class 907 * @param reference the reference of the explorer type setting 908 * @param elementView the element view 909 * @param isView 'true' if this type represents an element view 910 * @param namePattern the name pattern 911 * @param viewOrder the view order 912 */ 913 public void setTypeAttributes( 914 String name, 915 String key, 916 String icon, 917 String bigIcon, 918 String smallIconStyle, 919 String bigIconStyle, 920 String reference, 921 String elementView, 922 String isView, 923 String namePattern, 924 String viewOrder) { 925 926 setName(name); 927 setKey(key); 928 setIcon(icon); 929 setBigIcon(bigIcon); 930 setSmallIconStyle(smallIconStyle); 931 setBigIconStyle(bigIconStyle); 932 setReference(reference); 933 setElementView(elementView); 934 try { 935 m_viewOrder = Integer.valueOf(viewOrder); 936 } catch (NumberFormatException e) { 937 LOG.debug("Type " + name + " has no or invalid view order:" + viewOrder); 938 } 939 m_isView = Boolean.valueOf(isView).booleanValue(); 940 m_namePattern = namePattern; 941 942 } 943 944}