[jboss-user] [JBoss Seam] - Re: Bind a string property by reference
jbuechel
do-not-reply at jboss.com
Tue Jul 31 12:08:44 EDT 2007
I see...
The datatable in facelets page:
| <rich:dataTable value="#{entryList}" var="entr"
| rendered="#{entryList.size>0}" id="dtEntryList" rows="10"
| width="100%">
| <f:facet name="header">
| <rich:columnGroup>
| <h:column>
| <h:outputText styleClass="headerText" value="Id" />
| </h:column>
| <h:column>
| <h:outputText styleClass="headerText" value="Title" />
| </h:column>
| <h:column>
| <h:outputText styleClass="headerText" value="Text" />
| </h:column>
| </rich:columnGroup>
| </f:facet>
| <h:column>
| <h:outputText value="#{entr.id}" />
| </h:column>
| <h:column>
| <h:commandLink value="#{entr.title}" action="#{listManager.select}" />
| </h:column>
| <h:column>
| <s:link value="#{entr.text}" action="#{defaultDialogManager.open('Neue Funktion','Funktionsname', entr.text)}" />
|
| <s:link value="delete"
| action="#{listManager.delete}" />
| </h:column>
| </rich:dataTable>
|
|
DialogManager class which opens a dialog (rich:modalpanel) by setting the display property true. Also the title, label and the object (called source) which should be modified are passed to the open method:
@Scope(ScopeType.SESSION)
| @Name("defaultDialogManager")
| public class DefaultDialogManager implements DialogManager, Serializable {
| ...
| public String open(String title, String label, Object source){
| log.info("open called");
|
| setDisplay(true);
|
| Map labelMap = new HashMap();
| labelMap.put("title", title);
| labelMap.put("label", label);
|
| inputDialog.init(labelMap, source);
|
| return null;
| }
| public String accept(){
| log.info("accept called");
| inputDialog.accept();
| log.info("accepted: inputDialog.source: "+inputDialog.getSource());
| log.info("accepted: inputDialog.input: "+inputDialog.getInput());
| return close();
| }
|
| ..
| }
|
Dialog facelet contains an h:inputtext and h:commandbutton with an accept action:
| <ui:define name="dialogContent">
| <h:panelGrid columns="1" styleClass="fwc-input-dialog">
| <h:outputLabel for="input">#{defaultDialogManager.inputDialog.labelMap.label}</h:outputLabel>
| <h:inputText id="input"
| value="#{defaultDialogManager.inputDialog.input}" />
| </h:panelGrid>
| </ui:define>
|
| <ui:define name="dialogActionButtons">
| <h:commandButton value="#{messages['controls.save']}"
| action="#{defaultDialogManager.accept}" />
| <h:commandButton value="#{messages['controls.cancel']}"
| action="#{defaultDialogManager.cancel}" />
| </ui:define>
|
When #{defaultDialogManager.accept} is executed, SimpleInputDialog.accept() is called (inputDialog.accept();)
InputDialog implementation class:
| public class SimpleInputDialog implements InputDialog {
|
| @Logger
| Log log;
|
| private Map labelMap;
| private Object source;
| private Object input;
|
| public void init(Map labelMap, Object source) {
|
| this.labelMap = labelMap;
| this.source = source;
| this.input = source;
| }
|
| public void accept() {
|
| source = input;
| }
|
| public void cancel() {
|
| }
| ...
| }
the reference pointing to "input" should be assigned to "source":
source = input;
Is that clearly?
(seems like i didn't listen to the english teacher enough.. ;-) )
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069249#4069249
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069249
More information about the jboss-user
mailing list