Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext User haplo's Avatar
    Join Date
    Jul 2008
    Location
    Paderborn - Germany
    Posts
    11
    Vote Rating
    0
    haplo is on a distinguished road

      0  

    Default ImageBundleButton

    ImageBundleButton


    Hi everyone,

    i extended the GXT Button to support ImageBundels.

    Code:
    public class ImageBundleButton extends Button {
    
        private AbstractImagePrototype imagePrototype;
    
        /**
         * used for image width calculation  
         */
        private int additionalImageWidth = 0;
    
        public ImageBundleButton() {
    
        }
    
        public ImageBundleButton(AbstractImagePrototype imagePrototype) {
            this.imagePrototype = imagePrototype;
        }
    
    
        public ImageBundleButton(String text, AbstractImagePrototype imagePrototype) {
            super(text);
            this.imagePrototype = imagePrototype;
        }
    
        public void setImagePrototype(AbstractImagePrototype imagePrototype) {
            this.imagePrototype = imagePrototype;
        }
    
        /**
         * if margins are added to the icon style, use this method to correct the autowidth calculation in ie
         */
        public void setAdditionalImageWidth(int additionalImageWidth) {
            this.additionalImageWidth = additionalImageWidth;
        }
    
        protected void autoWidth() {
          if (rendered) {
            el().setWidth("auto");
            if (GXT.isIE) {
              if (buttonEl != null && buttonEl.getWidth() > 20) {
                buttonEl.clip();
                TextMetrics.get().bind(buttonEl.dom);
                int adj = getIconStyle() != null ? 8 : 0;
                adj += (imagePrototype!=null) ? imagePrototype.createImage().getWidth() + additionalImageWidth + 6: 0;
                int w = TextMetrics.get().getWidth(text) + buttonEl.getFrameWidth("lr") + adj;
                buttonEl.setWidth(w);
              }
            }
            if (getMinWidth() != Style.DEFAULT) {
              if (el().getWidth() < getMinWidth()) {
                el().setWidth(getMinWidth());
              }
            }
          }
        }
    
        protected void setElement(Element elem, Element parent, int index) {
            super.setElement(template.create((text != null && !text.equals("")) ? text : "&nbsp;", getType(), baseStyle, (imagePrototype !=null) ? imagePrototype.getHTML() : ""), parent, index);
        }
    
        protected void onRender(Element target, int index) {
            if(buttonTemplate == null){
                buttonTemplate = new Template(this.getTemplateString());
            }
            super.onRender(target, index);
        }
    
        private String getTemplateString(){
            StringBuffer sb = new StringBuffer();
            sb.append("<table border=0 cellpadding=0 cellspacing=0 class='{2}-wrap'><tbody><tr>");
            sb.append("<td class={2}-left><i>&#160;</i></td><td class='{2}-center'><em unselectable=on><button class={2}-text type={1}><span class={2}-image>{3}</span> {0}</button></em></td><td class={2}-right><i>&#160;</i></td>");
            sb.append("</tr></tbody></table>");
            return sb.toString();
        }
    }

  2. #2
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    363
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Question


    How could I do something similar for SplitButton?

Thread Participants: 1