What's best for caling business methods ?

Hi,
I developped a swing app with the JMenu Bar. This bar contains the edit, quit, usual options.
I implemented a MVC pattern with a business object whose responsibility is being called by the controllar to do what the user asked through the view.
For instance, if he clicks in the "rename" option, th model renames the selected element. (I go quickly on this part since this is not the interesting point :) )
So to the point.
I got a handler command which receives all commands sendable by the menus. this handler command does this :
private void commonHandler(ComponentEvent e)
          JMenuItem __source = (JMenuItem) (e.getSource());
          Method __method = delegatesList.get(_source);
          if (__source != null)
// do stuff
etc ...
I created the delegatesList which is this :
_delegatesList.put(addNewCdSubMenu, Catalogue.class.getMethod("methodName", null));
_delegatesList.put(addNewCdSubMenu, Catalogue.class.getMethod("othermethodName", null));
So using the JMenuItem as a source, I then retrieve the method and invoke it with reflection.
Question : I think that using plain switch cases with the __source.getName for instance would be simpler.
My question is the following : what is the standard in this kind of stuff : use if/else, switch or delegates like I did or some simpler and more elegant solution ?
Many thanks for your help !

Hi,
I considered that after some thought, the delegates stuff didn't bring any advantage so I hard coded the calls and dropped the reflection part.
I would have loved some insight from a senior developer though :)
bye

Similar Messages

  • External drives... whats the best for video.... ?

    Hi everyone,
    I'm trying to figure out what the best bang for the buck is in regards to external drives, and what works best for video.
    I have considered the LaCie enclosures, I have also considered buying a 500 GB SATA to replace the 200 GB second drive I have inside the G5. The issue than is what enclosure works the best with a MAC and is 1394 and will the firm ware support huge video files, for render or exporting?
    Can anyone give some advice based on what they have learned through past experience.
    Thanks

    I've been using LaCie FW (800 & 400) drives for about three years now with only one problem - One of the first drives I bought (I think it was a 120 GB) fried itself a few months ago. I currently have 80GB, 120 GB, 400GB and 500 GB drives, all working fine, never have dropped frames. The LaCie drives are pretty tough too, as I've sent most of them back and forth across the country at least a few times with no problems.
    However, be careful if you update the firmware for them - make sure the drive is clean as the firmware update can cause corruption of data on the drive (I found that out the hard way!). Also keep in mind that they do put off a fair amount of heat (especially the big ones) so I wouldn't consider stacking them on top of each other horizontally.

  • What apps can I download for my account, Photoshop CC, and what is best for that program

    What apps can I download for my account, Photoshop CC, and what is best for that program

    Hi Bosseb,
    You can install products listed in the Download Center, all are included except Photoshop Touch
    https://creative.adobe.com/products
    On the left hand margin you can see products based on field, Audio/Video, Gaming, Graphic Design, Photography, etc.
    If you have a fulll membership you can download any that are included that interest you.
    -Dave

  • Is Java the best for creating business apps?

    Hello everyone, I'm new to this. I programmed a bit in VB6 (lame to macho-coders... I know), and I really enjoyed it. Well I havent touched it for years and I havent even bothered trying to remember what I knew after finding out its all gone with .Net.
    So I'm employed at a new firm and I'd like to get back the old app building skills I had and more.
    I did alot of research on languages and decided that Java was my pick, but I'd like confirmation from someone who knows.
    FYI, I only created very simple apps with VB6 a few years ago.. I do not plan to start programming as a career.
    I just remember enjoying it immensely and have done side projects in the past for friends and business associates.. but I never got high powered.
    I'd like to get deep into a language.
    Did I make the right decision between C#/VB.net and Java? Try to be as unbiased as possible, as I realize this is a Java forum.
    I chose after reading mainly these links:
    http://www.csharpsoft.com/css/article.php?sid=9
    http://www.c-sharpcorner.com/faq/why_cs.asp
    http://www.aspnetpro.com/Opinion/2002/04/asp200204pl_o/asp200204pl_o.asp
    http://www.course.com/techtrends/java_0899.cfm (this one was especially convincing for me)
    http://www.eweek.com/article2/0,1759,1499017,00.asp
    http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=1751
    The just I got from most sources was: pick the language based on what you Want to Do.
    I want to create business apps, not necessarily cross-platform able ones. 98% of the time my apps will be used on Windows platforms anyway. And the performance boost from MS languages is enticing.
    Plus I've read from a few sources that Java is NOT cross platform interopertable.
    My main reason for posting is that I'm double guessing my Java inclinations.. because I'm having trouble finding tutorials for "guys like me".
    I'd like to know exactly what the heck Swing is, I mean... I got THIS,
    "The javax.swing package of classes is used to create GUI components for applets and applications. Project Swing classes enable programmers to specify a different look and feel for each platform, or a uniform look across all platforms. Swing is the project code name for the lightweight GUI components in JFC."
    But I have been doubting my decision enough to not download and start playing with whatever the heck Swing is.
    Also, AWT looks important but I do not quite grasp how that comes into play either.
    Basically I have the latest Java and Netbeans downloaded... is this all I need besides to find a great tutorial (that holds my hand) to get started? Does this Java/Netbeans package have Swing and AWT included inside them?
    Or should I stick with VB and go back to VB.Net to create my easy "crankem out" apps?
    I have a sinking feeling that would be best for a non-career programmer hobbiest like myself..
    Originally I figured Java would teach me a much more popular terse based syntax that would be much better to know if I ever did move on....
    Thanks for reading.

    THANK YOU to everyone that has replied this far. As you might have been able to tell from my disoriented post.. I have alot of questions and some questions I'm not exactly sure how to ask.
    To define business applications- I was referring to these two ideas that SteveW2 coined: "Applications that front end a database? Multi user thin client apps? "
    Mostly front end to a database and thin client apps.
    Also, I should add my employer does have a full MSDN subscription so I do have access to everything at MSDN.
    We have Visual Studio .Net 2003 at work as well. My company mostly programs in "MS" languages FYI.
    I hope it was quite clear that I'm no zealot on brand. I'm a complete capitalist (hence the name), and have always been, "best of breed". So I have absolutely no language preference.
    For general info, I am the network admin at my place of business and also do sales with small to mid-sized businesses.. but my degree is in local area network technology.
    My interest in beginning programming again stems just for my personal interest... someday I DO plan to start my own business but not for quite some time. So programming is just something I used to enjoy to a small extent.
    To be precise, I was only exposed to VB6. None before, none after. I created fun apps like a calculator, a simple database program, a program that half-heartedly 'locked' you out of a Win95/98 workstation without the password... things like that. And for now and the foreseeable future, thats an idea of the extent I wish to take this new venture.
    I found it very simple and easy... good things as long as its still powerful... and it appears DotNet has equalized the languages (J#/C#/C++/C/VB) to a large extent. Please feel free to elaborate on why I'm correct or not correct on this analysis.
    To address my "98%" statement, I meant in the foreseeable future everything I would ever create will be on ran on a Win32 system. But I do play around with Linux and wouldnt scoff at the idea of interoperability..
    Being locked into MS platforms doesnt bother me either. So you probably have a feel for my neutrality.
    I never realized how some people feel very strongly about languages (referring to most of the web, the responses here seem to be very fair considering I'm at Sun's site itself)!
    I'm definitely more confused than ever now with the conflicting opinions.
    But providing exactly WHAT I want to do with the language, will help.
    I provided an example of some of the things I've done, and plan to do.. but there is one thing I've been wanting to create for years that will probably give you the best idea for my ambitions.
    I'd like to create a family genealogy app, that allows me to integrate my GEDCOM files (the standard for family history files) into, integrate easy to view family photos/stories/videos... I'd like to put this program on a CD and distribute it at the family christmas some year.
    Whatever language would be the best for this? Keep in mind even though I dont have strong feelings about having interoperability or not... that my time that I'm going to be investing in language "X", I DO feel it important that I learn good coding practice.
    Something I always doubted about the extremely easy, and lax, VB6.
    Thanks again for reading and taking the time to reply.

  • Adobe reader does not work, what is best for viewing pdfs?

    While using Safari, I keep encountering a message that in order to view a .pdf, I need to download Adobe Reader, accept the end user agreement, then relaunch.  I have tried to do this many times and keep getting the above message. What program is best for viewing pdfs using Safari on an iMac

    Back up all data.
    If Adobe Reader or Acrobat is installed, there should be a setting in its preferences such as Display PDF in Browser. I don't use those applications myself, so I can't be more precise. Deselect that setting, if it's selected. Otherwise do as follows.
    Triple-click the line of text below on this page to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have "Adobe" or “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present. The same goes for a plugin called "iGetter," and perhaps others.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • What settings best for screen reading & min/no header/footer?

    I prepare documents for reading online on web sites.  How can I create pages that scroll smoothly and contain maximum text and other features on the page with minimum wasted white space.  These documents are never intended to print anywhere - in fact want to discourage any such attempt.  What settings are best for this in Adobe?

    This really has nothing to do with Acrobat, but is a general question about reading information on a screen. There is no easy answer since people have monitors of different sizes and keep the monitors at different resolutions. I have no problem with discussing this here, but you might get a better response in the Design or Web Design forums. As a first step in the discussion, you might try to figure our what size monitor you want to target.

  • What's best for my battery.

    I use my macbook alot, like 8 hours a day. So I was wondering what would be the best for my battery.
    Should I always connect it to the adapter. Or should I use it on the batterypower and charge it when its underneath 20%.
    Thanks in advance.

    The consensus here seems to be: (1) that it's quite ok to leave it plugged in; (2)  It is good to use the battery occasionally, per
    Apple - Batteries - Notebooks
    (3) It is not good to run your battery all the way down, or even close to that.
    Following these guidelines I have a battery which is 15 months old, with 108 cycles and currently reads between 98-100% health.
    charlie

  • What's best for allowing document download?

    Hi All,
    Quick question really. I'm looking to create a simple HTML page which is to provide documents and photos to be downloaded. Essentially there will be several pdfs and high res images for people to download and I was wondering what the best way to do this is without creating a very long page.
    Ideally, I'd like them to be able to read the PDF and then to download it and for the images to be in some sort of gallery and that if they click on the image they want they can download it. I've got all my images stored on a website called dropbox.
    I'm very new to Dreamweaver CS3 and am trying to get through the dummies guide and free online tutorials but can't lay my finger on the answer really.
    All suggestions greatly appreciated.
    Thanks,

    PDFs are downloaded anyway when your end user's click on a direct link.  For added convenience, you could combine images and PDFs into a folder and Zip it.  I use 7-Zip  http://www.7-zip.org/
    Another approach is to use a ForceDownload script in your favorite server-side programming language.
    This demo uses PHP:
    http://alt-web.com/TEST/formtest.shtml
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • What is best for my macbook pro... turn off,sleep,or leave it on?

    i know that u can leave it on for a couple of days nd it will b fine,but i would just like to know if its best to turn it off during the night.i dont mind that i have to wait for it to turn on,i just wanna do the best for my macbook pro.

    Some of LeafsMac's points make sense.
    Letting the battery completely die is not good.  Always plugged in, even asleep, it can die if power is off long enough.  But good planning can get around that.
    Also, it does need to run on battery once a month at least, down to 40%.  Then recharge back on A/C plug.
    Interesting note about MBPs ...  Even on charger the battery will lose slowly battery charge from 100% to 95%, then recharge to 100% all by itself.  That is to exercise the battery a little bit and save "recharge circuit" usage.  Nothng to worry about.

  • How do I change from Firefox 17 to Firefox 16 on my android and can I keep Firefox 17 at the same time on my Windows 7 PC? Whats the best for jelly bean?

    Some apps are not compatible on Acer A210 Iconia Tab jelly bean. What are the most recommended apps or widgets for Acer A210? How do I uninstall Firefox 17 and install Firefox 16 on my pc or what is the best version to use with the tablet? Thanks if you have a solution. Using Windows 7 home premium.

    The best version to use is Firefox 17 (it's the stable release). as for best apps, it's all up to you on what you want to use.

  • Array or Table of Records or...what is best for my scenario?

    I have been given task to trap last 5 action taken on a form application by user. This would be used where user gets a FRM or ORA error, dump last 5 steps to a table in the database along with error. Trapping FRM or ORA error is easy; I am wondering what & how should I note last 5 steps ( like, what page, what block & what form the user was clicking/entering data etc) when error occurred. I am planning to use when-mouse-click or some other triggers to capture the data; but at every action if I try inserting one record & deleting one record from the database table ( last one knocked out), there is going to be a lot of I/O & that table is going to be too hot. I am trying to avoid that unwanted I/O & keep those 5 steps info somewhere in forms till user gets a error. And, when he/she gets error, he/she can dump those 5 steps info along with error messages/number in a error table.
    My question is: what do I use? Array or Table of records..or something else. I have never used any of these & thought to discuss this before going deep into implementation.
    Any suggestion would be appreciated.
    Thanks.

    You could use a table of records or a record group. They both achieve similar results but with very different syntax. I am not sure if there is any difference in performance.
    Record groups are good for certain things like lists populated from the database because built-ins are provided for manipulating them. If you are going to do the manipulation programatically, I personally find the syntax for tables of records less cumbersome than record groups. Learning the syntax for tables of records is also likely to be more universally useful to you as they have various uses such as passing data between procedures.
    In your situation the table of records needs to exist throughout the forms session rather than just during the execution of a single pl/sql block. The way to do that is create a program unit which is a package header without a body. Declare the table in there and it can be used throughout the form.
    However, if you only ever want to keep 5 records, it would probably be easier just to have 5 ordinary items in a control block on the null canvas (or global variables). When you want to record your new action just do:
    :item5 := :item4;
    :item4 := :item3;
    :item3 := :item2;
    :item2 := :item1;
    :item1 := :new_stuff;
    You could even construct the above in a loop using
    copy(name_in('item'||i),'item'i+i)
    but with only 5 items to manipulate, is it worth the bother ?
    Whatever method you decide to use, you are not going to get anything simpler than 5 little assignment statements.

  • Project setup - what's best for source code versioning?

    We're about to start developing a new portal and are wondering what would be the best directory structure. It's important to decide at the beginning because we're using CVS version management for our source code (we are currently using it for our ADF development).
    Are there any issues related to directory/package structure? With ADF, we had problems when we wanted jsps from one application to call those in another application. To get around that, we had to put all of our applications within the same jdeveloper "project".
    I'm keen to hear any suggestions - especially if you work in a multi-application environment with concurrent development etc.
    thanks,
    M

    Since I don't have a Canon, I don't know the specifics of how to ingest media for that camera. But FCE does have the ability to log & transfer AVCHD, as I have done this with a Sony HandiCam and my Lumix GH-1.
    The codec that FCE transcoded to, was AIC, Apple Intermediate Codec. FCE is 'fine' if you are not using 24p frame rates, as there are no 24p sequence options. (You can use 24p in a 25p timeline... but broadcast engineers will gnash their teeth on such botchery.)
    This may or may not be an issue.
    On the 'problem' of 'wyrd things happen when I whip pan my camera'... well, yeah... There are some industry standards about how fast objects should move across the field of view to avoid artifacts.
    The "whip pan", namely quickly pivoting the camera, will produce strange imaging. While the technology and image formation is different, so the artifacts are different, but even for 'film film' there are limits.
    One rule thumb I've run across is an object should take at least 5 seconds from one side of the screen to the other. Faster will result in artifacts, strobing, or in the case of digital cameras, 'rolling shutter' issues.
    The motto of the day is... "Know thy camera"...
    There may be filters to minimize or save the day if needed, but it is just better to shoot correctly in the first place...

  • What's best for the battery?

    Have a new HP311.  I want to know what is the best treatment for the battery.  Should I just leave it in the  machine while I am using it off the mains power or should I remove it while running on mains or should I charge it up and use the machine off battery and then recharge.  I'm new to this.

    It is a matter of opinion as far as removing it or leaving it in. If you leave the battery in and plug it in and unplug it frequently the capacitors could read incorrectly and think that the battery is charged to 100% when it is not. This is only a temp issue. Calibrating the battery will resolve this. If you leave the battery out of the machine it could get lost, or give your notebook more spaces to get dust in it. Personally I always advise to leave batterys in for this reason. Charles informed you to leave it out which is not incorrect either. The notebook will run a bit faster on ac power and your graphics performance will be increased(with battery in or without) and you should not run into the memory issue. It is a matter of choice. You can run a battery check in the Total Care advisor and if it needs calibration because you leave it in often and it should link you to the steps if needed.
    Message Edited by Gangles on 10-29-2009 07:49 PM
    Signature:
    I currently work on behalf of HP for numerous support departments. The opinions expressed above are the personal opinions of myself, not of HP. There is no guarantee that the opinions expressed are 100% correct.

  • What's best for video output to plasma HDTV?

    I'm thinking of hooking my 15' MBP up to my Samsung Plasma HDTV. The TV has input options including VGA, DVI, and HDMI.
    Since I'll have to go purchase the necessary cables and/or adapters to make this work, I was curious to know which option would give me the best video quality. Or is there a difference?
    What's the best?

    VGA is an analog video format. You'd be degrading your signal from digital out to analog, then your TV would likely reconvert it to digital for display on the plasma. That's definitely not the way to go.
    As for the DVI vs HDMI they're both digital transport. I am not totally certain but I believe for digital video the HDMI is just a higher density tighter pack of wires than DVI (other than audio but that's irrelevant here) so it the DVI vs HDMI should be equivalent quality.
    I'd just plug the DVI out from the MacBook Pro into the DVI input of the TV. The cable will cost a mint (maybe like $50). I heard through someone that Apple is carrying low cost cables, but I haven't checked it out yet. I'll step back to hear someone who knows more comment more on the DVI vs HDMI and this price part.

  • What is best for my career: Sap ABAP or Sap BI

    Hi Experts,
    I am Rajesh, done my bachelor degree in Information Technology,
    having 4 years of Exp as a Mainframes Programmer in a Banking Software company.
    my job containts
    30 % understanding the product
    40 % Analysis
    30 % Programming
    my career Goal is to get SAP job in Abroad(US/UK/AUS) for that i am planning like below:
    First i want to gain some minimum(8-10 Months) Exp in India by
    Choosing one Best(or)Hot Cake Module in SAP, which matches any one of 3 points
    1)Currently that module should have more demand less supply.
    2)Should have good Future
    3)it should not be much vast Because need to expertise Early
    I already Trained and good in SAP-Core ABAP,
    but just Core ABAP is not enough to get expertise in ABAP, because i need to add it with
    OOPS, Webdynpro, Workflow ETC.
    even i Trained in all the above, it is difficult to be Expert in 1 YR.
    and Hard to get job in US/UK/AUS.
    So i am planning to go with SAP-BI for below Reasons
    1) SAP BI is not that much Vast compare to ABAP for becoming an Expert on it
    2) for Skill Set ABAP+BI, can have good openings
    3) SAP-BI is a techno functional Job, where ABAP is not a final Destination.
    4) in Future, BI will help to get into HANA.
    I request you to guide me, whether my decision towards my Goal is correct or not,
    if not, please give valuable Suggestions to reach my destination.
    Thanks in Advance,
    Rajesh

    Hi Rajesh,
    as per as your selection of module, its a good mix, but i have a few words that i wants to share with you. Being a developer in sap abap i have come across some points where many indivisuals get strucked by asking what is next.
    Started with sap abap you will have many options to go ahead, as you have seen that the combination of BI along with ABAP has an added advantages, and yes later on you can move towards HANA, one of the major sap module in which the database of sap persist in furure.
    As far as i concern, if you wants to be in technical stream of sap you will have UI5, Webdynpro, Workflow, BW/ BI, HANA etc, so you may go ahead with these options, but as you have told that you wants to get hands on these things in one year, i think you have to devote in abap as much as possible
    what you will require to know the syntax and semantics used in SAP, along with all the stuffs associated with it, once you will get familiar with it, you can play as you wants.
    But one thing more is that its not mandatory to have sap abap knowledge to learn other technologies,  you can learn without abap, but if yiu have hands on in abap somehow it will boost your future in related technilogies.
    So, finally your decision is on right track, what you will need is to get it as your passion.

Maybe you are looking for