Results 1 to 4 of 4

Thread: add form in abstract view

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    Rome
    Posts
    5

    Default add form in abstract view

    hi guys i'm try to add a form in an AbstractView

    this is a snippet of code from my abstract view

    Code:
    	protected JComponent createControl() {
    		
    		JPanel view = new JPanel(new BorderLayout());
    		
    		//crate table
    		myTable = new MyTable();
    		JComponent table = myTable.getControl();
                    //create scroll bal per tabella
    		JScrollPane sp = getComponentFactory().createScrollPane(table);
    
                    //create a form
    		TableForm tableForm = new TableForm(new Persona());
    		
    		view.add(tableForm.getControl(), BorderLayout.CENTER);
    		view.add(sp, BorderLayout.CENTER);
    the table is correct rendered but the form is not visible. TableForm is this

    Code:
    public class TableForm extends AbstractForm{
    
    
    	public TableForm(Persona persona){
    		super(FormModelHelper.createFormModel(persona, "personaForm"));
    	}
    
    
    	@Override
    	protected JComponent createFormControl() {
    
    		TableFormBuilder builder = new TableFormBuilder(getBindingFactory()); 
    		builder.add("firstName"); 
    		builder.row(); 
    		builder.add("lastName"); 
    		builder.row(); 		
    		builder.add("address.street"); 		
    		builder.row(); 		
    		builder.add("address.city"); 	
    		builder.row(); 		
    		builder.add("address.state"); 	
    		builder.row(); 		
    		builder.add("address.zip"); 		
    		
    		JPanel panel = (JPanel) builder.getForm(); 
    		panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    
    		return panel;
    	}
    
    }
    i'm try to develop a classic form with table results.
    I mean in the top of the page input fields with button
    and in the bottom page tables result

    thanks for any help

  2. #2
    Join Date
    Mar 2007
    Location
    Oudenaarde
    Posts
    294

    Default

    Uhm... not sure about this, but it seems like you're adding both components to the center part of the borderlayout, adding the table last. It's been a while since I've worked with BorderLayout, but this seems a bit fishy.
    If this turns out to be the problem, have a look at MigLayout. It's a lot easier to work with and has less surprises .
    MSN: PM me please
    Skype: doclo_lieven

    Spring Rich Client Project Lead

  3. #3
    Join Date
    Feb 2012
    Location
    Rome
    Posts
    5

    Default

    Quote Originally Posted by LievenDoclo View Post
    Uhm... not sure about this, but it seems like you're adding both components to the center part of the borderlayout, adding the table last. It's been a while since I've worked with BorderLayout, but this seems a bit fishy.
    If this turns out to be the problem, have a look at MigLayout. It's a lot easier to work with and has less surprises .
    thanks man you are right

    error in the definition of layout

    i'm very heppy to see that there is someone in this forum also if Spring Rich Client is not more developed

  4. #4

    Default

    Thanks for the coding.

Posting Permissions

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