All event listeners and models in one file?

I have one java file for all my event listeners of a programm and one java file for all my models. Is this good?
I create instances with new AllInOneHandler.MouseHandler() for example.
Or should I have one file for each event and each model?

Hi,
you should have one file for each class or interface - this gives you best control and reusability. Also when you have javadoc-comments in it, big files with many classes in it will become hard to edit.
When using one file for each class or interface you can import only the needed classes or interfaces instead of importing whole packages - so it is easier to see, what is exactly imported. As so a good structured application has many classes, where each of them is small (and in an own source file), you will have less problems during the evolution of your classes this way.
If you want to group some classes, why not use sub-packages for this purpose?
greetings Marsian

Similar Messages

  • [JS] Basic question about event listeners and event handlers

    I am very new to the whole topic of event listeners and event handlers.  I'd run the test for the following problem myself, but I don't know where to start, and I just want to know if it's impossible -- that is, if I'm misunderstanding what event listeners and event handlers do.
    Say I have an InDesign document with a text frame that is linked to an InCopy story.  Can I use an "afterImport" event listener on the text frame to perform some action any time the link to the InCopy story gets updated?  And will the event handler have access to both the story that is imported, and the pathname of the InCopy file?
    Thanks.

    Thank you, Kasyan.
    Both of those are good solutions.
    We are currently using InDesign CS4 and InCopy CS5.  I'm hoping to get them to purchase the whole CS5 suite soon, since I'd like to start writing scripts for InDesign CS5 as soon as possible, as long as I'm going to have to be doing it in the not too distant future anyway.  The greater variety of event handlers sounds like it might be something that is crucial to the project I'm working on, so that adds to the argument for getting CS5.
    Thanks again.  You have no idea how helpful this is.  I made some promises to my boss yesterday that I later realized were  based on assumptions of mine about the InDesign/InCopy system that didn't make any sense, and I was going  to have to retract my promises.  But after reading your response I think I can still deliver, in a slightly different way that I had been thinking before.
    Richard

  • I have two Creative Cloud accounts, occurred by accident, I wish to merge them and have all my details and licenses under one account, how do I do that?

    I have two Creative Cloud accounts, occurred by accident, I wish to merge them and have all my details and licenses under one account, how do I do that?
    This is due to the different changes Adobe has gone through and unfortunately I used different emails at certain times.

    Under one Adobe ID you can have one CC only,if by accident you have purchased two CC under one account, it needs to be cancelled & refunded, please contact Adobe Support at
    http://adobe.ly/yxj0t6
    Regards
    Rajshree

  • TS2972 I assume my Apple TV should allow me to view all events,albums and slideshows but It only allows four events to display on my TV. I'm using a Optus mini Wi Fi for my home network. Could this be the reason for limited access via my iMac computer? Ch

    I assume my Apple TV should allow me to view all events, albums and slideshows in my iPhotos app but it only allows four events and four albums to display on my television. I'm using a Optus mini Wi Fi for my home network. Could this be the reason for limited access via my iMac computer?
    Chris

    No, I have not chosen photos to share as I assumed that the Apple TV would access all photos and music that are stored on my iMac. 
    Thanks for your advice. I will check it out.
    Chris

  • My iPhone says storage is low. What do I do? I have a lot of pictures on my iPhone and don't' know how to download to MacBook Pro. Don't want all of them to go to one file .

    I have the iPhone4s and it says my storage is low. Is it because I have too many pictures stored on it? How do move them to my Macbook Pro? If I move them to my new MacBook Pro can they go to one file and then move them into other files?
    How do I do that?

    http://support.apple.com/kb/HT4083

  • How to get audio and video in one file

    hi...I am "premiere beginner user" and I have a simple question , I think..:)...Every time when I am trying to export media out from my premiere (using media encoder) I get video file and some audio files, but what I need is only ONE file, that contains both (audio and video)..for example , I have edited film in hd quality and I want it to export, I choose h.264 format(make some settings,pal,audio quality...) and when it´s "all done", only "result" I get is one video file and two audio files and they are not together :).....so please help mme anyone..ok and as you can see I am not from english speaking country, so sorry for my english...thanks for help....

    There is no indication that something is out-of-sync or the ability to move/slip into sync like in FCE/FCP.
    To the best of my knowledge, using match frame and overwriting the video with video+audio (or attaching it as a connected clip if you don't want to overwrite the video, which might have effects applied) is the best way to do this.
    You can use the blade tool first in the timeline to get just the section you want to get back into sync. Make cuts so that you have a single clip that needs the audio resynced, select it, and use shift-F to select the original synced clip in the Event Browser. Make sure your play head is at the beginning of this video clip in the timeline. Press option-2, then 'q', and now you have the audio back in your timeline, synced with the video.  Delete the old, no-longer-synced audio and you should be set.

  • Is there a way to clear ALL event listeners, stop all movie clips, etc?

    Is there a syntax for this?
    I have a movie that has 15 frames. Each frame has embedded movie clips within movie clips, tons of animations and event listeners. None is needed except when they are on the stage, on the frame. However, the animations continue even when the frame is left.
    For instance, I have a frame that has a dynamically rendered animation of leaves falling from a tree. When the frame is left, the leaves continue to fall.
    There are many instances of this type of thing happening.
    Ideally, I would love to just be able to clear everything when a new frame is loaded, since none of the animations or event listeners need to carry over from one frame to another.
    Is there a way to do this without the thousands of lines of code it would take to manually remove every single animation and event listener and sound, etc, from the stage?
    Thanks so much!!
    Amber

    you have to manually do that.
    or, you could convert each frame to a swf.  load each swf when needed and, if you're publishing for fp 10+, you can apply unloadAndStop() to kill all streams in the loaded swf and ready those assets for gc.

  • Removing All Event Listeners

    If you have multiple event listeners running, is there any way to remove all of them at once rather than one at a time?
    Thanks,
    Jeff

    Near the end of the article linked below is one approach that someone has used involving an array:
    http://www.almogdesign.net/blog/actionscript-3-event-listeners-tips-tricks/

  • How to locate all iTunes libraries and condense into one?

    Last fall I did multiple backups of my iTunes library, along with random music folders.  I reloaded my OS X and it seems didn't restore my iTunes folder correctly. 
    What is going to be the most efficient way for me to:
    1: Locate all my libraries (two backups with one being Time Machine)
    2: Place them all together in a Master iTunes library?
    I'm frustrated wondering if I've lost a big file of music!
    I see there's been other queries similar to my problem but the ones I read were dating back a number of years ago...
    Thanks for any help.

    06/2014 ChrisCA post: Restore iTunes library from Time Machine backup - https://discussions.apple.com/message/26104480#26104480 Useful tips where restoring to a new drive: http://pondini.org/TM/B6.html and https://discussions.apple.com/message/27599985#27599985
    No, a library is a bunch of files working together:
    What are the iTunes library files? - http://support.apple.com/kb/HT1660
    More on iTunes library files and what they do - http://en.wikipedia.org/wiki/ITunes#Media_management
    What are all those iTunes files? - http://www.macworld.com/article/139974/2009/04/itunes_files.html
    Where are my iTunes files located? - http://support.apple.com/kb/ht1391
    iTunes 9 [and later]: Understanding iTunes Media Organization - http://support.apple.com/kb/ht3847 - plus supplemental information about organizing to new structure https://discussions.apple.com/message/26404702#26404702
    Image of folder structure and explanation of different iTunes versions (turingtest2 post) - https://discussions.apple.com/docs/DOC-7392 and making an iTunes library portable.
    In your case unless you want things to get very messy very quickly the best thing is to choose which library you want as your starting copy, then add any media files you think are not in that library from the media folder used by the other backup.  If you want hugely messy you add all media files just to be safe and then spend a week or two sorting out the duplicates one by one.  If you want immensely, hugely messy you do the former and import the other library file into the first one and sort out all the duplicate playlists created in doing so as well as all the duplicate media files.  I mean for me I know yesterday's backup is last week's backup plus new media plus changes I have made, so I don't really need last week's backup unless yesterday's backup drive has fried.  I only really need one or the other.

  • Deleting all text boxes and images on one layer

    I am designing a 240 page book where nearly every page contains at least one image and at least one text box.  The book will be printed with a varnish (a fifth plate) on every image.
    The printer has instructed me to set up the varnish in the following way in InDesign:
    With the finished book, make a duplicate layer.
    Delete all text boxes on the new layer (including page numbers)
    Delete all images (but not their containers) on the new layer
    Fill all the empty image containers with 100% black
    I have done this previously with an even bigger book, and it did of course take several hours, and it's also easy to make mistakes. So I thought it might be possible to do this with a script - only problem is I know nothing about scripting - so I wonder if someone would be willing to help me out?
    Thanks in advance! Using ID CS5.5, win xp pro sp3.

    Hi Both,
    I am having a similar problem.
    I have to extract all images to a new layer, without modifying the size of the container.
    As long as I am not an expert in scripting I have tried to do a simple code to obtain all links and go to its parent to change its itemlayer property to the new layer. But it is not what I am looking for and it has not work.
    The layout of the current layer is based in tables, so images are anchored objects inside table cells, so when I run the simple script I mentioned I also get errors becuase it says the items are grouped. And even if I first run a script to ungroup everything I get the error.
    I would appreciate help.
    Thanks in advance.

  • Dynamic sender  file name Pattern and collecting into one file

    Hi Experts,
    Could you please let me know how to achieve below scenario.
    1)     File Directory: TEMP: files: test1,test2,ign1,ign2..etc.
    2)     Get the files of pattern test*
    3)     Received files test1, test2.
    4)     Club contents of file Hemanth1, Hemanth2.
    Ex: test1 contains------REC1
          test2  contains------REC2
    OUTPUT FILE contains REC1,REC2.
    5)     Pass OUTPUTFILE and filenames (test1,test2) to R/3.
    PS: Please dont give references of blogs..I went through most of them could n't finad anything helpful.
    My concern is how to collect files into one file and sending filename pattern..
    Thanks in advance..

    Hi Experts,
    Could you please let me know how to achieve below scenario.
    1)     File Directory: TEMP: files: test1,test2,ign1,ign2..etc.
    2)     Get the files of pattern test*
    3)     Received files test1, test2.
    4)     Club contents of file Hemanth1, Hemanth2.
    Ex: test1 contains------REC1
          test2  contains------REC2
    OUTPUT FILE contains REC1,REC2.
    5)     Pass OUTPUTFILE and filenames (test1,test2) to R/3.
    6) Suppose poling is for 2 minutes..I dont want to read the files which I already read again (I dont want to delete or modify source directory files)
    PS: Please dont give references of blogs..I went through most of them could n't finad anything helpful.
    Thanks in advance..

  • How do I move all the apps and podcasts from one mac to another mac?

    What is the best way to move all the apps and iTunes content (songs, podcasts, etc) from one Mac to another Mac?  I am switching to a newer computer.  I connect (with cables) an iPhone 4 and an iPad 2 to the old computer for syncing.

    Take a look at this.
    iTunes: How to move your music to a new computer
    When I recently got a new MacBook, I set it up with Times Machine using a backup of the old computer. It could not have been easier. If you use Time Machine - that will copy the contents of the old Mac to the new Mac - iTunes library included. You will have to authorize the new Mac in iTunes - Store>Authorize this computer.
    There are ways of copying the purchased contents from the iPad to the new iTunes library as well if you need to do that. But as long as you have the old Mac - copying the library and putting it on the new Mac makes the most sense.

  • Colors get desaturated when picked and transferred from one file to the other! Why?

    I used the color picker tool to choose colors from one file and fill it in another file. The color shows as desaturated when the other file is active. Both files are on the exact same settings, but I don't know what is happening. I reset the tools. But nothing.

    Are you sure that mode (RGB, CMYK, etc) and assigned color profiles is the same on both files?
    May be you turn on Proof Privew (Ctrl-Y) on one of the files.
    PS. my english is poor )

  • ICal-all events deleted and won't let me add new HELP!!

    Hi there,
    Recently I started my iCal and all my entries were gone. Not only that, but it won't let me add new entries no matter what I do. As well, my to do list on the right is blank and the space on the left where my calendars were listed before is also blank. If I go into my computer I can find the files from iCal with the information but they aren't showing up in iCal itself.
    HELP!!
    Thanks

    klgreene595,
    Welcome to Apple Discussions.
    1. Can you associate this behavior with anything that you recently installed on your computer?
    2. Are you using MobileMe, or any other sync software?
    3. Do you have any backups such as Time Machine, or an iCal archive?
    4. What calendars do you have listed in your sources pane?
    5. Have you subscribed to any calendars?
    6. Do you have an iPad or iPhone?
    7. Where have you found the iCal files on your computer?
    8. Have you attempted to repair disk permissions?
    9. Try refreshing the iCal plist file. You will find the "com.apple.iCal.plist" file in your Macintosh HD/Users/yourusername/Library/Preferences Folder. Quit iCal, and drag the .plist file to your Desktop. Then log out/in or restart.

  • Regd Event Listeners and Objects to listen to File events

    I have a specific requirement wherein, I want to listen to a java.io.File object pointing to a windows directory and keep track of any sub-files and sub-directories. If any new file or directory is created, I want an event object to be fired and captured by an event listener. Are there any classes already provided in the JDK APIs to meet this requirement.
    The situation is pretty much like listening to events fired when emails are received on an Exchange Server using Java Mail API MessageListener and MessageEvent.

    You should get in touch with this guy:
    http://developer.berlios.de/projects/jfilenotify/
    Looks like he might need a little help.

Maybe you are looking for

  • MBP keyboard and track pad not working

    Today the keyboard and track pad on our mac book pro laptop just stopped working. The mouse connected to it by usb continued to work but we can't type or anything. We tried the ^F6 keyboard shortcut but it did nothing since of course the keyboard isn

  • Internal microphone not working with Windows 7 on g6-1256ee

    Hi,  I recently installed Windows 7 (64bit) on my HP g6-1256ee and everything seems to work apart from the internal microphones. sound card driver install correctly and hp assisstant say your computer up yo date plz help me

  • Can i use any other branded headphone jack other than Apple jack ?

    My doubt is that , will there be any defects caused to any apple product if use any other banded 2.5mm jack other than apple? If so ma i know what can be those defects or mal-functionings..? Pls help me because the apple jack is not serving me to lis

  • Try this in DTW (oStockTransfer) -- No data is visible

    Hi Experts, I have a problem, I want to use the DTW to import the Inventory Transfers so i have to use the oStockTransfer template provided by SAP, I have put some data in the Header and lines templates, Now when i check the source data and target da

  • Print document in smaller size

    I have a single-page letter-size document. I would like to be able to print it in the original size, as well as @ 50% of the original size. How can I do this?