\\
JAXFront allows you to overwrite any standard wiget generated by the visualizer factory. Just specify an own plugin class in your XUI for a certain field/block.
\\
!worddavcb6485e9e92f2079ba5fb51986276aae.png|height=33,width=33! As an example see the Wiki-Markup
As an example see the po.xui in the jaxfront-demo.war. There is a HTML plugin defined for the xpath: /purchaseOrder/shipTo/street: \\
Codeblock | ||||||
---|---|---|---|---|---|---|
| ||||||
<component xpath="/purchaseOrder/shipTo/street">
|
...
<style>
<plugIn |
...
class="com.jaxfront.html.plugins.SimpleTypePluginPlainHTMLExampleView"> |
...
|
...
</plugIn>
|
...
</style>
</component> |
...
|
The following simple JAXFront HTML plugin just creates a listbox containing three different street names to choose from. As soon as the user selects a street, the value will be updated asynchronously in the server-side existing JAXFront DOM.
Codeblock | ||||||
---|---|---|---|---|---|---|
| ||||||
public class SimpleTypePluginPlainHTMLExampleView extends SimpleTypeView { protected void createEditorComponent(HtmlContainerWidget container) |
...
{
|
...
_component = |
...
new HtmlPlainTextWidget(container, |
...
getHTMLContent().toString());
|
...
} |
...
public void populateView() |
...
{
|
...
super.populateView(); |
...
((HtmlPlainTextWidget) |
...
_component).setHTMLContent(getHTMLContent().toString()); |
...
} |
...
public StringBuffer getHTMLContent() |
...
{
|
...
StringBuffer sb = |
...
new StringBuffer(); |
...
sb.append( |
...
"<b>Choose your favorite street! |
...
</b><br/><br/>"); |
...
sb.append( |
...
"<select id=\"" |
...
+ getXPath() + |
...
|
...
"\" size=\"3\" onclick=\"saveData(this)\" |
...
>"); |
...
String |
...
[ |
...
] names = |
...
new String |
...
[ |
...
] |
...
{ |
...
|
...
" |
...
Nowhere Land" |
...
, |
...
|
...
"Palm Street" |
...
, |
...
|
...
" |
...
Example Street" |
...
, |
...
|
...
" |
...
Wall Street" |
...
, |
...
|
...
" |
...
Bahnhof Street" |
...
|
...
};
|
...
String selected = |
...
|
...
"" |
...
;
|
...
for (int i = 0; i < names. |
...
length; i++) |
...
{
|
...
if (getValue() != |
...
null && getValue().equals(names |
...
[i |
...
]))
|
...
selected = |
...
|
...
"selected" |
...
; else selected = |
...
|
...
"" |
...
; sb.append( |
...
"<option " + selected + |
...
|
...
" |
...
|
...
value=\"" |
...
+ names |
...
[i |
...
] + |
...
"\">" |
...
+ names |
...
[i |
...
] + |
...
|
...
" |
...
</option>"); |
...
}
|
...
sb.append( |
...
"</select>"); return sb; |
...
} |
...
public void setSize(String size) |
...
{
|
...
// do |
...
nothing |
...
} |
...
|