Changeset 642
- Timestamp:
- Apr 4, 2008, 3:35:42 PM (15 years ago)
- Location:
- extensions/net.sf.basedb.examples/trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.examples/trunk/src/net/sf/basedb/examples/extensions/HelloUserFactory.java
r636 r642 7 7 import net.sf.basedb.core.SessionControl; 8 8 import net.sf.basedb.core.User; 9 import net.sf.basedb.util.extensions.C ontext;10 import net.sf.basedb.util.extensions. Extension;9 import net.sf.basedb.util.extensions.ClientContext; 10 import net.sf.basedb.util.extensions.InvokationContext; 11 11 import net.sf.basedb.util.extensions.xml.PathSetter; 12 12 import net.sf.basedb.util.extensions.xml.VariableSetter; … … 36 36 Creates a menu item that displays: {prefix} {name of user}! 37 37 */ 38 public MenuItemAction[] getActions(Context context, 39 Extension<? super MenuItemAction> extension) 38 public MenuItemAction[] getActions(InvokationContext<? super MenuItemAction> context) 40 39 { 41 String userName = getUserName(context );40 String userName = getUserName(context.getClientContext()); 42 41 MenuItemBean helloUser = new MenuItemBean(); 43 42 helloUser.setTitle(prefix + " " + userName + "!"); … … 50 49 Get the name of the logged in user. 51 50 */ 52 private String getUserName(C ontext context)51 private String getUserName(ClientContext context) 53 52 { 54 53 DbControl dc = null; -
extensions/net.sf.basedb.examples/trunk/src/net/sf/basedb/examples/extensions/HelloWorldFactory.java
r641 r642 5 5 import net.sf.basedb.clients.web.extensions.menu.MenuItemBean; 6 6 import net.sf.basedb.util.extensions.ActionFactory; 7 import net.sf.basedb.util.extensions.Context; 8 import net.sf.basedb.util.extensions.Extension; 7 import net.sf.basedb.util.extensions.InvokationContext; 9 8 10 9 /** … … 25 24 26 25 // Return true enable the extension, false to disable it 27 public boolean prepareContext(Context context, 28 Extension<? super MenuItemAction> extension) 26 public boolean prepareContext(InvokationContext<? super MenuItemAction> context) 29 27 { 30 28 return true; … … 32 30 33 31 // An extension may create one or more actions 34 public MenuItemAction[] getActions(Context context, 35 Extension<? super MenuItemAction> extension) 32 public MenuItemAction[] getActions(InvokationContext<? super MenuItemAction> context) 36 33 { 37 34 // This cast is always safe with the web client 38 JspContext jspContext = (JspContext)context ;35 JspContext jspContext = (JspContext)context.getClientContext(); 39 36 if (helloWorld[0] == null) 40 37 { 41 38 MenuItemBean bean = new MenuItemBean(); 42 39 bean.setTitle("Hello factory world!"); 43 bean.setIcon(jspContext.get Root() + "/images/info.gif");40 bean.setIcon(jspContext.getHome(context.getExtension()) + "/images/factory.png"); 44 41 bean.setOnClick("alert('Hello factory world!')"); 45 42 helloWorld[0] = bean;
Note: See TracChangeset
for help on using the changeset viewer.