Wiki source code of Click to Open
Version 39.1 by chuckhill on 2008/03/12 00:15
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
18.1 | 1 | == What It Is == |
2 | |||
![]() |
38.1 | 3 | Click to Open is a browser based extension to WOLips. It provides a component that appears in the browser as part of the pages of your running application. Clicking on this, 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. |
![]() |
18.1 | 4 | |
5 | == What You Need == | ||
6 | |||
![]() |
36.1 | 7 | 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).,, |
![]() |
18.1 | 8 | |
9 | == Getting Set Up == | ||
10 | |||
![]() |
38.1 | 11 | To fully utilize WOLips.framework, you must add support for click-to-open and you must provide |
12 | a prototype.js implementation. Note that click-to-open support is expensive, because it has to dig around | ||
13 | your component HTML quite a bit, so you will take a performance hit in development to have it enabled. | ||
![]() |
18.1 | 14 | |
![]() |
38.1 | 15 | 1) If your components extends ERXComponent, all you need to do is set: |
![]() |
18.1 | 16 | |
![]() |
38.1 | 17 | er.component.clickToOpen=true |
![]() |
18.1 | 18 | |
![]() |
38.1 | 19 | in your Properties file. |
![]() |
18.1 | 20 | |
![]() |
38.1 | 21 | If you do not use ERXComponent and instead have a custom component base class, you must add |
22 | clickToOpen support to your components on your own. You should ONLY have clickToOpen execute in your | ||
23 | component if you are in development mode. To include it into your component base class, you can use | ||
24 | the sample implementation from ERXComponent: | ||
![]() |
18.1 | 25 | |
26 | {{code value="java"}} | ||
27 | |||
![]() |
38.1 | 28 | @Override |
29 | public void appendToResponse(WOResponse response, WOContext context) { | ||
30 | ... | ||
31 | boolean clickToOpenEnabled = ...; | ||
32 | ERXClickToOpenSupport.preProcessResponse(response, context, clickToOpenEnabled); | ||
![]() |
26.1 | 33 | super.appendToResponse(response, context); |
![]() |
38.1 | 34 | ERXClickToOpenSupport.postProcessResponse(getClass(), response, context, clickToOpenEnabled); |
35 | ... | ||
![]() |
26.1 | 36 | } |
37 | |||
38 | {{/code}} | ||
39 | |||
![]() |
38.1 | 40 | Note that when clickToOpenEnabled is false, the ERXClickToOpenSupport methods are no-ops. |
![]() |
26.1 | 41 | |
![]() |
38.1 | 42 | 2) If your Application.java class does not extend ERXApplication, add a method like this: |
![]() |
18.1 | 43 | |
44 | {{code value="java"}} | ||
45 | |||
46 | private Boolean isDevelopmentMode; | ||
47 | public boolean developmentMode() { | ||
48 | if (isDevelopmentMode == null) { | ||
![]() |
36.1 | 49 | isDevelopmentMode = new Boolean(ERXProperties.booleanForKey("developmentMode", false)); |
![]() |
18.1 | 50 | } |
51 | return isDevelopmentMode.booleanValue(); | ||
52 | } | ||
53 | |||
54 | {{/code}} | ||
55 | |||
![]() |
38.1 | 56 | And add this to the launch arguments: |
57 | --DdevelopmentMode=true-- | ||
![]() |
18.1 | 58 | |
![]() |
38.1 | 59 | 3) You must be using a recent version of WOLips that supports the WOLips Server. In |
60 | your WOLips preferences, you must enable the WOLips Server, set the port number and the communication | ||
61 | password. Turning on the WOLips Server requires a restart of WOLips. | ||
![]() |
18.1 | 62 | |
![]() |
38.1 | 63 | In your application preferences, you can then set: |
![]() |
18.1 | 64 | |
![]() |
38.1 | 65 | wolips.host=localhost |
66 | wolips.port=9485 | ||
67 | wolips.password=yourpassword | ||
68 | |||
69 | Only 'wolips.password' is strictly required as long as you use the default port of 9485. | ||
![]() |
18.1 | 70 | |
![]() |
38.1 | 71 | 4) WOLips.framework needs a prototype.js. If you are using Ajax framework, you don't need to do |
72 | anything, because it will default to use Ajax.framework's prototype.js. However, if you are not, | ||
73 | you must set (as an example): | ||
![]() |
26.1 | 74 | |
![]() |
38.1 | 75 | wolips.prototype.framework=app |
76 | wolips.prototype.fileName=prototype.js | ||
![]() |
26.1 | 77 | |
![]() |
36.1 | 78 | 5) In your page wrapper, add a <wo:WOLToolBar/> component, and you're good to go. Look in the lower |
79 | left hand corner of the browser window for the link. |