[opencms-dev] OpenCms 9 custom widgets

Kai Widmann Widmann at mediaworx.com
Tue Jul 8 13:04:51 CEST 2014


Hi there,

there is a way to create custom widgets for OpenCms 8.5 (and I guess it should work in 9 as well, but I’m not sure), but it’s not documented.
With OpenCms 8.5 you get a module named org.opencms.dev.demo.customwidget that contains the source code for a Java Class (CustomWidget.java, it doesn’t do much) and a sample JavaScript widget (mywidget.js).
Using this sample you can create custom widgets in Plain JavaScript, no GWT required (that’s why I chose this method).

The JavaScript contains two functions:
  createNativeWidget: creates the widget for the form based XML editor
  createNativeWrapedElement: creates the widget for the inline editor

Besides others there are two notable functions for each of the widgets:
  getElement: returns a DOM element that is or contains your widget, this might be a simple editable DIV or a complex multi-select widget.
  setValue: must be called whenever the value of your widget changes, (e.g. if the value of a select box changes)

I got some custom widgets working that way, but it wasn’t easy.
Get the module, have a look at the source code. If you think that this is a way you could go then you can contact me again, I might be able to strip down one of my widgets to provide working sample code.

Cheers

Kai


Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Tobias Karrer
Gesendet: Freitag, 4. Juli 2014 11:34
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] OpenCms 9 custom widgets

Someone from Alkacon?

Am 12.06.2014 15:20, schrieb Tobias Karrer:

Hi!



Looking for a solution to migrate my old widgets, I went through the

recent topics.



Seems that a lot of people have problems with Custom Widgets in 8.5. and 9:



http://opencms.996256.n3.nabble.com/OpenCms-9-custom-widgets-tt24244.html

http://opencms.996256.n3.nabble.com/Custom-widgets-and-the-new-acacia-editor-tt18313.html

http://opencms.996256.n3.nabble.com/Custom-Widget-opencms-9-0-1-tt24186.html

http://opencms.996256.n3.nabble.com/GWT-custom-widgets-and-dev-demo-customwidget-tt24113.html

http://opencms.996256.n3.nabble.com/Custom-widget-with-GWT-tt23612.html

http://opencms.996256.n3.nabble.com/Creating-a-CustomeCategoryWidget-tt23473.html

http://opencms.996256.n3.nabble.com/Custom-widgets-in-latest-versions-tt23251.html

http://opencms.996256.n3.nabble.com/Custom-XmlContent-Widget-in-8-5-1-tt23181.html

http://opencms.996256.n3.nabble.com/I-Custom-widgets-and-the-new-acacia-editor-SOLVED-tt18800.html

http://opencms.996256.n3.nabble.com/Opencms-8-5-Custom-Widgets-tt14097.html



Maybe someone knows how to do it and gives us an hint :-)



Best,

Tobias



Am 09.06.2014 20:07, schrieb Tobias Karrer:



_______________________________________________

This mail is sent to you from the opencms-dev mailing list

To change your list options, or to unsubscribe from the list, please visit

http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20140708/93352d71/attachment.htm>


More information about the opencms-dev mailing list