Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with Layout of a DynamicForm

    Hello,

    I am having problems with my DynamicForm layout.
    Please look at my screenshot. That is what I am seeing.

    I am using a VLayout, with two members: A HLayout (the buttons) and a DynamicForm.
    But as you see in the screenshot, there is a big space between the two components. I created the VLayout with VLayout layout = new VLayout(0); , but still is not working.

    Could you please tell me how to remove the space?
    If I don't include the buttons, the form is aligned at the upper-left corner (correctly), but with the buttons it seems to be aligned at the down-left corner. Why?

    My SmartGWT version is the EE (Evaluation).

    My javascript log is:
    Code:
    19:20:33.619:INFO:Log:initialized
    19:20:33.930:WARN:AutoObserver:Use addInterfaceProperties() to add methods to interface [Class AutoObserver]
    19:20:34.323:WARN:Log:New Class ID: 'IAutoFitButton' collides with ID of existing Class object '[Class IAutoFitButton]'.  Existing object will be replaced.
    19:20:34.323:WARN:Log:New Class ID: 'HeaderImgButton' collides with ID of existing Class object '[Class HeaderImgButton]'.  Existing object will be replaced.
    19:21:00.198:INFO:Log:isc.Page is loaded
    My source is:
    Code:
    import com.google.gwt.user.client.ui.Widget;
    import com.gwtplatform.mvp.client.ViewImpl;
    import com.smartgwt.client.data.Criteria;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.ButtonItem;
    import com.smartgwt.client.widgets.form.fields.CheckboxItem;
    import com.smartgwt.client.widgets.form.fields.DateItem;
    import com.smartgwt.client.widgets.form.fields.SectionItem;
    import com.smartgwt.client.widgets.form.fields.TextItem;
    import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
    import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class ViewEditSchuelerView extends ViewImpl implements ViewEditSchuelerPresenter.MyView {
    
    	
    	private Widget content;
    	private DataSource ds = DataSource.get("schueler");
    	
    	
    	
    	@Override
    	public Widget asWidget() {
    		return content;
    	}
    
    	@Override
    	public Widget createContent(int id) {
    
    		//content.setTabProperties(id+"", vorname + " " + name);
     
    
    		final DynamicForm form = new DynamicForm();
    
    		
    		form.setWidth("100%");
    		
    		Criteria c = new Criteria();
    		c.addCriteria("schuelerID", id);
    		form.setInitialCriteria(c);
    		form.setDataSource(ds);
    		form.setAutoFetchData(true);
    		
    		final TextItem schuelerIDItem = new TextItem("schuelerID", "Schüler ID");
    		final TextItem nameItem = new TextItem("name", "Name");
    		final TextItem vornameItem = new TextItem("vorname", "Vorname");
    		final DateItem gebDatumItem = new DateItem("geb_datum", "Geb. Datum");
    
    		final SectionItem section1 = new SectionItem();  
    		section1.setDefaultValue("Persönliche Daten");  
    		section1.setSectionExpanded(true);  
    		section1.setItemIds("schuelerID", "name", "vorname", "geb_datum");
    		
    		final TextItem elternNameItem = new TextItem("eltern_name", "Eltern1 Name");
    		final TextItem elternVornameItem = new TextItem("eltern_vorname", "Eltern1 Vorname");
    		
    		final SectionItem section2 = new SectionItem();  
    		section2.setDefaultValue("Eltern");  
    		section2.setSectionExpanded(false);  
    		section2.setItemIds("eltern_name", "eltern_vorname");
    		
    		final CheckboxItem betreuung1Item = new CheckboxItem("betreuung1", "7:30-14:30");
    		final CheckboxItem betreuung2Item = new CheckboxItem("betreuung2", "7:30-15:30");
    		final CheckboxItem betreuung3Item = new CheckboxItem("betreuung3", "7:30-18:00");
    		
    		final SectionItem section3 = new SectionItem();  
    		section3.setDefaultValue("Betreuungszeiten");  
    		section3.setSectionExpanded(false);  
    		section3.setItemIds("betreuung1", "betreuung2", "betreuung3");
    		
    		 ButtonItem validateItem = new ButtonItem();  
    		         validateItem.setTitle("Speichern");  
    		         validateItem.setWidth(100);
    		         validateItem.addClickHandler(new ClickHandler() {  
    		             public void onClick(ClickEvent event) {  
    		                 if (form.validate(false)) {
    		                	 form.submit();
    		                 }
    		             }  
    		         }); 
    		
    		
    		form.setFields(section1, schuelerIDItem, nameItem, vornameItem, gebDatumItem,
    				section2, elternNameItem, elternVornameItem, section3, betreuung1Item,
    				betreuung2Item, betreuung3Item, validateItem);
    		
    		
    		
    		VLayout layout = new VLayout(0);
    		HLayout buttonPane = new HLayout(15);
    		
    		//TODO: put all handlers in the presenter!!!
    		 IButton vertragButton = new IButton();  
    		         vertragButton.setTitle("Vertrag");
    		         vertragButton.setWidth(100);
    		         vertragButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {  
    		             public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {  
    		                 SC.say("Vertrag von Schüler " + vornameItem.getValueAsString() + " " + nameItem.getValueAsString());
    		             }  
    		         });
    		
    		         IButton stammdatenblattButton = new IButton();  
    		         stammdatenblattButton.setTitle("Stammdatenblatt");
    		         stammdatenblattButton.setWidth(100);
    		         stammdatenblattButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {  
    		             public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {  
    		                 SC.say("Stammdatenblatt von Schüler " + vornameItem.getValueAsString() + " " + nameItem.getValueAsString());
    		             }  
    		         });
    		         
    		         IButton einzelBriefButton = new IButton();  
    		         einzelBriefButton.setTitle("Einzelbrief");
    		         einzelBriefButton.setWidth(100);
    		         einzelBriefButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {  
    		             public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {  
    		                 SC.say("Einzelbrief zu Schüler " + vornameItem.getValueAsString() + " " + nameItem.getValueAsString());
    		             }  
    		         });
    		         
    		buttonPane.setMembers(vertragButton, stammdatenblattButton, einzelBriefButton);
    		layout.addMember(buttonPane);
    		layout.addMember(form);
    		
    		content = layout;
    		
    		return content;
    
    	}
    
    	
    
    }
    Thank you!
    Last edited by edulid; 15 Aug 2011, 14:28.

    #2
    The solution was:

    buttonPane.setHeight();

    Thank you anyway!

    Comment

    Working...
    X