You are viewing an old version (v. 3) of this page.
The latest version is v. 6, last edited on Oct 14, 2011
(view differences
|
)
<< View previous version | view page history | view next version >>
<< View previous version | view page history | view next version >>
We will further enhance the plugin in tutorial Write Your First Plugin to add a custom gadget to display a specified message. Firstable, we create below class:
package com.example.myplugin; import org.apache.wicket.Component; import org.apache.wicket.behavior.AttributeAppender; import org.apache.wicket.markup.html.basic.Label; import org.hibernate.validator.constraints.NotEmpty; import com.pmease.quickbuild.annotation.Editable; import com.pmease.quickbuild.extensionpoint.support.Gadget; import com.pmease.quickbuild.extensionpoint.support.GadgetCategory; @Editable(name="My Message", order=100001, category=GadgetCategory.OTHERS) public class MyMessageGadget extends Gadget { private static final long serialVersionUID = 1L; private String message; @Editable(name="Message", description="Specify a message to display.") @NotEmpty public String getMessage() { return message; } @Override public String getCssClass() { return "window"; } public void setMessage(String message) { this.message = message; } @Override public Component renderBody(String componentId) { return new Label(componentId, getMessage()).add(new AttributeAppender("class", "p8p")); } }
Then modify class MyPlugin to contribute the message gadget: