On 05/10/2009 03:01 AM, LooneyLynn wrote:
>       }
>
>       public LabelEllipsis(
>                       String InContent,
>                       String InStyleName,
>                       int InWidth,
>                       int InMaxHeight,
>                       HorizontalAlignmentConstant InAlign){
>               this(InContent, InStyleName, InWidth, InMaxHeight);
>
>               this.setHorizontalAlignment(InAlign);
>       }
>
>       @Override
>       protected void onLoad(){
>               setText(m_Content);
>       }
>
>    



What's the purpose of InContent in the setText() method? It's never 
referenced...


>       @Override
>       public void setText(String InContent){
>               if(!isAttached())
>                       return;
>
>               String OldContent = m_Content;
>
>               super.setText(m_Content);
>
>               int Height = getOffsetHeight();
>
>               if(Height>  m_MaxHeight){
>                       float Ratio = (float)m_MaxHeight / (float)Height; //<  
> 1.0
>
>                       m_Content = m_Content.substring(0,
>                                       Math.min(m_Content.length() - 4, 
> (int)(m_Content.length() *
> Ratio))) + "...";
>
>                       super.setText(m_Content);
>
>                       Height = getOffsetHeight();
>
>                       if(Height<  m_MaxHeight){
>                               // add chars until max height is reached
>                               while(Height<  m_MaxHeight){
>                                       m_Content = OldContent.substring(0, 
> m_Content.length() - 2) +
> "...";
>
>                                       super.setText(m_Content);
>
>                                       Height = getOffsetHeight();
>                               }
>
>                               // remove last char
>                               m_Content = m_Content.substring(0,
>                                               Math.min(m_Content.length() - 
> 4, m_Content.length() *
> m_MaxHeight)) + "...";
>
>                               super.setText(m_Content);
>                       }else if(Height>  m_MaxHeight){
>                               // remove chars until max height is reached
>                               while((Height>  m_MaxHeight)&&  
> (m_Content.length()>= 4)){
>                                       m_Content = m_Content.substring(0, 
> m_Content.length() - 4) +
> "...";
>
>                                       super.setText(m_Content);
>
>                                       Height = getOffsetHeight();
>                               }
>                       }
>               }
>       }
> }
> >
>    


--~--~---------~--~----~------------~-------~--~----~
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