Package org.damour.base.client.ui.share

Source Code of org.damour.base.client.ui.share.TwitterWidget

package org.damour.base.client.ui.share;

import java.util.List;

import org.damour.base.client.objects.PermissibleObject;
import org.damour.base.client.ui.permalink.PermaLinkBuilder;

import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.SimplePanel;

public class TwitterWidget extends SimplePanel {

  public TwitterWidget(PermissibleObject permissibleObject, List<String> ignoredParameters) {
    Frame frame = new Frame();

    @SuppressWarnings("deprecation")
    String url = URL.encodeComponent(PermaLinkBuilder.getLink(permissibleObject, ignoredParameters));

    frame.setUrl("http://platform.twitter.com/widgets/tweet_button.html?count=horizontal&url=" + url);
    DOM.setElementAttribute(frame.getElement(), "frameBorder", "0");
    DOM.setElementAttribute(frame.getElement(), "allowTransparency", "true");
    DOM.setElementAttribute(frame.getElement(), "scrolling", "no");
    DOM.setStyleAttribute(frame.getElement(), "height", "20px");
    DOM.setStyleAttribute(frame.getElement(), "width", "130px");
    // DOM.setStyleAttribute(frame.getElement(), "backgroundColor", "#e3e3e3");
    setWidget(frame);
  }
}
TOP

Related Classes of org.damour.base.client.ui.share.TwitterWidget

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.