Results 1 to 5 of 5
  1. #1
    quandrione is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

    Default Design Pattern for GUI configuration tool for Network Routers

    Hi,

    I am a new member to this forum and apologize in advance if I am starting a thread for an already discussed topic. In that case please refer to an appropriate thread as I could find one.

    QUESTION:

    What would be the appropriate design pattern to implement the GUI tree, GUI tree nodes, the nodes representing the actual instances, etc. We are right now using JTree for the tree.

    PROBLEM BACKGROUND:
    I am designing a GUI tool that will be used by a mobile operator to configure a very advanced telecom network router. Configuration in the router is based on a hierarchical model that could be visualized as a tree with one root node and several childs and subchilds. Some of the childs are actual configuration instances and other childs are just holders for actual instances e.g

    Root Node
    |
    - Routes
    |
    Route 1
    Route 2
    Route 3
    - IP Interfaces
    |
    Interface 0
    Interface 1
    Interface 2


    The GUI tool is supposed to do following:

    - Let the user get the configuration (xml file) from the router and display it in a tree form
    - Browse through the config by expanding/collapsing the nodes in the tree
    - Examine specific instances by clicking on an instance tree node (e.g. Route 1) and displaying related values in the GUI
    - Create new instances that could be built into an xml and sent to the router.

    We have already started working on the tool but not using any well thought design.

  2. #2
    quandrione is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

    Default

    Really need some help with this guys.

    Thanks in advance.

    Regards,
    - Aamir

  3. #3
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Seems to me you should just stick with the basics. Identify the nouns in the problem domain, and create a class for each noun:

    Router
    Route
    NetworkInterface
    etc.

    The rest should be reasonably straightforward class design. Identify the state that each class will need to maintain, and identify the behaviors that will need to be implemented. The state becomes instance variables, and the behaviors become methods.

    The fact that this question is in the Advanced Java area made me hesitate to give this simple answer, but I really don't know a better answer to give. This is meant to be a configuration program, so it's all about maintaining state, right? I don't see any great algorithmic complexity here, unless I'm missing something.

    -Gary-

  4. #4
    quandrione is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

    Default

    Thanks Gary.

    You are right that algorithmically there are no advance requirements. The simple class per noun that you suggested seems quite appropriate. However, one thing that I am not sure about is whether the application always knows which nouns exist. The application reads an xml schema file that defines which type of instances there exist and then it parses the actual config file and displays the config in tree form for the user to browse.
    I suppose your approach should still be visible where we could add new object if the router supports a new type of instance.

    I still believe though that I might need a well though design pattern for integrating GUI with actual instances. Here is one specific design question:

    Each type of element in the config has parameters. E.g. a route has parameters like source ip, destination ip, etc.

    Q: Should I then create a class to represent a generic instance and then create a route class that inherits from that generic class?

    This route class could have class variables for each route parameter that will hold current values parsed from the config file. Should this same route class represent the node in the GUI too. Since we used JTree, we might need to create classes inheriting from DefaultMutableTreeNode to enable sorting in the tree, etc (I might be wrong on this point).

    Q: Should we then create a separate class for TreeNodes representing e.g. a route and connect it to the route class mentioned above.

    The route class will hold the values parsed from the xml config file and display them in the GUI. At some point user will create a new route or change parameters of the existing route. Application should keep track of both the parsed values and the new value from the user.

    Q: How to do that?

  5. #5
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Sounds like you're heading toward a Model-View-Controller (MVC) design. The logical elements -- the classes that represent the nouns in the domain -- are the Model. The visual elements -- the Tree and its TreeNodes -- are the View. Ideally, the Model doesn't know anything at all about the View, and there could conceivably be more than one View that interacts with the same Model, through the Controller. The Controller receives messages from the View and updates the Model, and also retrieves data from the Model so that the View can display it. The Controller can also do the XML reading, writing and parsing that needs doing.

    There is a whole lot of literature about MVC design. Start with Google and go from there.

    -Gary-

Similar Threads

  1. Replies: 2
    Last Post: 05-07-2009, 04:06 AM
  2. Replies: 1
    Last Post: 02-19-2009, 05:02 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •