Package com.smartgwt.client.widgets.layout

Examples of com.smartgwt.client.widgets.layout.VLayout


      }

    };

    // Continue creating the layout:
    final VLayout layout = new VLayout();
    layout.setMembersMargin(10);
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID beansMap is defined in the XML configuration. (contains any type of attribute)
    final MapWidget map = new MapWidget("mapBeansCustomForm", "gwt-samples");
    map.setVisible(false);
    layout.addMember(map);
    map.init();

    map.getMapModel().addMapModelHandler(new MapModelHandler() {

      public void onMapModelChange(MapModelEvent event) {
        VectorLayer layer = (VectorLayer) map.getMapModel().getLayer("beansLayerCustomForm");
        FeatureAttributeEditor editor = new FeatureAttributeEditor(layer, false, myFactory);
        layout.addMember(editor);
      }
    });

    return layout;
  }
View Full Code Here


      return new EditMultiLineLayerSample();
    }
  };

  public Canvas getViewPanel() {
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setShowResizeBar(true);

    // Map with ID editLineLayerMap is defined in the XML configuration.
    final MapWidget map = new MapWidget("mapEditMultiLine", "gwt-samples");
    map.getMapModel().addMapModelHandler(new MapModelHandler() {

      // When the map is initialized: select the cities layer - so that new features are created in this layer:
      public void onMapModelChange(MapModelEvent event) {
        map.getMapModel().selectLayer(map.getMapModel().getLayer("editableRoadtrl020LayerML"));
        map.registerMapAddon(new GoogleAddon("google", map, GoogleAddon.MapType.SATELLITE, false));
      }
    });

    // Create a tool-bar for this map:
    final Toolbar toolbar = new Toolbar(map);
    toolbar.setButtonSize(Toolbar.BUTTON_SIZE_BIG);

    mapLayout.addMember(toolbar);
    mapLayout.addMember(map);

    // Add an explanation to the page that explains how editing is done:
    HLayout infoLayout = new HLayout();
    infoLayout.setHeight("35%");
    infoLayout.setShowEdges(true);
View Full Code Here

    // Drawing information:
    final Bbox rectangle = new Bbox(100, 100, 300, 100);
    final ShapeStyle style = new ShapeStyle("#66AA00", 0.7f, "#667700", 0.8f, 3);
    final ShapeStyle hoverStyle = new ShapeStyle("#66AA00", 0.5f, "#667700", 0.7f, 3);

    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID wmsMap is defined in the XML configuration. (mapWms.xml)
    final MapWidget map = new MapWidget("mapOsm", "gwt-samples");

    // Create the custom controller:
    final GraphicsController customController = new AbstractGraphicsController(map) {

      public void onMouseOver(MouseOverEvent event) {
        // When the mouse hovers over the image, make it transparent:
        map.getVectorContext().drawRectangle(map.getGroup(RenderGroup.SCREEN), "rectangle", rectangle,
            hoverStyle);
      }

      public void onMouseOut(MouseOutEvent event) {
        // When the mouse moves away from the image, make it visible again:
        map.getVectorContext().drawRectangle(map.getGroup(RenderGroup.SCREEN), "rectangle", rectangle, style);
      }

      public void onMouseDown(MouseDownEvent event) {
        map.getVectorContext().drawRectangle(map.getGroup(RenderGroup.SCREEN), "rectangle", rectangle,
            new ShapeStyle("#AA0000", 0.8f, "#990000", 1.0f, 3));
      }

      public void onMouseUp(MouseUpEvent event) {
        map.getVectorContext().drawRectangle(map.getGroup(RenderGroup.SCREEN), "rectangle", rectangle,
            hoverStyle);
      }
    };

    // After map initialization we draw an image on the map:
    map.getMapModel().addMapModelHandler(new MapModelHandler() {

      public void onMapModelChange(MapModelEvent event) {
        GraphicsContext graphics = map.getVectorContext();
        graphics.drawRectangle(map.getGroup(RenderGroup.SCREEN), "rectangle", rectangle, style);
        map.getVectorContext().setController(map.getGroup(RenderGroup.SCREEN), "rectangle", customController);
      }
    });

    layout.addMember(map);
    return layout;
  }
View Full Code Here

      return new AttributeSearchSample();
    }
  };

  public Canvas getViewPanel() {
    final VLayout layout = new VLayout();
    layout.setMembersMargin(10);
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID beansMap is defined in the XML configuration. (contains any type of attribute)
    final MapWidget map = new MapWidget("mapBeans", "gwt-samples");
    map.setVisible(false);
    layout.addMember(map);
    map.init();

    // Create a layout with a FeatureListGrid in it:
    final FeatureListGrid grid = new FeatureListGrid(map.getMapModel());
    grid.setShowEdges(true);

    // Create a search widget that displays it's results in the FeatureListGrid:
    final FeatureSearch search = new FeatureSearch(map.getMapModel(), true);
    search.addSearchHandler(new DefaultSearchHandler(grid) {

      public void afterSearch() {
      }
    });
   
    // Create a layout for the search, and add a title in it:
    VLayout searchLayout = new VLayout();
    searchLayout.setHeight("40%");
    searchLayout.setShowEdges(true);
    searchLayout.setMembersMargin(10);
   
    ToolStrip title = new ToolStrip();
    title.setWidth100();
    Label titleLabel = new Label(I18nProvider.getSampleMessages().search2InnerTitle());
    titleLabel.setWidth100();
    title.addSpacer(10);
    title.addMember(titleLabel);
    searchLayout.addMember(title);
    searchLayout.addMember(search);
    searchLayout.setShowResizeBar(true);

    // Add the search and the grid to the layout:
    layout.addMember(searchLayout);
    layout.addMember(grid);
View Full Code Here

      return new LayerOpacitySample();
    }
  };

  public Canvas getViewPanel() {
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();
    layout.setMembersMargin(10);

    // Create map with OSM layer, and add a PanController to it:
    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setHeight("60%");

    final MapWidget map = new MapWidget("mapOsm", "gwt-samples");
    map.setController(new PanController(map));
    mapLayout.addMember(map);

    VLayout opacityLayout = new VLayout();
    Slider slider = new Slider("Opacity");
    slider.setWidth(300);
    slider.setVertical(false);
    slider.setMinValue(0);
    slider.setMaxValue(100);
    slider.setNumValues(101);
    slider.setValue(100);
    slider.addValueChangedHandler(new ValueChangedHandler() {

      public void onValueChanged(ValueChangedEvent event) {
        int intValue = event.getValue();
        double value = 0;
        if (intValue != 0) {
          value = (double) intValue / (double) 100;
        }

        RasterLayer layer = (RasterLayer) map.getMapModel().getLayer("clientLayerOsm");
        if (layer != null) {
          layer.setOpacity(value);
        }
      }
    });
    opacityLayout.addMember(slider);

    // Place both in the layout:
    layout.addMember(mapLayout);
    layout.addMember(opacityLayout);
View Full Code Here

      return new EditMultiPointLayerSample();
    }
  };

  public Canvas getViewPanel() {
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setShowResizeBar(true);

    // Map with ID editMultiPointLayerMap is defined in the XML configuration.
    final MapWidget map = new MapWidget("mapEditMultiPoint", "gwt-samples");
    map.getMapModel().addMapModelHandler(new MapModelHandler() {

      // When the map is initialized: select the cities layer - so that new features are created in this layer:
      public void onMapModelChange(MapModelEvent event) {
        map.getMapModel().selectLayer(map.getMapModel().getLayer("clientLayerEditableMultiCities"));
      }
    });

    // Create a toolbar for this map:
    final Toolbar toolbar = new Toolbar(map);
    toolbar.setButtonSize(Toolbar.BUTTON_SIZE_BIG);

    mapLayout.addMember(toolbar);
    mapLayout.addMember(map);

    // Add an explanation to the page that explains how editing is done:
    HLayout infoLayout = new HLayout();
    infoLayout.setHeight("35%");
    infoLayout.setShowEdges(true);
View Full Code Here

      return new OverviewMapSample();
    }
  };

  public Canvas getViewPanel() {
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();
    layout.setMembersMargin(10);

    // Create a layout for the main map:
    HLayout mapLayout = new HLayout();
    mapLayout.setShowEdges(true);

    // Map with ID osmNavigationToolbarMap is defined in the XML configuration.
    final MapWidget map = new MapWidget("mapOsm", "gwt-samples");
    map.setController(new PanController(map));
    mapLayout.addMember(map);

    // Create a layout for the overview map:
    HLayout bottomLayout = new HLayout();
    bottomLayout.setHeight(300);
    bottomLayout.setMembersMargin(10);
    bottomLayout.setAlign(Alignment.CENTER);

    VLayout overviewMapLayout = new VLayout();
    overviewMapLayout.setShowEdges(true);
    overviewMapLayout.setWidth(300);

    // Create an overview map:
    final OverviewMap overviewMap = new OverviewMap("mapOverviewOsm", "gwt-samples", map, true, true);
    overviewMapLayout.addMember(overviewMap);

    // Create a layout for a few buttons:
    HLayout buttonLayout = new HLayout();
    buttonLayout.setHeight(20);
    buttonLayout.setAlign(VerticalAlignment.BOTTOM);
View Full Code Here

      return new AttributeSecuritySample();
    }
  };

  public Canvas getViewPanel() {
    final VLayout layout = new VLayout();
    layout.setMembersMargin(10);
    layout.setWidth100();
    layout.setHeight100();

    // Create horizontal layout for login buttons:
    HLayout buttonLayout = new HLayout();
    buttonLayout.setMembersMargin(10);
    buttonLayout.setHeight(20);

    // Map with ID duisburgMap is defined in the XML configuration. (mapDuisburg.xml)
    map = new MapWidget("mapBeans", "gwt-samples");
    map.setVisible(false);
    layout.addMember(map);
    map.init();

    // Create login handler that re-initializes the map on a successful login:
    final BooleanCallback initMapCallback = new BooleanCallback() {

      public void execute(Boolean value) {
        if (value) {
          map.destroy();
          map = new MapWidget("mapBeans", "gwt-samples");
          map.setVisible(false);
          layout.addMember(map);
          map.init();
        }
      }
    };

    // Create a button that logs in user "elvis":
    IButton loginButtonMarino = new IButton(I18nProvider.getSampleMessages().securityLogInWith("elvis"));
    loginButtonMarino.setWidth(150);
    loginButtonMarino.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Authentication.getInstance().login("elvis", "elvis", initMapCallback);
        if (null != featureAttributeWindow) {
          featureAttributeWindow.destroy();
          featureAttributeWindow = null;
        }
      }
    });
    buttonLayout.addMember(loginButtonMarino);

    // Create a button that logs in user "luc":
    IButton loginButtonLuc = new IButton(I18nProvider.getSampleMessages().securityLogInWith("luc"));
    loginButtonLuc.setWidth(150);
    loginButtonLuc.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Authentication.getInstance().login("luc", "luc", initMapCallback);
        if (null != featureAttributeWindow) {
          featureAttributeWindow.destroy();
          featureAttributeWindow = null;
        }
      }
    });
    buttonLayout.addMember(loginButtonLuc);

    // Set up the search command, that will fetch a feature:
    // Searches for ID=1, but we might as well have created a filter on one of the attributes...
    SearchFeatureRequest request = new SearchFeatureRequest();
    request.setBooleanOperator("AND");
    request.setCrs("EPSG:900913"); // Can normally be acquired from the MapModel.
    request.setLayerId("layerBeans");
    request.setMax(1);
    request.setCriteria(new SearchCriterion[] { new SearchCriterion("id", "=", "1") });
    final GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND);
    command.setCommandRequest(request);

    // Create a button that executes the search command:
    IButton editFeatureButton = new IButton(I18nProvider.getSampleMessages().attributeSecurityButtonTitle());
    editFeatureButton.setWidth(200);
    editFeatureButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        layer = (VectorLayer) map.getMapModel().getLayer("clientLayerBeans");
        GwtCommandDispatcher.getInstance().execute(command, new CommandCallback() {

          public void execute(CommandResponse response) {
            if (response instanceof SearchFeatureResponse) {
              SearchFeatureResponse resp = (SearchFeatureResponse) response;
              for (org.geomajas.layer.feature.Feature dtoFeature : resp.getFeatures()) {
                Feature feature = new Feature(dtoFeature, layer);
                if (null != featureAttributeWindow) {
                  featureAttributeWindow.destroy();
                  featureAttributeWindow = null;
                }
                featureAttributeWindow = new FeatureAttributeWindow(feature, true);
                featureAttributeWindow.setWidth(400);
                layout.addMember(featureAttributeWindow);
              }
            }
          }
        });
      }
    });

    layout.addMember(buttonLayout);
    layout.addMember(editFeatureButton);
    return layout;
  }
View Full Code Here

  /**
   * @return The viewPanel Canvas
   */
  public Canvas getViewPanel() {
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID featureInfoMap is defined in the XML configuration.
    final MapWidget map = new MapWidget("mapFeatureInfo", "gwt-samples");

    final Toolbar toolbar = new Toolbar(map);
    toolbar.setButtonSize(Toolbar.BUTTON_SIZE_BIG);

    layout.addMember(toolbar);
    layout.addMember(map);

    // wait for the map to be loaded and select the 1st layer
    // the map only has one layer so selecting the 1st one is correct
    // We need to select a layer cause the FeatureInfo works on selected layers only
    map.getMapModel().addMapModelHandler(new MapModelHandler() {
View Full Code Here

      return new LayerSecuritySample();
    }
  };

  public Canvas getViewPanel() {
    final VLayout layout = new VLayout();
    layout.setMembersMargin(10);
    layout.setWidth100();
    layout.setHeight100();

    // Map with ID duisburgMap is defined in the XML configuration. (mapDuisburg.xml)
    final VLayout mapLayout = new VLayout();
    mapLayout.setShowEdges(true);
    mapLayout.setHeight("60%");
    map = new MapWidget("mapVectorSecurity", "gwt-samples");
    map.setController(new PanController(map));
    mapLayout.addMember(map);

    // Create horizontal layout for login buttons:
    HLayout buttonLayout = new HLayout();
    buttonLayout.setMembersMargin(10);

    // Create login handler that re-initializes the map on a successful login:
    final BooleanCallback initMapCallback = new BooleanCallback() {

      public void execute(Boolean value) {
        if (value) {
          map.destroy();
          map = new MapWidget("mapVectorSecurity", "gwt-samples");
          mapLayout.addMember(map);
          map.setController(new PanController(map));
        }
      }
    };
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.layout.VLayout

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.