-
1. Re: Editing in visual pane
mareshkau Mar 1, 2009 5:31 PM (in response to kukeltje)The simplest example it's editing just a text, you can see HtmlTextTemplate class.
In this class exist such lines
VpeElementData textElementData = new VpeElementData();
//here we create mapping for editing between source and visual elements.
NodeData nodeData = new NodeData(sourceNode, visualNewTextNode);
textElementData.addNodeData(nodeData);
Another example AbstractOutputJsfTemplate, line 105. -
2. Re: Editing in visual pane
kukeltje Mar 2, 2009 3:35 AM (in response to kukeltje)tnx, will look into that
-
3. Re: Editing in visual pane
kukeltje Mar 5, 2009 7:42 PM (in response to kukeltje)Ok, it works partially now
public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) { VpeCreationData creationData = null; Element sourceElement = (Element) sourceNode; readAttributes(sourceElement); nsIDOMElement label; label = visualDocument.createElement(HTML.TAG_LABEL); label.setAttribute(HTML.ATTR_STYLE, style); label.setAttribute(HTML.ATTR_CLASS, styleClass); creationData = new VpeCreationData(label); Node textChild = sourceElement.getFirstChild(); if (textChild != null) { VpeElementData elementData = new VpeElementData(); nsIDOMText text; boolean isEditable = true; text = visualDocument.createTextNode(textChild.getNodeValue()); label.appendChild(text); elementData.addNodeData(new NodeData(textChild, label, isEditable)); creationData.setElementData(elementData); } return creationData;
makes it possible to edit the data inline at least at the place you click. You cannot go left or right with the cursors.
I'll try to look into this, but any hints would be appreciated -
4. Re: Editing in visual pane
kukeltje Mar 9, 2009 9:37 PM (in response to kukeltje)hmm... ctrl-left and ctrl-right seem to work. Think I have to do something with keybindings... Besides that, If I select the 'label' element in the visual pane, the corresponding xml element in the source is not selected anymore. Think I have to digg a little into the existing jsf/richfaces code again....
Still.... hints are welcome :-) -
5. Re: Editing in visual pane
sdzmitrovich Mar 10, 2009 3:55 AM (in response to kukeltje)May be It is because you has described label's template as children="no" and label's template add children itself. Try to set children="yes" and not add children by label's template. Look org.jboss.tools.jsf.vpe.jsf.template.JsfOutputLabelTemplate
-
6. Re: Editing in visual pane
sdzmitrovich Mar 10, 2009 4:07 AM (in response to kukeltje)Sorry ... org.jboss.tools.jsf.vpe.jsf.template.JsfOutputLabelTemplate is bad example :)
-
7. Re: Editing in visual pane
sdzmitrovich Mar 10, 2009 4:36 AM (in response to kukeltje)In fact ... Source selection is right in your case :)
If an element is "editable" then behavior of selection is changed.
In this case cursor just is set to necessary position. But so as focus is not on source part it looks like as selection is not set.