Wiki source code of Click to Open

Version 24.1 by chuckhill on 2008/03/12 00:49

Hide last authors
Pascal Robert 18.1 1 == What It Is ==
2
chuckhill 22.1 3 Check out the [[screencast at the mDimension build site>>http://webobjects.mdimension.com/wolips/preview/WOLipsFramework.m4v]]!
Pascal Robert 18.1 4
chuckhill 22.1 5 Click to Open is a browser based extension to WOLips found in [[Project Wonder>>WONDER:Home]]. It provides some very slick debugging tools, like the ability to click on arbitrary components in your web browser and have the corresponding component open in WOLips. All of the Wonder ERD2W components support this.
Pascal Robert 18.1 6
chuckhill 22.1 7 Click to Open appears in the lover left corner of browser as part of the pages of your running application. Clicking on this component, and then on an object in the browser window opens the relevant WOComponent in Eclipse. This makes life easier for UI designers and for developers getting familiar with new projects.
Pascal Robert 18.1 8
chuckhill 22.1 9 **Note that click-to-open support is expensive, because it has to dig around
10 your component HTML quite a bit, so you will take a performance hit in development to have it enabled.**
Pascal Robert 18.1 11
12 == What You Need ==
13
chuckhill 22.1 14 You either need to be using Project Wonder or you need to get the **WOLips** framework that is part of Project Wonder. You can download it from [[mDimension's site>>http://webobjects.mdimension.com/wonder/]]. If not using Wonder, untar the frameworks and copy WOLips.framework to where you have the rest of your frameworks (usually /Library or ,,/Library).,,
Pascal Robert 18.1 15
16 == Getting Set Up ==
17
18 === Add the WOLips.framework ===
19
chuckhill 22.1 20 Follow the [[tutorial>>Add a Framework Dependency]] on adding a framework to add WOLips.framework to your application.
Pascal Robert 18.1 21
22 === Add Support to Component Base Class ===
23
24 If your components extend Wonder's ERXComponent, you can skip this step. Once again, using Wonder makes your life easier.
25
chuckhill 22.1 26 If you don't have a custom component base class, you really should. Using com.webobjects.appserver.WOComponent as the super-class for your pages and components is just going to leave you doing the same things over and over.
Pascal Robert 18.1 27
chuckhill 22.1 28 You will need to add the appendToResponse(WOResponse, WOContext) method to your component base class, or add to it if you already have that method. You should ONLY have clickToOpen execute in your component if you are in development mode.
Pascal Robert 18.1 29
chuckhill 22.1 30 To include it into your component base class, you can use this sample implementation:
Pascal Robert 18.1 31
32 {{code value="java"}}
33
34 package net.com.foo.bar;
35
36 import com.webobjects.appserver.*;
chuckhill 22.1 37 import er.extensions.*;
Pascal Robert 18.1 38
39 /**
40 * Support for "Click to Open" navigation from the browser to the template in Eclipse. To enable this,
41 * launch with:
42 * <pre>
43 * -Der.component.clickToOpen=true
44 * </pre>
45 */
46 public class ClickToOpenComponent extends com.webobjects.appserver.WOComponent {
47
chuckhill 24.1 48 private static final boolean isClickToOpenEnabled = ERXProperties.booleanForKeyWithDefault("er.component.clickToOpen", false);
Pascal Robert 18.1 49
50 public ClickToOpenComponent(WOContext context) {
51 super(context);
52 }
53
54 public void appendToResponse(WOResponse response, WOContext context) {
55 ERXClickToOpenSupport.preProcessResponse(response, context, isClickToOpenEnabled);
56 super.appendToResponse(response, context);
57 ERXClickToOpenSupport.postProcessResponse(getClass(), response, context, isClickToOpenEnabled);
58 }
59 }
60
61 {{/code}}
62
chuckhill 24.1 63 Note that when isClickToOpenEnabled is false, the ERXClickToOpenSupport methods are no-ops.
Pascal Robert 18.1 64
65 === Add Support to Application ===
66
67 If your Application.java class extends Wonder's ERXApplication, you can skip this step too. Otherwise, add a developmentMode() method like this:
68
69 {{code value="java"}}
70
71 private Boolean isDevelopmentMode;
72 public boolean developmentMode() {
73 if (isDevelopmentMode == null) {
chuckhill 22.1 74 isDevelopmentMode = new Boolean(ERXProperties.booleanForKey("developmentMode", false));
Pascal Robert 18.1 75 }
76 return isDevelopmentMode.booleanValue();
77 }
78
79 {{/code}}
80
chuckhill 22.1 81 And add this to the launch arguments:
82 --DdevelopmentMode=true--
83
Pascal Robert 18.1 84 === Set Application Properties ===
85
chuckhill 22.1 86 In your application preferences, you can then set:
Pascal Robert 18.1 87
chuckhill 24.1 88 wolips.host=localhost
89 wolips.port=9485
90 wolips.password=yourpassword
91 er.component.clickToOpen=true
Pascal Robert 18.1 92
chuckhill 22.1 93 Only 'wolips.password' is strictly required as long as you use the default port of 9485.
Pascal Robert 18.1 94
95 === Provide prototype.js ===
96
chuckhill 22.1 97 WOLips.framework needs a prototype.js. If you are using Ajax framework, you don't need to do
98 anything, because it will default to use Ajax.framework's prototype.js. However, if you are not,
99 you must set (as an example):
Pascal Robert 18.1 100
chuckhill 22.1 101 wolips.prototype.framework=app
102 wolips.prototype.fileName=prototype.js
Pascal Robert 18.1 103
104 === Add WOLToolBar to Your Pages ===
105
chuckhill 22.1 106 5) In your page wrapper, add a <wo:WOLToolBar/> component, and you're good to go. Look in the lower
107 left hand corner of the browser window for the link.
Pascal Robert 18.1 108
109 === Configure WOLips Server ===
110
chuckhill 22.1 111 You must be using a recent version of WOLips that supports the WOLips Server. In
112 your WOLips preferences, you must enable the WOLips Server, set the port number and the communication
113 password. Turning on the WOLips Server requires a restart of WOLips.
Pascal Robert 18.1 114
115 == Using Click to Open ==