Example usage for com.google.gwt.user.client DOM setElementAttribute

List of usage examples for com.google.gwt.user.client DOM setElementAttribute

Introduction

In this page you can find the example usage for com.google.gwt.user.client DOM setElementAttribute.

Prototype

@Deprecated
public static void setElementAttribute(Element elem, String attr, String value) 

Source Link

Document

Sets an attribute on a given element.

Usage

From source file:asquare.gwt.tk.client.ui.CWindow.java

License:Apache License

@Override
public void setTitle(String title) {
    if (title == null || title.length() == 0) {
        DOM.removeElementAttribute(getContainerElement(), "title");
    } else {/*w w  w.j  a  v a 2s .c om*/
        DOM.setElementAttribute(getContainerElement(), "title", title);
    }
}

From source file:at.ait.dme.yuma.client.Application.java

License:EUPL

/**
 * show the header (search field and logo)
 *//*from  w  ww. j av  a 2  s. c om*/
private void showHeader() {
    if (Application.isInTileMode())
        return;

    final HorizontalPanel hPanel = new HorizontalPanel();

    // removed the search since it's not needed by europeana
    // show the search field      
    /*final TextBox searchTerm = new TextBox();
    searchTerm.setStyleName("imageAnnotation-search-term");
    searchTerm.addKeyDownHandler(new KeyDownHandler() {
       public void onKeyDown(KeyDownEvent event) {
    if(event.getNativeKeyCode()==KeyCodes.KEY_ENTER)
       startSearch(searchTerm.getText());
       }
    });
    hPanel.add(searchTerm);
            
    // show the search button
    Button search = new Button(getConstants().annotationSearch());
    search.setStyleName("imageAnnotation-search");
    search.addClickHandler(new ClickHandler() {
       public void onClick(ClickEvent event) {
    startSearch(searchTerm.getText());
       }   
    });
    hPanel.add(search);*/

    // show the logo
    String dbName = getDatabaseName();
    if (dbName == null)
        dbName = "ait";
    String logoPath = "images/" + dbName + ".gif";
    final Image logo = new Image(logoPath);
    // workaround for IE caching issue see 
    // http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/11851753ba99454d/6079e2e2b9aea4bf
    DOM.setElementAttribute(logo.getElement(), "src", logoPath);

    // see also http://code.google.com/p/google-web-toolkit/issues/detail?id=2149
    if (logo.getWidth() > 0) {
        RootPanel.get().add(hPanel, logo.getWidth() + 20, 50);
    } else {
        logo.addLoadHandler(new LoadHandler() {
            public void onLoad(LoadEvent event) {
                RootPanel.get().add(hPanel, logo.getWidth() + 20, 50);
            }
        });
    }
    RootPanel.get().add(logo, 10, 10);
}

From source file:bufferings.ktr.wjr.client.ui.widget.WjrNoBorderFocusPanel.java

License:Apache License

/**
 * Hides the focus border./*from  w ww.j av  a  2  s  . c  o  m*/
 */
protected void initialize() {
    DOM.setStyleAttribute(getElement(), "outline", "0px");
    DOM.setElementAttribute(getElement(), "hideFocus", "true");
}

From source file:ccc.client.gwt.widgets.CodeMirrorEditor.java

License:Open Source License

private void initWidget() {
    final VerticalPanel panel = new VerticalPanel();
    panel.setWidth("100%");
    panel.setStyleName("codemirror-ed");

    final TextArea textArea = new TextArea();
    DOM.setElementAttribute(textArea.getElement(), "id", _id);
    textArea.setVisible(false);//from  ww  w.  j ava2  s  .co  m

    panel.add(textArea);
    initWidget(panel);
}

From source file:ch.amaba.client.ui.LoginPageView.java

License:Open Source License

@Override
public void setError(List<String> messages) {
    errorPanel.clear();//from  w  w  w.  j  a  v  a 2 s.  co  m
    for (final String message : messages) {
        final Label l = new Label(message);
        DOM.setElementAttribute(l.getElement(), "id", "my-button-id");
        errorPanel.add(l);
    }
}

From source file:ch.heftix.mailxel.client.MailOverviewCellTable.java

License:Open Source License

public void fillGrid(List<Envelope> result) {

    envelopes = result;//  w  w  w  . ja  v  a  2  s. c o  m
    // checkboxes = new ArrayList<CheckBox>(envelopes.size());

    // clean all except header
    int rows = grid.getRowCount();
    for (int i = rows - 1; i >= first_payload_row; i--) {
        grid.removeRow(i);
    }

    int row = first_payload_row;

    for (final Envelope envelope : result) {

        grid.setText(row, C_SELECT, Integer.toString(envelope.count));

        setTextHelper(grid, row, C_FROM, envelope.from, 12);
        setTextHelper(grid, row, C_TO, envelope.to, 12);
        Label dateTime = dateTimeLabel(envelope.date, envelope.time);
        if (envelope.urgency > 0) {
            String style = "background-color:#FA5858;";
            switch (envelope.urgency) {
            case 4:
                style = "background-color:#FA5858;";
                break;
            case 3:
                style = "background-color:#FAAC58;";
                break;
            case 2:
                style = "background-color:#F4FA58;";
                break;
            default:
                style = "background-color:#ACFA58;";
                break;
            }
            DOM.setElementAttribute(dateTime.getElement(), "style", style);
        }

        grid.setWidget(row, C_DATE, dateTime);

        // GTD label (unless label is 'not categorized')
        if (990 != envelope.curcatid) {
            Label gtdLabel = createLabel(envelope.GTD, 16);
            grid.setWidget(row, C_GTD, gtdLabel);
            // see if there is an icon for it
            Image img = setIconForGTD(grid, row, envelope.curcatid, envelope.GTD);
            img.addMouseOverHandler(new MouseOverHandler() {
                public void onMouseOver(final MouseOverEvent event) {

                    final PopupPanel pop = new PopupPanel(true);
                    pop.setPopupPosition(event.getClientX(), event.getClientY());

                    mailxelService.getCategoryHistory(envelope.id,
                            new AsyncCallback<List<AttachedCategoryTO>>() {
                                public void onFailure(Throwable caught) {
                                    //
                                }

                                public void onSuccess(List<AttachedCategoryTO> result) {
                                    if (null == result || result.size() < 1) {
                                        return;
                                    }
                                    FlexTable ft = new FlexTable();
                                    pop.add(ft);
                                    int row = 0;
                                    for (AttachedCategoryTO cat : result) {
                                        ft.setText(row, 0, cat.date);
                                        String url = DirectMailServiceUtil.getIconURL(cat.category.iconid);
                                        if (null != url) {
                                            Image img = new Image(url);
                                            ft.setWidget(row, 1, img);
                                        }
                                        ft.setText(row, 2, cat.category.name);
                                        row++;
                                    }
                                    pop.show();
                                }

                            });
                }
            });
        }

        if (envelope.nattach > 0) {
            Image attach = new Image("img/attach.png");
            grid.setWidget(row, C_ATTACHMENT, attach);
        }
        Label subject = setTextHelper(grid, row, C_SUBJECT, envelope.subject, 64);
        // subject.addMouseOverHandler(new MouseOverHandler() {
        //
        // public void onMouseOver(MouseOverEvent event) {
        // // System.out.println("on mouse over:" + event + "/" +
        // // envelope);
        // mailxelService.snippet(envelope.id,
        // new AsyncCallback<String>() {
        //
        // public void onFailure(Throwable caught) {
        // System.out.println("E snippet: " + caught);
        // }
        //
        // public void onSuccess(String result) {
        // System.out.println("I snippet: " + result);
        //
        // }
        // });
        // }
        // });

        if (row % 2 == 0) {
            rf.setStylePrimaryName(row, "row-bg");
        }
        row++;

    }

    cl = new CursoredList<Envelope>(envelopes);
    cl.setCursorPosition(0);
}

From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.util.DOMUtils.java

License:Apache License

/**
 * Creates an <i>HTML</i> link with given <var>href</var>, <var>styleClass</var> and given
 * <var>title</var>.//from  ww w. j a v  a 2  s .co  m
 * 
 * @param href if <code>null</code> then no <code>href</code> attribute will be added.
 * @param styleClass if <code>null</code> then no <code>class</code> attribute will be
 *            added.
 * @param title if <code>null</code> then no <code>title</code> attribute will be added.
 */
public final static Element createAnchorElement(final String styleClass, final String href,
        final String title) {
    final Element anchor = DOM.createAnchor();
    if (styleClass != null) {
        DOM.setElementAttribute(anchor, "class", styleClass);
    }
    if (href != null) {
        DOM.setElementAttribute(anchor, "href", href);
    }
    if (title != null) {
        DOM.setElementAttribute(anchor, "title", title);
    }
    return anchor;
}

From source file:com.ait.ext4j.client.core.Component.java

License:Apache License

public void setTitle(final String title) {
    if (isRendered()) {
        if (title == null || title.length() == 0) {
            DOM.removeElementAttribute(getElement(), "title");
        } else {//from   w  w  w  .  j av  a2  s.c o  m
            DOM.setElementAttribute(getElement(), "title", title);
        }
    } else {
        addListener("render", new Function() {
            public void execute() {
                setTitle(title);
            }
        });
    }
}

From source file:com.ait.toolkit.editors.ckeditor.client.CKEditor.java

License:Open Source License

/**
 * Initialize the editor//from   w ww. j  ava  2 s .c o  m
 */
private void initCKEditor() {
    div = DOM.createDiv();
    baseTextArea = DOM.createTextArea();
    name = HTMLPanel.createUniqueId();
    div.appendChild(baseTextArea);
    DOM.setElementAttribute(baseTextArea, "name", name);
    this.sinkEvents(Event.ONCLICK | Event.KEYEVENTS);

    if (config.isUsingFormPanel()) {
        FormPanel form = new FormPanel();
        Button submit = new Button();
        submit.addClickHandler(this);
        submit.getElement().setAttribute("name", "submit");
        submit.setVisible(false);
        // .getElement().setAttribute("style", "visibility:hidden");

        form.getElement().appendChild(div);
        form.add(submit);
        initWidget(form);
    } else {
        SimplePanel simplePanel = new SimplePanel();
        simplePanel.getElement().appendChild(div);
        initWidget(simplePanel);
    }
}

From source file:com.ait.toolkit.flash.widget.client.swf.ui.SWFWidget.java

License:Open Source License

/**
 * Instantiates a new sWF widget.//w w w.  j  a va  2s.c  om
 * 
 * @param src
 *            the src
 * @param settings
 *            the settings
 */
public SWFWidget(String src, SWFSettings settings) {
    this.src = src;
    swfSettings = settings;
    swfId = idPrefix + count;
    swfDivId = divPrefix + count;
    ++count;
    Element element = DOM.createElement("div");
    DOM.setElementProperty(element, "id", swfDivId);
    DOM.setElementAttribute(element, "width", "100%");
    DOM.setElementAttribute(element, "height", "100%");

    // add new div which will be replaced by SWFObject
    setElement(element);

}