Results 1 to 2 of 2

Thread: Master-detail form help

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    6

    Default 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. #2
    Join Date
    Jul 2007
    Posts
    17

    Default 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);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •