Announcement Announcement Module
Collapse
No announcement yet.
add form in abstract view Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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 .

    Comment


    • #3
      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

      Comment


      • #4
        Thanks for the coding.

        Comment

        Working...
        X