Search in sources :

Example 1 with IGPAccountDetail

use of org.geosdi.geoplatform.gui.global.security.IGPAccountDetail in project geo-platform by geosdi.

the class MapLayoutWidget method setMapCenter.

/**
 * Set center of the Map on Italy
 */
public void setMapCenter() {
    IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
    GPClientViewport viewport = accountDetail.getViewport();
    if (viewport != null) {
        ViewportUtility.gotoViewportLocation(map, viewport);
    } else {
        LonLat center = new LonLat(13.375, 42.329);
        if (map.getProjection().equals(GPCoordinateReferenceSystem.GOOGLE_MERCATOR.getCode())) {
            center.transform(WGS_84.getCode(), GPCoordinateReferenceSystem.EPSG_GOOGLE.getCode());
        }
        float zoomLevel = 5;
        this.map.setCenter(center, (int) zoomLevel);
    }
    this.mapControl.clearNavigationHistory();
}
Also used : IGPAccountDetail(org.geosdi.geoplatform.gui.global.security.IGPAccountDetail) GPClientViewport(org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport)

Example 2 with IGPAccountDetail

use of org.geosdi.geoplatform.gui.global.security.IGPAccountDetail in project geo-platform by geosdi.

the class BaseLayerWidget method generateListView.

private ListView<GPBaseLayer> generateListView() {
    listView = new ListView<GPBaseLayer>() {

        @Override
        protected GPBaseLayer prepareData(GPBaseLayer baseLayer) {
            baseLayer.set("shortName", Format.ellipse(baseLayer.getGwtOlBaseLayer().getName(), 30));
            return baseLayer;
        }
    };
    listView.addStyleName("overview-page");
    listView.setItemSelector(".project-box");
    listView.setOverStyle("sample-over");
    listView.setSelectStyle("none");
    listView.setBorders(Boolean.FALSE);
    listView.setStore(store);
    listView.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<GPBaseLayer>() {

        ChangeBaseLayerEvent event;

        @Override
        public void selectionChanged(SelectionChangedEvent<GPBaseLayer> se) {
            GPBaseLayer selectedBaseLayer = se.getSelectedItem();
            if (selectedBaseLayer != null) {
                event = new ChangeBaseLayerEvent(selectedBaseLayer);
                MapHandlerManager.fireEvent(event);
                IGPAccountDetail accountDetail = Registry.get(ACCOUNT_DETAIL_IN_SESSION.name());
                accountDetail.setBaseLayer(selectedBaseLayer.getBaseLayerEnumName().toString());
            }
            listView.getSelectionModel().deselectAll();
            BaseLayerWidget.this.saveButton.enable();
        }
    });
    setListViewProperties();
    return listView;
}
Also used : IGPAccountDetail(org.geosdi.geoplatform.gui.global.security.IGPAccountDetail) ChangeBaseLayerEvent(org.geosdi.geoplatform.gui.client.event.ChangeBaseLayerEvent) GPBaseLayer(org.geosdi.geoplatform.gui.client.widget.baselayer.model.GPBaseLayer)

Example 3 with IGPAccountDetail

use of org.geosdi.geoplatform.gui.global.security.IGPAccountDetail in project geo-platform by geosdi.

the class GeoPlatformSecureAction method isEnabled.

@Override
public boolean isEnabled() {
    IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
    // Application has neither an authority nor a trusted level
    GPTrustedLevel accountTrustedLevel = accountDetail.getTrustedLevel();
    if (accountTrustedLevel == null) {
        return false;
    } else {
        return accountTrustedLevel.ordinal() >= this.trustedLevel.ordinal();
    }
}
Also used : IGPAccountDetail(org.geosdi.geoplatform.gui.global.security.IGPAccountDetail) GPTrustedLevel(org.geosdi.geoplatform.gui.shared.GPTrustedLevel)

Example 4 with IGPAccountDetail

use of org.geosdi.geoplatform.gui.global.security.IGPAccountDetail in project geo-platform by geosdi.

the class GSAuthKeyManager method getAuthKeyTuple.

public static String getAuthKeyTuple() {
    StringBuilder tuple = new StringBuilder();
    IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
    String authKeyValue = accountDetail.getAuthkey();
    if (authKeyValue != null) {
        tuple.append(GlobalRegistryEnum.AUTH_KEY.getValue()).append('=').append(authKeyValue);
    }
    return tuple.toString();
}
Also used : IGPAccountDetail(org.geosdi.geoplatform.gui.global.security.IGPAccountDetail)

Example 5 with IGPAccountDetail

use of org.geosdi.geoplatform.gui.global.security.IGPAccountDetail in project geo-platform by geosdi.

the class MementoSaveProvider method get.

@Override
public IMementoSave get() {
    // System.out.println("Trying to get the project from provider");
    IGPClientProject clientProject = (IGPClientProject) Registry.get(UserSessionEnum.CURRENT_PROJECT_ON_TREE.name());
    // System.out.println("Client proj saved shared: " + this.savedShareStatus);
    // System.out.println("Client proj saved id: " + this.projID);
    // if (clientProject != null) {
    // System.out.println("Client proj name: " + clientProject.getName());
    // System.out.println("Client proj shared: " + clientProject.isShared());
    // System.out.println("Client proj id: " + clientProject.getId());
    // }
    logger.log(Level.INFO, "Getting the IMementoSave from Provider");
    if (this.mementoSave == null || clientProject == null || this.projID != clientProject.getId() || this.savedShareStatus != clientProject.isProjectShared()) {
        if (clientProject == null) {
            this.mementoSave = new GPMementoSaveCache(observable);
            logger.log(Level.INFO, "returning GPMementoSaveCache(observable) clientProject is null.");
        } else {
            this.savedShareStatus = clientProject.isProjectShared();
            IGPAccountDetail accountInSession = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
            if (GPRole.VIEWER.toString().equalsIgnoreCase(accountInSession.getAuthority()) || (clientProject.isProjectShared() && clientProject.getOwner() != null && !clientProject.getOwner().getId().equals(accountInSession.getId()))) {
                this.mementoSave = new GPMementoSaveDummy();
                logger.log(Level.INFO, "Returning GPMementoSaveDummy");
            } else if (clientProject.isProjectShared()) {
                this.mementoSave = new GPMementoSaveShared(observable, peekCacheEvent);
                logger.log(Level.INFO, "returning GPMementoSaveShared");
            } else {
                this.mementoSave = new GPMementoSaveCache(observable);
                logger.log(Level.INFO, "returning GPMementoSaveCache(observable)");
            }
            this.projID = clientProject.getId();
        }
    }
    return this.mementoSave;
}
Also used : IGPAccountDetail(org.geosdi.geoplatform.gui.global.security.IGPAccountDetail) IGPClientProject(org.geosdi.geoplatform.gui.model.project.IGPClientProject)

Aggregations

IGPAccountDetail (org.geosdi.geoplatform.gui.global.security.IGPAccountDetail)33 GPClientProject (org.geosdi.geoplatform.gui.client.model.projects.GPClientProject)3 GPBaseLayer (org.geosdi.geoplatform.gui.client.widget.baselayer.model.GPBaseLayer)3 IGPClientMessage (org.geosdi.geoplatform.gui.model.message.IGPClientMessage)3 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)2 Button (com.extjs.gxt.ui.client.widget.button.Button)2 Command (com.google.gwt.user.client.Command)2 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)2 RpcTokenException (com.google.gwt.user.client.rpc.RpcTokenException)2 XsrfToken (com.google.gwt.user.client.rpc.XsrfToken)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)2 GetUsersToShareProjectResponse (org.geosdi.geoplatform.gui.client.command.share.GetUsersToShareProjectResponse)2 GPClientViewport (org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport)2 GeoPlatformException (org.geosdi.geoplatform.gui.global.GeoPlatformException)2 GPLoginEvent (org.geosdi.geoplatform.gui.impl.map.event.GPLoginEvent)2 GPSimpleUser (org.geosdi.geoplatform.gui.model.user.GPSimpleUser)2 FeatureInfoAddLayer (org.geosdi.geoplatform.gui.puregwt.featureinfo.event.FeatureInfoAddLayer)2 FeatureInfoRemoveLayer (org.geosdi.geoplatform.gui.puregwt.featureinfo.event.FeatureInfoRemoveLayer)2 GPTrustedLevel (org.geosdi.geoplatform.gui.shared.GPTrustedLevel)2