1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    25
    Vote Rating
    0
    geovannefarell is on a distinguished road

      0  

    Default Reload App

    Reload App


    how can i create the button to reload the application ???

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    If you want to reload the page, the standard built-in classes from GWT can provide this functionality. As when writing code in JavaScript, where this would involve manipulating the window.location properties, there is a class called Window.Location which can be used here. To reload a page, typically you would call Window.Location.reload().

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    25
    Vote Rating
    0
    geovannefarell is on a distinguished road

      0  

    Default


    hmm...
    but show me the code please....
    i don't know how,
    i use Viewport,

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    To reload a page, typically you would call Window.Location.reload().
    Does that not work? Is it not what you want?

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    25
    Vote Rating
    0
    geovannefarell is on a distinguished road

      0  

    Default


    it doesn't work for me,
    i want, if button click, button event is reload the page in viewport

    hmm... i have one question again,
    can you help please,
    i want to create report from grid panel,

  6. #6
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Can you post what you've tried? That line of code should be enough to force the page to refresh, so I'm concerned that you might not have it wired up correctly. It is best to post in the form of a simple EntryPoint - this makes sure that you don't have any other code that could possibly interact and break this, and gives you a chance to try building this very simply, and to experiment with it further.

    As far as creating a report from a grid, what kind of report? What does it mean to have a report of a grid? What have you tried so far, and what doesn't make sense?

  7. #7
    Sencha User
    Join Date
    Aug 2011
    Posts
    25
    Vote Rating
    0
    geovannefarell is on a distinguished road

      0  

    Default


    this my code on module load
    Code:
    public class Sisfo implements EntryPoint {
        private TextField<String> txtUser;
        private TextField<String> txtPwd;
        private Dialog login;
        private Viewport vp;
        
        public void onModuleLoad() {
            
             login=new Dialog(){
             @Override 
             protected void onButtonPressed(Button button){
                 //super.onButtonPressed(button);
                 if(button.getItemId()==Dialog.OK){
                     SecurityServiceAsync svc=GWT.create(SecurityService.class);
                     svc.ftr(txtUser.getValue(), txtPwd.getValue(), new AsyncCallback<List<String>>(){
                        @Override
                        public void onFailure(Throwable caught) {
                            // TODO Auto-generated method stub
                            MessageBox.alert("login", caught.getMessage(), null);
                        }
                        @Override
                        public void onSuccess(final List<String> ftrs) {
                            // TODO Auto-generated method stub
                            final MessageBox box = MessageBox.wait("Progress",  
                                    "Now Loading, please wait...", "Login...");  
                                Timer t = new Timer() {  
                                  @Override  
                                  public void run() {  
                                      halaman(ftrs);  
                                    box.close();  
                                  }  
                                };  
                                t.schedule(3000);  
                         
                            
                            login.hide();
                        }                     
                     });
                 }
                     
                 }
             };
             login.setSize(330, 120);
             login.setHideOnButtonClick(false);
             //ToolBar tb=new ToolBar(); 
                //tb.add(new FillToolItem());  
                
                //tb.add(new SeparatorToolItem());
                //tb.add(selector); 
                
            login.setLayout(new FormLayout());
        login.setHeaderVisible(true);
        login.setHeading("Login Form");
        login.setSize(320, 200);
        
        HBoxLayoutData flexo = new HBoxLayoutData(new Margins(0, 5, 0, 0));  
        flexo.setFlex(1);  
        login.add(new Text(), flexo); 
            txtUser=new TextField<String>(); 
            txtUser.focus();
            txtUser.setFieldLabel("User Name"); 
            login.add(txtUser); 
            txtPwd=new TextField<String>();
            txtPwd.setPassword(true);
            txtPwd.setFieldLabel("Password");
            login.add(txtPwd); 
            
            HBoxLayoutData flex = new HBoxLayoutData(new Margins(0, 5, 0, 0));  
            flex.setFlex(1);  
            login.add(new Text(), flex);  
            ThemeSelector selector = new ThemeSelector(); 
            selector.setFieldLabel("Theme");
            login.add(selector);
            login.setClosable(false);
            login.setResizable(false);
            login.setButtons(Dialog.OK);
             
        //    login.setHideOnButtonClick(true);
            login.show();
            
             
            
        }
        
            public void halaman(List<String> ftrs){
                RootPanel rp=RootPanel.get("main");
            
                vp=new Viewport();
                rp.add(vp);
    
                
                Dispatcher d=Dispatcher.get();
                MainController mc=new MainController();
                d.addController(mc);
                
                
                vp.setLayout(new BorderLayout());
                
                BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH);
                ContainerData ac=new ContainerData(vp, northData);
                Dispatcher.get().dispatch(atasEvent.DISPLAY, ac);
                //northData.setSize(100);
                //northData.setMargins(new Margins(0, 0, 5, 0)); 
                vp.layout(true);
                
                
                BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST);
                ContainerData dc=new ContainerData(vp, westData);
                FastMap<Object> map=new FastMap<Object>();
                map.put("ftrs", ftrs);
                dc.setData(map);
                westData.setSplit(true);
                westData.setSize(200);
                westData.setMaxSize(400);
                westData.setCollapsible(true);
                Dispatcher.get().dispatch(treeEvent.DISPLAY, dc);
        
                BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
                ContainerData cd=new ContainerData(vp, centerData);
                Dispatcher.get().dispatch(menuEvent.DISPLAY, cd);
                vp.layout(true);
                        
            }
        
            
        
    }
    how to create some button to reload back to on module load ??
    i want to make logout,

  8. #8
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Where in that code is the logout button that isn't reloading the page? All I am seeing is the login code, nowhere is there a button, with text like logout, that calls Window.Location.reload().

  9. #9
    Sencha User
    Join Date
    Aug 2011
    Posts
    25
    Vote Rating
    0
    geovannefarell is on a distinguished road

      0  

    Default


    i want to create inheritance class from borderLayout north,
    this is the code
    Code:
    public class atasView extends View {
        
    
        public atasView(Controller controller) {
            super(controller);
            // TODO Auto-generated constructor stub
        
        }
        @Override
        protected void handleEvent(AppEvent event) {
            // TODO Auto-generated method stub
            EventType t=event.getType();
            Object o=event.getData();
            if(t==atasEvent.DISPLAY){
                
                if( o instanceof ContainerData ){
                    ContainerData cd=(ContainerData)o;
                    LayoutContainer cont=cd.getLayoutContainer();
                    LayoutData ld=cd.getLayoutData();
                    ContentPanel cp= createUI();
                    cont.add(cp, ld);
                    
                    
                }
    
            } 
        }
        
    
        private ContentPanel createUI(){
                  
                 
                 
                final Window w = new Window(); 
                
                w.setPlain(true);  
                w.setSize(800, 400);  
                w.setHeading("Made in Indonesia");  
                w.addWindowListener(new WindowListener() {  
                      @Override  
                      public void windowHide(WindowEvent we) {  
                        Button open = we.getWindow().getData("open");  
                        open.focus();  
                      }  
                    });  
                w.setLayout(new FitLayout()); 
                
                Html x=new Html("<img height=\"100%\" width=\"100%\"  src=gambar/fa.gif >");
                w.add(x);
            
                
            
            
            
            ToolBar tb=new ToolBar(); 
            tb.add(new FillToolItem());  
            ThemeSelector selector = new ThemeSelector();  
            tb.add(new SeparatorToolItem());
            tb.add(selector); 
            tb.add(new SeparatorToolItem());
            Button btn=new Button("Copyrigth");
            btn.setToolTip(new ToolTipConfig("Keterangan", "Untuk membuka panel coppyright"));
            btn.addSelectionListener(new SelectionListener<ButtonEvent>(){
                @Override
                public void componentSelected(ButtonEvent ce) {
                    
                    w.show();
                    //Dispatcher.get().dispatch(atasEvent.yeah);    
                    
                }
            });
            
            Button out=new Button("Logout");
            out.setToolTip(new ToolTipConfig("Keterangan", "Untuk keluar"));
            out.addSelectionListener(new SelectionListener<ButtonEvent>(){
                @Override
                public void componentSelected(ButtonEvent ce) {
                    
            
                    
                }
            });
            tb.add(out);
            tb.add(btn);
            ContentPanel cp=new ContentPanel();
            cp.setHeading("Geovanne Farell Project");  
            cp.setLayout(new FitLayout());
            cp.setTopComponent(tb);
            
            
            Html h=new Html("<img height=\"100%\" width=\"100%\"  src=gambar/ban.jpg >");
    
    
            
            
            cp.add(h);
            return cp;
    button logout there

  10. #10
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Does it not work to add Window.Location.reload() in that listener?

    Code:
            Button out=new Button("Logout");
            out.setToolTip(new ToolTipConfig("Keterangan", "Untuk keluar"));
            out.addSelectionListener(new SelectionListener<ButtonEvent>(){
                @Override
                public void componentSelected(ButtonEvent ce) {
                    Window.Location.reload();
                }
            });
    You might need to qualify Window if you are using the GXT window somewhere in that file, it would then look like

    com.google.gwt.user.client.Window.Location.reload();

Thread Participants: 1

Tags for this Thread