private static final long serialVersionUID = 1L;
public FullFeaturedTinyMCEPage()
{
TinyMCESettings settings = new TinyMCESettings(TinyMCESettings.Theme.advanced);
// Register non-buttuon plugins
settings.register(new ContextMenuPlugin());
settings.register(new AutoSavePlugin());
settings.register(new WordcountPlugin());
settings.register(new AdvListPlugin());
// first toolbar
SavePlugin savePlugin = new SavePlugin();
settings.add(savePlugin.getSaveButton(), TinyMCESettings.Toolbar.first,
TinyMCESettings.Position.before);
settings.add(Button.newdocument, TinyMCESettings.Toolbar.first,
TinyMCESettings.Position.before);
settings.add(Button.separator, TinyMCESettings.Toolbar.first,
TinyMCESettings.Position.before);
settings.add(Button.fontselect, TinyMCESettings.Toolbar.first,
TinyMCESettings.Position.after);
settings.add(Button.fontsizeselect, TinyMCESettings.Toolbar.first,
TinyMCESettings.Position.after);
// second toolbar
PastePlugin pastePlugin = new PastePlugin();
SearchReplacePlugin searchReplacePlugin = new SearchReplacePlugin();
DateTimePlugin dateTimePlugin = new DateTimePlugin();
dateTimePlugin.setDateFormat("Date: %m-%d-%Y");
dateTimePlugin.setTimeFormat("Time: %H:%M");
PreviewPlugin previewPlugin = new PreviewPlugin();
settings.add(Button.cut, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
settings.add(Button.copy, TinyMCESettings.Toolbar.second, TinyMCESettings.Position.before);
settings.add(pastePlugin.getPasteButton(), TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.before);
settings.add(pastePlugin.getPasteTextButton(), TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.before);
settings.add(pastePlugin.getPasteWordButton(), TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.before);
settings.add(Button.separator, TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.before);
settings.add(searchReplacePlugin.getSearchButton(), TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.before);
settings.add(searchReplacePlugin.getReplaceButton(), TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.before);
settings.add(Button.separator, TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.before);
settings.add(Button.separator, TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.after);
settings.add(dateTimePlugin.getDateButton(), TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.after);
settings.add(dateTimePlugin.getTimeButton(), TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.after);
settings.add(Button.separator, TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.after);
settings.add(previewPlugin.getPreviewButton(), TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.after);
settings.add(Button.separator, TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.after);
settings.add(Button.forecolor, TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.after);
settings.add(Button.backcolor, TinyMCESettings.Toolbar.second,
TinyMCESettings.Position.after);
// third toolbar
TablePlugin tablePlugin = new TablePlugin();
EmotionsPlugin emotionsPlugin = new EmotionsPlugin();
IESpellPlugin iespellPlugin = new IESpellPlugin();
MediaPlugin mediaPlugin = new MediaPlugin();
PrintPlugin printPlugin = new PrintPlugin();
FullScreenPlugin fullScreenPlugin = new FullScreenPlugin();
DirectionalityPlugin directionalityPlugin = new DirectionalityPlugin();
settings.add(tablePlugin.getTableControls(), TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.before);
settings.add(Button.separator, TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(emotionsPlugin.getEmotionsButton(), TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(iespellPlugin.getIespellButton(), TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(mediaPlugin.getMediaButton(), TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(Button.separator, TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(printPlugin.getPrintButton(), TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(Button.separator, TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(directionalityPlugin.getLtrButton(), TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(directionalityPlugin.getRtlButton(), TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(Button.separator, TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
settings.add(fullScreenPlugin.getFullscreenButton(), TinyMCESettings.Toolbar.third,
TinyMCESettings.Position.after);
// other settings
settings.setToolbarAlign(TinyMCESettings.Align.left);
settings.setToolbarLocation(TinyMCESettings.Location.top);
settings.setStatusbarLocation(TinyMCESettings.Location.bottom);
settings.setResizing(true);
// custom settings
String styleFormats = "style_formats : ["
+ "{title : 'Bold text', inline : 'b'},"
+ "{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},"
+ "{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},"
+ "{title : 'Example 1', inline : 'span', classes : 'example1'},"
+ "{title : 'Example 2', inline : 'span', classes : 'example2'},"
+ "{title : 'Table styles'},"
+ "{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}]";
settings.addCustomSetting(styleFormats);
settings.addCustomSetting("content_css : \"../../../../../content.css\"");
TextArea<String> textArea = new TextArea<String>("ta", new Model<String>(TEXT));
textArea.add(new TinyMceBehavior(settings));
add(textArea);
}