Example #1
0
  /* (non-Javadoc)
   * @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
   */
  @Override
  public void onModuleLoad() {
    // initialization
    defaultPlace = new HistoryPlace();
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();

    // Start ActivityManager for the main widget with our ActivityMapper
    ActivityMapper activityMapper = new HistoryActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(appWidget);

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    HistoryPlaceHistoryMapper historyMapper = GWT.create(HistoryPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    // Start the events handler
    new HistoryEventsHandler(clientFactory);

    // build UI
    RootPanel.get().add(appWidget);

    // Goes to the place represented on URL else default place
    historyHandler.handleCurrentHistory();

    // timer for player update
    eventBus.fireEvent(new RefreshHistoryEvent());
  }
Example #2
0
  public void onModuleLoad() {

    // Add a handler to send the name to the server
    // TextButton b = new TextButton("Button sencha");
    // RootPanel.get("main_content").add(b);

    RootLayoutPanel.get().add(mainLayout);

    MainMenu mainMenu = new MainMenu();
    mainLayout.getMenuPanel().add(mainMenu);

    EventBus eventBus = ClientFactory.getEventBus();
    PlaceController placeController = ClientFactory.getPlaceController();

    ActivityMapper activityMapper = new AppActivityMapper();
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay((AcceptsOneWidget) mainLayout.getContentPanel().asWidget());

    Place defaultPlace = new LoginPlace("World!");

    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    historyHandler.handleCurrentHistory();
    // RootPanel.get().add(panel);

  }
Example #3
0
  @Override
  public void onModuleLoad() {

    defaultPlace = new ProfilePlace("Profile");

    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();

    // Start ActivityManager for the main widget with our ActivityMapper
    ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(appWidget);

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    // Header
    // DockLayoutPanel dlPanel = new DockLayoutPanel(Unit.EM);
    // dlPanel.addNorth(new HeaderViewImpl(), 5);
    // dlPanel.add(appWidget);
    RootPanel.get().add(appWidget);

    // RootPanel.get().add(appWidget);

    // Goes to the place represented on URL else default place
    historyHandler.handleCurrentHistory();
  }
Example #4
0
  @SuppressWarnings("deprecation")
  private void intAuthorizedUserGUI() {
    final ClientFactory clientFactory = GWT.create(ClientFactory.class);
    SiteHeader header = clientFactory.getHeader();
    // user.setAdmin(true);
    if (user.getAdmin()) {
      header.setVisibleAdminButtons();
      header.setVisibleOperatorButtons();
    } else {
      header.setVisibleOperatorButtons(user.getRoles());
    }
    header.setVisibleFooterAndHeader();
    RootPanel rootLayoutPanel = RootPanel.get("container");
    rootLayoutPanel.add(contentPanel);
    contentPanel.setStyleName("content-container");

    ActivityMapper activityMapper = new CustomActivityMapper(clientFactory);
    ActivityManager activityManager =
        new ActivityManager(activityMapper, clientFactory.getEventBus());
    activityManager.setDisplay(contentPanel);

    PlaceHistoryHandler historyHandler =
        new PlaceHistoryHandler((PlaceHistoryMapper) GWT.create(CustomPlaceHistoryMapper.class));
    historyHandlerRegistration =
        historyHandler.register(
            clientFactory.getPlaceController(), clientFactory.getEventBus(), new AboutPagePlace());
    historyHandler.handleCurrentHistory();
    setWaitingBlockVisible(false);
  }
Example #5
0
  public void init() {
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(view);

    historyMapper.setFactory(placeFactory);

    final PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, placeFactory.getHomePlace());

    RootLayoutPanel.get().add(view);

    historyHandler.handleCurrentHistory();
  }
Example #6
0
  public void onModuleLoad() {
    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();
    SimplePanel contentPanel = new SimplePanel();

    // Start ActivityManager for the main widget with our ActivityMapper
    ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(contentPanel);

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, new TaskResultListPlace());

    RootPanel.get().add(contentPanel);
    // Goes to the place represented on URL else default place
    historyHandler.handleCurrentHistory();
  }
  public void onModuleLoad() {
    GWT.log("FlashCards_App - onModuleLoad()");

    ShellStyleResource.INSTANCE.shellStyles().ensureInjected();
    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();

    User loggedInUser = clientFactory.getLoggedInUser();
    /*
    		if (loggedInUser == null) {
    			GWT.log("User is NOT logged in");
    			Cookies.setCookie("desitinationURL", Window.Location.getHref());
    			defaultPlace = new LoginPlace(ConstsUtil.LOGIN);
    		}
    		else {
    			GWT.log("Logged in user: "******"desitinationURL", Window.Location.getHref());
    defaultPlace = new ShellPlace(ConstsUtil.SHELL_VIEW);

    // start activity manager for our main widget with our ActivityMapper
    ActivityMapper activityMapper = new ShellActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(appWidget);

    // start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    RootLayoutPanel.get().add(appWidget);

    historyHandler.handleCurrentHistory();
  }
  private void init() {
    GWT.setUncaughtExceptionHandler(
        new GWT.UncaughtExceptionHandler() {
          public void onUncaughtException(Throwable e) {
            log.log(Level.SEVERE, e.getMessage(), e);
          }
        });

    if (LogConfiguration.loggingIsEnabled()) {
      /* Add remote logging handler */
      RequestFactoryLogHandler.LoggingRequestProvider provider =
          new RequestFactoryLogHandler.LoggingRequestProvider() {
            public LoggingRequest getLoggingRequest() {
              return requestFactory.loggingRequest();
            }
          };
      Logger.getLogger("")
          .addHandler(
              new RequestFactoryLogHandler(provider, Level.WARNING, new ArrayList<String>()));
    }

    // AppEngine user authentication

    new GaeLoginWidgetDriver(requestFactory).setWidget(shell.loginWidget);

    new ReloadOnAuthenticationFailure().register(eventBus);

    /* Left side lets us pick from all the types of entities */

    final Renderer<ProxyListPlace> placePickerRenderer = new ApplicationListPlaceRenderer();
    Cell<ProxyListPlace> placePickerCell =
        new AbstractCell<ProxyListPlace>() {
          @Override
          public void render(Context context, ProxyListPlace value, SafeHtmlBuilder sb) {
            sb.appendEscaped(placePickerRenderer.render(value));
          }
        };
    CellList<ProxyListPlace> placePickerList =
        new CellList<ProxyListPlace>(placePickerCell, getMobileListResources());
    placePickerList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    final ValuePicker<ProxyListPlace> placePickerView =
        new ValuePicker<ProxyListPlace>(placePickerList);
    Activity defaultActivity = new DefaultActivity(placePickerView);
    ProxyPlaceToListPlace proxyPlaceToListPlace = new ProxyPlaceToListPlace();
    ProxyListPlacePicker proxyListPlacePicker =
        new ProxyListPlacePicker(placeController, proxyPlaceToListPlace);
    placePickerView.setAcceptableValues(getTopPlaces());
    proxyListPlacePicker.register(eventBus, placePickerView);

    /*
     * Wrap the scaffoldMobileActivities so we can intercept activity requests
     * and remember the last activity (for back button support).
     */

    scaffoldMobileActivities.setRootActivity(defaultActivity);
    ActivityMapper activityMapper =
        new ActivityMapper() {
          public Activity getActivity(Place place) {
            // Defer to scaffoldMobileActivities.
            Activity nextActivity = scaffoldMobileActivities.getActivity(place);

            // Clear the value of the placePicker so we can select a new top level
            // value.
            placePickerView.setValue(null, false);

            // Update the title, back and edit buttons.
            Button backButton = shell.getBackButton();
            if (nextActivity instanceof IsScaffoldMobileActivity) {
              lastActivity = (IsScaffoldMobileActivity) nextActivity;

              // Update the title.
              shell.setTitleText(lastActivity.getTitleText());

              // Update the back button.
              String backButtonText = lastActivity.getBackButtonText();
              if (backButtonText == null || backButtonText.length() == 0) {
                shell.setBackButtonVisible(false);
              } else {
                shell.setBackButtonVisible(true);
                backButton.setText(backButtonText);
              }

              // Update the edit button.
              shell.setEditButtonVisible(lastActivity.hasEditButton());
            } else {
              lastActivity = null;
              shell.setTitleText("");
              shell.setBackButtonVisible(false);
              shell.setEditButtonVisible(false);
            }

            // Return the activity.
            return nextActivity;
          }
        };

    /*
     * The body is run by an ActivityManager that listens for PlaceChange events
     * and finds the corresponding Activity to run
     */

    final ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);

    activityManager.setDisplay(shell.getBody());

    /* Browser history integration */
    ScaffoldPlaceHistoryMapper mapper = GWT.create(ScaffoldPlaceHistoryMapper.class);
    mapper.setFactory(placeHistoryFactory);
    PlaceHistoryHandler placeHistoryHandler = new PlaceHistoryHandler(mapper);
    placeHistoryHandler.register(placeController, eventBus, ROOT_PLACE);
    placeHistoryHandler.handleCurrentHistory();

    shell
        .getBackButton()
        .addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                if (lastActivity != null) {
                  Place backPlace = lastActivity.getBackButtonPlace();
                  if (backPlace != null) {
                    placeController.goTo(backPlace);
                  }
                }
              }
            });
    shell
        .getEditButton()
        .addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                if (lastActivity != null) {
                  Place editPlace = lastActivity.getEditButtonPlace();
                  if (editPlace != null) {
                    placeController.goTo(editPlace);
                  }
                }
              }
            });
  }
 public PlaceHistoryHandler get() {
   PlaceHistoryHandler placeHistoryHandler = new PlaceHistoryHandler(placeHistoryMapper);
   placeHistoryHandler.register(placeController, eventBus, ProjectsDiscoverPlace.createPlace());
   return placeHistoryHandler;
 }
Example #10
0
  public void onModuleLoad() {
    Logger logger = Logger.getLogger("");
    //   logger.log(Level.FINE, "Arrancando aplicaciĆ³n");
    logger.log(Level.INFO, "Arrancando aplicaciĆ³n2");

    // Create app layout

    // Create ClientFactory using deferred binding so we can replace with
    // different
    // impls in gwt.xml
    clientFactory = GWT.create(ClientFactory.class);

    clientFactory.getLogger().log(Level.INFO, "holaaaaa");

    // clientFactory.setMainView(this);

    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();
    clientFactory.getRequestFactory().initialize(eventBus);

    // Initialize RequestFactory
    // clientFactory.initializeRequestFactory();
    System.out.println("contruyendo mappers");
    // Start ActivityManager for each area with its ActivityMapper
    ActivityMapper alumnoMapper = new AlumnoMapper(clientFactory);
    ActivityMapper observacionesAlumnoMapper = new ObservacionesAlumnoMapper(clientFactory);
    ActivityMapper matriculaMapper = new MatriculaMapper(clientFactory);
    ActivityMapper materialMapper = new MaterialMapper(clientFactory);
    /*	ActivityMapper mainPanelActivityMapper = new MainPanelActivityMapper(
    				clientFactory);
    		ActivityMapper formularioAlumnoPanelActivityMapper = new FormularioAlumnoPanelActivityMapper(
    				clientFactory);
    		ActivityMapper alumnoPanelActivityMapper = new AlumnoPanelActivityMapper(
    				clientFactory);
    		ActivityMapper observacionesPanelActivityMapper = new ObservacionesPanelActivityMapper(
    				clientFactory);
    		ActivityMapper matriculaPanelActivityMapper = new MatriculaPanelActivityMapper(
    				clientFactory);

    		ActivityManager mainPanelActivityManager = new ActivityManager(
    				mainPanelActivityMapper, eventBus);

    		mainPanelActivityManager.setDisplay(appWidget);

    		ActivityManager alumnoPanelActivityManager = new ActivityManager(
    				alumnoPanelActivityMapper, eventBus);
    		alumnoPanelActivityManager.setDisplay(alumnoPanel);

    		ActivityManager formularioAlumnoPanelActivityManager = new ActivityManager(
    				formularioAlumnoPanelActivityMapper, eventBus);
    		formularioAlumnoPanelActivityManager.setDisplay(alumnoPanel);

    		ActivityManager panelObservacionesActivityManager = new ActivityManager(
    				observacionesPanelActivityMapper, eventBus);
    		panelObservacionesActivityManager.setDisplay(observacionesalumnoPanel);

    		ActivityManager panelMatriculaActivityManager = new ActivityManager(
    				matriculaPanelActivityMapper, eventBus);
    		panelMatriculaActivityManager.setDisplay(matriculaPanel);
    */
    tabAlumno.selectTab(1);
    ActivityManager alumnoManager = new ActivityManager(alumnoMapper, eventBus);
    alumnoManager.setDisplay(alumnoPanel);

    ActivityManager observacionesAlumnoManager =
        new ActivityManager(observacionesAlumnoMapper, eventBus);
    observacionesAlumnoManager.setDisplay(observacionesalumnoPanel);

    ActivityManager matriculaManager = new ActivityManager(matriculaMapper, eventBus);
    matriculaManager.setDisplay(matriculaPanel);

    ActivityManager materialManager = new ActivityManager(materialMapper, eventBus);
    materialManager.setDisplay(materialPanel);

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    // Add app layout to root layout
    RootLayoutPanel.get().add(outer);

    //	historyHandler.handleCurrentHistory();
    /*eventBus.addHandler(SeleccionAlumnoEvent.TYPE,
    new SeleccionAlumnoEventHandler() {
    	@Override
    	public void onSelecc(
    			SeleccionAlumnoEvent authenticationEvent) {
    		// authentication changed - do something
    		System.out.println("tocado"
    				+ clientFactory.getSelectedAlumnoNif());
    		if (clientFactory.getSelectedAlumnoNif() == null)
    			tabDatosAlumno.setVisible(false);
    		else
    			tabDatosAlumno.setVisible(true);
    	}
    });*/

    PopupPanel loggingPopup = new PopupPanel(false);
    loggingPopup.setPopupPosition(10, 240);
    loggingPopup.setWidth("500px");
    clientFactory.getLogger().addHandler(new HasWidgetsLogHandler(loggingPopup));
  }