Santy, Michael wrote:
> 
> In my application, I have written a CSS extension to render a set of
> attributes on a single node in a very specialized way that cannot be
> done in pure CSS.  The CSS extension returns the desired textual
> representation as intended.
> 
> These attributes will be edited when a user double clicks on content
> returned from the CSS extension.  I'm having trouble figuring out how to
> bind mouse clicks to the StyleValue returned by a CSS extension.

You cannot do that: style sheet extensions and user input such as
double-clicks are totally unrelated concepts.



> The only way that I've seen as a possibility is to replace the CSS
> extension with a ComponentFactory.  This ComponentFactory would have to
> return a JLabel that has a mouse listener registered that opens the
> custom dialog on a double click.
> 
> Is there a more straightforward approach that I'm overlooking?

Using a standard Java[tm] AWT/Swing Component created using a
ComponentFactory (rather an style extension) is certainly a clean and
simple way to achieve what you want.

http://www.xmlmind.com/xmleditor/_distrib/doc/dev/styleext.html#solution4

http://www.xmlmind.com/xmleditor/_distrib/doc/dev/styleext.html#solution1



(You could create a Gadget using a GadgetFactory, which is much more
efficient than creating a Component, but doing so is not documented and
is not officially supported:

http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/gadget/Gadget.html
Use the grabsMouseButton and handleMouseEvent methods to do something
when the Gadget is double-clicked.

http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/styledview/GadgetFactory.html
Gadgets returned by GadgetFactory must implement the
StyledElementViewPart interface.

http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/styledgadget/TextLabel.html
TextLabel is a simple styled Gadget

http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/styledview/TextLabelVP.html
TextLabelVP is a TextLabel which implements the StyledElementViewPart
interface.)

Reply via email to