Search in sources :

Example 6 with GPClientViewport

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;
}
Also used : BBoxClientInfo(org.geosdi.geoplatform.gui.configuration.map.client.geometry.BBoxClientInfo) IGPAccountDetail(org.geosdi.geoplatform.gui.global.security.IGPAccountDetail) IGPClientMessage(org.geosdi.geoplatform.gui.model.message.IGPClientMessage) GPMessage(org.geosdi.geoplatform.core.model.GPMessage) GPUser(org.geosdi.geoplatform.core.model.GPUser) GPClientMessage(org.geosdi.geoplatform.gui.impl.message.GPClientMessage) IGPClientMessage(org.geosdi.geoplatform.gui.model.message.IGPClientMessage) GPClientViewport(org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport) UserTreeOptions(org.geosdi.geoplatform.gui.impl.users.options.UserTreeOptions) GPLoginUserDetail(org.geosdi.geoplatform.gui.client.model.security.GPLoginUserDetail) GPBBox(org.geosdi.geoplatform.core.model.GPBBox)

Example 7 with GPClientViewport

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;
}
Also used : BBoxClientInfo(org.geosdi.geoplatform.gui.configuration.map.client.geometry.BBoxClientInfo) GPClientViewport(org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport) Bounds(org.gwtopenmaps.openlayers.client.Bounds) Projection(org.gwtopenmaps.openlayers.client.Projection)

Example 8 with GPClientViewport

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;
}
Also used : GPViewport(org.geosdi.geoplatform.core.model.GPViewport) BBoxClientInfo(org.geosdi.geoplatform.gui.configuration.map.client.geometry.BBoxClientInfo) GPClientViewport(org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport) GPBBox(org.geosdi.geoplatform.core.model.GPBBox)

Example 9 with GPClientViewport

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;
}
Also used : GPSecureStringTextField(org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField) GPClientViewport(org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport)

Aggregations

GPClientViewport (org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport)9 BBoxClientInfo (org.geosdi.geoplatform.gui.configuration.map.client.geometry.BBoxClientInfo)6 GPBBox (org.geosdi.geoplatform.core.model.GPBBox)3 GPViewport (org.geosdi.geoplatform.core.model.GPViewport)2 IGPAccountDetail (org.geosdi.geoplatform.gui.global.security.IGPAccountDetail)2 Bounds (org.gwtopenmaps.openlayers.client.Bounds)2 Projection (org.gwtopenmaps.openlayers.client.Projection)2 Button (com.extjs.gxt.ui.client.widget.button.Button)1 ButtonBar (com.extjs.gxt.ui.client.widget.button.ButtonBar)1 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)1 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)1 GPMessage (org.geosdi.geoplatform.core.model.GPMessage)1 GPUser (org.geosdi.geoplatform.core.model.GPUser)1 GPSecureButton (org.geosdi.geoplatform.gui.action.button.GPSecureButton)1 SaveViewportAction (org.geosdi.geoplatform.gui.client.action.viewport.SaveViewportAction)1 GPLoginUserDetail (org.geosdi.geoplatform.gui.client.model.security.GPLoginUserDetail)1 GPSecureStringTextField (org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField)1 GPClientMessage (org.geosdi.geoplatform.gui.impl.message.GPClientMessage)1 UserTreeOptions (org.geosdi.geoplatform.gui.impl.users.options.UserTreeOptions)1 IGPClientMessage (org.geosdi.geoplatform.gui.model.message.IGPClientMessage)1