| adjusting a layout [message #150512] | 
Sat, 11 September 2004 14:59  | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: dag.s.rende.se 
 
I have written a planning application where the user can manually place 
boxes. Sometimes the user opens a file where some boxes have no position 
information. Here I want the editor to automatically place these boxes 
using a simple algorithm. 
 
My question is, where should i put the code that can use the layout made by 
the layout manager and complete it. Is there some listener I can put that 
tells when the layout managers have done their work after opening the input 
file. 
Or can I call some validate method myself after inputting the file, and then 
do the layout fixup? (in this case, what should i call and where) 
 
I was tempted to fix this in one of my layout managers, but it doesn't feel 
right to change the model from there (to save the coords in the box model 
objects). 
 
Best Regards, 
Dag Rende
 |  
 |  
  | 
| Re: adjusting a layout [message #150544 is a reply to message #150512] | 
Sat, 11 September 2004 12:53   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
This does not quite qualify as a change to the model.  You are merely 
assuming default values for where there were none specified.  You cannot 
undo/redo such changes.  So, I think it's not all that bad to subclass the 
LayoutManager and put your algorithm in the layout() method. 
 
Alternatively, you could do a sweep when the model is loaded (in your 
Editor's setInput() method) to check for missing locations and they provide 
defaults for them.  If your algorithm is truly simple, the model objects 
themselves, upon initialization, might be able to choose meaningful defaults 
(perhaps via a static variable). 
 
--  
 
Pratik Shah 
"Dag Rende" <dag.s@rende.se> wrote in message 
news:cht041$rlc$1@eclipse.org... 
> I have written a planning application where the user can manually place 
> boxes. Sometimes the user opens a file where some boxes have no position 
> information. Here I want the editor to automatically place these boxes 
> using a simple algorithm. 
> 
> My question is, where should i put the code that can use the layout made 
by 
> the layout manager and complete it. Is there some listener I can put that 
> tells when the layout managers have done their work after opening the 
input 
> file. 
> Or can I call some validate method myself after inputting the file, and 
then 
> do the layout fixup? (in this case, what should i call and where) 
> 
> I was tempted to fix this in one of my layout managers, but it doesn't 
feel 
> right to change the model from there (to save the coords in the box model 
> objects). 
> 
> Best Regards, 
> Dag Rende
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.04730 seconds