Esempio n. 1
0
  /** Creates the south. */
  private void createSouth() {
    BorderLayoutData data =
        new BorderLayoutData(LayoutRegion.SOUTH, Constants.SOUTH_PANEL_DIMENSION + 25);
    // data.setMargins(new Margins(5, 5, 5, 5));
    // data.setHideCollapseTool(false);
    data.setMargins(new Margins(5, 0, 0, 0));
    data.setCollapsible(true);
    data.setSplit(false);

    /*
     * south = new ContentPanel(); south.setBodyBorder(false); south.setAnimCollapse(true);
     * south.setCollapsible(true); south.setLayout(new FitLayout());
     * south.setLayoutOnChange(true); south.setScrollMode(Scroll.AUTOY);
     * south.setHeaderVisible(true);
     * south.setHeading(I18nProvider.getMessages().accordionLabel());
     * south.setMonitorWindowResize(true); south.setLayoutOnChange(true); south.layout();
     */
    south = new ContentPanel();
    south.setBodyBorder(false);
    south.setLayout(new FitLayout());
    south.setScrollMode(Scroll.AUTOY);
    south.setHeaderVisible(true);
    // south.setHeading(I18nProvider.getMessages().accordionLabel());
    south.setMonitorWindowResize(true);
    south.setLayoutOnChange(true);
    south.layout();

    south.addListener(
        Events.Resize,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });
    south.addListener(
        Events.Move,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });
    this.tabWidget = new TabWidget();

    south.add(this.tabWidget);

    Dispatcher.forwardEvent(GeofenceEvents.ATTACH_BOTTOM_TAB_WIDGETS, this.tabWidget);

    center.add(south, data);
  }
  protected void initUI() {
    TabItem west = (TabItem) Registry.get(AppView.TAB_STORAGE);
    ContentPanel clusters = new ContentPanel();
    clusters.setAnimCollapse(false);
    clusters.setHeading("Storage Engines");
    clusters.addListener(
        Events.Expand,
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent be) {
            Dispatcher.get().dispatch(AppEvents.NAV_STORAGE);
          }
        });

    storageEnginesPanel = new StorageEnginesPanel();
    storageEnginesPanel
        .getGrid()
        .getSelectionModel()
        .addSelectionChangedListener(
            new SelectionChangedListener<StorageEngine>() {
              @Override
              public void selectionChanged(SelectionChangedEvent<StorageEngine> se) {
                AppEvent evt = new AppEvent(AppEvents.VIEW_STORAGE_ENGINE, se.getSelectedItem());
                Dispatcher.forwardEvent(evt);
              }
            });
    clusters.add(storageEnginesPanel, new BorderLayoutData(LayoutRegion.CENTER));

    west.add(clusters);
  }
  private ContentPanel buildConfigBloc(ConfigGroup configGroup, ImageResource icon) {
    final ContentPanel cPanel = new ContentPanel(new ColumnLayout());
    cPanel.setHeading(
        "<div class='config-title'>" + I18nUtils.getString(configGroup.key) + "</div>");
    cPanel.getHeader().addStyleName("config-header");
    cPanel.setCollapsible(true);
    cPanel.setAnimCollapse(false);
    cPanel.collapse();
    cPanel.setIcon(AbstractImagePrototype.create(icon));
    cPanel.addListener(
        Events.Expand,
        new Listener<ComponentEvent>() {

          @Override
          public void handleEvent(ComponentEvent be) {
            cPanel.layout(true);
          }
        });

    cPanel.getHeader().addDomHandler(this, ClickEvent.getType());
    mapConfigGroupPanel.put(configGroup, cPanel);
    mapHeaderGroup.put(cPanel.getHeader(), cPanel);

    return cPanel;
  }
Esempio n. 4
0
  protected void build() {
    final RowData fillBoth = new RowData(1, 1);
    final RowData fillHorizontal = new RowData(1, 25);
    RowLayout layout = new RowLayout(Orientation.VERTICAL);
    setLayout(layout);

    Listener<ComponentEvent> listener =
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent be) {
            if (be.getType() == Events.Collapse) {
              setLayoutData(be.getComponent(), fillHorizontal);
            } else {
              setLayoutData(be.getComponent(), fillBoth);
            }

            layout();
          }
        };

    buildToolbar();
    buildTable();
    buildSearchPanel();
    buildAdvancedOptionsPanel();
    buildResultsPanel();

    advancedOptions.addListener(Events.Expand, listener);
    advancedOptions.addListener(Events.Collapse, listener);
    expandableResults.addListener(Events.Expand, listener);
    expandableResults.addListener(Events.Collapse, listener);

    add(expandableSearch, fillHorizontal);
    add(advancedOptions, fillHorizontal);
    add(expandableResults, fillBoth);

    advancedOptions.collapse();
    expandableResults.expand();

    layout();
  }
Esempio n. 5
0
  /** Creates the east. */
  private void createEast() {
    BorderLayoutData data =
        new BorderLayoutData(LayoutRegion.EAST, Constants.EASTH_PANEL_DIMENSION);
    data.setMargins(new Margins(5, 0, 5, 5));
    data.setCollapsible(true);
    data.setSplit(true);
    east = new ContentPanel();
    east.setBodyBorder(false);
    east.setLayout(new AccordionLayout());
    east.setHeading(I18nProvider.getMessages().accordionLabel());
    east.setScrollMode(Scroll.AUTO);

    east.addListener(
        Events.Resize,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });
    east.addListener(
        Events.Move,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });
    east.setStyleAttribute("height", "auto");
    east.setStyleAttribute("width", "auto");
    configureAccordionPanel();
    east.setMonitorWindowResize(true);
    east.setLayoutOnChange(true);
    viewport.add(east, data);
  }
Esempio n. 6
0
  /** Creates the north. */
  private void createNorth() {
    north = new ContentPanel();
    north.setHeaderVisible(false);
    north.addListener(
        Events.Resize,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(GeofenceEvents.UPDATE_SOUTH_SIZE);
          }
        });

    BorderLayoutData data =
        new BorderLayoutData(LayoutRegion.NORTH, Constants.NORTH_PANEL_DIMENSION);
    data.setMargins(new Margins(0, 5, 0, 5));
    data.setSplit(true);

    viewport.add(north, data);
  }
Esempio n. 7
0
  /** Creates the center. */
  private void createCenter() {
    center = new ContentPanel();
    center.setLayout(new BorderLayout());
    center.setHeaderVisible(false);

    ContentPanel map = new ContentPanel();
    map.setLayout(new FitLayout());
    map.setHeaderVisible(false);

    // we dont need this since we have listener on south panel as well

    map.addListener(
        Events.Resize,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(AcoDBEvents.UPDATE_SOUTH_SIZE);
          }
        });
    map.addListener(
        Events.Move,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            Dispatcher.forwardEvent(GeoGWTEvents.UPDATE_MAP_SIZE);
            // Dispatcher.forwardEvent(AcoDBEvents.UPDATE_SOUTH_SIZE);
          }
        });

    map.setMonitorWindowResize(true);
    map.setLayoutOnChange(true);

    BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
    data.setMargins(new Margins(0));

    // add map to center region of center panel
    center.add(map, data);

    data = new BorderLayoutData(LayoutRegion.CENTER);
    // data.setCollapsible(true);
    // data.setFloatable(true);
    // data.setSplit(true);
    data.setMargins(new Margins(5, 5, 5, 5));

    viewport.add(center, data);

    /* map options */
    MapOptions mapOptions = new MapOptions();
    mapOptions.setUnits(MapUnits.DEGREES);
    mapOptions.setProjection("EPSG:4326");

    MousePositionOutput mpOut =
        new MousePositionOutput() {

          public String format(LonLat lonLat, Map map) {
            String out = "";
            out += "<font size='2' color='black' style='font-weight:900'>";
            out += (float) lonLat.lon();
            out += " ";
            out += (float) lonLat.lat();
            out += "</font>";

            return out;
          }
        };

    MousePositionOptions mpOptions = new MousePositionOptions();
    mpOptions.setFormatOutput(mpOut);

    JSObject[] controls =
        new JSObject[] {
          new Navigation().getJSObject(),
          new PanZoom().getJSObject(),
          new LayerSwitcher().getJSObject(),
          new ScaleLine().getJSObject(),
          new MousePosition(mpOptions).getJSObject()
        };
    JObjectArray mapControls = new JObjectArray(controls);
    mapOptions.setControls(mapControls);

    Dispatcher.forwardEvent(GeoGWTEvents.INIT_MAPS_UI_MODULE, mapOptions);

    addBaseLayer();

    Dispatcher.forwardEvent(GeoGWTEvents.ATTACH_MAP_WIDGET, map);

    GeofenceGlobalConfiguration geoFenceConfiguration =
        (GeofenceGlobalConfiguration) GeofenceUtils.getInstance().getGlobalConfiguration();

    // Adjusting the Zoom level
    // Dispatcher.forwardEvent(GeoGWTEvents.ZOOM_TO_MAX_EXTENT);
    Dispatcher.forwardEvent(
        GeoGWTEvents.SET_MAP_CENTER,
        new Double[] {
          Double.valueOf(geoFenceConfiguration.getMapCenterLon()),
          Double.valueOf(geoFenceConfiguration.getMapCenterLat())
        });
    Dispatcher.forwardEvent(
        GeoGWTEvents.ZOOM, Integer.parseInt(geoFenceConfiguration.getMapZoom()));

    ToolbarItemManager toolbarItemManager = new ToolbarItemManager();

    // defining toolbar tools
    GenericClientTool poweredBy = new GenericClientTool();
    poweredBy.setId(ButtonBar.POWERED_BY);
    poweredBy.setOrder(-400);

    GenericClientTool toolbarSeparator1 = new GenericClientTool();
    toolbarSeparator1.setId(ButtonBar.TOOLBAR_SEPARATOR);
    toolbarSeparator1.setOrder(-300);

    ActionClientTool pan = new ActionClientTool();
    pan.setId("pan");
    pan.setEnabled(true);
    pan.setType("toggle");
    pan.setOrder(0);

    ActionClientTool zoomAll = new ActionClientTool();
    zoomAll.setId("zoomAll");
    zoomAll.setEnabled(true);
    zoomAll.setType("button");
    zoomAll.setOrder(10);

    ActionClientTool zoomBox = new ActionClientTool();
    zoomBox.setId("zoomBox");
    zoomBox.setEnabled(true);
    zoomBox.setType("toggle");
    zoomBox.setOrder(20);

    ActionClientTool zoomIn = new ActionClientTool();
    zoomIn.setId("zoomIn");
    zoomIn.setEnabled(true);
    zoomIn.setType("button");
    zoomIn.setOrder(30);

    ActionClientTool zoomOut = new ActionClientTool();
    zoomOut.setId("zoomOut");
    zoomOut.setEnabled(true);
    zoomOut.setType("button");
    zoomOut.setOrder(40);

    ActionClientTool drawFeature = new ActionClientTool();
    drawFeature.setId("drawFeature");
    drawFeature.setEnabled(true);
    drawFeature.setType("toggle");
    drawFeature.setOrder(50);

    GenericClientTool toolbarSeparator2 = new GenericClientTool();
    toolbarSeparator2.setId(ButtonBar.TOOLBAR_SEPARATOR);
    toolbarSeparator2.setOrder(300);

    //        ToolbarActionRegistry.getRegistry().put("synchUsers", new ToolActionCreator()
    //            {
    //
    //                public ToolbarAction createActionTool()
    //                {
    //                    UpdateUsersAction action = new UpdateUsersAction();
    //                    action.initialize();
    //
    //                    return action;
    //                }
    //            });
    //
    //        ActionClientTool synchUsers = new ActionClientTool();
    //        synchUsers.setId("synchUsers");
    //        synchUsers.setEnabled(true);
    //        synchUsers.setType("button");
    //        synchUsers.setOrder(310);

    GenericClientTool fillItem = new GenericClientTool();
    fillItem.setId(ButtonBar.FILL_ITEM);
    fillItem.setOrder(320);

    ToolbarActionRegistry.getRegistry()
        .put(
            "logout",
            new ToolActionCreator() {

              public ToolbarAction createActionTool() {
                LogoutAction action = new LogoutAction();
                action.initialize();

                return action;
              }
            });

    ActionClientTool logout = new ActionClientTool();
    logout.setId("logout");
    logout.setEnabled(true);
    logout.setType("button");
    logout.setOrder(500);

    List<GenericClientTool> clientTools = new ArrayList<GenericClientTool>();
    // clientTools.add(poweredBy);
    // clientTools.add(toolbarSeparator1);
    clientTools.add(pan);
    clientTools.add(zoomAll);
    clientTools.add(zoomBox);
    clientTools.add(zoomIn);
    clientTools.add(zoomOut);
    clientTools.add(drawFeature);
    clientTools.add(toolbarSeparator2);
    //        clientTools.add(synchUsers);
    clientTools.add(fillItem);
    clientTools.add(logout);

    toolbarItemManager.setClientTools(clientTools);

    if (GeoGWTUtils.getInstance().getGlobalConfiguration() == null) {
      GeoGWTUtils.getInstance().setGlobalConfiguration(new GeoGWTConfiguration());
    }

    GeoGWTUtils.getInstance().getGlobalConfiguration().setToolbarItemManager(toolbarItemManager);

    Dispatcher.forwardEvent(GeoGWTEvents.ATTACH_TOOLBAR, this.north);
    // Dispatcher.forwardEvent(GeofenceEvents.ATTACH_MAP_WIDGET, this.center);
  }