1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    11
    Answers
    1
    Vote Rating
    0
    army81 is on a distinguished road

      0  

    Default Answered: Desktop Implementation

    Answered: Desktop Implementation


    I have imported the Desktop project from example pack. I have created:

    <?xml version="1.0" encoding="UTF-8"?>


    <module rename-to='desktop'>
    <inherits name='com.sencha.gxt.desktop.Desktop' />
    <inherits name="com.google.gwt.logging.Logging" />
    <inherits name='com.sencha.gxt.chart.Chart' />


    <set-property name="gxt.logging.enabled" value="false" />
    <set-property name="gwt.logging.logLevel" value="INFO" />
    <set-property name="gwt.logging.consoleHandler" value="ENABLED" />
    <set-property name="gwt.logging.popupHandler" value="DISABLED" />


    <!-- Comment out the following line to disable readable style names -->
    <!-- <set-configuration-property name='CssResource.style' value='pretty' /> -->


    <entry-point class='com.myproject.client.desktop.DesktopApp' />
    </module>




    And EntryPoint:

    public class DesktopApp implements EntryPoint{
    @Override
    public void onModuleLoad() {
    Desktop desktop = new Desktop();
    StartMainMenuItem menuItem = new StartMainMenuItem("TEST");
    desktop.addStartMenuItem(menuItem );
    desktop.layout(DesktopLayoutType.CENTER);
    }
    }

    But when I start the server, the page is blank... why the desktop structure is not visible?

  2. The entrypoint included in the desktop adds the desktop to the rootpanel, along with a few other details. At the very least, you must be calling:
    Code:
    RootPanel.get().add(desktop);
    Take a look at the DesktopApp class, the EntryPoint that is used by default, to look at other setup that might be done. The Desktop is not the only widget being used, or the only wiring being done to make that app work.

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,640
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      1  

    Default


    The entrypoint included in the desktop adds the desktop to the rootpanel, along with a few other details. At the very least, you must be calling:
    Code:
    RootPanel.get().add(desktop);
    Take a look at the DesktopApp class, the EntryPoint that is used by default, to look at other setup that might be done. The Desktop is not the only widget being used, or the only wiring being done to make that app work.

  4. #3
    Sencha User
    Join Date
    Aug 2013
    Location
    tunisia
    Posts
    4
    Vote Rating
    0
    marwakes is on a distinguished road

      0  

    Default


    I have the same problem as you, but not the desktop structure, the start menu is not visible, only the file manager is visible
    what should I do to fix this issue

  5. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,640
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Marwakes, what code are you running? Clearly if you are running the entire desktop app, you'd see everything, so something that you have changed is causing this.

    http://sencha.com/examples/desktop.html

  6. #5
    Sencha User
    Join Date
    Aug 2013
    Location
    tunisia
    Posts
    4
    Vote Rating
    0
    marwakes is on a distinguished road

      0  

    Default


    Colin Alworth, thank you for replying me,



    yes, I'm running desktopapp, and I could fix the last issue by deleting gwt-unit cache, but now, when I run the application in dev-mode, I got this alert


    java.lang.NullPointerException without any compliation problem or other output. like what I attached


    Also, I am not able to see the beautiful blue theme neither the black task bar as http://www.sencha.com/examples/desktop.html
    13-08-2013 17-32-47.jpg

  7. #6
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,640
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    I still can't see your code, so I don't know what changes you've made or what things you've added to the desktop sample project, so I have no way of debugging a screenshot. Can you provide no code or no full stack trace on that error? Are you not running dev mode, or can you not add break points in your IDE?

  8. #7
    Sencha User
    Join Date
    Aug 2013
    Location
    tunisia
    Posts
    4
    Vote Rating
    0
    marwakes is on a distinguished road

      0  

    Default


    Well,
    Here is the content of the EntryPoint class 'DesktopApp', I guess it is the origin of the exception
    Code:
    /** * Sencha GXT 3.0.1 - Sencha for GWT
     * Copyright(c) 2007-2012, Sencha, Inc.
     * licensing@sencha.com
     *
     * http://www.sencha.com/products/gxt/license/
     */
    package com.sencha.gxt.desktopapp.client;
    
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
    import com.google.gwt.user.client.History;
    import com.google.gwt.user.client.ui.Frame;
    import com.google.gwt.user.client.ui.HasWidgets;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.UIObject;
    import com.sencha.gxt.desktopapp.client.layout.DesktopLayoutType;
    import com.sencha.gxt.desktopapp.client.widget.ShortcutCell.ShortcutCellAppearance;
    import com.sencha.gxt.desktopapp.client.event.LoginEvent;
    import com.sencha.gxt.desktopapp.client.event.LoginEvent.LoginHandler;
    import com.sencha.gxt.desktopapp.client.event.LogoutEvent;
    import com.sencha.gxt.desktopapp.client.event.LogoutEvent.LogoutHandler;
    import com.sencha.gxt.desktopapp.client.service.LoginServiceProvider;
    import com.sencha.gxt.desktopapp.client.service.ProfileServiceProvider;
    import com.sencha.gxt.desktopapp.client.utility.Prompt;
    import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
    import com.sencha.gxt.widget.core.client.form.HtmlEditor;
    import com.sencha.gxt.widget.core.client.grid.Grid;
    import com.sencha.gxt.widget.core.client.treegrid.TreeGrid;
    
    
    /**
     * A sample application that provides a basic desktop capability in a browser
     * window. This includes a start menu, shortcuts and a task bar with buttons for
     * each active application, as well as support for multiple users, each with
     * their own profile settings. Desktop applications include:
     * <dl>
     * <dt>File Manager</dt>
     * <dd>Uses a {@link TreeGrid} to provides access to a hierarchical,
     * browser-based file system, which is persistent on browsers that support HTML5
     * Local Storage. Users may create folders, documents, browser shortcuts, and
     * other files, rename files and drag and drop to move files in the file system.
     * As file operations occur, open applications respond appropriately (e.g. to
     * indicate renamed or moved files).</dd>
     * <dt>Word Processor</dt>
     * <dd>Uses a {@link HtmlEditor} to provides a simple rich editing capability
     * with documents that can be stored locally in the browser based file system.
     * Automatically propagates saved changes to other Word Processor windows,
     * closes if the document is deleted in File Manager, as well as handling
     * documents that are renamed or moved using File Manager.</dd>
     * <dt>Browser</dt>
     * <dd>Uses a {@link Frame} to provide a browser-within-a-browser that displays
     * a browser web page within the desktop. Although this may sound like a
     * gimmick, it's amazing how useful it can be to display multiple web pages
     * simultaneously in conjunction with the {@link DesktopLayoutType#TILE}
     * feature.</dd>
     * <dt>Spreadsheet</dt>
     * <dd>Uses a {@link Grid} to provide a simple spreadsheet capability, including
     * sorting, column and row move, insert and delete as well as formulas and
     * charts.</dd>
     * <dt>Program</dt>
     * <dd>Uses <code>JSNI</code> to provide a simple JavaScript snippet
     * interpreter, including use of references to the page's window object and
     * call-backs to a Java method.</dd>
     * </dl>
     * In addition to highlighting the capability of the GXT components and
     * providing useful, reusable function, the desktop application illustrates a
     * number of best practices for creating complex, interactive real-world
     * applications.
     * <p/>
     * <ul>
     * <li>Use of an enhanced Model View Presenter (MVP) pattern to improve
     * separation of concerns and simplify testing.</li>
     * <ul>
     * <li>Model - the structured data used by the application</li>
     * <li>View - the components that display information and receive user input.
     * The View receives data and commands from the Presenter via the View interface
     * and sends Events to the Presenter using the Presenter interface. The actual
     * widgets the View uses to display the data are hidden from the Presenter. To
     * paraphrase Einstein, "The View is as simple as possible, but no simpler."</li>
     * <li>Presenter - the components that prepare Models for display and act on
     * events from the user. The Presenter sends commands and data to the View via
     * the View interface. The Presenter receives events from the View via the
     * Presenter interface. The Presenter is generally responsible for creating the
     * View and connecting it to the application's user interface.</li>
     * </ul>
     * <li>Use of a Bus to decouple providers and consumers</li>
     * <ul>
     * <li>Event Bus - broadcast application level events from one producer to zero
     * or more consumers</li>
     * <li>Service Bus - request a service (with optional response) from one and
     * only one provider</li>
     * </ul>
     * <li>Use of encapsulated field access in declaring type to support lazy
     * instantiation and initialization as well as implicit order of execution</li>
     * </ul>
     * <p/>
     * In addition, this application illustrates the use of a number of GWT and
     * Sencha technologies, including:
     * <ul>
     * <li>GWT Editor / Driver Framework - {@link LoginView}</li>
     * <li>GWT AutoBeans - {@link ProfileModel} and {@link ProfileFactory}</li>
     * <li>GWT / Sencha Appearances - {@link ShortcutCellAppearance}</li>
     * </ul>
     * <p/>
     * If the browser does not support HTML5 Local Storage, or it is not configured
     * for use with the application, this application will prompt the user whether
     * to degrade gracefully to temporary (in-memory) storage that will be freed
     * when the browser terminates or the the browser window is refreshed.
     * <p/>
     * To request that the desktop application prompt the user to clear all local
     * storage for all users of this application, add <code>#clear</code> to the
     * application URL.
     * <p/>
     * This sample application is under continuing development. The API is subject
     * to change without notice.
     */
    public class DesktopApp implements EntryPoint {
    
    
      private DesktopBus desktopBus;
      private DesktopAppPresenter desktopAppPresenter;
      private LoginHandler loginHandler;
      private LoginServiceProvider loginServiceProvider;
      private ProfileServiceProvider profileServiceProvider;
      private LogoutHandler logoutHandler;
      private LoginPresenter loginPresenter;
      private ProfilePresenter profilePresenter;
    
    
      public void loadModule(HasWidgets hasWidgets) {
        setBackground(hasWidgets);
        initializeDesktopBus(hasWidgets);
        if (!getDesktopAppPresenter().isLocalStorageSupported()) {
          loadApplicationAfterAlertingUser(hasWidgets);
        } else {
          loadApplication(hasWidgets);
        }
      }
    
    
      @Override
      public void onModuleLoad() {
        setUncaughtExceptionHandler();
    //new Desktop();
    //RootPanel.get().add(new Desktop());
        
        loadModule(RootPanel.get());
        
        
      }
        //onModuleLoad(RootPanel.get());
      
    
    
      private void checkForLogin(HasWidgets hasWidgets) {
        if (getDesktopAppPresenter().isLoggedIn()) {
          displayView(hasWidgets);
        } else {
          getDesktopBus().invokeLoginService();
        }
      }
    
    
      private void displayView(HasWidgets hasWidgets) {
        getDesktopAppPresenter().go(hasWidgets);
      }
    
    
      private DesktopAppPresenter getDesktopAppPresenter() {
        if (desktopAppPresenter == null) {
          desktopAppPresenter = new DesktopAppPresenterImpl(getDesktopBus());
        }
        return desktopAppPresenter;
      }
    
    
      private DesktopBus getDesktopBus() {
        if (desktopBus == null) {
          desktopBus = new DesktopBus();
        }
        return desktopBus;
      }
    
    
      private LoginHandler getLoginHandler(final HasWidgets hasWidgets) {
        if (loginHandler == null) {
          loginHandler = new LoginHandler() {
            @Override
            public void onLogin(LoginEvent loginEvent) {
              displayView(hasWidgets);
              if (loginEvent.isNewUser()) {
                getDesktopBus().invokeProfileService();
              }
            }
          };
        }
        return loginHandler;
      }
    
    
      private LoginPresenter getLoginPresenter() {
        if (loginPresenter == null) {
          loginPresenter = new LoginPresenterImpl(getDesktopAppPresenter());
        }
        return loginPresenter;
      }
    
    
      private LoginServiceProvider getLoginServiceProvider(HasWidgets rootPanel) {
        if (loginServiceProvider == null) {
          loginServiceProvider = new LoginServiceProvider(getLoginPresenter(), rootPanel);
        }
        return loginServiceProvider;
      }
    
    
      private LogoutHandler getLogoutHandler() {
        if (logoutHandler == null) {
          logoutHandler = new LogoutHandler() {
            @Override
            public void onLogout(LogoutEvent logoutEvent) {
              com.google.gwt.user.client.Window.Location.reload();
            }
          };
        }
        return logoutHandler;
      }
    
    
      private ProfilePresenter getProfilePresenter() {
        if (profilePresenter == null) {
          profilePresenter = new ProfilePresenterImpl(getDesktopAppPresenter());
        }
        return profilePresenter;
      }
    
    
      private ProfileServiceProvider getProfileServiceProvider(HasWidgets hasWidgets) {
        if (profileServiceProvider == null) {
          profileServiceProvider = new ProfileServiceProvider(getProfilePresenter(), hasWidgets);
        }
        return profileServiceProvider;
      }
    
    
      private void initializeDesktopBus(HasWidgets hasWidgets) {
        getDesktopBus().registerLoginService(getLoginServiceProvider(hasWidgets));
        getDesktopBus().registerProfileService(getProfileServiceProvider(hasWidgets));
        getDesktopBus().addLoginHandler(getLoginHandler(hasWidgets));
        getDesktopBus().addLogoutHandler(getLogoutHandler());
      }
    
    
      private void loadApplication(HasWidgets hasWidgets) {
        if ("clear".equals(History.getToken())) {
          promptToClearStorage(hasWidgets);
        } else {
          checkForLogin(hasWidgets);
        }
      }
    
    
      private void loadApplicationAfterAlertingUser(final HasWidgets hasWidgets) {
        Prompt.get().alert(
            "Local Storage is Not Supported",
            "Either your browser does not support HTML5 Local Storage or it is not configured for use by this application.<br/><br/>This application will continue to run, but anything you create will be discarded when the browser terminates or the browser window is refreshed.",
            new Runnable() {
              @Override
              public void run() {
                loadApplication(hasWidgets);
              }
            });
      }
    
    
      private void promptToClearStorage(final HasWidgets hasWidgets) {
        Prompt.get().confirm("Desktop", "Would you like to clear this domain's local storage before continuing?",
            new Runnable() {
              @Override
              public void run() {
                getDesktopAppPresenter().clearLocalStorage();
                checkForLogin(hasWidgets);
              }
            }, new Runnable() {
              @Override
              public void run() {
                checkForLogin(hasWidgets);
              }
            });
      }
    
    
      private void setBackground(HasWidgets hasWidgets) {
        if (hasWidgets instanceof UIObject) {
          ((UIObject) hasWidgets).addStyleName("x-desktop");
        }
      }
    
    
      private void setUncaughtExceptionHandler() {
        GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
          @Override
          public void onUncaughtException(Throwable e) {
              e.getMessage();
            //e.printStackTrace();
            Throwable rootCause = getRootCause(e);
            new AlertMessageBox("Exception", rootCause.toString()).show();
          }
        });
      }
    
    
      private Throwable getRootCause(Throwable e) {
        Throwable lastCause;
        do {
          lastCause = e;
        } while ((e = e.getCause()) != null);
        return lastCause;
      }
    
    
    }
    The error is missunderstood, I don't know what it references. I tried to enter a "e.getMessage() or e.printstacktrace(); but I did'nt know where to enter it.

    My second issue, is the apperance of the application.I want to get the default appearance of the application. What I get is a blanc bakground and a light blue task bar.
    Here is my .gwt.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?><!--
      When updating your version of GWT, you should also update this DTD reference,
      so that your app can take advantage of the latest GWT module capabilities.
    -->
    <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
      "http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
    <module rename-to='webtop'>
      <!-- Inherit the core Web Toolkit stuff.                        -->
    <!--   <inherits name='com.google.gwt.user.User'/> -->
    
    
      <!-- Inherit the default GWT style sheet.  You can change       -->
      <!-- the theme of your GWT application by uncommenting          -->
      <!-- any one of the following lines.                            -->
    <!--   <inherits name='com.google.gwt.user.theme.clean.Clean'/> -->
      <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
      <inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
    <!--  <inherits name='com.google.gwt.user.theme.dark.Dark'/>    -->
    
    
      <!-- Other module inherits                                      -->
      <inherits name="com.google.gwt.logging.Logging" />
      <inherits name='com.sencha.gxt.chart.Chart' />
    
    
      <set-property name="gxt.logging.enabled" value="false" />
      <set-property name="gwt.logging.logLevel" value="INFO" />
      <set-property name="gwt.logging.consoleHandler" value="ENABLED" />
      <set-property name="gwt.logging.popupHandler" value="DISABLED" />
      <!-- Specify the app entry point class.                         -->
      <entry-point class='com.sencha.gxt.desktopapp.client.DesktopApp'/>
    <replace-with class="com.sencha.gxt.desktopapp.client.theme.base.shortcut.ShortcutCellDefaultAppearance">
        <when-type-is class="com.sencha.gxt.desktopapp.client.widget.ShortcutCell.ShortcutCellAppearance" />
      </replace-with>
      <replace-with class="com.sencha.gxt.desktopapp.client.theme.base.startbutton.StartButtonCellDefaultAppearance">
        <when-type-is class="com.sencha.gxt.desktopapp.client.widget.StartButtonCell.StartButtonCellAppearance" />
      </replace-with>
      <replace-with class="com.sencha.gxt.desktopapp.client.theme.base.taskbutton.TaskButtonCellDefaultAppearance">
        <when-type-is class="com.sencha.gxt.desktopapp.client.widget.TaskButtonCell.TaskButtonCellAppearance" />
      </replace-with>
      <!-- Specify the paths for translatable code                    -->
      <source path='client'/>
      <source path='shared'/>
    
    
    </module>
    I commented the .css file to avoid any problems with the GWT style sheet

Thread Participants: 2

Tags for this Thread

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