Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Looking for preferred way of widget interaction

    Hi everyone,

    I'm getting started with SmartGWT EE and I'm stuck now for quite a time on an app-design-widget-communication-problem and looking for a best practice advice.

    System:
    - SmartGWT EE 2.4 evaluation version
    - Eclipse Indigo
    - GWT 2.3
    - SQL Server 2005, Windows 2008 Server
    - sqljdbc_3.0.1301.101 from http://www.microsoft.com/downloads/de-de/details.aspx?familyid=a737000d-68d0-4531-b65d-da0f2a735707&displaylang=de
    - Tomcat 7.0 (nothing deployed there yet, only hosted mode so far)
    - FF 5.01

    I build a nice app mockup so far with a navigation pane left and a main window with tabs right.
    They are created from the onModuleLoad like this

    Code:
    public void onModuleLoad() {
        		Window.setMargin("0px");
    
    		// main layout occupies the whole area
    		mainLayout = new VLayout();
    		mainLayout.setWidth100();
    		mainLayout.setHeight100();
    
    		navigationArea = new NavigationArea();
    		navigationArea.setWidth("15%");
    		
    		
    		mainArea = new MainArea();
    		mainArea.setWidth("85%");
    
    		navigationPlusMain = new HLayout();
    		navigationPlusMain.setMembers(navigationArea, mainArea);
    
    		mainLayout.addMember(navigationPlusMain);
    		mainLayout.draw();
    		// add the main layout container to GWT's root panel
    		RootLayoutPanel.get().add(mainLayout);
    The NavigationArea class looks like this:

    Code:
    public class NavigationArea extends HLayout {
    	public StammdatenTreeGrid stammdatenTreeGrid;
    
    	public void nothing() {
    	};
    
    	public NavigationArea() {
    		super();
    
    		this.setMembersMargin(20);
    		this.setOverflow(Overflow.HIDDEN);
    		this.setShowResizeBar(true);
    
    		SectionStack sectionStack = new SectionStack();
    		sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    		sectionStack.setShowExpandControls(true);
    		sectionStack.setAnimateSections(true);
    		sectionStack.setVisibilityMode(VisibilityMode.MUTEX);
    		sectionStack.setOverflow(Overflow.HIDDEN);
    
    		SectionStackSection sectionStammdaten = new SectionStackSection(
    				"Stammdaten");
    		sectionStammdaten.setExpanded(true);
    
    		stammdatenTreeGrid = new StammdatenTreeGrid();
    		stammdatenTreeGrid.setHeight100();
    		sectionStammdaten.addItem(stammdatenTreeGrid);
    
    		SectionStackSection sectionAdmin = new SectionStackSection(
    				"SmartGWT Admin");
    		sectionAdmin.setExpanded(false);
    
    		IButton adminButton = new IButton("Admin Console");
    		adminButton.addClickHandler(new ClickHandler() {
    			public void onClick(ClickEvent event) {
    				com.smartgwtee.tools.client.SCEE.openDataSourceConsole();
    			}
    		});
    
    		IButton generatorButton = new IButton("DS Generator");
    		generatorButton.addClickHandler(new ClickHandler() {
    			public void onClick(ClickEvent event) {
    				com.smartgwtee.tools.client.SCEE.openDataSourceGenerator();
    			}
    		});
    
    		sectionAdmin.addItem(adminButton);
    		sectionAdmin.addItem(generatorButton);
    
    		sectionStack.addSection(sectionStammdaten);
    		sectionStack.addSection(sectionAdmin);
    
    		this.addMember(sectionStack);
    	}
    }
    Now from onModuleLoad() I can't access the public members of navigationArea. Eclipse does not offer them as auto-complete. I can't neither access the "StammdatenTreeGrid" member nor the "nothing" method.

    My question is:
    What is the best practice for communicating between widgets?
    Is there a document on this? What am I doing wrong in my example?

    Thanks a lot,
    Blama

    #2
    I think the problem is the same one as in this post: http://stackoverflow.com/questions/5...classsmart-gwt

    It is also what is described (but not explained) in the tutorial http://www.javacodegeeks.com/2011/01...al-part-2.html as "Note that the navigation pane should be linked to the main area".

    Best regards,
    Blama

    Comment


      #3
      Error on my behalf.

      I didn't show the members of buildinds class above "onModuleLoad".

      The variable was typed like this:
      public HLayout navigationArea;

      Of course, this is wrong. Correct is
      public NavigationArea navigationArea;

      Eclipse didn't bother or warn because NavigationArea extends HLayout. But of course it didn't show the NavigationArea-specific methods.

      Lesson learned (again): Always take breaks while programming.

      Comment

      Working...
      X