[izpack-devel] Fix properly position components while switching between packs

David.Guan soft.guan at yahoo.com.cn
Sat May 5 05:51:31 CEST 2007


In fact, This problem still exists in Izpack3.10.1. 
It has not been solved correctly.
Does anyone has some idea? 
Thanks.


Amit Bhayani wrote:
> 
> Hello Friends,
> 
>  
> 
> I am using Installer for our specific requirement and came across a bug
> where if User changes the Packs selected, component layout gets ugly. I
> have seen other users too facing this problem.
> 
>  
> 
> To fix this I have made changes in removeLayoutComponent(Component) of
> TwoColumnLayout Class. I am attaching the patch ( PFA patch1.txt ) for
> the changes made. I have quickly coded a small application making use of
> TwoColumnLayout. PFA TwoColumnLayoutTest.java. This is just for testing
> and by no means a quality code.
> 
>  
> 
> Please let me know what you think about the changes.
> 
>  
> 
> Thanks and Regards,
> 
> Amit.
> 
> 
> Index:
> C:/IzPack/IzPack3-head/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java
> ===================================================================
> ---
> C:/IzPack/IzPack3-head/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java
> (revision 1508)
> +++
> C:/IzPack/IzPack3-head/src/lib/com/izforge/izpack/gui/TwoColumnLayout.java
> (working copy)
> @@ -875,12 +875,48 @@
>      }
>  
>      /**
> -     * This functionality is not supported
> +     * This functionality removes the TwoColumnConstraints from Vectors
> +     * so that alignment of components on UserInputPanel doesn't get
> +     * dirty
>       * 
>       * @param comp the component to be removed
>       */
>      public void removeLayoutComponent(Component comp)
>      {
> +        Vector left = components[LEFT];
> +        Vector right = components[RIGHT];
> +        boolean removedLeft = false;
> +        boolean removedRight = false;
> +        
> +        for(int i=0;i<left.size();i++){
> +            TwoColumnConstraints constraints =
> (TwoColumnConstraints)left.get(i);
> +            if(constraints == null){
> +                continue;
> +            }            
> +            Component ctemp = constraints.component;
> +            if(ctemp!=null && ctemp.equals(comp)){
> +                removedLeft = left.remove(constraints);
> +                if(constraints.position == TwoColumnConstraints.BOTH ||
> constraints.position == TwoColumnConstraints.WESTONLY){ 
> +                    right.remove(i);
> +                }
> +                break;                
> +            }            
> +        }
> +        
> +        for(int j=0;j<right.size();j++){
> +            TwoColumnConstraints constraints =
> (TwoColumnConstraints)right.get(j);
> +            if(constraints == null){
> +                continue;
> +            }
> +            Component ctemp = constraints.component;
> +            if(ctemp!=null && ctemp.equals(comp)){
> +                removedRight = right.remove(constraints);
> +                if(constraints.position == TwoColumnConstraints.BOTH ||
> constraints.position == TwoColumnConstraints.EASTONLY){ 
> +                    left.remove(j);
> +                }                
> +                break;                
> +            }            
> +        }               
>      }
>  
>      /**
> 
> _______________________________________________
> izpack-devel mailing list
> izpack-devel at lists.berlios.de
> http://bat.berlios.de/mailman/listinfo/izpack-devel
> 
> 

-- 
View this message in context: http://www.nabble.com/Fix-properly-position-components-while-switching-between-packs-tf2011062.html#a10333407
Sent from the izpack devel mailing list archive at Nabble.com.




More information about the izpack-devel mailing list