Apr 02

Gwt-Ext solutions by forum community

Tag: Ext,Gwt,Java,Links,Programming,WebAbhijeet Maharana @ 11:45 pm

The Gwt-Ext forum is very active and I try to participate when I can. In the process, I have bookmarked a few threads with solutions that I could use later. I am posting some of them below so that more people can stumble upon them. Within brackets is the forum id of the community member who suggested the solution.

  1. Expand / collapse a panel on button click in another panel (daverh and sjivan)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    panelB.setCollapsible(true);
    ...
    panelA.getSaveButton().addListener(new ButtonListenerAdapter(){
                public void onClick(Button button, EventObject e) {   
                   panelB.setCollapsed(false);
                   panelA.setTitle("Saved");
                   panelB.doLayout();
                   panelA.doLayout();
                }
    });
  2. Attach a clicklistener to a panel (me)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    panel.addListener(new ContainerListenerAdapter(){
       public void onRender(Component component) {
          panel.getEl().addListener("click", new EventCallback(){
             public void execute(EventObject e) {
                MessageBox.alert("Panel clicked");
             }   
          });
       }
    });
  3. Force a combo box to always go back to the server for the list items (sjivan)

    1
    2
    3
    4
    5
    
    cb.addListener(new ComboBoxListenerAdapter() {
        public void onExpand(ComboBox comboBox) {
            store.reload();
        }
    });
  4. BorderLayout throws an exception when nothing is added to its center region (sjivan)

    When using BorderLayout, you *must* have a Panel assigned to the CENTER region.

  5. Update a text field’s contents (e.g. force all lowercase) when user leaves text field (takeustoyourleader)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    final TextField lcaseTextField = new TextField();
    lcaseTextField.addListener(new TextFieldListenerAdapter(){
    	public void onBlur(Field field) {
    		updateValue();
    	}
     
    	public void onSpecialKey(Field field, EventObject e){
    		updateValue();
    	}
     
    	private void updateValue(){
    		lcaseTextField.setRawValue(lcaseTextField.getValueAsString().toLowerCase());
    	}
    });

    The “onBlur” catches the user leaving the field by clicking off, the onSpecialKey catches them leaving by enter or tab or anything like that.

  6. Wait for an IFrame to load and then execute some code (grabka)

    1
    2
    3
    4
    5
    
    EventManager.addListener(frame.getElement(), "load", new EventCallback() {
                public void execute(EventObject e) {
                   /* do some stuff */
                }
             }, new ListenerConfig());

I may post some more links as and when I bookmark them.

8 Responses to “Gwt-Ext solutions by forum community”

  1. CawCheeta says:

    Hello my friends :) ;)

  2. JaneiczPeaileruy says:

    How its going?

  3. jb3 says:

    hi, i have a strange problem. the panel clicklistener code reports error:
    The type new EventCallback(){} must implement the inherited abstract method
    EventCallback.execute(EventObject)

    however it is obviously implemented. i copy and paste the code from this page.
    i have no clue what to do. do you? i have restarted eclipse, but even the gwt shell says so.

  4. jb3 says:

    keep up the good work.

  5. Abhijeet Maharana says:

    Can you post your code and error stack trace?

  6. Evituettivy says:

    Hello. It is test.

  7. gg says:

    jb3, you should remove the @Override annotation from the method exexcute. Eclipse adds automatically this annotation when a methods is overridden, but the java compiler screams when it’s present on an interface method.

  8. Ellie Lenigan says:

    Really good site, where did you come up with the info in this posting? Im happy I found it though, ill be checking back soon to see what other articles you have.

Leave a Reply