• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLYBird GUI

 
donal horgan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quick question -- in the spec it says yiou must use the same GUI for both local and remote.
Is this saying you must use the same GUI class or just the same bisual interface?
i.e. is there a seperate GUI class for both local and remote?
 
Muthaiah Ramanathan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the same GUI (same class as well) for both alone and networked mode.
 
donal horgan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So how are you doing that?

I have a main run method which,depending on the argument,runs locally or on the server.
I tried using only one GUI class.
I did this by instantiating the GUI class and also passed in a parameter into the constructor.
That parameter being either a reference to the DBAccess interface or else a reference to the data class -also called data -depending on whether it runs remoptely or locally respectively.
I then have an if statement determining whether the 'data' reference should refer to the DBAccess interfgace or simply the data object.
That way,throughout my GUI class I can make references to data nd the class knows if this is either the DBAccess interface(i.e. a remote call) or to the data object(i.e. a local call).
My GUI class doesn't like it though.

ANy ideas/suggestions?

Is that also how you did yours?
 
Uwe Schäfer
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by donal horgan:

That parameter being either a reference to the DBAccess interface or else a reference to the data class -also called data -depending on whether it runs remoptely or locally respectively.
I then have an if statement ...


have a look at proxy or adapter pattern.
passing (or "injecting") a proxy, that hides away the complexity of the possible remoteness of the datasource, will make reuse of the same GUI class simple.
 
Muthaiah Ramanathan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uwe Sch�fer: have a look at proxy or adapter pattern.

That is what I have done too. I have two inner classes which implement local and remote interfaces respectively. This class is properly instantiated based on the argument passed and then passed to the GUI - which can then retrieve the information from those classes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic