Example usage for com.google.gwt.resources.client DataResource getUrl

List of usage examples for com.google.gwt.resources.client DataResource getUrl

Introduction

In this page you can find the example usage for com.google.gwt.resources.client DataResource getUrl.

Prototype

@Deprecated
String getUrl();

Source Link

Document

Retrieves a URL by which the contents of the resource can be obtained.

Usage

From source file:forplay.flash.FlashAssetManager.java

License:Apache License

@Override
protected Sound loadSound(String path) {
    String url = pathPrefix + path;

    AutoClientBundleWithLookup clientBundle = getBundle(path);
    if (clientBundle != null) {
        String key = getKey(path);
        DataResource resource = (DataResource) getResource(key, clientBundle);
        if (resource != null) {
            url = resource.getUrl();
        }//from  w w  w .  j a v  a 2 s .  c om
    } else {
        url += ".mp3";
    }

    return adaptSound(url);
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.SearchOriginMapPresenter.java

License:Apache License

public void handleUpdate(StateEvent event) {

    State state = event.getState();

    if (state instanceof SearchLocationUpdatedState) {

        if (_marker != null) {
            _mapOverlayManager.removeOverlay(_marker);
            _marker = null;//from   w  ww.  j  a  va2 s.  co m
        }

        LatLng location = _queryModel.getLocation();

        if (location == null) {
            System.err.println("PROBLEM!");
            return;
        }

        MapResources resources = MapResources.INSTANCE;
        DataResource resource = resources.getImageRouteStart();
        Icon icon = Icon.newInstance();
        icon.setImageURL(resource.getUrl());
        icon.setIconSize(Size.newInstance(20, 34));
        icon.setIconAnchor(Point.newInstance(10, 34));
        MarkerOptions opts = MarkerOptions.newInstance(icon);

        _marker = new Marker(location, opts);
        _mapOverlayManager.addOverlay(_marker);
    }

}

From source file:org.onebusaway.webapp.gwt.tripplanner_library.view.SingleTripPresenter.java

License:Apache License

public void displayTrip(ItineraryBean trip, int index, String destination) {

    _panel.clear();/*from  www .jav a 2s. c om*/
    _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);
        }
    }
}

From source file:org.onebusaway.webapp.gwt.tripplanner_library.view.TripPlanResultTablePresenter.java

License:Apache License

private Widget getTripTypeWidget(ItineraryBean trip) {

    FlowPanel panel = new FlowPanel();
    TripPlannerResources resources = TripPlannerResources.INSTANCE;

    for (LegBean segment : trip.getLegs()) {
        if (segment.getMode().equals("walk")) {
            if (segment.getDistance() > 400) {
                DataResource walkIcon = resources.getWalkTripTypeIcon();
                Image image = new Image(walkIcon.getUrl());
                panel.add(image);/*from ww  w. ja va 2  s .c om*/
            }
        } else if (segment.getMode().equals("transit")) {
            DataResource busIcon = resources.getBusTripTypeIcon();
            Image image = new Image(busIcon.getUrl());
            panel.add(image);
        }
    }

    return panel;
}