What It Is
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.
Check out the screencast at the mDimension build site!
Click to Open is a browser based extension to WOLips found in Project Wonder. All of the Wonder ERD2W components support this.
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.
What You Need
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. If not using Wonder, untar the frameworks and copy WOLips.framework to where you have the rest of your frameworks (usually /Library or ~/Library).
Getting Set Up
Add the WOLips.framework
Follow the tutorial on adding a framework to add WOLips.framework to your application.
Add Support to Component Base Class
If your components extend Wonder's ERXComponent, you can skip this step. Once again, using Wonder makes your life easier.
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.
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.
To include it into your component base class, you can use this sample implementation:
For components that can't sub-class ClickToOpenComponent (directly or indirectly), you can enable Click to Open by adding this method to your component:
Note that when isClickToOpenEnabled is false, the ERXClickToOpenSupport methods are no-ops.
Add Support to Application
If your Application.java class extends Wonder's ERXApplication, you can skip this step too. Otherwise, add a developmentMode() method like this:
Set Application Properties
In your application's Properties file, add this line:
If you need to, you can also change these default values:
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):
Add WOLToolBar to Your Pages
In your page wrapper's HTML template, add
and you're done. If you don't have a page wrapper, you will have to add this to every page. Hint: page wrappers make your life easier.
If you are using the old WO template syntax, add this to the .html file:
And add this to the .wod file:
Configure WOLips Server
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
Turning on the WOLips Server requires Eclipse to be restarted.
You can optionally change the port number. If you do change the port number, see
wolips.port in the Set Application Properties section above.
Enable Click to Open
And add -Der.component.clickToOpen=true and -Der.extensions.ERXApplication.developmentMode=true to the launch arguments:
Using Click to Open
you can hold cmd
and it will highlight the component
and if you cmd-click
it will popup the stack
and you can pick from the stack
also esc is a shortcut for getting out of click-to-open mode