Announcement Announcement Module
Collapse
No announcement yet.
Master-detail form help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Master-detail form help

    I have a combobox populated from a list of objects. On a selection in the combobox, I'd like to display certain properties of the selected object. Any help on how I should achieve this ?

    Domain object looks like this:

    public class SearchDescriptor
    {
    String title;
    MapLayer[] layer; // combobox binding used for this
    }

    public class MapLayer
    {
    PropertyDescriptors[] properties; // I'd like to display this dynamically on combobox selection
    }

    Now I can always create a binding that generates the controls for the properties but I'm not sure how to do that dynamically.

  • #2
    Using RefreshableValueHolder in the AbstractDetailForm

    I had a similar problem and have done the actualization of the selectable values using a RefreshableValueHolder:

    Code:
    	private class YourValueHolder extends RefreshableValueHolder{
    		public YourValueHolder() {
    			super(new Closure() {
    				public Object call(Object arg0) {
    					return "retieve your data from the selected object";
    				}
    			}, false, false); //alwaysRefresh ainda não funciona - springrcp1.0.0);
    		}
    	}
    
    	private YourValueHolder yourValueHolder = new YourValueHolder();
    Then I overrided the method below in the AbstractDetailForm returned by createDetailForm(...):

    Code:
    			@Override
    			protected void setEditState(int editState) {
    				if(editState != 0) {
    					yourValueHolder.refresh();
    				}
    				super.setEditState(editState);
    			}
    Or you can just add a property change listener and call yourValueHolder.refresh();

    Your combobox can be binded as:

    Code:
    bindingFactory.createBoundComboBox("formProperty", yourValueHolder);

    Comment

    Working...
    X