Example usage for com.google.gwt.user.client.ui Image wrap

List of usage examples for com.google.gwt.user.client.ui Image wrap

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Image wrap.

Prototype

public static Image wrap(Element element) 

Source Link

Document

Creates a Image widget that wraps an existing <img> element.

Usage

From source file:cc.kune.gspace.client.armor.GSpaceArmorPolymer.java

License:GNU Affero Public License

@Override
public Image getGroupLogo() {
    return Image.wrap(getElement(HEADER_GROUP_LOGO));
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped */
public static Widget elementToWidget(Element e, String typ) {
    Widget result = null;/*from  w ww . j a v a 2 s . c  o m*/
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped  */
public static Widget elementToWidget(String elementName, String typ) {
    Widget result = null;//from  ww w .j  a va  2s .com
    Element e = DOM.getElementById(elementName);
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:fr.gael.dhus.gwt.client.page.SearchPage.java

License:Open Source License

private static void init() {
    firstSearch = true;//from www.java  2s  .co m

    advancedProductType = TextBox.wrap(RootPanel.get("search_advancedFieldProductType").getElement());
    advancedIngestionDate = TextBox.wrap(RootPanel.get("search_advancedFieldIngestionDate").getElement());
    advancedSensorMode = TextBox.wrap(RootPanel.get("search_advancedFieldSensorMode").getElement());
    advancedPolarisation = TextBox.wrap(RootPanel.get("search_advancedFieldPolarisation").getElement());
    advancedSwath = TextBox.wrap(RootPanel.get("search_advancedFieldSwath").getElement());
    advancedSensingDate = TextBox.wrap(RootPanel.get("search_advancedFieldSensingDate").getElement());
    advancedIngestionDateEnd = TextBox.wrap(RootPanel.get("search_advancedFieldIngestionDateEnd").getElement());
    advancedSensingDateEnd = TextBox.wrap(RootPanel.get("search_advancedFieldSensingDateEnd").getElement());

    search_button = RootPanel.get("search_button");
    search_button.addDomHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            searchClicked = true;
            doSearch();
        }
    }, ClickEvent.getType());
    search_request = TextBox.wrap(RootPanel.get("search_request").getElement());
    search_value = TextBox.wrap(RootPanel.get("search_value").getElement());
    search_value.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                NativeEvent evt = Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false);
                DomEvent.fireNativeEvent(evt, search_button);
            } else {
                search_filling();
            }
        }
    });
    final Image saveSearch = Image.wrap(RootPanel.get("search_saveImage").getElement());
    saveSearch.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (saveSearch.getUrl().contains("saveSearch_disabled")) {
                return;
            }

            String searchPoly = getCurrentPolygonSearchString();
            String footprint = getCurrentPolygon();
            String advancedSearch = "";
            HashMap<String, String> advancedSearchMap = new HashMap<String, String>();
            if (advancedSearchActive) {
                boolean first = true;
                String productType = advancedProductType.getValue();
                String polarisation = advancedPolarisation.getValue();
                String sensorMode = advancedSensorMode.getValue();
                String swath = advancedSwath.getValue();
                String sensingDate = advancedSensingDate.getValue();
                String ingestionDate = advancedIngestionDate.getValue();
                String sensingDateEnd = advancedSensingDateEnd.getValue();
                String ingestionDateEnd = advancedIngestionDateEnd.getValue();
                if (productType != null && !productType.isEmpty()) {
                    advancedSearchMap.put(ADVANCED_PRODUCTTYPE, productType);
                    advancedSearch += " productType:\"" + productType + "\" ";
                    first = false;
                }
                if (polarisation != null && !polarisation.isEmpty()) {
                    advancedSearchMap.put(ADVANCED_POLARISATION, polarisation);
                    advancedSearch += (!first ? " AND " : "") + " polarisationMode:\"" + polarisation + "\" ";
                    first = false;
                }
                if (sensorMode != null && !sensorMode.isEmpty()) {
                    advancedSearchMap.put(ADVANCED_SENSORMODE, sensorMode);
                    advancedSearch += (!first ? " AND " : "") + " sensorOperationalMode:\"" + sensorMode
                            + "\" ";
                    first = false;
                }
                if (swath != null && !swath.isEmpty()) {
                    advancedSearchMap.put(ADVANCED_RESOLUTION, swath);
                    advancedSearch += (!first ? " AND " : "") + " swathIdentifier:\"" + swath + "\" ";
                    first = false;
                }
                if (sensingDate != null && !sensingDate.isEmpty()) {
                    advancedSearchMap.put(ADVANCED_SENSINGDATE, sensingDate);
                }
                if (sensingDateEnd != null && !sensingDateEnd.isEmpty()) {
                    advancedSearchMap.put(ADVANCED_SENSINGDATEEND, sensingDateEnd);
                }
                if (ingestionDate != null && !ingestionDate.isEmpty()) {
                    advancedSearchMap.put(ADVANCED_INGESTIONDATE, ingestionDate);
                }
                if (ingestionDateEnd != null && !ingestionDateEnd.isEmpty()) {
                    advancedSearchMap.put(ADVANCED_INGESTIONDATEEND, ingestionDateEnd);
                }
                if ((sensingDate != null && !sensingDate.isEmpty())
                        || (sensingDateEnd != null && !sensingDateEnd.isEmpty())) {
                    String range = "["
                            + ((sensingDate != null && !sensingDate.isEmpty()) ? sensingDate + "T00:00:00.000Z"
                                    : "*")
                            + " TO "
                            + ((sensingDateEnd != null && !sensingDateEnd.isEmpty())
                                    ? sensingDateEnd + "T23:59:59.999Z"
                                    : "NOW")
                            + "]";
                    advancedSearch += (!first ? " AND " : "") + "( beginPosition:" + range + " AND endPosition:"
                            + range + " ) ";
                    first = false;
                }
                if ((ingestionDate != null && !ingestionDate.isEmpty())
                        || (ingestionDateEnd != null && !ingestionDateEnd.isEmpty())) {
                    String range = "["
                            + ((ingestionDate != null && !ingestionDate.isEmpty())
                                    ? ingestionDate + "T00:00:00.000Z"
                                    : "*")
                            + " TO "
                            + ((ingestionDateEnd != null && !ingestionDateEnd.isEmpty())
                                    ? ingestionDateEnd + "T23:59:59.999Z"
                                    : "NOW")
                            + " ]";
                    advancedSearch += (!first ? " AND " : "") + "( ingestionDate:" + range + " ) ";
                    first = false;
                }
            }

            String tmpSearch = search_value.getValue();
            tmpSearch += (!tmpSearch.isEmpty() && !advancedSearch.isEmpty() ? " AND " : "") + advancedSearch;
            tmpSearch += (!tmpSearch.isEmpty() && !searchPoly.isEmpty() ? " AND " : "") + searchPoly;

            String completeSearch = tmpSearch.isEmpty() ? "*" : tmpSearch.trim();
            String search = search_value.getValue();
            search = search.isEmpty() ? "*" : search.trim();

            userService.storeUserSearch(GWTClient.getCurrentUser().getId(), search, footprint,
                    advancedSearchMap, completeSearch.trim(), new AccessDeniedRedirectionCallback<Void>() {

                        @Override
                        public void _onFailure(Throwable caught) {
                            Window.alert("There was an error while saving your search.");
                        }

                        @Override
                        public void onSuccess(Void result) {
                            Window.alert("Your search was successfully saved.");
                            reloadSavedSearches();
                        }
                    });
        }
    });
    showSearch();
    refresh();
}