use of org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport in project geo-platform by geosdi.
the class DTOSecurityConverter method convertAccountToDTO.
public IGPAccountDetail convertAccountToDTO(GPAccount account, GPAccountProject accountProject, GPViewport viewport, List<GPMessage> messages) {
GPLoginUserDetail accountDetail = new GPLoginUserDetail();
UserTreeOptions usertreeOptions = new UserTreeOptions();
accountDetail.setId(account.getId());
// Forced representation
accountDetail.setUsername(account.getNaturalID());
accountDetail.setOrganization(account.getOrganization().getName());
usertreeOptions.setLoadExpandedFolders(account.isLoadExpandedFolders());
accountDetail.setTreeOptions(usertreeOptions);
if (account instanceof GPUser) {
GPUser user = (GPUser) account;
accountDetail.setName(user.getName());
accountDetail.setEmail(user.getEmailAddress());
this.extractGPAuthoritiesInToUser(accountDetail, account.getGPAuthorities());
}
if (account.getGsAccount() != null) {
accountDetail.setAuthkey(account.getGsAccount().getAuthkey());
}
accountDetail.setHostXmppServer(hostXmppServer);
if (accountProject != null) {
accountDetail.setBaseLayer(accountProject.getBaseLayer());
}
if (viewport != null) {
GPBBox serverBBOX = viewport.getBbox();
BBoxClientInfo clientBBOX = new BBoxClientInfo(serverBBOX.getMinX(), serverBBOX.getMinY(), serverBBOX.getMaxX(), serverBBOX.getMaxY());
GPClientViewport clientViewport = new GPClientViewport(viewport.getName(), viewport.getDescription(), clientBBOX, viewport.getZoomLevel(), viewport.isIsDefault());
accountDetail.setViewport(clientViewport);
}
if (messages != null) {
List<IGPClientMessage> unreadMessages = Lists.newArrayListWithCapacity(messages.size());
for (GPMessage message : messages) {
GPClientMessage clientMessage = this.convertMessage(message);
unreadMessages.add(clientMessage);
logger.debug("\n*** {}", clientMessage);
}
Collections.sort(unreadMessages);
accountDetail.setUnreadMessages(unreadMessages);
}
return (IGPAccountDetail) accountDetail;
}
use of org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport in project geo-platform by geosdi.
the class ViewportUtility method generateViewportFromMap.
public static GPClientViewport generateViewportFromMap(Map map) {
Projection currentProjection = new Projection(map.getProjection());
Projection destinationProjection = new Projection(GPCoordinateReferenceSystem.WGS_84.getCode());
Bounds bounds = map.getExtent().transform(currentProjection, destinationProjection);
BBoxClientInfo bbox = generateBBOXFromBounds(bounds);
GPClientViewport viewport = new GPClientViewport(MapModuleConstants.INSTANCE.ViewportUtility_newViewportBeanNameText(), MapModuleConstants.INSTANCE.ViewportUtility_newViewportDescriptionText(), bbox, map.getZoom(), Boolean.FALSE);
return viewport;
}
use of org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport in project geo-platform by geosdi.
the class MapService method convertClientViewportToDTO.
private ArrayList<GPViewport> convertClientViewportToDTO(List<GPClientViewport> viewportList) {
ArrayList<GPViewport> serverViewportList = Lists.<GPViewport>newArrayList();
GPViewport serverViewport;
GPBBox serverBBOX;
BBoxClientInfo clientBBOX;
if (viewportList != null) {
for (GPClientViewport viewport : viewportList) {
clientBBOX = viewport.getBbox();
serverBBOX = new GPBBox(clientBBOX.getLowerLeftX(), clientBBOX.getLowerLeftY(), clientBBOX.getUpperRightX(), clientBBOX.getUpperRightY());
serverViewport = new GPViewport(viewport.getName(), viewport.getDescription(), viewport.getZoomLevel(), serverBBOX, viewport.isDefault());
serverViewportList.add(serverViewport);
}
}
return serverViewportList;
}
use of org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport in project geo-platform by geosdi.
the class ViewportGridFieldSet method generateGrid.
private Grid generateGrid() {
List<ColumnConfig> configs = Lists.<ColumnConfig>newArrayList();
final String idIsDefaultColumn = MapModuleConstants.INSTANCE.ViewportGridFieldSet_defaultViewportText();
CheckColumnConfig isDefaultColumn = new CheckColumnConfig(ViewportEnum.IS_DEFAULT.toString(), idIsDefaultColumn, 50);
configs.add(isDefaultColumn);
final String idNameColumn = MapModuleConstants.INSTANCE.ViewportGridFieldSet_nameColumnText();
ColumnConfig nameColumnConfig = new ColumnConfig(ViewportEnum.NAME.toString(), idNameColumn, 80);
nameColumnConfig.setEditor(new CellEditor(new GPSecureStringTextField()));
configs.add(nameColumnConfig);
final String idDescriptionColumn = MapModuleConstants.INSTANCE.ViewportGridFieldSet_descriptionColumnText();
ColumnConfig descriptionColumnConfig = new ColumnConfig(ViewportEnum.DESCRIPTION.toString(), idDescriptionColumn, 80);
descriptionColumnConfig.setEditor(new CellEditor(new GPSecureStringTextField()));
configs.add(descriptionColumnConfig);
ColumnConfig minXColumnConfig = new ColumnConfig(ViewportEnum.LOWER_LEFT_X.toString(), MapModuleConstants.INSTANCE.ViewportGridFieldSet_minXColumnText(), 70);
minXColumnConfig.setNumberFormat(NumberFormat.getDecimalFormat());
NumberField numberFieldBBOX = new NumberField();
numberFieldBBOX.setMaxValue(180);
numberFieldBBOX.setMinValue(-180);
minXColumnConfig.setEditor(new CellEditor(numberFieldBBOX));
configs.add(minXColumnConfig);
ColumnConfig minYColumnConfig = new ColumnConfig(ViewportEnum.LOWER_LEFT_Y.toString(), MapModuleConstants.INSTANCE.ViewportGridFieldSet_minYColumnText(), 70);
minYColumnConfig.setNumberFormat(NumberFormat.getDecimalFormat());
NumberField numberFieldBBOX2 = new NumberField();
numberFieldBBOX2.setMaxValue(90);
numberFieldBBOX2.setMinValue(90);
minYColumnConfig.setEditor(new CellEditor(numberFieldBBOX2));
configs.add(minYColumnConfig);
ColumnConfig maxXColumnConfig = new ColumnConfig(ViewportEnum.UPPER_RIGHT_X.toString(), MapModuleConstants.INSTANCE.ViewportGridFieldSet_maxXColumnText(), 70);
maxXColumnConfig.setNumberFormat(NumberFormat.getDecimalFormat());
NumberField numberFieldBBOX3 = new NumberField();
numberFieldBBOX3.setMaxValue(180);
numberFieldBBOX3.setMinValue(-180);
maxXColumnConfig.setEditor(new CellEditor(numberFieldBBOX3));
configs.add(maxXColumnConfig);
ColumnConfig maxYColumnConfig = new ColumnConfig(ViewportEnum.UPPER_RIGHT_Y.toString(), MapModuleConstants.INSTANCE.ViewportGridFieldSet_maxYColumnText(), 70);
maxYColumnConfig.setNumberFormat(NumberFormat.getDecimalFormat());
NumberField numberFieldBBOX4 = new NumberField();
numberFieldBBOX4.setMaxValue(90);
numberFieldBBOX4.setMinValue(-90);
maxYColumnConfig.setEditor(new CellEditor(numberFieldBBOX4));
configs.add(maxYColumnConfig);
ColumnConfig zoomLevelColumnConfig = new ColumnConfig(ViewportEnum.ZOOM_LEVEL.toString(), MapModuleConstants.INSTANCE.ViewportGridFieldSet_zoomLevelColumnText(), 70);
zoomLevelColumnConfig.setNumberFormat(NumberFormat.getDecimalFormat());
NumberField numberFieldZoom = new NumberField();
numberFieldZoom.setAllowNegative(Boolean.FALSE);
numberFieldZoom.setMaxValue(MapLayoutWidget.NUM_ZOOM_LEVEL);
numberFieldZoom.setMinValue(0);
zoomLevelColumnConfig.setEditor(new CellEditor(numberFieldZoom));
configs.add(zoomLevelColumnConfig);
CheckBoxSelectionModel<GPClientViewport> checkBoxSelectionModel = new CheckBoxSelectionModel<GPClientViewport>();
checkBoxSelectionModel.setSelectionMode(SelectionMode.MULTI);
checkBoxSelectionModel.addSelectionChangedListener(new SelectionChangedListener<GPClientViewport>() {
@Override
public void selectionChanged(SelectionChangedEvent<GPClientViewport> se) {
if (se.getSelection().isEmpty()) {
deleteViewportButton.disable();
gotoViewportButton.disable();
setDefaultViewportButton.disable();
} else {
deleteViewportButton.enable();
gotoViewportButton.enable();
setDefaultViewportButton.enable();
}
}
});
checkBoxSelectionModel.setLocked(Boolean.FALSE);
configs.add(checkBoxSelectionModel.getColumn());
this.viewportGrid = new EditorGrid<GPClientViewport>(store, new ColumnModel(configs));
this.viewportGrid.addPlugin(checkBoxSelectionModel);
this.viewportGrid.setSelectionModel(checkBoxSelectionModel);
this.viewportGrid.setBorders(Boolean.TRUE);
this.viewportGrid.setStripeRows(Boolean.TRUE);
this.viewportGrid.setBorders(Boolean.TRUE);
this.viewportGrid.setClicksToEdit(EditorGrid.ClicksToEdit.TWO);
viewportGrid.setStyleAttribute("borderTop", "none");
viewportGrid.setAutoExpandColumn(ViewportEnum.DESCRIPTION.toString());
viewportGrid.setAutoExpandMin(120);
viewportGrid.setSize("250px", "300px");
return viewportGrid;
}
Aggregations