1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    16
    Vote Rating
    0
    kostepanych is on a distinguished road

      0  

    Default Unanswered: How to create Form classes correctly?

    Unanswered: How to create Form classes correctly?


    I try to create form class in GXT 2.2.4, but it doesn't work properly.

    Here is form code:
    Code:
    public class TestForm extends FormPanel {
        
        public TestForm() {
            setHeading("TestForm"); 
        }
        
        @Override
        protected void onRender(Element parent, int pos) {
            super.onRender(parent, pos);
    
    
                setFrame(true);  //This doesn't work
                setCollapsible(true); 
                setWidth(300); //This crashes UI
                 
                final TextField<String> firstName = new TextField<String>();  
                firstName.setFieldLabel("First Name *");  
                firstName.setAllowBlank(false);  
                add(firstName);  
              
                final TextField<String> lastName = new TextField<String>();  
                lastName.setFieldLabel("Last Name *");
                lastName.setAllowBlank(false);  
                add(lastName);  
                
                Radio radio1 = new Radio();  
                radio1.setBoxLabel("Male");  
                radio1.setValue(true);  
              
                Radio radio2 = new Radio();  
                radio2.setBoxLabel("Female");
              
                final RadioGroup rgGender = new RadioGroup();  
                rgGender.setFieldLabel("Gender *");  
                rgGender.add(radio1);  
                rgGender.add(radio2);  
                rgGender.setSelectionRequired(true);
                add(rgGender);  
    
    
                final Button btnSearch = new Button("Search");
                addButton(btnSearch);  //This doesn't work
    
    
                Button btnClear = new Button("Clear");
                btnClear.addSelectionListener(new
                        SelectionListener<ButtonEvent>() {
                            public void componentSelected(ButtonEvent ce) {
                                reset();
                            }
                    });
                
                addButton(btnClear);  //This doesn't work
        }
    
    
    }
    In this code setFrame and addButton methods doesn't work. setWidth metod crashes UI.

    So how can I create form class correctly?


    And here is entry point code:
    Code:
    private final VerticalPanel formPanel = new VerticalPanel();
    @Override
    public void onModuleLoad() {    
    
    
        Viewport viewport = new Viewport();
        viewport.setLayout(new RowLayout(Orientation.HORIZONTAL));
    
    
        formPanel.add(new TestForm());
    
    
        formPanel.setSpacing(10); 
        viewport.add(formPanel);
    
    
        RootPanel.get("gwtcontent").add(viewport);
    }

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    Russian federation, Smolensk
    Posts
    38
    Answers
    5
    Vote Rating
    0
    Mike_javaJunior is on a distinguished road

      0  

    Default


    how abot to put your code
    Code:
    setFrame(true);  //This doesn't work
                setCollapsible(true);             setWidth(300); //This crashes UI                         final TextField<String> firstName = new TextField<String>();              firstName.setFieldLabel("First Name *");              firstName.setAllowBlank(false);              add(firstName);                        final TextField<String> lastName = new TextField<String>();              lastName.setFieldLabel("Last Name *");            lastName.setAllowBlank(false);              add(lastName);                          Radio radio1 = new Radio();              radio1.setBoxLabel("Male");              radio1.setValue(true);                        Radio radio2 = new Radio();              radio2.setBoxLabel("Female");                      final RadioGroup rgGender = new RadioGroup();              rgGender.setFieldLabel("Gender *");              rgGender.add(radio1);              rgGender.add(radio2);              rgGender.setSelectionRequired(true);            add(rgGender);              final Button btnSearch = new Button("Search");            addButton(btnSearch);  //This doesn't work            Button btnClear = new Button("Clear");            btnClear.addSelectionListener(new                    SelectionListener<ButtonEvent>() {                        public void componentSelected(ButtonEvent ce) {                            reset();                        }                });                         addButton(btnClear);  //This doesn't work
    to the method which returns form panel?

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar