Dashboard > People > Uwe Schaefer > Browse Space > News Items for
  codesmell Log In   View a printable version of the current page.  
  News Items for Jun 15, 2008
  2008/06/15
Last changed: Jun 23, 2008 08:26 by Uwe Schaefer
Labels: wicket, gem, javascript, editor, richtexteditor

Just another Gem from the Wicket-Mailinglist:

[Update: see comments for updated Version]


francisco.treacy wrote:

i thought i'd like to share a simple behaviour for NicEdit
(http://nicedit.com/).

to use it, just download nicedit and modify NICEDIT_JAVASCRIPT and NICEDIT_ICONS accordingly. (i chose to put them together in the same
package). if you download the basic version (without xhtml/ code view), when adding the behaviour pass 'false' into the constructor, in order not
to use the full panel. of course, you can use it with multiple textareas in the same page.

francisco

public class NicEditTextAreaBehavior extends AbstractBehavior {

	private Component<TextArea<String>> textArea;
	private Boolean fullPanel = Boolean.TRUE;
	
	private static final ResourceReference NICEDIT_JAVASCRIPT =
		new JavascriptResourceReference(NicEditTextAreaBehavior.class, "nicEdit.js");
	
	private static final ResourceReference NICEDIT_ICONS = new
ResourceReference(NicEditTextAreaBehavior.class,
		"nicEditorIcons.gif");
	
	public NicEditTextAreaBehavior() {
	}
	
	public NicEditTextAreaBehavior(Boolean fullPanel) {
		this.fullPanel = fullPanel;
	}	
	
	@Override @SuppressWarnings("unchecked")
	public void bind(Component component) {
		this.textArea = component;
		component.setOutputMarkupId(true);
	}
	
	@Override
	public void renderHead(IHeaderResponse response) {
		super.renderHead(response);
		response.renderJavascriptReference(NICEDIT_JAVASCRIPT);
		response.renderOnDomReadyJavascript("new nicEditor({iconsPath : '"+
RequestCycle.get().urlFor(
				NICEDIT_ICONS) +"', fullPanel : "+ fullPanel +"}).panelInstance('"
+ textArea.getMarkupId() + "');");
	}
}
Posted at 15 Jun @ 10:50 AM by Uwe Schaefer | 2 comments

Juni 2008
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

Jun 16, 2008
Jun 13, 2008

This site is powered by a free Atlassian Confluence Personal Server License. Evaluate Confluence for your organisation or read more about Confluence licensing here.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators