1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    6
    Vote Rating
    0
    SmallerPlatypus is on a distinguished road

      0  

    Default Resizable Portlet

    Resizable Portlet


    Apologies if this has already been addressed, but I had a need to vertically resize a portlet and if I needed it, I guess others may need it too so here is my extended Portlet class.

    Code:
    import com.extjs.gxt.ui.client.event.ResizeEvent;
    import com.extjs.gxt.ui.client.event.ResizeListener;
    import com.extjs.gxt.ui.client.fx.Resizable;
    import com.extjs.gxt.ui.client.widget.Layout;
    import com.extjs.gxt.ui.client.widget.custom.Portlet;
    
    import com.google.gwt.core.client.Scheduler;
    import com.google.gwt.core.client.Scheduler.ScheduledCommand;
    
    /**
     * A vertically resizable content panel contained in a Portal.
     * 
     * @author Matt Verrinder
     * 
     */
    public class ResizablePortlet extends Portlet {
      private Resizable resizer;
      private boolean resizable = true;
      private boolean resizing = false;
      private int minHeight = 100;
    
      /**
       * @param fitLayout
       */
      public ResizablePortlet(Layout layout) {
        super(layout);
        setResizable(true);
      }
    
      /**
       * Returns the min height.
       * 
       * @return the min height
       */
      public int getMinHeight() {
        return minHeight;
      }
    
      /**
       * Returns the window's resizable instance.
       * 
       * @return the resizable
       */
      public Resizable getResizable() {
        if (resizer == null && resizable) {
          resizer = new Resizable(this, "s");
    
          resizer.setMinHeight(getMinHeight());
          resizer.addResizeListener(new ResizeListener() {
    
            @Override
            public void resizeEnd(final ResizeEvent re) {
              // end resize after event preview
              Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                @Override
                public void execute() {
                  onEndResize(re);
                }
              });
            }
    
            @Override
            public void resizeStart(ResizeEvent re) {
              onStartResize(re);
            }
    
          });
        }
        return resizer;
      }
    
      /**
       * The minimum height in pixels allowed for this window (defaults to 100).
       * Only applies when resizable = true.
       * 
       * @param minHeight the min height
       */
      public void setMinHeight(int minHeight) {
        this.minHeight = minHeight;
        if (resizer != null) {
          resizer.setMinHeight(minHeight);
        }
      }
    
      /**
       * True to allow user resizing at each edge and corner of the window, false to
       * disable resizing (defaults to true).
       * 
       * @param resizable true to enabled resizing
       */
      public void setResizable(boolean resizable) {
        this.resizable = resizable;
        if (resizable) {
          getResizable();
        } else if (resizer != null) {
          resizer.release();
          resizer = null;
        }
      }
    
      protected void onEndResize(ResizeEvent re) {
        resizing = false;
      }
    
      protected void onStartResize(ResizeEvent re) {
        resizing = true;
      }

  2. #2
    Ext GWT Premium Member
    Join Date
    Aug 2011
    Posts
    2
    Vote Rating
    0
    sbaramov is on a distinguished road

      0  

    Default


    Thank you very much for sharing the code. It does work nicely. I have one question though: What was the intend for the 'resizing' field?

Similar Threads

  1. Force pinned portlet as the first/top portlet
    By MickeyMiner in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 24 Nov 2009, 2:07 AM
  2. Replies: 2
    Last Post: 30 Jul 2009, 7:50 AM
  3. Resizable ContentPanel in Window not Resizable when Window isMaximed
    By francescoNemesi in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 27 Jul 2009, 8:30 AM
  4. About Ext.ux.Portlet
    By iTzAngel in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 24 Jul 2008, 11:58 PM

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi