trying to make a NodeFieldPlugin

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

trying to make a NodeFieldPlugin

JoostOudeman
So I am trying to make a plugin for a NodeField.
For some reason, I can't get the Markup to work with the Plugin or something, and it is driving me nuts.
I am not experienced with Wicked, so it might be a very simple mistake of mine, and I would love some help here...
the error I get is:
An error has occurred, sorry for that.
org.apache.wicket.WicketRuntimeException: No markup found:
[MarkupContainer [Component id = fragment]]
Failed to instantiate plugin 'org.onehippo.forge.cms.plugin.HTMLSnippetPlugin' for id 
'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.hippostdEditorFactory.cluster.cms-preview.plugin.viewerPlugin.cluster._default_.field'.

However I am pretty sure I got the fragment in the markup...
this is the markup:
<html xmlns:wicket="http://wicket.apache.org/">
  <wicket:panel>
    <wicket:container wicket:id="fragment" />
  </wicket:panel>
  <wicket:fragment wicket:id="edit">
    Select your snippet:
    <select wicket:id="select"></select>
  </wicket:fragment>
  <wicket:fragment wicket:id="view">
    Selected snippet: <span wicket:id="snippet" />
  </wicket:fragment>
</html>
Reply | Threaded
Open this post in threaded view
|

Re: trying to make a NodeFieldPlugin

marijan milicevic
Hi Joost,

do you have HTMLSnippetPlugin.html file and is this file deployed with
your plugin?  (please check your jar or classes directory),
cheers,
marijan

On 07/26/2011 01:37 PM, JoostOudeman wrote:

> So I am trying to make a plugin for a NodeField.
> For some reason, I can't get the Markup to work with the Plugin or
> something, and it is driving me nuts.
> I am not experienced with Wicked, so it might be a very simple mistake of
> mine, and I would love some help here...
> the error I get is:
> An error has occurred, sorry for that.
> org.apache.wicket.WicketRuntimeException: No markup found:
> [MarkupContainer [Component id = fragment]]
> Failed to instantiate plugin
> 'org.onehippo.forge.cms.plugin.HTMLSnippetPlugin' for id
> 'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.hippostdEditorFactory.cluster.cms-preview.plugin.viewerPlugin.cluster._default_.field'.
>
>
> However I am pretty sure I got the fragment in the markup...
> this is the markup:
>
> <html xmlns:wicket="http://wicket.apache.org/">
>    <wicket:panel>
>      <wicket:container wicket:id="fragment" />
>    </wicket:panel>
>    <wicket:fragment wicket:id="edit">
>      Select your snippet:
>      <select wicket:id="select"></select>
>    </wicket:fragment>
>    <wicket:fragment wicket:id="view">
>      Selected snippet:
>    </wicket:fragment>
> </html>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6621861.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: trying to make a NodeFieldPlugin

Mathijs den Burger
In reply to this post by JoostOudeman
Hi Joost,

Also make sure that in the constructor of org.onehippo.forge.cms.plugin.HTMLSnippetPlugin.java you have something like:

---
Mode mode = Mode.fromString(config.getString(ITemplateEngine.MODE, "view"));

Fragment fragment;

switch(mode) {
case EDIT:
    fragment = new Fragment("fragment", "edit", ...);
    Component select = new WhateverComponent("select", ...)
    fragment.add(select);
    break;
case VIEW:
    fragment = new Fragment("fragment", "view", ...)
}

add(fragment)
---

best,
-Mathijs


On Tue, Jul 26, 2011 at 1:37 PM, JoostOudeman <[hidden email]> wrote:
So I am trying to make a plugin for a NodeField.
For some reason, I can't get the Markup to work with the Plugin or
something, and it is driving me nuts.
I am not experienced with Wicked, so it might be a very simple mistake of
mine, and I would love some help here...
the error I get is:
An error has occurred, sorry for that.
org.apache.wicket.WicketRuntimeException: No markup found:
[MarkupContainer [Component id = fragment]]
Failed to instantiate plugin
'org.onehippo.forge.cms.plugin.HTMLSnippetPlugin' for id
'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.hippostdEditorFactory.cluster.cms-preview.plugin.viewerPlugin.cluster._default_.field'.


However I am pretty sure I got the fragment in the markup...
this is the markup:

<html xmlns:wicket="http://wicket.apache.org/">
 <wicket:panel>
   <wicket:container wicket:id="fragment" />
 </wicket:panel>
 <wicket:fragment wicket:id="edit">
   Select your snippet:
   <select wicket:id="select"></select>
 </wicket:fragment>
 <wicket:fragment wicket:id="view">
   Selected snippet:
 </wicket:fragment>
</html>


--
View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6621861.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: trying to make a NodeFieldPlugin

JoostOudeman
In reply to this post by marijan milicevic
Hey,

Indeed I have named the markup as I mentioned HTMLSnippetPlugin.html.
When I look in the jar, I can find in in the same location as I find the HTMLSnippetPlugin.class...

Joost



-----Original Message-----
From: marijan milicevic [via Hippo] <[hidden email]>
To: JoostOudeman <[hidden email]>
Sent: Tue, Jul 26, 2011 2:26 pm
Subject: Re: trying to make a NodeFieldPlugin

Hi Joost,

do you have HTMLSnippetPlugin.html file and is this file deployed with
your plugin?  (please check your jar or classes directory),
cheers,
marijan

On 07/26/2011 01:37 PM, JoostOudeman wrote:

> So I am trying to make a plugin for a NodeField.
> For some reason, I can't get the Markup to work with the Plugin or
> something, and it is driving me nuts.
> I am not experienced with Wicked, so it might be a very simple mistake of
> mine, and I would love some help here...
> the error I get is:
> An error has occurred, sorry for that.
> org.apache.wicket.WicketRuntimeException: No markup found:
> [MarkupContainer [Component id = fragment]]
> Failed to instantiate plugin
> 'org.onehippo.forge.cms.plugin.HTMLSnippetPlugin' for id
> 'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.hippostdEditorFactory.cluster.cms-preview.plugin.viewerPlugin.cluster._default_.field'.
>
>
> However I am pretty sure I got the fragment in the markup...
> this is the markup:
>
> <html xmlns:wicket="http://wicket.apache.org/">
>    <wicket:panel>
>      <wicket:container wicket:id="fragment" />
>    </wicket:panel>
>    <wicket:fragment wicket:id="edit">
>      Select your snippet:
>      <select wicket:id="select"></select>
>    </wicket:fragment>
>    <wicket:fragment wicket:id="view">
>      Selected snippet:
>    </wicket:fragment>
> </html>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6621861.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



If you reply to this email, your message will be added to the discussion below:
http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6621995.html
To unsubscribe from trying to make a NodeFieldPlugin, click here.
Reply | Threaded
Open this post in threaded view
|

Re: trying to make a NodeFieldPlugin

Vijay Kiran-3
Can you post your field plugin java code ?

./Vijay
On Jul 26, 2011, at 2:36 PM, JoostOudeman wrote:

>
> Hey,
>
> Indeed I have named the markup as I mentioned HTMLSnippetPlugin.html.
> When I look in the jar, I can find in in the same location as I find the HTMLSnippetPlugin.class...
>
> Joost
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: marijan milicevic [via Hippo] <[hidden email]>
> To: JoostOudeman <[hidden email]>
> Sent: Tue, Jul 26, 2011 2:26 pm
> Subject: Re: trying to make a NodeFieldPlugin
>
>
>    Hi Joost,
>
> do you have HTMLSnippetPlugin.html file and is this file deployed with
> your plugin?  (please check your jar or classes directory),
> cheers,
> marijan
>
> On 07/26/2011 01:37 PM, JoostOudeman wrote:
>
>> So I am trying to make a plugin for a NodeField.
>> For some reason, I can't get the Markup to work with the Plugin or
>> something, and it is driving me nuts.
>> I am not experienced with Wicked, so it might be a very simple mistake of
>> mine, and I would love some help here...
>> the error I get is:
>> An error has occurred, sorry for that.
>> org.apache.wicket.WicketRuntimeException: No markup found:
>> [MarkupContainer [Component id = fragment]]
>> Failed to instantiate plugin
>> 'org.onehippo.forge.cms.plugin.HTMLSnippetPlugin' for id
>> 'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.hippostdEditorFactory.cluster.cms-preview.plugin.viewerPlugin.cluster._default_.field'.
>>
>>
>> However I am pretty sure I got the fragment in the markup...
>> this is the markup:
>>
>> <html xmlns:wicket="http://wicket.apache.org/">
>>   <wicket:panel>
>>     <wicket:container wicket:id="fragment" />
>>   </wicket:panel>
>>   <wicket:fragment wicket:id="edit">
>>     Select your snippet:
>>     <select wicket:id="select"></select>
>>   </wicket:fragment>
>>   <wicket:fragment wicket:id="view">
>>     Selected snippet:
>>   </wicket:fragment>
>> </html>
>>
>>
>> --
>> View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6621861.html
>> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
>
> If you reply to this email, your message will be added to the discussion below:
>        http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6621995.html   
>
>                To unsubscribe from trying to make a NodeFieldPlugin, click here.    
>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6622031.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: trying to make a NodeFieldPlugin

JoostOudeman
here's the java-code for my plugin...

I stripped imports, package and comments for readability:
public class HTMLSnippetPlugin extends NodeFieldPlugin {

	private static final long serialVersionUID = 1L;
	
	private HTMLSnippet selected;
	private String selectedTitle;

	private ArrayList<HTMLSnippet> snippets;
	private ArrayList<String> options;
    
	protected Fragment fragment;
	private final FieldPluginHelper helper;

	protected DropDownChoice<HTMLSnippet> choice;
	static final Logger log = LoggerFactory.getLogger(HTMLSnippetPlugin.class);

	public HTMLSnippetPlugin(IPluginContext context, IPluginConfig config) throws RepositoryException {
		super(context, config);
		this.helper = new FieldPluginHelper(context, config);
		final HTMLSnippetListProvider provider = new HTMLSnippetListProvider(context, config);
		snippets = provider.getSnippetList();
		JcrNodeModel model = (JcrNodeModel) getModel();
		log.info("model:" + model);
        selectedTitle = model.getObject().getProperty("anwbvrijetijd:snippetselect").getValue().toString();
        selected = provider.getSnippet(selectedTitle);
        options = provider.getSnippetTitleList();
		
        String mode = config.getString("mode", "view");
        
        fragment = new Fragment("fragment", mode, this);

        add(fragment);

        IFieldDescriptor field = this.helper.getField();
        
        if ("edit".equals(mode)) {

            DropDownChoice choice = new DropDownChoice("select", new PropertyModel(this, "selected"), new Model(options)) {
        	private static final long serialVersionUID = 1L;

                @Override
                protected boolean wantOnSelectionChangedNotifications() {
                    return true;
                }
            };
            choice.add(new OnChangeAjaxBehavior() {
                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                	JcrNodeModel model =  (JcrNodeModel) HTMLSnippetPlugin.this.getModel();
                    updateFragment(HTMLSnippetPlugin.this.fragment, HTMLSnippetPlugin.this.choice);
                }
            });
            updateFragment(fragment, choice);
        }else{
        	if(selected!=null){
        		fragment.add(new Label("snippet", selected.getTitle()));
        	}
        }
	}
	
	private void updateFragment(Fragment fragment, DropDownChoice choice){
		log.info("updateFragment");
		fragment.add(new TextField<String>("latida", new Model<String>("test")));
		fragment.add(choice);
		if(selected!=null){
			for (Object parameter : selected.getParameters().keySet()) {
				String key = (String) parameter;
				String value = selected.getParameters().getProperty(key);
				if(value==null){
					value="";
				}
				log.info("add to view: " + key + " #> " + value);
				fragment.add(new TextField<String>(key, new Model<String>(value)));
			}
		}
	}
}
Reply | Threaded
Open this post in threaded view
|

Re: trying to make a NodeFieldPlugin

Vijay Kiran-3

I'm not sure if extending the NodeFieldPlugin is the cause of the issue - since it has its own markup with "fragment" container. I need to check the root cause.

But, is there any reason why you are extending the NodeFieldPlugin, this can be very well done by just extending the RenderPlugin.

./Vijay

On Jul 26, 2011, at 3:00 PM, JoostOudeman wrote:

> here's the java-code for my plugin...
>
> I stripped imports, package and comments for readability:
>
> public class HTMLSnippetPlugin extends NodeFieldPlugin {
>
> private static final long serialVersionUID = 1L;
>
> private HTMLSnippet selected;
> private String selectedTitle;
>
> private ArrayList<HTMLSnippet> snippets;
> private ArrayList<String> options;
>
> protected Fragment fragment;
> private final FieldPluginHelper helper;
>
> protected DropDownChoice<HTMLSnippet> choice;
> static final Logger log = LoggerFactory.getLogger(HTMLSnippetPlugin.class);
>
> public HTMLSnippetPlugin(IPluginContext context, IPluginConfig config)
> throws RepositoryException {
> super(context, config);
> this.helper = new FieldPluginHelper(context, config);
> final HTMLSnippetListProvider provider = new
> HTMLSnippetListProvider(context, config);
> snippets = provider.getSnippetList();
> JcrNodeModel model = (JcrNodeModel) getModel();
> log.info("model:" + model);
>        selectedTitle =
> model.getObject().getProperty("anwbvrijetijd:snippetselect").getValue().toString();
>        selected = provider.getSnippet(selectedTitle);
>        options = provider.getSnippetTitleList();
>
>        String mode = config.getString("mode", "view");
>
>        fragment = new Fragment("fragment", mode, this);
>
>        add(fragment);
>
>        IFieldDescriptor field = this.helper.getField();
>
>        if ("edit".equals(mode)) {
>
>            DropDownChoice choice = new DropDownChoice("select", new
> PropertyModel(this, "selected"), new Model(options)) {
>         private static final long serialVersionUID = 1L;
>
>                @Override
>                protected boolean wantOnSelectionChangedNotifications() {
>                    return true;
>                }
>            };
>            choice.add(new OnChangeAjaxBehavior() {
>                private static final long serialVersionUID = 1L;
>
>                @Override
>                protected void onUpdate(AjaxRequestTarget target) {
>                 JcrNodeModel model =  (JcrNodeModel)
> HTMLSnippetPlugin.this.getModel();
>                    updateFragment(HTMLSnippetPlugin.this.fragment,
> HTMLSnippetPlugin.this.choice);
>                }
>            });
>            updateFragment(fragment, choice);
>        }else{
>         if(selected!=null){
>         fragment.add(new Label("snippet", selected.getTitle()));
>         }
>        }
> }
>
> private void updateFragment(Fragment fragment, DropDownChoice choice){
> log.info("updateFragment");
> fragment.add(new TextField<String>("latida", new Model<String>("test")));
> fragment.add(choice);
> if(selected!=null){
> for (Object parameter : selected.getParameters().keySet()) {
> String key = (String) parameter;
> String value = selected.getParameters().getProperty(key);
> if(value==null){
> value="";
> }
> log.info("add to view: " + key + " #> " + value);
> fragment.add(new TextField<String>(key, new Model<String>(value)));
> }
> }
> }
> }
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6622107.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: trying to make a NodeFieldPlugin

JoostOudeman
I have no idea what the difference between the NodeFieldPlugin and the RenderPlugin would be.
I figured since I am editing a Node, a NodeFieldPlugin would make most sense....



-----Original Message-----
From: Vijay Kiran-3 [via Hippo] <[hidden email]>
To: JoostOudeman <[hidden email]>
Sent: Tue, Jul 26, 2011 3:59 pm
Subject: Re: trying to make a NodeFieldPlugin


I'm not sure if extending the NodeFieldPlugin is the cause of the issue - since it has its own markup with "fragment" container. I need to check the root cause.

But, is there any reason why you are extending the NodeFieldPlugin, this can be very well done by just extending the RenderPlugin.

./Vijay

On Jul 26, 2011, at 3:00 PM, JoostOudeman wrote:

> here's the java-code for my plugin...
>
> I stripped imports, package and comments for readability:
>
> public class HTMLSnippetPlugin extends NodeFieldPlugin {
>
> private static final long serialVersionUID = 1L;
>
> private HTMLSnippet selected;
> private String selectedTitle;
>
> private ArrayList<HTMLSnippet> snippets;
> private ArrayList<String> options;
>
> protected Fragment fragment;
> private final FieldPluginHelper helper;
>
> protected DropDownChoice<HTMLSnippet> choice;
> static final Logger log = LoggerFactory.getLogger(HTMLSnippetPlugin.class);
>
> public HTMLSnippetPlugin(IPluginContext context, IPluginConfig config)
> throws RepositoryException {
> super(context, config);
> this.helper = new FieldPluginHelper(context, config);
> final HTMLSnippetListProvider provider = new
> HTMLSnippetListProvider(context, config);
> snippets = provider.getSnippetList();
> JcrNodeModel model = (JcrNodeModel) getModel();
> log.info("model:" + model);
>        selectedTitle =
> model.getObject().getProperty("anwbvrijetijd:snippetselect").getValue().toString();
>        selected = provider.getSnippet(selectedTitle);
>        options = provider.getSnippetTitleList();
>
>        String mode = config.getString("mode", "view");
>
>        fragment = new Fragment("fragment", mode, this);
>
>        add(fragment);
>
>        IFieldDescriptor field = this.helper.getField();
>
>        if ("edit".equals(mode)) {
>
>            DropDownChoice choice = new DropDownChoice("select", new
> PropertyModel(this, "selected"), new Model(options)) {
>         private static final long serialVersionUID = 1L;
>
>                @Override
>                protected boolean wantOnSelectionChangedNotifications() {
>                    return true;
>                }
>            };
>            choice.add(new OnChangeAjaxBehavior() {
>                private static final long serialVersionUID = 1L;
>
>                @Override
>                protected void onUpdate(AjaxRequestTarget target) {
>                 JcrNodeModel model =  (JcrNodeModel)
> HTMLSnippetPlugin.this.getModel();
>                    updateFragment(HTMLSnippetPlugin.this.fragment,
> HTMLSnippetPlugin.this.choice);
>                }
>            });
>            updateFragment(fragment, choice);
>        }else{
>         if(selected!=null){
>         fragment.add(new Label("snippet", selected.getTitle()));
>         }
>        }
> }
>
> private void updateFragment(Fragment fragment, DropDownChoice choice){
> log.info("updateFragment");
> fragment.add(new TextField<String>("latida", new Model<String>("test")));
> fragment.add(choice);
> if(selected!=null){
> for (Object parameter : selected.getParameters().keySet()) {
> String key = (String) parameter;
> String value = selected.getParameters().getProperty(key);
> if(value==null){
> value="";
> }
> log.info("add to view: " + key + " #> " + value);
> fragment.add(new TextField<String>(key, new Model<String>(value)));
> }
> }
> }
> }
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6622107.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



If you reply to this email, your message will be added to the discussion below:
http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6622296.html
To unsubscribe from trying to make a NodeFieldPlugin, click here.
Reply | Threaded
Open this post in threaded view
|

Re: trying to make a NodeFieldPlugin

Frank van Lankvelt
the nodefieldplugin is not intended for extension; it renders a field
in a document all right, but does this by instantiating other plugins.
It is quite generic since it needs to deal with all kinds of fields,
handle addition and removal, etcetera.  You probably don't need this.

It is a lot easier to just have a renderplugin.  It's model will be an
IModel<Node> of the document, which should give you all you need for
an editing plugin.  Note that you don't need to do saves, that is
handled by the cms itself.

If you have a specific type of child node that you want to have the
editor for, then you can simply put such a plugin as the (only) plugin
in the editor for that compound type.

cheers, Frank


On Tue, Jul 26, 2011 at 5:03 PM, JoostOudeman <[hidden email]> wrote:

>
>  I have no idea what the difference between the NodeFieldPlugin and the RenderPlugin would be.
> I figured since I am editing a Node, a NodeFieldPlugin would make most sense....
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Vijay Kiran-3 [via Hippo] <[hidden email]>
> To: JoostOudeman <[hidden email]>
> Sent: Tue, Jul 26, 2011 3:59 pm
> Subject: Re: trying to make a NodeFieldPlugin
>
>
>
> I'm not sure if extending the NodeFieldPlugin is the cause of the issue - since it has its own markup with "fragment" container. I need to check the root cause.
>
> But, is there any reason why you are extending the NodeFieldPlugin, this can be very well done by just extending the RenderPlugin.
>
> ./Vijay
>
> On Jul 26, 2011, at 3:00 PM, JoostOudeman wrote:
>
>
>> here's the java-code for my plugin...
>>
>> I stripped imports, package and comments for readability:
>>
>> public class HTMLSnippetPlugin extends NodeFieldPlugin {
>>
>>   private static final long serialVersionUID = 1L;
>>
>>   private HTMLSnippet selected;
>>   private String selectedTitle;
>>
>>   private ArrayList<HTMLSnippet> snippets;
>>   private ArrayList<String> options;
>>
>>   protected Fragment fragment;
>>   private final FieldPluginHelper helper;
>>
>>   protected DropDownChoice<HTMLSnippet> choice;
>>   static final Logger log = LoggerFactory.getLogger(HTMLSnippetPlugin.class);
>>
>>   public HTMLSnippetPlugin(IPluginContext context, IPluginConfig config)
>> throws RepositoryException {
>>       super(context, config);
>>       this.helper = new FieldPluginHelper(context, config);
>>       final HTMLSnippetListProvider provider = new
>> HTMLSnippetListProvider(context, config);
>>       snippets = provider.getSnippetList();
>>       JcrNodeModel model = (JcrNodeModel) getModel();
>>       log.info("model:" + model);
>>        selectedTitle =
>> model.getObject().getProperty("anwbvrijetijd:snippetselect").getValue().toString();
>>        selected = provider.getSnippet(selectedTitle);
>>        options = provider.getSnippetTitleList();
>>
>>        String mode = config.getString("mode", "view");
>>
>>        fragment = new Fragment("fragment", mode, this);
>>
>>        add(fragment);
>>
>>        IFieldDescriptor field = this.helper.getField();
>>
>>        if ("edit".equals(mode)) {
>>
>>            DropDownChoice choice = new DropDownChoice("select", new
>> PropertyModel(this, "selected"), new Model(options)) {
>>           private static final long serialVersionUID = 1L;
>>
>>                @Override
>>                protected boolean wantOnSelectionChangedNotifications() {
>>                    return true;
>>                }
>>            };
>>            choice.add(new OnChangeAjaxBehavior() {
>>                private static final long serialVersionUID = 1L;
>>
>>                @Override
>>                protected void onUpdate(AjaxRequestTarget target) {
>>                   JcrNodeModel model =  (JcrNodeModel)
>> HTMLSnippetPlugin.this.getModel();
>>                    updateFragment(HTMLSnippetPlugin.this.fragment,
>> HTMLSnippetPlugin.this.choice);
>>                }
>>            });
>>            updateFragment(fragment, choice);
>>        }else{
>>           if(selected!=null){
>>               fragment.add(new Label("snippet", selected.getTitle()));
>>           }
>>        }
>>   }
>>
>>   private void updateFragment(Fragment fragment, DropDownChoice choice){
>>       log.info("updateFragment");
>>       fragment.add(new TextField<String>("latida", new Model<String>("test")));
>>       fragment.add(choice);
>>       if(selected!=null){
>>           for (Object parameter : selected.getParameters().keySet()) {
>>               String key = (String) parameter;
>>               String value = selected.getParameters().getProperty(key);
>>               if(value==null){
>>                   value="";
>>               }
>>               log.info("add to view: " + key + " #> " + value);
>>               fragment.add(new TextField<String>(key, new Model<String>(value)));
>>           }
>>       }
>>   }
>> }
>>
>>
>> --
>> View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6622107.html
>> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
>
> If you reply to this email, your message will be added to the discussion below:
>        http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6622296.html
>
>                To unsubscribe from trying to make a NodeFieldPlugin, click here.
>
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/trying-to-make-a-NodeFieldPlugin-tp6621861p6622556.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html