Changes for page Click to Open
Last modified by Kieran Kelleher on 2012/07/21 20:41
From version 39.1
edited by chuckhill
on 2008/03/12 00:15
on 2008/03/12 00:15
Change comment:
There is no comment for this version
To version 40.1
edited by David Avendasora
on 2008/03/21 08:38
on 2008/03/21 08:38
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. chuckhill1 +XWiki.avendasora - Content
-
... ... @@ -1,52 +1,91 @@ 1 1 == What It Is == 2 2 3 -Click to Open isabrowserbasedextension toWOLips.It providesacomponentthat 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.3 +Click to Open (C2O) allows you to open components in Eclipse directly from the running application in your browser! Click to Open appears in the lower 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. It also provides some other very slick debugging tools. 4 4 5 +Check out the [[screencast at the mDimension build site>>http://webobjects.mdimension.com/wolips/preview/WOLipsFramework.m4v]] 6 + 7 +Click to Open is a browser based extension to WOLips found in [[Project Wonder>>WONDER:Home]]. All of the Wonder ERD2W components support Click to Open. 8 + 9 +**Note that click-to-open support is expensive, because it has to dig around your component HTML quite a bit, so you will take a performance hit in development to have it enabled.** 10 + 5 5 == What You Need == 6 6 7 -You eitherneed to be using Project Wonder or you need to get the **WOLips** framework that is part of Project Wonder. Youcan downloaditfrom [[mDimension'ssite>>http://webobjects.mdimension.com/wonder/]].IfnotusingWonder,untartheframeworks andcopyWOLips.frameworktowhereyouhavethe rest ofyourframeworks(usually /Libraryor ,,/Library).,,13 +You need the **WOLips** framework that is part of Project Wonder. You also need the **ERExtensions** framework that is part of Project Wonder on the class path at runtime. If you already use Project Wonder, are you almost done. 8 8 15 +If you are not using Project Wonder, you can download it from [[mDimension's site>>http://webobjects.mdimension.com/wonder/]], untar the frameworks, and copy just the WOLips.framework and ERExtensions.framework to where you have the rest of your frameworks (usually /Library/Frameworks or ,,/Library/Frameworks).,, 16 + 9 9 == Getting Set Up == 10 10 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. 19 +=== Add the WOLips.framework === 14 14 15 - 1)IfyourcomponentsextendsERXComponent, all youneedtodo is set:21 +Follow the [[tutorial>>Add a Framework Dependency]] on adding a framework to add WOLips.framework and ERXExtentions.framework to your application. 16 16 17 - er.component.clickToOpen=true23 +=== Add Support to Component Base Class === 18 18 19 - inyourProperties file.25 +If your components extend Wonder's ERXComponent, you can skip this step. Once again, using Wonder makes your life easier. 20 20 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: 27 +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. If you don't have one, you might want to start using the ClickToOpenComponent below. 25 25 29 +You will need to add the appendToResponse(WOResponse, WOContext) method below to your component base class, or add this code to your appendToResponse method if you already have one. 30 + 31 +Here is an example implementation of a component base class and of Click to Open support: 32 + 26 26 {{code value="java"}} 27 27 28 -@Override 29 -public void appendToResponse(WOResponse response, WOContext context) { 30 - ... 31 - boolean clickToOpenEnabled = ...; 32 - ERXClickToOpenSupport.preProcessResponse(response, context, clickToOpenEnabled); 35 +package net.com.foo.bar; 36 + 37 +import com.webobjects.appserver.*; 38 + 39 + 40 +/** 41 + * Support for "Click to Open" navigation from the browser to the template in Eclipse. To enable this, 42 + * launch with: 43 + * <pre> 44 + * -Der.component.clickToOpen=true 45 + * </pre> 46 + */ 47 +public class ClickToOpenComponent extends com.webobjects.appserver.WOComponent { 48 + 49 + public static final boolean isClickToOpenEnabled = Boolean.getBoolean(System.getProperty("er.component.clickToOpen", "false")); 50 + 51 + public ClickToOpenComponent(WOContext context) { 52 + super(context); 53 + } 54 + 55 + public void appendToResponse(WOResponse response, WOContext context) { 56 + ERXClickToOpenSupport.preProcessResponse(response, context, isClickToOpenEnabled); 57 + super.appendToResponse(response, context); 58 + ERXClickToOpenSupport.postProcessResponse(getClass(), response, context, isClickToOpenEnabled); 59 + } 60 +} 61 + 62 +{{/code}} 63 + 64 +For components that can't sub-class ClickToOpenComponent (directly or indirectly), you can enable Click to Open by adding this method to your component: 65 + 66 +{{code value="java"}} 67 + 68 +public void appendToResponse(WOResponse response, WOContext context) 69 +{ 70 + ERXClickToOpenSupport.preProcessResponse(response, context, ClickToOpenComponent.isClickToOpenEnabled); 33 33 super.appendToResponse(response, context); 34 - ERXClickToOpenSupport.postProcessResponse(getClass(), response, context, clickToOpenEnabled); 35 - ... 72 + ERXClickToOpenSupport.postProcessResponse(getClass(), response, context, ClickToOpenComponent.isClickToOpenEnabled); 36 36 } 37 37 38 38 {{/code}} 39 39 40 -Note that when clickToOpenEnabled is false, the ERXClickToOpenSupport methods are no-ops.77 +**Note that when isClickToOpenEnabled is false, the ERXClickToOpenSupport methods are no-ops.** 41 41 42 - 2)Ifyour Application.java class does notextendERXApplication,add a method like this:79 +=== Add Support to Application === 43 43 81 +If your Application.java class extends Wonder's ERXApplication, you can skip this step too. Otherwise, add a developmentMode() method like this: 82 + 44 44 {{code value="java"}} 45 45 46 46 private Boolean isDevelopmentMode; 47 47 public boolean developmentMode() { 48 48 if (isDevelopmentMode == null) { 49 - isDevelopmentMode = new Boolean( ERXProperties.booleanForKey("developmentMode", false));88 + isDevelopmentMode = new Boolean(System.getProperty("er.extensions.ERXApplication.developmentMode", "false")); 50 50 } 51 51 return isDevelopmentMode.booleanValue(); 52 52 } ... ... @@ -53,27 +53,109 @@ 53 53 54 54 {{/code}} 55 55 56 -And add this to the launch arguments: 57 ---DdevelopmentMode=true-- 95 +=== Set Application Properties === 58 58 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. 97 +In your application's Properties file, add this line: 62 62 63 - In your application preferences, you can then set:99 +{{code}} 64 64 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. 101 +wolips.password=yourpassword 70 70 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): 103 +{{/code}} 74 74 75 - wolips.prototype.framework=app 76 - wolips.prototype.fileName=prototype.js 105 +If you need to, you can also change these default values: 77 77 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. 107 +{{code}} 108 + 109 +wolips.host=localhost 110 +wolips.port=9485 111 + 112 +{{/code}} 113 + 114 +=== Provide prototype.js === 115 + 116 +WOLips.framework needs a prototype.js. If you are using Ajax framework, you don't need to do anything, because it will default to use Ajax.framework's prototype.js. However, if you are not, add this to your application's Properties file (as an example, change the values as appropriate): 117 + 118 +{{code}} 119 + 120 +wolips.prototype.framework=app 121 +wolips.prototype.fileName=prototype.js 122 + 123 +{{/code}} 124 + 125 +=== Add WOLToolBar to Your Pages === 126 + 127 +In your page wrapper's HTML template, add 128 + 129 +{{code value="html"}} 130 + 131 +<wo:WOLToolBar/> 132 + 133 +{{/code}} 134 + 135 +and you're done. If you don't have a [[page wrapper>>WO:Web Applications-Development-Examples-Page Layout]], you will have to add this to every page. Hint: page wrappers make your life easier. 136 + 137 +If you are using the old WO template syntax, add this to the .html file: 138 + 139 +{{code value="html"}} 140 + 141 +<webobject name="WOLToolBar" /> 142 + 143 +{{/code}} 144 + 145 +And add this to the .wod file: 146 + 147 +{{code value="html"}} 148 + 149 +WOLToolBar: WOLToolBar{ 150 +} 151 + 152 +{{/code}} 153 + 154 +=== Configure WOLips Server === 155 + 156 +You must be using a recent version of WOLips that supports the **WOLips Server**. In your WOLips preferences, you must enable the WOLips Server and set the communication password. This password must match the ##wolips.password## in the **Set Application Properties** section above. 157 + 158 +**Turning on the WOLips Server requires Eclipse to be restarted.** 159 + 160 +[[image:WOLipsServerPreferences.png]] 161 + 162 +You can optionally change the port number. If you do change the port number, see ##wolips.port## in the **Set Application Properties** section above. 163 + 164 +=== Enable Click to Open === 165 + 166 +And add **-Der.component.clickToOpen=true** and **-Der.extensions.ERXApplication.developmentMode=true** to the launch arguments: 167 + 168 +[[image:EnableClickToOpen.png]] 169 + 170 +== Using Click to Open == 171 + 172 +Run your application and look in the lower, left hand corner. You should see a link like this: 173 + 174 +[[image:ClickToOpenLink.png]] 175 + 176 +If you don't, check that the page has the WOLToolBar on it and that the ##er.component.clickToOpen## property is set to true and the ##er.extensions.ERXApplication.developmentMode## property is set to true. 177 + 178 +\\ 179 + 180 +Click on this component to open the Click to Open UI: 181 + 182 +[[image:ClickToOpenExpanded.png]] 183 + 184 +**EditDisplayAd** is the page in the browser. Click on this link to open this page in Eclipse. 185 + 186 +\\ 187 + 188 +If you are looking for a sub-component of this page, click on the **Click to Open** link. As you move your mouse over the page, the bread crumb of components will change to show you where you are. Just click to open the component under the mouse in Eclipse. It is that easy! 189 + 190 +[[image:ClickToOpenInAction.png]] 191 + 192 +\\ 193 + 194 +=== Additional Functionality === 195 + 196 +* Esc is a shortcut for getting out of click-to-open mode 197 +* hold down the Cmd key while you move the mouse around and it will highlight the component 198 +* Cmd-click it will popup the stack of components and you can pick from the stack: 199 +[[image:ComponentStack.png]] 200 +* you can the binding ##expanded=true;## on WOLToolBar so it's open by default, instead of closed