Changeset 4262
- Timestamp:
- Apr 30, 2008, 9:54:50 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/menu/FixedMenuItemFactory.java
r4207 r4262 1 1 /** 2 $Id :$2 $Id$ 3 3 4 4 Copyright (C) Authors contributing to this file. … … 52 52 private MenuItemAction[] actions; 53 53 54 private String menuId; 55 private String submenuId; 54 56 private String icon; 55 57 private String onClick; … … 94 96 95 97 @Override 98 public String getMenuId() 99 { 100 return menuId; 101 } 102 103 @Override 96 104 public String getOnClick() 97 105 { … … 103 111 { 104 112 return style; 113 } 114 115 @Override 116 public String getSubmenuId() 117 { 118 return submenuId; 105 119 } 106 120 … … 147 161 } 148 162 163 public void setMenuId(String menuId) 164 { 165 this.menuId = menuId; 166 } 167 149 168 @VariableSetter 150 169 public void setOnClick(String onClick) … … 158 177 } 159 178 179 public void setSubmenuId(String submenuId) 180 { 181 this.submenuId = submenuId; 182 } 183 160 184 public void setTitle(String title) 161 185 { -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/menu/MenuItemAction.java
r4187 r4262 27 27 28 28 /** 29 An action for extensions to the menu system. Currently, two menu 29 An action for extensions to the menu system. The extension point 30 will add menu items to the <code>Extensions</code> menu. 31 32 Currently, two menu 30 33 subtypes are supported: a real menu item and a menu separator. 31 34 Submenus are not supported. … … 43 46 */ 44 47 public MenuType getType(); 48 49 /** 50 The ID of the menu where this menu item belongs, or null if 51 it belongs to the top-level menu. 52 */ 53 public String getMenuId(); 54 55 /** 56 The ID of a new submenu. This value is required when the menu item is 57 a {@link MenuType#SUBMENU}, and is ignored otherwise. 58 */ 59 public String getSubmenuId(); 45 60 46 61 /** … … 144 159 145 160 /** 161 A menu item that opens a submenu. 162 */ 163 SUBMENU, 164 165 /** 146 166 This is a separator line. All properties except 147 167 {@link MenuItemAction#isVisible()} and {@link MenuItemAction#getStyle()} -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/menu/MenuItemBean.java
r4187 r4262 36 36 { 37 37 38 private String menuId; 39 private String submenuId; 38 40 private String icon; 39 41 private String onClick; … … 58 60 Create a new initialised menu item action 59 61 */ 60 public MenuItemBean(MenuType type, 62 public MenuItemBean(MenuType type, String menuId, String submenuId, 61 63 String title, String onClick, String tooltip, String icon, String style, 62 64 boolean enabled, boolean visible) 63 65 { 64 66 this.type = type; 67 this.menuId = menuId; 68 this.submenuId = submenuId; 65 69 this.title = title; 66 70 this.onClick = onClick; … … 83 87 84 88 @Override 89 public String getMenuId() 90 { 91 return menuId; 92 } 93 94 @Override 85 95 public String getOnClick() 86 96 { … … 92 102 { 93 103 return style; 104 } 105 106 @Override 107 public String getSubmenuId() 108 { 109 return submenuId; 94 110 } 95 111 … … 130 146 } 131 147 148 public void setMenuId(String menuId) 149 { 150 this.menuId = menuId; 151 } 152 132 153 public void setOnClick(String onClick) 133 154 { … … 138 159 { 139 160 this.style = style; 161 } 162 163 public void setSubmenuId(String submenuId) 164 { 165 this.submenuId = submenuId; 140 166 } 141 167 -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/menu/PermissionMenuItemFactory.java
r4233 r4262 1 1 /** 2 $Id :$2 $Id$ 3 3 4 4 Copyright (C) Authors contributing to this file. … … 68 68 private String onClick; 69 69 private MenuType type; 70 private String menuId; 71 private String submenuId; 70 72 71 73 private Permission visiblePermission; … … 114 116 // Menu item should be visible but disabled 115 117 action = new MenuItemBean( 116 type, disabledTitle, null, disabledTooltip, disabledIcon, disabledStyle, false, true);118 type, menuId, submenuId, disabledTitle, null, disabledTooltip, disabledIcon, disabledStyle, false, true); 117 119 } 118 120 else … … 120 122 // Menu item is visible and enabled 121 123 action = new MenuItemBean( 122 type, enabledTitle, onClick, enabledTooltip, enabledIcon, enabledStyle, true, true);124 type, menuId, submenuId, enabledTitle, onClick, enabledTooltip, enabledIcon, enabledStyle, true, true); 123 125 } 124 126 return new MenuItemAction[] { action }; … … 191 193 this.disabledIcon = icon; 192 194 } 195 196 public void setMenuId(String menuId) 197 { 198 this.menuId = menuId; 199 } 193 200 194 201 /** … … 222 229 this.enabledStyle = style; 223 230 this.disabledStyle = style; 231 } 232 233 public void setSubmenuId(String submenuId) 234 { 235 this.submenuId = submenuId; 224 236 } 225 237 -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/menu/Submenu.java
r4093 r4262 178 178 */ 179 179 private String icon = null; 180 181 private boolean iconAbsolute = false; 180 182 181 183 … … 244 246 { 245 247 return icon; 248 } 249 public void setIconabsolute(boolean absolute) 250 { 251 this.iconAbsolute = absolute; 252 } 253 254 public boolean isIconabsolute() 255 { 256 return iconAbsolute; 246 257 } 247 258 … … 277 288 sb.append("<img src=\"").append(menu.getRoot()).append("images/submenu.gif\" alt=\">\" style=\"float: right; padding-right: 4px;\">"); 278 289 String theIcon = getIcon() == null ? "padding.gif" : getIcon(); 279 sb.append("<img src=\"").append(menu.getRoot()).append("images/").append(theIcon).append("\" alt=\"\" style=\"padding-left: 4px; padding-right: 4px;\">"); 290 if (!isIconabsolute()) 291 { 292 // The icon is in the 'images' directory 293 theIcon = menu.getRoot() + "images/" + theIcon; 294 } 295 296 sb.append("<img src=\"").append(theIcon).append("\" alt=\"\" style=\"padding-left: 4px; padding-right: 4px;\">"); 280 297 } 281 298 String padding = menu.isVertical() ? " " : ""; -
trunk/www/WEB-INF/menu.tld
r4187 r4262 171 171 <rtexprvalue>true</rtexprvalue> 172 172 </attribute> 173 <attribute> 174 <name>iconabsolute</name> 175 <required>false</required> 176 <rtexprvalue>true</rtexprvalue> 177 </attribute> 173 178 </tag> 174 179 <tag> -
trunk/www/include/menu.jsp
r4237 r4262 64 64 import="net.sf.basedb.util.extensions.ActionIterator" 65 65 import="java.util.HashMap" 66 import="java.util.Map" 66 67 import="java.util.ArrayList" 68 import="java.util.LinkedList" 67 69 import="java.util.List" 68 70 import="java.util.Arrays" … … 957 959 "net.sf.basedb.clients.web.menu.extensions"); 958 960 ExtensionsControl ec = ExtensionsControl.get(dc); 959 ActionIterator<MenuItemAction> items = invoker.iterate(); 960 boolean addSeparator = false; 961 %> 962 <m:menu id="extensions" style="display: none"> 961 ActionIterator<MenuItemAction> it = invoker.iterate(); 962 Map<String, List<MenuItemAction>> menus = new HashMap<String, List<MenuItemAction>>(); 963 while (it.hasNext()) 964 { 965 MenuItemAction action = it.next(); 966 String menuId = action.getMenuId(); 967 menuId = menuId == null ? "extensions" : "extensions." + menuId; 968 List<MenuItemAction> actions = menus.get(menuId); 969 if (actions == null) 970 { 971 actions = new LinkedList<MenuItemAction>(); 972 menus.put(menuId, actions); 973 } 974 actions.add(action); 975 } 976 977 for (Map.Entry<String, List<MenuItemAction>> entry : menus.entrySet()) 978 { 979 String menuId = entry.getKey(); 980 List<MenuItemAction> actions = entry.getValue(); 981 %> 982 <m:menu id="<%=menuId%>" style="display: none;"> 963 983 <% 964 while (items.hasNext())984 for (MenuItemAction action : actions) 965 985 { 966 MenuItemAction item = items.next(); 967 Extension extension = items.getExtension(); 968 if (item.getType() == MenuItemAction.MenuType.SEPARATOR) 986 if (action.getType() == MenuItemAction.MenuType.SEPARATOR) 969 987 { 970 addSeparator = false;971 988 %> 972 <m:menuseparator style="<%= item.getStyle()%>" visible="<%=item.isVisible()%>" />989 <m:menuseparator style="<%=action.getStyle()%>" visible="<%=action.isVisible()%>" /> 973 990 <% 974 991 } 975 else if ( item.getType() == MenuItemAction.MenuType.MENUITEM)992 else if (action.getType() == MenuItemAction.MenuType.MENUITEM) 976 993 { 977 addSeparator = true;978 994 %> 979 995 <m:menuitem 980 style="<%= item.getStyle()%>"981 title="<%= item.getTitle()%>"982 icon="<%= item.getIcon()%>"996 style="<%=action.getStyle()%>" 997 title="<%=action.getTitle()%>" 998 icon="<%=action.getIcon()%>" 983 999 iconabsolute="true" 984 tooltip="<%=item.getTooltip()%>" 985 enabled="<%=item.isEnabled()%>" 986 visible="<%=item.isVisible()%>" 987 onclick="<%=item.getOnClick()%>" 1000 tooltip="<%=action.getTooltip()%>" 1001 enabled="<%=action.isEnabled()%>" 1002 visible="<%=action.isVisible()%>" 1003 onclick="<%=action.getOnClick()%>" 1004 /> 1005 <% 1006 } 1007 else if (action.getType() == MenuItemAction.MenuType.SUBMENU) 1008 { 1009 %> 1010 <m:submenu 1011 subid="<%="extensions." + action.getSubmenuId()%>" 1012 style="<%=action.getStyle()%>" 1013 title="<%=action.getTitle()%>" 1014 icon="<%=action.getIcon()%>" 1015 iconabsolute="true" 1016 tooltip="<%=action.getTooltip()%>" 1017 enabled="<%=action.isEnabled()%>" 1018 visible="<%=action.isVisible()%>" 988 1019 /> 989 1020 <% 990 1021 } 991 1022 } 992 if ( addSeparator)1023 if ("extensions".equals(menuId)) 993 1024 { 1025 if (actions.size() > 0) 1026 { 1027 %> 1028 <m:menuseparator /> 1029 <% 1030 } 994 1031 %> 995 <m:menuseparator /> 1032 <m:menuitem 1033 title="Installed extensions" 1034 onclick="<%="Menu.openUrl('"+root+"admin/extensions/index.jsp?ID="+ID+"')"%>" 1035 tooltip="Display and administrate installed extensions" 1036 /> 1037 <m:menuitem 1038 title="Manual scan…" 1039 onclick="<%="Main.openPopup('"+root+"admin/extensions/manual_scan.jsp?ID=" + ID + "', 'ManualScan', 500, 400);"%>" 1040 enabled="<%=ec.hasPermission(Permission.WRITE)%>" 1041 tooltip="Start a manual scan for new, updated and deleted extensions" 1042 /> 996 1043 <% 997 1044 } 998 1045 %> 999 <m:menuitem 1000 title="Installed extensions" 1001 onclick="<%="Menu.openUrl('"+root+"admin/extensions/index.jsp?ID="+ID+"')"%>" 1002 tooltip="Display and administrate installed extensions" 1003 /> 1004 <m:menuitem 1005 title="Manual scan…" 1006 onclick="<%="Main.openPopup('"+root+"admin/extensions/manual_scan.jsp?ID=" + ID + "', 'ManualScan', 500, 400);"%>" 1007 enabled="<%=ec.hasPermission(Permission.WRITE)%>" 1008 tooltip="Start a manual scan for new, updated and deleted extensions" 1009 /> 1010 </m:menu> 1046 </m:menu> 1047 <% 1048 } 1049 %> 1011 1050 1012 1051 <%
Note: See TracChangeset
for help on using the changeset viewer.