Package org.onebusaway.webapp.gwt.common.widgets

Examples of org.onebusaway.webapp.gwt.common.widgets.DivPanel


      panel.add(new DivWidget(place.getName()));
      String desc = place.getDescriptionAsString();
      if (desc.length() > 0)
        panel.add(new DivWidget(desc));

      DivPanel row = new DivPanel();
      panel.add(row);

      Anchor anchor = new Anchor("Show nearby transit stops");
      row.add(anchor);

      anchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
          _transitMapManager.showPlace(place, true,
View Full Code Here


    });

    FlowPanel panel = new FlowPanel();
    form.add(panel);

    DivPanel searchPanel = new DivPanel();
    searchPanel.addStyleName(_css.SearchWidgetSearchPanel());
    panel.add(searchPanel);

    DivPanel searchForPanel = new DivPanel();
    searchForPanel.addStyleName(_css.SearchWidgetSearchForPanel());
    searchPanel.add(searchForPanel);

    DivWidget queryLabel = new DivWidget("Search for:");
    queryLabel.addStyleName(_css.SearchWidgetLabel());
    searchForPanel.add(queryLabel);

    DivPanel queryTextBoxPanel = new DivPanel();
    queryTextBoxPanel.addStyleName(_css.SearchWidgetTextBoxPanel());
    searchForPanel.add(queryTextBoxPanel);

    _queryTextBox = new TextBox();
    _queryTextBox.addStyleName(_css.SearchWidgetTextBox());
    _queryTextBox.setName(ConstraintsParameterMapping.PARAM_QUERY);
    _queryTextBox.addKeyPressHandler(new QueryTextBoxHandler());
    queryTextBoxPanel.add(_queryTextBox);

    DivPanel searchForExamplePanel = new DivPanel();
    searchForExamplePanel.addStyleName(_css.SearchWidgetExamplePanel());
    searchForPanel.add(searchForExamplePanel);

    DivWidget searchForExampleLabel = new DivWidget(
        "(ex. \"restaurants\", \"parks\", \"grocery stores\")");
    searchForExampleLabel.addStyleName(_css.SearchWidgetExampleLabel());
    searchForExamplePanel.add(searchForExampleLabel);

    DivPanel addressPanel = new DivPanel();
    searchPanel.add(addressPanel);

    DivPanel addressPanel1 = new DivPanel();
    addressPanel.add(addressPanel1);

    DivWidget addressLabel = new DivWidget("Start Address:");
    addressLabel.addStyleName(_css.SearchWidgetLabel());
    addressPanel1.add(addressLabel);

    DivPanel addressTextBoxPanel = new DivPanel();
    addressTextBoxPanel.addStyleName(_css.SearchWidgetTextBoxPanel());
    addressPanel1.add(addressTextBoxPanel);

    _addressTextBox = new TextBox();
    _addressTextBox.addStyleName(_css.SearchWidgetTextBox());
    _addressTextBox.setName(ConstraintsParameterMapping.PARAM_LOCATION);
    addressTextBoxPanel.add(_addressTextBox);

    DivPanel addressPanel2 = new DivPanel();
    addressPanel2.addStyleName(_css.SearchWidgetExamplePanel());
    addressPanel.add(addressPanel2);

    SpanWidget addressExampleLabel1 = new SpanWidget(
        "(ex. \"3rd and pike\" or ");
    addressExampleLabel1.addStyleName(_css.SearchWidgetExampleLabel());
    addressPanel2.add(addressExampleLabel1);

    Anchor addressExampleLabel2 = new Anchor("use the map");
    addressExampleLabel2.addStyleName(_css.SearchWidgetExampleLabel());
    addressExampleLabel2.addClickHandler(new UseTheMapHandler());
    addressPanel2.add(addressExampleLabel2);

    SpanWidget addressExampleLabel3 = new SpanWidget(")");
    addressExampleLabel3.addStyleName(_css.SearchWidgetExampleLabel());
    addressPanel2.add(addressExampleLabel3);

    DivPanel buttonPanel = new DivPanel();
    buttonPanel.addStyleName(_css.SearchWidgetButtonPanel());
    searchPanel.add(buttonPanel);

    Button button = new Button("Go");
    buttonPanel.add(button);
    button.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent widget) {
        handleQuery();
      }
    });

    AddressTextBoxHandler handler = new AddressTextBoxHandler();
    _addressTextBox.addKeyPressHandler(handler);
    _addressTextBox.addFocusHandler(handler);
    _addressTextBox.addBlurHandler(handler);

    _optionsButton = new Anchor("Show More Options");
    _optionsButton.addStyleName(_css.SearchWidgetShowOptionsButton());
    _optionsButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent arg0) {
        toggleExpansion();
        // TODO : Refresh layout
      }
    });
    buttonPanel.add(_optionsButton);

    DivPanel clearPanel = new DivPanel();
    clearPanel.addStyleName(_css.ClearPanel());
    panel.add(clearPanel);
    Image hiddenPixel = new Image(
        CommonResources.INSTANCE.getHiddenPixel().getUrl());
    clearPanel.add(hiddenPixel);

    _optionsPanel = new DivPanel();
    _optionsPanel.addStyleName(_css.SearchWidgetOptionsPanel());
    _optionsPanel.setVisible(false);
    panel.add(_optionsPanel);

    Grid optionsGrid = new Grid(2, 4);
    optionsGrid.addStyleName(_css.SearchWidgetOptionsGrid());
    for (int i = 0; i < 4; i++) {
      optionsGrid.getCellFormatter().addStyleName(0, i,
          "SearchWidget-OptionsGrid-Column" + i);
      optionsGrid.getCellFormatter().addStyleName(1, i,
          "SearchWidget-OptionsGrid-Column" + i);
    }
    _optionsPanel.add(optionsGrid);

    SpanWidget timeLabel = new SpanWidget("Start Time:");
    optionsGrid.setWidget(0, 0, timeLabel);

    DivPanel dateAndTimePanel = new DivPanel();
    optionsGrid.setWidget(0, 1, dateAndTimePanel);
    _dateTextBox = new TextBox();
    _dateTextBox.addStyleName(_css.SearchWidgetStartDateTextBox());
    dateAndTimePanel.add(_dateTextBox);
    _timeTextBox = new TextBox();
    _timeTextBox.addStyleName(_css.SearchWidgetStartTimeTextBox());
    dateAndTimePanel.add(_timeTextBox);

    SpanWidget maxLengthLabel = new SpanWidget("Trip Time:");
    optionsGrid.setWidget(1, 0, maxLengthLabel);

    _maxTripLengthBox = new ListBox();
    _maxTripLengthBox.addItem("10 mins", "10");
    _maxTripLengthBox.addItem("15 mins", "15");
    _maxTripLengthBox.addItem("20 mins", "20");
    _maxTripLengthBox.addItem("30 mins", "30");
    _maxTripLengthBox.addItem("45 mins", "45");
    _maxTripLengthBox.addItem("1 hour", "60");
    _maxTripLengthBox.addStyleName(_css.SearchWidgetTripLengthList());
    optionsGrid.setWidget(1, 1, _maxTripLengthBox);

    SpanWidget maxTransfersLabel = new SpanWidget("Transfers:");
    optionsGrid.setWidget(0, 2, maxTransfersLabel);

    _maxTransfersListBox = new ListBox();
    _maxTransfersListBox.addItem("Don't Care", "-1");
    _maxTransfersListBox.addItem("0", "0");
    _maxTransfersListBox.addItem("1", "1");
    _maxTransfersListBox.addItem("2", "2");
    optionsGrid.setWidget(0, 3, _maxTransfersListBox);

    SpanWidget maxWalkLabel = new SpanWidget("Walk at most:");
    optionsGrid.setWidget(1, 2, maxWalkLabel);

    _maxWalkDistance = new ListBox();
    _maxWalkDistance.addItem("1/4 mile", "1320");
    _maxWalkDistance.addItem("1/2 mile", "2640");
    _maxWalkDistance.addItem("3/4 mile", "3960");
    _maxWalkDistance.addItem("1 mile", "5280");
    optionsGrid.setWidget(1, 3, _maxWalkDistance);

    DivPanel optionsPanelRowB = new DivPanel();
    _optionsPanel.add(optionsPanelRowB);
  }
View Full Code Here

    _panel.setVisible(true);

    List<LegBean> legs = trip.getLegs();
    TripPlannerResources resources = TripPlannerResources.INSTANCE;

    DivPanel summaryPanel = new DivPanel(_css.tripPanelSummaryPanel());
    _panel.add(summaryPanel);

    String duration = TripBeanSupport.getDurationLabel(trip);
    summaryPanel.add(new DivWidget("Showing <span>Trip " + index + "</span>",
        _css.tripPanelSummaryTrip()));
    summaryPanel.add(new DivWidget("Travel time: about " + duration,
        _css.tripPanelSummaryDuration()));

    for (int i = 0; i < legs.size(); i++) {
      LegBean leg = legs.get(i);

      String mode = leg.getMode();
      if( mode.equals("transit")) {

        TransitLegBean transitLeg = leg.getTransitLeg();
        TripBean tripBean = transitLeg.getTrip();
        RouteBean routeBean = tripBean.getRoute();

        DivPanel panel = new DivPanel();
        panel.addStyleName(_css.tripPanelVehiclePanel());

        DivPanel row1 = new DivPanel(_css.tripPanelVehiclePanelRow1());
        panel.add(row1);

        DataResource busIcon = resources.getBusTripTypeIcon();
        Image image = new Image(busIcon.getUrl());
        image.addStyleName(_css.tripPanelVehiclePanelModeImage());
        row1.add(image);

        int minutes = Math.round((leg.getEndTime() - leg.getStartTime())
            / (1000 * 60));
       
        String routeShortName = getBestName(transitLeg.getRouteShortName(),tripBean.getRouteShortName(), routeBean.getShortName(),"");
        String tripHeadsign = getBestName(transitLeg.getTripHeadsign(),tripBean.getTripHeadsign(),routeBean.getLongName(),"");
       
        row1.add(new DivWidget("Bus - " + routeShortName + " - "
            + tripHeadsign, _css.tripPanelVehiclePanelTitle()));

        String departureTime = _timeFormat.format(new Date(leg.getStartTime()));
        String arrivalTime = _timeFormat.format(new Date(leg.getEndTime()));

        DivPanel row2 = new DivPanel(_css.tripPanelVehiclePanelRow2());
        panel.add(row2);

        DivPanel row3 = new DivPanel(_css.tripPanelVehiclePanelRow3());
        panel.add(row3);

        DivPanel row4 = new DivPanel(_css.tripPanelVehiclePanelRow4());
        panel.add(row4);
       
        String fromStopName = "";
        StopBean fromStop = transitLeg.getFromStop();
        if( fromStop != null)
          fromStopName = fromStop.getName();
       
        String toStopName = "";
        StopBean toStop = transitLeg.getToStop();
        if( toStop != null)
          toStopName = toStop.getName();

        row2.add(new DivWidget(departureTime,
            _css.tripPlanVehiclePanelDepartureTime(),
            _css.tripPlanVehiclePanelA()));
        row2.add(new DivWidget("Depart " + fromStopName,
            _css.tripPlanVehiclePanelDepartureLabel(),
            _css.tripPlanVehiclePanelB()));
        row3.add(new DivWidget("...",
            _css.tripPlanVehiclePanelInTransitLabel(),
            _css.tripPlanVehiclePanelA()));
        row3.add(new DivWidget(minutes + " mins",
            _css.tripPlanVehiclePanelInTransitTime(),
            _css.tripPlanVehiclePanelB()));
        row4.add(new DivWidget(arrivalTime,
            _css.tripPlanVehiclePanelArrivalLabel(),
            _css.tripPlanVehiclePanelA()));
        row4.add(new DivWidget("Arrive " + toStopName,
            _css.tripPlanVehiclePanelArrivalTime(),
            _css.tripPlanVehiclePanelB()));
        _panel.add(panel);

      } else if (mode.equals("walk")) {
       
        DivPanel panel = new DivPanel();
        panel.addStyleName(_css.tripPanelWalkPanel());

        DivPanel row1 = new DivPanel(_css.tripPanelWalkPanelRow1());
        panel.add(row1);

        DataResource walkIcon = resources.getWalkTripTypeIcon();
        Image image = new Image(walkIcon.getUrl());
        image.addStyleName(_css.tripPanelWalkPanelModeImage());
        row1.add(image);

        String target = getWalkToTarget(legs, i, destination);
        row1.add(new DivWidget("Walk to " + target,
            _css.tripPanelWalkPanelTitle()));

        DivPanel row2 = new DivPanel(_css.tripPanelWalkPanelRow2());
        panel.add(row2);
       
        long dur = leg.getEndTime() - leg.getStartTime();

        row2.add(new DivWidget("About "
            + TripBeanSupport.getDurationLabel(dur)));
        _panel.add(panel);
      }
    }
  }
View Full Code Here

  private void fillEntryPanel(TimedLocalSearchResult result, FlowPanel panel) {

    LocalSearchResult entry = result.getLocalSearchResult();

    DivPanel namePanel = new DivPanel();
    namePanel.addStyleName(_css.ActiveResultNamePanel());
    panel.add(namePanel);

    if (entry.getUrl() == null) {
      DivWidget name = new DivWidget(entry.getName());
      name.addStyleName(_css.ActiveResultName());
      namePanel.add(name);
    } else {
      Anchor name = new Anchor(entry.getName(), entry.getUrl());
      name.addStyleName(_css.ActiveResultName());
      name.setTarget("_blank");
      namePanel.add(name);
    }

    DivWidget address = new DivWidget(getFormatedAddressForEntry(entry));
    address.addStyleName(_css.ActiveResultAddress());
    panel.add(address);

    DivWidget phone = new DivWidget(getFormatedPhoneNumber(entry));
    phone.addStyleName(_css.ActiveResultPhone());
    panel.add(phone);

    DivPanel ratingPanel = new DivPanel();
    ratingPanel.addStyleName(_css.ActiveResultRatingPanel());
    panel.add(ratingPanel);

    if (entry.getRatingUrl() != null) {
      Image image = new Image(entry.getRatingUrl());
      image.setSize("84px", "17px");
      image.addStyleName(_css.ActiveResultRatingImage());
      ratingPanel.add(image);
    } else if (entry.getRatingUrlSmall() != null) {
      Image image = new Image(entry.getRatingUrlSmall());
      image.addStyleName(_css.ActiveResultRatingImageSmall());
      ratingPanel.add(image);
    } else {
      DivWidget rating = new DivWidget(entry.getRating() + "/"
          + entry.getMaxRating());
      ratingPanel.add(rating);
    }

    DivWidget time = new DivWidget("Travel time: ~" + (result.getTime() / 60)
        + " mins");
    time.addStyleName(_css.ActiveResultTravelTime());
    panel.add(time);

    _currentDirectionWidgets.add(time);

    DivPanel directionsPanel = new DivPanel();
    directionsPanel.addStyleName(_css.ActiveResultDirectionsPanel());
    panel.add(directionsPanel);

    Anchor directions = new Anchor("Get Directions Using Public Transit");
    directions.addStyleName(_css.ActiveResultDirections());
    directions.addClickHandler(new DirectionsHandler(entry));
    directionsPanel.add(directions);

    _currentDirectionWidgets.add(directions);
  }
View Full Code Here

    Object primary = getPrimaryResult(result);
    addPrimaryResult(primary);

    if (!result.isEmpty()) {

      DivPanel panel = new DivPanel(_css.resultListAdditional());
      _panel.add(panel);

      panel.add(new DivWidget("Did you mean:", _css.resultListWarning()));

      List<RouteBean> routes = result.getRoutes();
      addElementsToPanel(panel, routes, "Routes");

      List<StopBean> stops = result.getStops();
      addElementsToPanel(panel, stops, "Stops");

      List<Place> addresses = result.getAddresses();
      DivPanel addressesPanel = addElementsToPanel(panel, addresses,
          "Addresses");
      if (!addresses.isEmpty()) {
        ShowPlacesOnMapToggleHandler handler = addShowOnMapLink(addressesPanel,
            addresses, primary);
        if (primary == null && routes.isEmpty() && stops.isEmpty())
          handler.setShowingOnMap(true);
      }

      List<Place> places = result.getPlaces();
      DivPanel placesPanel = addElementsToPanel(panel, places, "Places");
      if (!places.isEmpty()) {
        ShowPlacesOnMapToggleHandler handler = addShowOnMapLink(placesPanel,
            places, primary);
        if (primary == null && routes.isEmpty() && stops.isEmpty()
            && addresses.isEmpty())
View Full Code Here

   * Private Methods
   ****/

  private void addPrimaryResult(Object primary) {
    if (primary != null) {
      DivPanel primaryPanel = new DivPanel(_css.resultListPrimary());
      _panel.add(primaryPanel);
      addResultToPanel(primaryPanel, primary);
      displayPrimaryResult(primary);
    }
  }
View Full Code Here

      @Override
      public void onClick(ClickEvent arg0) {
        _stopFinder.queryCurrentView();
      }
    });
    DivPanel p = new DivPanel(_css.resultListClear());
    p.add(anchor);
    _panel.add(p);
  }
View Full Code Here

      String label) {

    if (objects.isEmpty())
      return null;

    DivPanel panel = new DivPanel(_css.resultList());
    parentPanel.add(panel);
    panel.add(new DivWidget(label + ":", _css.resultListHeader()));

    for (Object bean : objects)
      addResultToPanel(panel, bean);

    return panel;
View Full Code Here

    }
  }

  private void addRouteBeanToPanel(final RouteBean route, DivPanel panel) {

    DivPanel resultPanel = new DivPanel(_css.resultListEntry());
    panel.add(resultPanel);

    DivPanel routeRow = new DivPanel(_css.resultListEntryName());
    resultPanel.add(routeRow);

    String name = getRouteName(route);
    Anchor anchor = new Anchor(name);
    anchor.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        _stopFinder.queryRoute(route.getId());
      }
    });
    routeRow.add(anchor);

    AgencyBean agency = route.getAgency();
    String agencyLink = agency.getName();
    if (agency.getUrl() != null)
      agencyLink = "<a href=\"" + agency.getUrl() + "\">" + agency.getName()
View Full Code Here

        _css.resultListEntryDescription()));
  }

  protected void addStopBeanToPanel(StopBean stop, DivPanel panel) {

    DivPanel resultPanel = new DivPanel(_css.resultListEntry());
    panel.add(resultPanel);

    DivPanel nameRow = new DivPanel(_css.resultListEntryName());
    resultPanel.add(nameRow);

    Anchor anchor = new Anchor(stop.getName(), false,
        _stopFinder.getStopQueryLink(stop.getId()));
    nameRow.add(anchor);

    String desc = "Stop # " + StopPresenter.getCodeForStop(stop);
    if (stop.getDirection() != null)
      desc += " - " + stop.getDirection() + " bound";
    resultPanel.add(new DivWidget(desc, _css.resultListEntryDescription()));
View Full Code Here

TOP

Related Classes of org.onebusaway.webapp.gwt.common.widgets.DivPanel

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.