Patterns for JavaBean and GUI interaction

Forgive the newbie feel to this question.
I have a number of JavaBeans-compliant classes for several entities that will end up persisted. I can use any of a number of technologies to persist these to a database or serialize to disk. If, now, I want to add a GUI for interaction with these beans, it seems there are at least a couple of ways to go. The first is to encapsulate the code for doing so in the bean itself, perhaps extending JComponent. The second is to make a "view" for each Bean that uses multiple PropertyChangeListeners(?) to/from the Bean to maintain state within the bean. The latter seems to separate the model from the view better.
I am curious from a design point-of-view how best to go about solving this generic problem. I have done similar things in other languages with varying degrees of satisfaction with the resulting maintainability of the resulting product. So, I am aiming for something that balances complexity with maintainability and flexibility (to change a view or to change the underlying model).
Thanks
Sean

Well, thanks for your reply. My program is kind of large to be entered online.
In any case, I tried again with the synchronized keyword for the method that accesses the shared member (between the two threads) and things look good now and I do not see the problem I was seeing earlier.
One question I have is w.r.t the usage of the synchronized keyword - can this be used for methods as well as members of a class ?
I mean for example, if I have a static variable declared in a class and this static needs to be accessed outside the declaring class in a different thread, then should this static member be declared as synchronized too?
Thanks.

Similar Messages

  • Design pattern for unprotecting and reprotecting sheets with VBA?

    Many macros can't run when a worksheet is protected, so when I develop an Excel workbook that has protected worksheets, I have to unprotect worksheets when macros are called and then reprotect the worksheets once the macro has completed.
    The current design pattern I use for this is the following:
    I look at each procedure individually and consider which sheets need to be unprotected for it to run. Then in each procedure I write:
    Sub Test()
    Dim bSheet1Protected as boolean
    Dim bSheet2Protected as boolean
    bSheet1Protected = Sheet1.ProtectContents
    bSheet2Protected = Sheet1.ProtectContents
    bSheet1Protected.Unprotect
    bSheet2Protected.Unprotect
    '''The rest of my code
    if bSheet1Protected then Sheet1.Protect
    if bSheet2Protected then Sheet2.Protect
    End Sub
    But I imagine that maybe there are better ways of doing this. What is your preferred design pattern for unprotecting and reprotecting sheets with VBA?

    Hi JP3O,
    I think it is a good practice to unprotect the worksheet before execute some code and protect it back after the code execute finished.
    >>But I imagine that maybe there are better ways of doing this. What is your preferred design pattern for unprotecting and reprotecting sheets with VBA?<<
    I am not able to find a better way since we always need to unproect the worksheet if some code didn't not executed successful when the worksheet is proected.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Design Pattern for Role-based GUI

    Hi,
    I'm looking for a java design pattern to provide different GUI according to the user role.
    For example, If logon user has general user role, the GUI would disable some administrator related menu items...
    I think, this kind of functionality is now in use at many applications..
    Thanks in advance..
    Habin

    Hi
    I try to explain with some more detail (sorry for my bad english) :
    I write a complete hotel reservation app with Java+Bd (relational). This app is used by diferent users types.
    The administrator has all privileges (can do every action) and other users can do only some actions (make a reservation, check-in, check-out etc but not modify a
    room price for example).
    The app is a MDI app, there are a menu and menuitems
    and when a user do an actionEvent over a menuItem an InternalFrame is activated and so on. These InternalFrame make possible some actions at app level (ex. : do a check-in).
    The menuItems set is controled by the App (is the Controller in MVC design pattern) and the model is represented by a set of user possible actions; so there are a class (UserConfig) with these set of possible actions.
    the Controller ask UserConfig abouth the posible action
    set and do the enable/disable job. There are a 1 to 1
    relationship : each possible actions has a menuItem. And
    there are a M to N relationship from User/Action perspective.
    With this design (I think is an MVC design) the Controler mantain a UserConfig (via a Relational Database) and the Administrator (via the App) can create or modify the UserConfig objects.
    At implementation level, each menu item has a name, and
    for each registered user there are the name/id_user pair
    of actions. These info (stored in BD) is used to create
    the UserConfig objects (via username/password).
    Bye

  • Default format pattern for Date and Number

    Hi everybody,
    I'm finding it very hard: my java app runs on Tomcat 5.5, I'd like to format dates and numbers with a specific format. For example: with Locale it_it date format is "dd-mm-yyyy", my wish is to display "dd/mm/yyyy" without changing the Locale (it_it is correct). Is there an env variable to set?
    Thanks.

    gianoele wrote:
    How cai I set with a proprerty? Like -Ddate.format="dd/mm/yyyy" -Dnumber.format="###.00"?You could do that.
    Then fetch it from your app and feed it to SimpleDateFormat.

  • How do I get the student's answers to show on the next slide for drag and drop interaction?

    I'm working with Captivate 7 on a computer running Windows 8.
    I created a simple, one-to-one drag and drop activity using the  Drag and Drop Wizard.
    I want the student's answers to show on the next slide. Specifically, I want the drop source  to show with the drag target that the student connected to the drag source. This way the student can review his/her answers while the program discusses the correct answers.
    Is there anyway to do this?

    * You see the orange (on Linux gray) Firefox button if the Menu Bar is hidden (View > Toolbars > Customize or right-click a toolbar).
    * If you need to access the hidden Menu bar then press F10 or hold down the Alt key to make the Menu Bar appear temporarily.

  • SAP GUI for windows and HTML

    Hello,
    We have problem running a custom program, when it was integrated as Transactional iView with SAP GUI Type as SAP GUI for HTML.
    But, the same program is running fine with SAP GUI Type as SAP GUI for Windows.
    Is there any possibility to make some modifications to properties and make the SAP GUI for HTML working.
    Thank you.

    Hi,
    We have a custom ABAP program, where we we can upload data through an excel file.
    The xls file can be uploaded from local drive.
    So, we have created a Transactional iView with SAP GUI Type as SAP GUI for HTML.
    When we try to run the program with an excel file, we are receiving an error message - "Empty input file or input file not found"
    Then we have created a Transactional iView with SAP GUI Type as SAP GUI for windows and was successful in uploading the xls file.
    Just want to understand, if there is any possibility to make some modifications to properties and make the SAP GUI for HTML working.
    Thanks in Advance.

  • Drag and drop interaction for a different use

    Hi,
    Can anyone please help me get the a solution to the below:  For the drag and drop interaction my user should be able to drop the answer (irrespective of that being a wrong answer) to any of the options, but as they click Submit, the actual answers should show up.
    I am using Captivate 7.
    Thanks,
    Roja

    Thanks so much Sreekanth!
    One thing that I am still struggling with is, the source (the questions) do not sit on the wrong destinations (non-answers), the moment it dragged to the wrong answer, the source goes back to its original place .
    Thanks,
    Roja

  • 1 Success Caption for Multiple Targets in a Drag and Drop Interaction

    I see how I can add success captions to each target in a drag and drop interaction, but can you apply only 1 success caption multiple targets?

    The boundaries of smartshapes were overlapping with each other. For example, the smartshape on 1st line was overlapping with the one on 2nd line. Due to this, every time you place the text caption "Investment" on the smartshape on 2nd line, it automatically moved to the smartshape on 1st line. As a result, you could never get the answer right, and hence you never saw the Success Caption.
    Solution: Move the smartshapes away from each other (or resize them), and ensure that there are no overlaps.
    2,  The number of attempts for this interaction was set to Infinite. So, you have to play this until you get it right, but you could not get it right because of the reasons mention above. That is why you never saw the Failure Caption.
    Solution: Clear the Infinite check box in the Action accordion and specify the required number of attempts. You will get the Failure Caption if you don't get it right in those attempts.
    I just tested these solutions and they worked fine. Let me know if you still face any issues.

  • Adobe Captivate Help | Drag-and-drop interaction (for subscription and Adobe Software Assurance customers only)

    This question was posted in response to the following article: http://helpx.adobe.com/captivate/using/drag-and-drop-interaction.html

    Yep.  But it will only likely get to you in the next version released for NON subscription or ASA customers.  With 6.1 Adobe was giving a preview of the functionality they would be including in your next release.  Either way, whether you upgraded to the subscription edition or waited for the next paid upgrade, you were always going to be paying something to get this new functionality.  6.1 users just got it earlier than everyone else.  That was Adobe's decision.  It certainly hasn't been a popular one.

  • Is the drag and drop interaction available for responsive projects in Cp8?

    I created a responsive course but the Drag and Drop button is not active. Is the drag and drop interaction available for responsive projects in Cp8?
    Thanks

    Not yet available for responsive projects.
    On Jul 14, 2014 10:31 PM, "EWC_elearningDev" <[email protected]>

  • Integration for Business Workflow and SAP Interactive forms by Adobe

    Hi
    Is any of you able to watch the following SDN eLearning Session ?
    <i>Integration for Business Workflow and SAP Interactive forms by Adobe (RIG session 7)</i>
    I can play nearly all the other eBooks, but not this one. Any idea ???
    Regards, bernhard

    I solved the problem.
    It is not possible to view the ebook with IE 7.0. So I removed the new Internet Explorer and everythink is working fine.
    Greetings, Bernhard

  • SAP GUI 7.20 for Windows and problem with Screen Painter

    Hello,
    I just installed the SAP GUI 7.20 for Windows and it looks good.
    But when when I start the Screen Painter for a dynpro I get the following message:
    Graphical Layout Editor not available. Continue with alphanumeric editor.
    And: EU_SCRP_WN32 Connection broken  '..' / CPIC
    The SCreen Painter is installed correctly (I can start ist manually from file system) and the RFC destination works.
    Any idea?
    Regards,
    Ole.

    Hello,
    I've uninstalled all SAP installations, cleaned the registry of Windows XP and deleted all folders with SAP content. Then I've installed the SAP Gui 7.20 again and it works.
    And now I will update the Screen Painter with the information from the OSS-Note!
    Thank's for your help!
    Regards,
    Ole.

  • [iPhone] UI Design pattern for table views with properties and children?

    Hello,
    I'm getting started with iPhone development and I have a question about the proper way to display a list that has both properties of the list itself as well as the ability to drill down into the members of the list. For example, my data is a Group (of people say). The Group itself can have properties - the name of the group, group email address, web page, etc. - and it obviously has members which also have properties - name, address, etc.
    In my table view, I want to show the Group members and have accessory/disclosure buttons on each row to show the details of a person, but I also want to be able to edit the properties of the group - Group name, etc. What's the UI pattern for editing the properties of the table itself?
    I thought about having a tabbar that toggles between the list and the properties of the list.
    I also thought about having a parent table that lists the groups (so I could have more than one) and then have accessory buttons on each group row. The UI would then have to be that the user taps the row to drill down to the group members and taps the accessory button to edit the properties of the group. Is that "proper" - tap the bar or tap the accessory icon in a table row?
    Thanks

    I don't think I'd use a tab bar.
    You could break the table up into 2 sections, section 0 being the properties, section 1 the list.
    Make section 0 just say 'Properties', then when you tap that row you drill down to a properties table, slap an edit button in the navigation bar to go into edit mode.

  • Is MVC2 a design pattern or architecture? for yes and no why?

    I am using JSF which follows MVC2. Is MVC2 a design pattern or architecture? For yes and no why? what is the difference between design pattern or architecture?

    Hi There,
    Maybe this will help answer your questions...
    Firstly, MVC2 is a proprietary name for the Microsoft .NET framework based around the Model-View-Controller pattern - it is an updated version of their first attempt - MVC.
    The Model-View-Controller pattern harks back to the days of SmallTalk, and as far as I am aware is not included in the original Gang Of Four design patterns, although there is no reason why it can't be considered a design pattern.
    Software architecture is about how different parts of the system fit (interface) together and how they relate, including static relationships (cardinality relationships, state) and processes (what happens when), it most often consists of many design patterns each used to address the various needs of a complete system.
    Hope this helps
    Rich

  • GUI Based tool for search and replace using regular expression

    Hi,
    I have developed this small tool which can be used for search and replace in multiple files using reqular expressions.
    Features:
    1. Full regular expression
    2. GUI based with Highlighted results
    3. Preview for replace available
    4. Pure Java based.
    5. Its like unix sed and grep
    Please visit below site for download/more information :
    http://sourceforge.net/projects/regexsearchrepl/
    Thanks,
    Hitesh Viseria

    I agree with you, it cannot compete grep/sed/awk combination. I couldnt find anything even close to grep/sed for windows which will also have a preview and most important, free. That is what made me write this tool. I am trying to
    improve its performance and more features like history etc.
    Any suggestions on additional features are most welcome.

Maybe you are looking for

  • YouTube app not letting me sign in without going to website first?

    Hello, Whenever I try and login to my YouTube account via the app it tells me to login to the website to verify. Then when I do that, it still won't let me log into the app. Anyone else having this problem?

  • ITunes 10.6.1 can't sync!!!

    After I upgraded to iTunes 10.6.1 in my MBP with Lion 10.7.3, I can't sync my iPod Nano 5G. The devices is no seen by iTunes so it's totally ununsable right now... :-( What are you doing with iTunes, Apple?

  • Sql query descending

    Hello, i have some problem with sql query. Could somebody help me, pleas? I have this query in universe: left('00', 2 - length(cast(datepart(week,VISION.OPOBJHISTJEDN.DATUM ) as varchar))) || datepart(week, VISION.OPOBJHISTJEDN.DATUM) || ') '||datefo

  • Quicktime in Golive is activex in dreamweaver

    I used GoLive successfully on my own large multimedia website for several years. Got a message that Adobe no longer supports GoLive so i bought Dreamweaver. All the films on my site were created using Golive's quicktime placeholders. Now i notice tha

  • New PC, Xfi, driver installed, sound disapears after a short time

    Help. I have a new computer which i've been looking forward to some time. I think my motherboard is Asus P32N SLI or something similiar. Quad core and X-fi music on Vista Premium I installed the drivers from the CD and rebooted then I couldnt change