You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Emmanuel Lécharny <el...@gmail.com> on 2015/06/03 20:27:36 UTC

[Studio] Pb with some auto-resizing Text widget

Hi,

I'va an issue with some Text that is feed by a Dialog, and which expands
way too much when the Dialog generates a long text.

Typically, here is what teh screen looks like before the edition :

  
+---------------------------------------------------------------------------------+
   |
Tuning                                                                         
|
  
+---------------------------------------------------------------------------------+
   | .-------------------------------------.
.-------------------------------------. |
   | | TCP configuration                   | | 
Concurrency                         | |
   | +-------------------------------------+
+-------------------------------------+ |
   | | TCPBuffers                          |
|                                     | |
   | | +-----------------------+           | | Concurrency             
: [      ] | |
   | | | xyz                   | (Add)     | | Max Pending Conn         
: [      ] | |
   | | | abc                   | (Edit)    | | Max Pending Conn Auth   
: [      ] | |
   | | |                       | (Delete)  | | Nb Threads              
: [      ] | |
   | | +-----------------------+           | | Nb Threads Tool Mode    
: [      ] | |
   | |                                     | | Nb Listener threads     
: [      ] | |
   | | Max Incoming Buffer      : [      ] |
|                                     | |
   | | Max Incoming Buffer Auth : [      ] |
|                                     | |
   | +-------------------------------------+
+-------------------------------------+ |
   | .-------------------------------------.
.-------------------------------------. |
   | | LDAP Limits                         | | Index
Limits                        | |
   | +-------------------------------------+
+-------------------------------------+ |
   | | Write Timeout : [      ]            | | Integer Indices Length  
: [      ] | |
   | | Idle Timeout  : [      ]            | | Subany Indices Length    
: [      ] | |
   | | Size Limit : [             ] (Edit) | | Subany Indices Step     
: [      ] | |
   | | Time Limit : [             ] (Edit) | | Sub indices Max length  
: [      ] | |
   | |                                     | | Sub indices Min length  
: [      ] | |
   | +-------------------------------------+
+-------------------------------------+ |
  
+---------------------------------------------------------------------------------+


When I enter many data into the Size Limit (this is done through the
Edit dialog), then the Size Limit text expands, with the Section, giving
something like :

  |
.----------------------------------------------------------------------------------------------------------------------------------.
.-------------------------------------. |
  | | LDAP Limits                         
                                                                                            
| | Index Limits                        | |
  |
+----------------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------+ |
  | | Write Timeout : [      ]           
                                                                                            
| | Integer Indices Length   : [      ] | |
  | | Idle Timeout  : [      ] 
                                                                                                       
| | Subany Indices Length    : [      ] | |
  | | Size Limit : [size.hard=8 size.soft=7 size.unchecked=disabled
size.pr=unlimited size.prtotal=disabled size.pr=noEstimate] (Edit) | | 
Subany Indices Step      : [      ] | |


FTR, I have 4 sections in the main page, one per 'box'. The TCP Config
section and the LDAP Limits section are expanded the exact same way.

What I want is that the Size Limit to have a fixed size, and be a WRAP
text, but I don't see how to do that...

The code is in
http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java?view=markup,
lines 768 for the section creation method ( createFormContent) and line
1009 (method createLdapLimitsSection) for the Size Limit Text.

thanks !

Re: [Studio] Pb with some auto-resizing Text widget

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 04/06/15 10:37, Emmanuel Lécharny a écrit :
> Le 03/06/15 23:40, Emmanuel Lécharny a écrit :
>> Le 03/06/15 22:54, Stefan Seelmann a écrit :
>>> Hi Emmanuel,
>>>
>>> I played a bit with it, changed
>>>
>>> * new GridData( GridData.FILL_HORIZONTAL )
>>> * toolkit.createText( ldapLimitSectionComposite, "" , SWT.WRAP |
>>> SWT.MULTI );
>>>
>>> but nothing helped, I'm also clueless.
>> I'll see if using a GridData helps. Otherwise, I'll step through the
>> code to see what's going on (wish me good luck ;-)
>>
> Using GridData keeps the Sections' size correct. However, the Text
> itself grows up to a point I don't see what's at the end, but this is
> definitively better. Except that if I resize the window, then the
> section grows as it did with the TabWrapLayout.
>
> So it seems the key is to find the way to tune the Text widget so that
> it does not grow.
>
> And who said GUI development was for beginners ? ;-)
Ok, some workaround :

        // The olcSizeLimit parameter.
        toolkit.createLabel( ldapLimitSectionComposite,
            Messages.getString( "OpenLDAPTuningPage.SizeLimit" ) );
//$NON-NLS-1$
        sizeLimitText = toolkit.createText( ldapLimitSectionComposite, "" );
        GridData sizeLimitData= new GridData( SWT.FILL, SWT.NONE, false,
false, 2, 1 );
        sizeLimitData.horizontalAlignment = SWT.FILL;
        Rectangle rect =
sizeLimitText.getShell().getMonitor().getClientArea();
        sizeLimitData.widthHint = rect.width/8; 
<<-------------------------------------- This provides a hint about the
requested maximal size.
        sizeLimitText.setLayoutData(sizeLimitData );
        sizeLimitText.setEditable( false );

It's a kind of a hack, but it does the trick.

Now, I think I will change the screen to avoid exposing the
Size/TimeLimit. ENough to have a button that brings the user to the
associated Dialog.

Re: [Studio] Pb with some auto-resizing Text widget

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 03/06/15 23:40, Emmanuel Lécharny a écrit :
> Le 03/06/15 22:54, Stefan Seelmann a écrit :
>> Hi Emmanuel,
>>
>> I played a bit with it, changed
>>
>> * new GridData( GridData.FILL_HORIZONTAL )
>> * toolkit.createText( ldapLimitSectionComposite, "" , SWT.WRAP |
>> SWT.MULTI );
>>
>> but nothing helped, I'm also clueless.
> I'll see if using a GridData helps. Otherwise, I'll step through the
> code to see what's going on (wish me good luck ;-)
>
Using GridData keeps the Sections' size correct. However, the Text
itself grows up to a point I don't see what's at the end, but this is
definitively better. Except that if I resize the window, then the
section grows as it did with the TabWrapLayout.

So it seems the key is to find the way to tune the Text widget so that
it does not grow.

And who said GUI development was for beginners ? ;-)

Re: [Studio] Pb with some auto-resizing Text widget

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 03/06/15 22:54, Stefan Seelmann a écrit :
> Hi Emmanuel,
>
> I played a bit with it, changed
>
> * new GridData( GridData.FILL_HORIZONTAL )
> * toolkit.createText( ldapLimitSectionComposite, "" , SWT.WRAP |
> SWT.MULTI );
>
> but nothing helped, I'm also clueless.

I'll see if using a GridData helps. Otherwise, I'll step through the
code to see what's going on (wish me good luck ;-)


Re: [Studio] Pb with some auto-resizing Text widget

Posted by Stefan Seelmann <ma...@stefan-seelmann.de>.
Hi Emmanuel,

I played a bit with it, changed

* new GridData( GridData.FILL_HORIZONTAL )
* toolkit.createText( ldapLimitSectionComposite, "" , SWT.WRAP |
SWT.MULTI );

but nothing helped, I'm also clueless.

I did something similar in the LdapBroser e.g. in
AttributeTypeDescriptionDetailsPage (descText, line 521). That was back
in 2006/7...

Kind Reards,
Stefan


On 06/03/2015 08:27 PM, Emmanuel Lécharny wrote:
> Hi,
> 
> I'va an issue with some Text that is feed by a Dialog, and which expands
> way too much when the Dialog generates a long text.
> 
> Typically, here is what teh screen looks like before the edition :
> 
>   
> +---------------------------------------------------------------------------------+
>    |
> Tuning                                                                         
> |
>   
> +---------------------------------------------------------------------------------+
>    | .-------------------------------------.
> .-------------------------------------. |
>    | | TCP configuration                   | | 
> Concurrency                         | |
>    | +-------------------------------------+
> +-------------------------------------+ |
>    | | TCPBuffers                          |
> |                                     | |
>    | | +-----------------------+           | | Concurrency             
> : [      ] | |
>    | | | xyz                   | (Add)     | | Max Pending Conn         
> : [      ] | |
>    | | | abc                   | (Edit)    | | Max Pending Conn Auth   
> : [      ] | |
>    | | |                       | (Delete)  | | Nb Threads              
> : [      ] | |
>    | | +-----------------------+           | | Nb Threads Tool Mode    
> : [      ] | |
>    | |                                     | | Nb Listener threads     
> : [      ] | |
>    | | Max Incoming Buffer      : [      ] |
> |                                     | |
>    | | Max Incoming Buffer Auth : [      ] |
> |                                     | |
>    | +-------------------------------------+
> +-------------------------------------+ |
>    | .-------------------------------------.
> .-------------------------------------. |
>    | | LDAP Limits                         | | Index
> Limits                        | |
>    | +-------------------------------------+
> +-------------------------------------+ |
>    | | Write Timeout : [      ]            | | Integer Indices Length  
> : [      ] | |
>    | | Idle Timeout  : [      ]            | | Subany Indices Length    
> : [      ] | |
>    | | Size Limit : [             ] (Edit) | | Subany Indices Step     
> : [      ] | |
>    | | Time Limit : [             ] (Edit) | | Sub indices Max length  
> : [      ] | |
>    | |                                     | | Sub indices Min length  
> : [      ] | |
>    | +-------------------------------------+
> +-------------------------------------+ |
>   
> +---------------------------------------------------------------------------------+
> 
> 
> When I enter many data into the Size Limit (this is done through the
> Edit dialog), then the Size Limit text expands, with the Section, giving
> something like :
> 
>   |
> .----------------------------------------------------------------------------------------------------------------------------------.
> .-------------------------------------. |
>   | | LDAP Limits                         
>                                                                                             
> | | Index Limits                        | |
>   |
> +----------------------------------------------------------------------------------------------------------------------------------+
> +-------------------------------------+ |
>   | | Write Timeout : [      ]           
>                                                                                             
> | | Integer Indices Length   : [      ] | |
>   | | Idle Timeout  : [      ] 
>                                                                                                        
> | | Subany Indices Length    : [      ] | |
>   | | Size Limit : [size.hard=8 size.soft=7 size.unchecked=disabled
> size.pr=unlimited size.prtotal=disabled size.pr=noEstimate] (Edit) | | 
> Subany Indices Step      : [      ] | |
> 
> 
> FTR, I have 4 sections in the main page, one per 'box'. The TCP Config
> section and the LDAP Limits section are expanded the exact same way.
> 
> What I want is that the Size Limit to have a fixed size, and be a WRAP
> text, but I don't see how to do that...
> 
> The code is in
> http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java?view=markup,
> lines 768 for the section creation method ( createFormContent) and line
> 1009 (method createLdapLimitsSection) for the Size Limit Text.
> 
> thanks !
>