Layout in 6.4.5

I’have an app that works with Vaadin 6.4.4, I’ve updated to 6.4.5 and that is the result :

The Layout don’t show some components : see the image (first 6.4.4 the second one 6.4.5)

This is a form Layout with ComboBox and CustomField.

Any idea?

The code :


		//Panel
		 rootPanel=new Panel(locale.getString("MESSAGELAYOUT_ROOTPANEL_CAPTION"));
		rootPanel.setWidth("40%");
		rootPanel.setStyleName("bubble");
		rootPanel.setIcon(new ThemeResource("img/email.png"));
		
		informationLabel= new Label("",Label.CONTENT_XML);
		informationLabel.setCaption(locale.getString("MESSAGELAYOUT_INFORMATIONLABEL_CAPTION") );
		informationLabel.setIcon(new ThemeResource("img/information.png"));
		//Form
		BeanItem<MessageInfo> messagebean = new BeanItem<MessageInfo>(messageInfo);
		messageform.setItemDataSource(messagebean);
		messageform.setFormFieldFactory(new MyFormFieldFactory());
		messageform.setVisibleItemProperties(Arrays.asList(new String[] {
                "sendoptions", "from", "to","sendtome","subject","message"}));
		messageform.setValidationVisible(true);
		messageform.setImmediate(true);
		
		messageform.getField("sendtome").setValue(true);
		messageform.getField("sendtome").setCaption(locale.getString("MESSAGELAYOUT_SENDMECHECKBOX_CAPTION"));
		
		fromtext = (TextField)messageform.getField("from");
		fromtext.setWidth("100%");
		fromtext.setValue(rb.getString("mailer_from"));
		fromtext.setReadOnly(true);
		
		messageform.getField("from").setRequired(true);
		messageform.getField("from").setCaption(locale.getString("MESSAGELAYOUT_FROMTEXT_CAPTION"));
		messageform.getField("from").setRequiredError(locale.getString("MESSAGELAYOUT_FROMTEXT_REQUIREDERROR"));
		
		subjecttext = (TextField)messageform.getField("subject");
		subjecttext.setWidth("100%");
		subjecttext.setRequired(false);
		subjecttext.setCaption(locale.getString("MESSAGELAYOUT_SUBJECTFIELD_CAPTION"));
		subjecttext.setRequiredError(locale.getString("MESSAGELAYOUT_SUBJECTMESSAGE_REQUIREDERROR"));
		
		messagetext = (TextField)messageform.getField("message");
		messagetext.setWidth("100%");
		messagetext.setRows(5);
		messagetext.setImmediate(true);
		messagetext.setCaption(locale.getString("MESSAGELAYOUT_MESSAGETEXT_CAPTION"));
		
		messageform.getField("to").setCaption(locale.getString("MESSAGELAYOUT_TOTEXT_CAPTION"));
		messageform.getField("to").setRequiredError(locale.getString("MESSAGELAYOUT_TOTEXT_REQUIREDERROR"));
	
		sendbutton = new Button(locale.getString("MESSAGELAYOUT_SENDBUTTON_CAPTION"), this, "commit");
		sendbutton.setIcon(new ThemeResource("img/accept.png"));
		sendbutton.setStyleName("default");
		
		discardbutton = new Button(locale.getString("MESSAGELAYOUT_DISCARDBUTTON_CAPTION"),this,"discard");
		discardbutton.setIcon(new ThemeResource("img/cancel.png"));
		discardbutton.setStyleName("default");
		
		HorizontalLayout footerlayout=new HorizontalLayout(); 
		footerlayout.addComponent(sendbutton);
		footerlayout.addComponent(discardbutton);
		footerlayout.setSpacing(true);
		messageform.getFooter().addComponent(footerlayout);
		
		rootPanel.addComponent(informationLabel);
		rootPanel.addComponent(messageform);
		addComponent(rootPanel);

11452.png
11453.png

Did you also upgrade CustomField (if using it in the field factory - the source for that is not shown here).

I would guess there is an exception thrown somewhere in the code below or in the field factory, and the form construction stops there. Could you check (with a debugger or logging) if there is an exception, and the stack trace.

If there is no exception, or one that might come from a bug in Vaadin, reducing the code piece by piece to produce a minimal example demonstrating the problem would be very helpful.

Apart from this specific problem: I would suggest giving the visible columns as a second parameter to setItemDataSource(). Also, setting up your fields in the field factory would probably be a good idea to make sure they always get configured properly, even if the fields are re-created e.g. when changing the data source.

Thank You!!

I’ve added the updated customField (0.7.3 Version) but the problem is the same…

The code of FormFieldFactory is :


	public class MyFormFieldFactory extends DefaultFieldFactory implements FormFieldFactory {
		    private static final long serialVersionUID = 5845192054295782123L;
		    final ComboBox optionsCombo = new ComboBox(locale.getString("MESSAGELAYOUT_OPTIONSCOMBOBOX_CAPTION"));
		    private Field f;
		    private StringLengthValidator stringlenghtvalidator; 
		    public Field createField(Item item, final Object propertyId, Component uiContext) {
		        if ("to".equals(propertyId)) {
		        	f=new ListSelectField();
		        	f.setRequired(true);
		        }else if ("sendoptions".equals(propertyId)){
		        		optionsCombo.setRequiredError(locale.getString("MESSAGELAYOUT_OPTIONSCOMBOBOX_REQUIREDERROR"));
		        		optionsCombo.setRequired(true);
		        		optionsCombo.setImmediate(true);
		        		optionsCombo.setNullSelectionAllowed(false);
		        		optionsCombo.addItem(locale.getString("MESSAGELAYOUT_OPTIONSCOMBO_OPTION_EMAIL"));
		        		optionsCombo.addItem(locale.getString("MESSAGELAYOUT_OPTIONSCOMBO_OPTION_SMS"));
		        		optionsCombo.addItem(locale.getString("MESSAGELAYOUT_OPTIONSCOMBO_OPTION_SMSEMAIL"));
		        		optionsCombo.addListener(new Property.ValueChangeListener() {
		        			@Override
		        			public void valueChange(ValueChangeEvent event) {
		        				
		        				//TODO Add Validator
		        				if (stringlenghtvalidator!=null){
		        					messageform.getField("message").removeValidator(stringlenghtvalidator);
		        				}
		        					stringlenghtvalidator=getLengthMessageValidator(optionsCombo.getValue().toString());
		        					messageform.getField("message").addValidator(stringlenghtvalidator);
		        				
		        				//Information Label
		        				setInformationLabel(optionsCombo.getValue().toString());
		        			}
		        		});
		        		
		      
		                return optionsCombo;
		            }
		        else{
		            f = super.createField(item, propertyId, uiContext);
		        }  
		        
		        f.setParent(((Form)uiContext).getLayout());
		        f.setWidth("100%");
		        return f;       
		    }