DOM related helper methods (Smart GWT) : Utility « GWT « Java






DOM related helper methods (Smart GWT)

     
/*
 * SmartGWT (GWT for SmartClient)
 * Copyright 2008 and beyond, Isomorphic Software, Inc.
 *
 * SmartGWT is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3
 * as published by the Free Software Foundation.  SmartGWT is also
 * available under typical commercial license terms - see
 * http://smartclient.com/license
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 */

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;

/**
 * DOM related helper methods.
 *
 * @author Sanjiv Jivan
 */
public class DOMUtil {

    public static String getID(Widget widget) {
        return getID(widget.getElement());
    }

    public static String getID(Element element) {
        String id = DOM.getElementProperty(element, "id");
        return id == null || id.equals("") ? null : id;

    }


    public static void setID(Widget widget, String id) {
        setID(widget.getElement(), id);
    }

    public static void setID(Element element, String id) {
        DOM.setElementProperty(element, "id", id);
    }

}

   
    
    
    
    
  








SmartGWT.zip( 9,880 k)

Related examples in the same category

1.Use reflection to generate the async interface from the Service interface as per GWT standard
2.Array Utils for client side GWT
3.A simple number formatting/ parsing class
4.GWT window utility
5.Implement java.util.regex.Pattern with Javascript RegExp object
6.GWT color class
7.Formatting functions for GWT client side (Ext GWT)
8.Helper class to decode and encode objects to and from Json (Ext GWT)
9.String util for GWT client side (Smart GWT)
10.GWT DOM util
11.Replace string for GWT
12.GWT style util
13.gwt DateTimeFormat
14.A utility class that provides utility methods to work with arrays for GWT.
15.Date compare util for GWT
16.GWT DOM utility functions for use when programmatically constructing a UI.
17.Generate a faster string comparison than String.equals() for web mode code.
18.Js Array Util