Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: RE: [platform-swt-dev] org.eclipse.swt.SWT

Sorry, a typo mistake:

>>myStartLocation.set(new Point(10, 0));

read as

someWidget.setStartLocation(new Point(10, 0));




                                                                                                                  
                        vellapillli_h.indukumar                                                                   
                                    @systor.com           To:  platform-swt-dev@xxxxxxxxxxx                       
                        Sent by:                          cc:                                                     
                        platform-swt-dev-admin@           Subject:   RE: RE: [platform-swt-dev]                   
                        eclipse.org                         org.eclipse.swt.SWT                                   
                                                                                                                  
                                                                                                                  
                                                                                                                  
                            02/28/2003 03:32 PM                                                                   
                              Please respond to                                                                   
                               platform-swt-dev                                                                   
                                                                                                                  
                                                                                                                  


Hi Scott!

It basically boils down to the question "What is a Point"? Is it a
Windowing System Point (your Mac example fits here). Or is it a geometrical
point (which guarentees only that there is a x-coordinate and
y-coordinate). If we consider the first definition of a Point, then we
definitely need to have checks whether the x and y coordinates are in sync
with the underlying windowing system. But, I think, here we think of a
Point only in terms of a geometrical point. Here, the point does not make
any assumptions about windowing system. It says 'I contain a x-coordinate
and a y-coordinate in a graphical system.' And I tend to the design of
Point as it is at present. It is the responsibilty of the windowing system
that uses the point to translate its meaning and to check whether it fits
to its culture.

Now the question about being notified when the Point changes. Where do you
percieve a need for this?
Suppose a Widget contains a Point as its location. How would you design it?
Would you expose the Point that the Widget contains so that user can change
its location or would you let the user set a new Point. As example, which
design you percieve as being superior?

Sol: A
public class SomeWdiget {

Point myStartLocation;

...
...

public void getStartLocation() {
return myStartLocation; // An internal data being exposed.
}

}

User calls it as
someWidget.getStartLocation().setX(10);

-----------------

Sol B:

public class SomeWidget {

Point myStartLocation;

...
...

public void getStartLocation() {
return new Point(myStartLocation);
}

public void setStartLocation(Point newStartLocation) {
myStartLocation = newStartLocation;
}

}

User calls it as
myStartLocation.set(new Point(10, 0));

-------------------

Do you really need to know when startLocation's x-coordinate is changed?
Doesn't getting notified when the startLocation as a whole changes satisfy
your need?

Thanks and Regards
Indukumar









Back to the top