Example usage for com.google.gwt.place.shared Place NOWHERE

List of usage examples for com.google.gwt.place.shared Place NOWHERE

Introduction

In this page you can find the example usage for com.google.gwt.place.shared Place NOWHERE.

Prototype

Place NOWHERE

To view the source code for com.google.gwt.place.shared Place NOWHERE.

Click Source Link

Document

The null place.

Usage

From source file:com.eucalyptus.webui.client.ExPlaceHistoryHandler.java

License:Open Source License

/**
 * Initialize this place history handler.
 * /*from  w ww. j  a v a  2  s  .  c  o m*/
 * @return a registration object to de-register the handler
 */
public HandlerRegistration register(PlaceController placeController, EventBus eventBus, Place defaultPlace,
        Place errorPlace) {
    this.placeController = placeController;
    this.defaultPlace = defaultPlace;
    this.errorPlace = errorPlace;

    final HandlerRegistration placeReg = eventBus.addHandler(PlaceChangeEvent.TYPE,
            new PlaceChangeEvent.Handler() {
                public void onPlaceChange(PlaceChangeEvent event) {
                    log().log(Level.INFO, "Place changed");
                    Place newPlace = event.getNewPlace();
                    historian.newItem(tokenForPlace(newPlace), false);
                }
            });

    final HandlerRegistration historyReg = historian.addValueChangeHandler(new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent<String> event) {
            String token = event.getValue();
            log().log(Level.INFO, "History changed: " + token);
            handleHistoryToken(token);
        }
    });

    return new HandlerRegistration() {
        public void removeHandler() {
            ExPlaceHistoryHandler.this.defaultPlace = Place.NOWHERE;
            ExPlaceHistoryHandler.this.placeController = null;
            placeReg.removeHandler();
            historyReg.removeHandler();
        }
    };
}

From source file:com.googlecode.mgwt.mvp.client.history.MGWTPlaceHistoryHandler.java

License:Apache License

protected HandlerRegistration bind() {

    final HandlerRegistration popHandler = historian.addPopStateHandler(new PopStateHandler() {

        @Override//from   w  w  w  . j a  v a2  s  .c om
        public void onPopStateEvent(PopStateEvent event) {
            onPopStateEventOccured(event.getData());
        }
    });

    final HandlerRegistration placeChangeHandler = eventBus.addHandler(PlaceChangeEvent.TYPE,
            new PlaceChangeEvent.Handler() {

                @Override
                public void onPlaceChange(PlaceChangeEvent event) {
                    onPlaceChangeEvent(event);

                }
            });

    return new HandlerRegistration() {
        public void removeHandler() {
            MGWTPlaceHistoryHandler.this.defaultPlace = Place.NOWHERE;
            MGWTPlaceHistoryHandler.this.placeController = null;
            popHandler.removeHandler();
            placeChangeHandler.removeHandler();
        }
    };

}

From source file:com.sfeir.common.gwt.client.mvp.PlaceController.java

License:Apache License

/**
 * Create a new PlaceController.// ww  w .  ja v  a  2  s . com
 * 
 * @param eventBus the {@link EventBus}
 * @param delegate the {@link Delegate} in charge of Window-related events
 */
public PlaceController(EventBus eventBus, Delegate delegate) {
    super(eventBus);
    this.eventBus = eventBus;
    this.delegate = delegate;
    delegate.addWindowClosingHandler(new ClosingHandler() {
        public void onWindowClosing(ClosingEvent event) {
            String warning = maybeGoTo(Place.NOWHERE);
            if (warning != null) {
                event.setMessage(warning);
            }
        }
    });
}

From source file:com.sfeir.common.gwt.client.mvp.PlaceHistoryHandler.java

License:Apache License

/**
 * Initialize this place history handler.
 * /* w  ww. j  a  v  a  2 s.  c o m*/
 * @return a registration object to de-register the handler
 */
public HandlerRegistration register(PlaceController placeController, EventBus eventBus, Place defaultPlace) {
    this.defaultPlace = defaultPlace;
    this.placeController = placeController;

    final HandlerRegistration placeReg = eventBus.addHandler(PlaceChangeEvent.TYPE,
            new PlaceChangeEvent.Handler() {
                public void onPlaceChange(PlaceChangeEvent event) {
                    Place newPlace = event.getNewPlace();
                    String token = tokenForPlace(newPlace);
                    if (token != null)
                        historian.newItem(token, false);
                }
            });

    final HandlerRegistration historyReg = historian.addValueChangeHandler(new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent<String> event) {
            String token = event.getValue();
            handleHistoryToken(token);
        }
    });

    final HandlerRegistration replaceReg = eventBus.addHandler(ReplacePlaceEvent.TYPE,
            new ReplacePlaceEvent.Handler() {
                @Override
                public void onPlaceReplace(ReplacePlaceEvent event) {
                    Place newPlace = event.getNewPlace();
                    String token = tokenForPlace(newPlace);
                    if (token != null)
                        historian.replaceToken(token, false);
                }
            });

    return new HandlerRegistration() {
        public void removeHandler() {
            PlaceHistoryHandler.this.defaultPlace = Place.NOWHERE;
            PlaceHistoryHandler.this.placeController = null;
            placeReg.removeHandler();
            historyReg.removeHandler();
            replaceReg.removeHandler();
        }
    };
}

From source file:com.smvp4g.mvp.client.core.module.ApplicationModule.java

License:Open Source License

private Place getDefaultPlace() {
    for (FactoryModel model : ClientFactory.INSTANCE.getFactoryModels()) {
        if (!model.isComponent()) {
            com.smvp4g.mvp.client.core.place.Place place = ClassUtils.getAnnotation(model.getPlaceClass(),
                    com.smvp4g.mvp.client.core.place.Place.class);
            if (place != null && place.defaultPlace()) {
                ViewSecurity viewSecurity = ClassUtils.getAnnotation(model.getViewClass(), ViewSecurity.class);
                if (viewSecurity != null) {
                    ViewSecurityConfigurator configurator = ClassUtils
                            .instantiate(viewSecurity.configuratorClass());
                    if ((LoginUtils.checkPermission(configurator.getRoles(), LoginUtils.getRole())
                            && !viewSecurity.showOnlyGuest())
                            || (viewSecurity.showOnlyGuest() && LoginUtils.getRole() == null)) {
                        return ClassUtils.instantiate(model.getPlaceClass());
                    }//from w  w  w . ja  v  a  2  s. co  m
                } else {
                    return ClassUtils.instantiate(model.getPlaceClass());
                }
            }
        }
    }
    return Place.NOWHERE;
}

From source file:cz.cas.lib.proarc.webapp.client.EditorWorkFlow.java

License:Open Source License

public EditorWorkFlow(EventBus ebus, PlaceController placeController, ActivityManager activityManager,
        Layout delegate, PresenterFactory presenterFactory, ClientMessages i18n) {

    this.presenterFactory = presenterFactory;
    this.i18n = i18n;
    this.ebus = (ebus != null) ? ebus : new SimpleEventBus();
    // PlaceController uses delegate to ask user with blocking Window.confirm
    // whether to leave the current place.
    // In order to use non blocking SmartGWT dialog
    // it will be necessary to override PlaceController.goto method.
    this.placeController = (placeController != null) ? placeController : new PlaceController(this.ebus);
    this.activityManager = (activityManager != null) ? activityManager
            : new ActivityManager(new EditorActivityMapper(), this.ebus);
    this.activityManager.setDisplay(new EditorDisplay(delegate));
    EditorPlaceHistoryMapper historyMapper = GWT.create(EditorPlaceHistoryMapper.class);
    placeHistoryHandler = new PlaceHistoryHandler(historyMapper);
    placeHistoryHandler.register(this.placeController, this.ebus, Place.NOWHERE);
}

From source file:cz.cas.lib.proarc.webapp.client.EditorWorkFlow.java

License:Open Source License

public void init() {
    placeHistoryHandler.handleCurrentHistory();
    Place where = placeController.getWhere();
    if (where == Place.NOWHERE) {
        AboutWindow.getInstance(i18n).show();
    }/* www  .  j av  a 2  s  .  c  o m*/
}

From source file:cz.cas.lib.proarc.webapp.client.presenter.DigitalObjectEditor.java

License:Open Source License

private void notifyMissingPid(DatastreamEditorType type) {
    ClientUtils.severe(LOG, "invalid edit parameters: %s, no pid", type);
    SC.warn("Invalid URL!");
    places.goTo(Place.NOWHERE);
}

From source file:cz.cas.lib.proarc.webapp.client.widget.DigitalObjectChildrenEditor.java

License:Open Source License

/**
 * Handles a new children selection./*from  w  w  w  .  j a va2s  . c o m*/
 */
private void onChildSelection(Record[] records) {
    actionSource.fireEvent();
    if (records == null || records.length == 0 || originChildren != null) {
        childPlaces.goTo(Place.NOWHERE);
    } else {
        childPlaces.goTo(new DigitalObjectEditorPlace(null, records));
    }
    if (records == null || records.length <= 1) {
        // in case of multiselection the preview opens the last clicked record
        // see RecordClickHandler.
        preview(records);
    }
}

From source file:cz.cas.lib.proarc.webapp.client.widget.DigitalObjectChildrenEditor.java

License:Open Source License

private void detachListFromEditor() {
    if (childrenSelectionHandler != null) {
        childrenSelectionHandler.removeHandler();
        childrenSelectionHandler = null;
        childPlaces.goTo(Place.NOWHERE);
        preview();/* www  .j a  v  a 2s .  c  o m*/
    }
}