Hi,

im using uibinder and im been force to create a lot of new widgets
that supports inner widgets mixed with html. Im extending HTMLPanel to
create Paragraph & Anchor widgets. Is a bad practice? Is there any
cons?

Thx in advice!

example:


package com.banana.client.view.widget.components;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasAllMouseHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.dom.client.MouseMoveEvent;
import com.google.gwt.event.dom.client.MouseMoveHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.event.dom.client.MouseUpHandler;
import com.google.gwt.event.dom.client.MouseWheelEvent;
import com.google.gwt.event.dom.client.MouseWheelHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.user.client.ui.HTMLPanel;

/**
 * This widget is to create <p> elements in a page.
 *
 * @author Javier Arnáiz, javier[at]bananacampus.com
 */
public class Paragraph extends HTMLPanel implements HasClickHandlers,
                                                                                
                HasAllMouseHandlers{

    public Paragraph(String html) {
        super("p", html);
    }

    public Paragraph(SafeHtml safehtml){
        super("p", safehtml.asString());
    }

    public Paragraph(){
        super("p", "");
    }

        public String getHTML() {
                return getElement().getInnerHTML();
        }

        public void setHTML(String html) {
                getElement().setInnerHTML(html);
        }

        public String getText() {
                return getElement().getInnerText();
        }

        public void setText(String text) {
                getElement().setInnerText(text);
        }

        @Override
        public HandlerRegistration addClickHandler(ClickHandler handler)
        {
                return addDomHandler(handler, ClickEvent.getType());
        }

        @Override
        public HandlerRegistration addMouseDownHandler(MouseDownHandler
handler)
        {
                return addDomHandler(handler, MouseDownEvent.getType());
        }

        @Override
        public HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
        {
                return addDomHandler(handler, MouseUpEvent.getType());
        }

        @Override
        public HandlerRegistration addMouseOutHandler(MouseOutHandler
handler)
        {
                return addDomHandler(handler, MouseOutEvent.getType());
        }

        @Override
        public HandlerRegistration addMouseOverHandler(MouseOverHandler
handler)
        {
                return addDomHandler(handler, MouseOverEvent.getType());
        }

        @Override
        public HandlerRegistration addMouseMoveHandler(MouseMoveHandler
handler)
        {
                return addDomHandler(handler, MouseMoveEvent.getType());
        }

        @Override
        public HandlerRegistration addMouseWheelHandler(MouseWheelHandler
handler)
        {
                return addDomHandler(handler, MouseWheelEvent.getType());
        }
        /*
        public void setVisible(boolean visible)
        {
                super.setVisible(visible);
        }
        */

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to