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();
}
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;
}
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();
}
}
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();
}
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;
}
Aggregations