Implement command pattern in any way or anything similar or anything at all

I have a controller class that listens to button presses from my button panel, and it also listens to mouse actions from another drawing panel.
When I press a button, it indicates some kind of drawing is going to happen in the drawing area. Only one action could be "active" at the same time. (To exemplify, put out square, put out circle, or whatever).
First I thought of using something similar to the command pattern. But when I press the button (here I wanted to create the command since then I know which one) I dont know yet which coordinates that are of interest. That would mean I would have to pass that data into the command�s execute() method, or create the command first now (right before it should execute)
Any suggestions of what could be a nice approach here are very welcome.
I know I am in that phase that I want to "patternize" a bit to much, but hey, at least you learn something and eventually you learn when not/how to use it more properly.

Maybe you could have a method that would return when the command needed to be excuted.
I dont get you fully there.
or could pass something else to the command that it could use determine when it needed to be executed?
I will however try to also send a bool which indicates whether it comes from a click or not. If that succeeds, I have managed to get all the commands to know by themselves when to do or not to do their stuff.
The only things that feels bad about that, is that only one command (for the moment at least) makes use of it. But I get rid of the bad smell ;-)
Add: Turned out that after all changes, most of the commands needed this variable too. Now everything feels good again ;)
Message was edited by:
sandsater
Message was edited by:
sandsater

Similar Messages

  • How to implement command pattern into BC4J framework?

    How to implement command pattern into BC4J framework, Is BC4J just only suport AIDU(insert,update,delete,query) function? Could it support execute function like salary caculation in HR system or posting in GL(general ledger) system? May I create a java object named salaryCalc which use view objects to get the salary by employee and then write it to database?
    Thanks.

    BC4J makes it easy to support the command pattern, right out of the box.
    You can write a custom method on your application module class, then visit the application module wizard and see the "Client Methods" tab to select which custom methods should be exposed for invocation as task-specific commands by clients.
    BC4J is not only for Insert,Update,Delete style applications. It is a complete application framework that automates most of the typical things you need to do while building J2EE applications. You can have a read of my Simplifying J2EE and EJB Development Using BC4J whitepaper to read up on an overview of all the basic J2EE design patterns that the framework implements for you.
    Let us know if you have more specific questions on how to put the framework into practice.

  • Is there any way to have a COMPLETE list of all samples and loops ( Logic 8

    I'm sure it's been posted previously, but anyway, I'm looking to buy new Apple Loops libraries and I have faced the fact , that many of the sounds and loops produced by third parties manufacturers have been already included in Logic installation discs.
    I have a list of Apple Loops DVD's that have been included with Logic somewhere, the problem is, Apple didn't post ( I believe) the credits of all 3rd party manufacturers that have produced these libraries that are included with Logic or Garage band. Is there any way to have a COMPLETE list of all samples and loops that are included with Apple DAW's so I wouldn't duplicate anything ? I'm pretty much positive that Apple had other companies to sound design and sample all libraries for them, so is there also a way to have a list of those manufacturers? Again, the objection is to start upgrading the sound library without any possible duplication?
    Thanks in advance!

    Chris, I certainly don't mind additional questions and postings.
    I believe there are many issues with Apple Loops and Logic that need to be resolved and people need to be aware of that. Unfortunately, in opposite to the old "german" version of Logic , there's no lifetime tech support, you can't even call and ask the question after 60 days , which isn't right for a professional software of this level, especially considering the fact that many things still remain vague in Logic even for developers and tech support people!( believe me, I've called and asked!)
    Issues like that need to be resolved over the phone with the company, period!
    One thing I also learned over the years as a Mac OSX user, if something doesn't work, don't mess with it. Delete your drive and re-install everything. This is very frustrating , I know, but unfortunately this is the only way to deal with OSX issues, if you got a problem with your system, don't try to fix it. It's never gonna be the same again. I know , it's off the topic a little bit, but if your content is missing from the system files, before installing your new Logic, back up your important files, wipe up your drive and clean install Mac OSX , run updates and then install the Logic. Most likely , everything will be in it's place, at least 90% or more. I gave up trying to make two system in my house to be compatible 100% , but it's OK if they're 90% or more identical. I spent enormous amount of time trying to find out what's missing and where, I visited most of the forums and there's no clean answer.
    Message was edited by: Moderator

  • I bought a MacBook Pro off of someone and the home folder is still in their name...is there any way I can change it without losing all of my stuff?

    So I recently bought a MacBook Pro off of someone so I can use it for school. The home folder is still in the previous owners name and I was wondering if there is any way I could change it without losing all of my stuff that is on the MacBook Pro??  Thanks for your help!

    See Changing user account short name

  • I have been using the apple IPad camera connection kit and my photos can be viewed in the events... But the all imported folder is no longer there and the last import folder is empty. Is there any way to resolve this ang get my all imported folder back?

    I have been using the apple IPad camera connection kit and my photos can be viewed in the events... But the all imported folder is no longer there and the last import folder is empty. Is there any way to resolve this and get my all imported folder back? as well as get my last import functioning normally?

    Please please help me, if you know how.

  • I have deleted all my bookmarks from firefox sync by error on reintalling operating system. Is there any way to recover it? I have all bookmarks saved on "Firefox Home" on my iPod. Can I extract bookmarks from "Firefox Home" to my computer? Thanks

    I have deleted all my bookmarks from firefox sync by error on reintalling operating system. Is there any way to recover it? I have all bookmarks saved on "Firefox Home" on my iPod. Can I extract bookmarks from "Firefox Home" to my computer? Thanks

    Restore your backup.

  • I have an IPhone 4s and am getting an IPad Mini. Do I have to change my Verizon plan in any way to include the IPad?  After all I already have the phone number.

    I have an IPhone 4s and am getting an IPad Mini. Do I have to change my Verizon plan in any way to include the IPad?  After all I already have the phone number.

    Gina your post was very helpful to me as well. I recently Traded In my Apple IPad 3 WIFI Only Device for a Verizon Wireless Apple IPad Mini Pre-Order. This is actually my very first WIFI + Cellular IPad Purchase. The Price was Finally Affordable.

  • Okay so my brother changed the passcode on my iphone now its disabled is their any way i can unlock it without deleting all my photos on it?

    okay so my brother changed the passcode on my iphone now its disabled is their any way i can unlock it without deleting all my photos on it?

    jeffypanora wrote:
    okay so my brother changed the passcode on my iphone now its disabled is their any way i can unlock it without deleting all my photos on it?
    You do regularly sync your photos to your computer and delete them from the Camera Roll on the iPhone, correct?
    Have you tried to download them using Photo Stream?

  • Any way to reverse how iTunes re-organized all my music files on my comp?!?

    When I changed my "iTunes music folder" location to the big folder on my computer that has all my music files (over 900), I accidentally checked the box that said "keep iTunes music folder organized"!
    Now, iTunes has re-organized my big music folder into a million folders organized by artist. Not only that, but the stupid thing changed the names of all my music files, too!!!
    is there any way i can reverse all this?!?!
    I cant believe checking that little box changed so much!!! DAMMM YOU iTUNES!!!!
    please help!!

    Why not? It did exactly what you told it to do.
    yes thats true... it's just that I didnt think it would "re-organize" the files in such an extreme way (i.e. separating them into a tonne of different folders and subfolders and changing the file names).
    Thanks for the heads-up, guys! I will check out TagScanner...

  • I'm getting a not-quite crash in which I lose ability to interact with the window at all. Is there any way to fix the problem itself? All I can do is an inconvenient "fix" in which I open a new window, and it works in the second window for some reason.

    I'm experiencing a not-quite-crash every time I attempt to open firefox on my new computer. What happens is that the menu bar (which I prefer to have visible instead of that orange single-button menu) has all the letters on it turn gray, and I lose my ability to click anywhere on the page, including to close it. If I attempt to close the page via the taskbar it doesn't let me. It does, however, let me open new windows via the taskbar which don't have the same problem, which allows for an easy-but-inconvenient fix. I've tried it out and it does not have the same problem in Safe Mode. As a result of not being a "true" crash I can't give a crash ID, so you won't be able to trace it that way, sorry.

    ''Problem:'' For whatever reason, NoScript is stopping Runescape Community Toolbar from working properly which freezes your first Firefox window.
    ''Fix:'' Uninstall the toolbar. Disable NoScript. Install the toolbar. Add your RS account to it and make sure it works, then Enable NoScript again.
    EDIT: Posted a fix earlier that was wrong. Corrected to the right one, sorry ^_^ Answer was on Runescape Forums.

  • I have not synced my Ipod before, and I forgot the passcode. Is there any way I don't have to erase all my data to access it again?

    Please help

    Again, no.
    A simple search finds:
    iOS: Forgotten passcode or device disabled after entering wrong ...
    You will lose anything that you have failed to save to your computer.

  • Is there any way to remove "stitching" in Illustrator at all?

    I've encountered a very common problem with thin white lines appearing in some of my vector imagery in Illustrator CS5.5. Like with most stitching errors, I get this when using shapes with gradient transparency. There's also some shape distortion happening depending on the level of zoom I'm on.
    I understand that this may go away when printed but I actually intend to e-mail a portfolio PDF that contains these vectors which is meant to be viewed on screen. I have tried turning the transparency of the objects to 99% but the problem would not go away. I've tried disabling anti-aliasing which removes the white lines but makes the vector jagged and not smoothed. The shapes that I'm using comes from text that's been broken apart with gradient transparency added to some parts.
    To get a better understanding of what I'm seeing, this is what it looks like. The top is what the image looks like in actual size and the bottom are zoomed up to further show how it looks like.

    I also thought that it might be a small gap in between the shapes but I don't think that's the case. I've tried what you suggested and it gave even more stitching.

  • Is there any way to permanently delete items from the "all mail" box?

    every time i delete the mail in that particular box, it meturns in just moments.....  i simply want my deleted items to disappear, not remain in my "all mail" box forever....

    Change the settings at the google site:

  • Is there any way to not include myself in reply all?

    Does anyone know how to remove this incredibly annoying "feature" in Mail?
    Thanks,
    Mark

    .... I primarily use an Exchange account...email that say was sent to me as well as other people....
    Is your name (email address) specifically in the To or CC line? Or is the message sent to a distribution group and you're a member of the distribution group? I can replicate this for Exchange accounts, but only when the person is part of a group and not listed specifically...and only with Outlook (specifically Outlook 2007.) I cannot replicate this in OSX Mail 4.2.
    BTW, is your server Exchange 2007? OSX mail is only supported on Exchange 2007. When I tried OSX Mail with an Exchange 2003 server, I had weird issues. Sometimes mail wouldn't send, but nothing consistent that I could pin down. (My above server is Exchange 2007.)

  • Is there any way to close download windows that remain all black and open after the downloading ?

    <blockquote>Locking duplicate thread.<br>
    Please continue here: [[/questions/968842]]
    </blockquote>
    Hi,
    I have my download windows that remain black and open after the downloading achieved. The only button active is the red cross but seems to be inoperative...
    I can have couple of them open at the end of the day at the same time.
    I have already tried to uninstall/resinstall but the problem remains...
    For info, i am running firefox on a Mac OS.
    Thanks in advance for your help.
    Cheers,
    Jul_313

    Hello,
    Try disabling graphics hardware acceleration. Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches.
    You might need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    Then perform these steps:
    *Click the orange Firefox button at the top left, then select the "Options" button, or, if there is no Firefox button at the top, go to Tools > Options.
    *In the Firefox options window click the ''Advanced'' tab, then select "General".
    *In the settings list, you should find the ''Use hardware acceleration when available'' checkbox. Uncheck this checkbox.
    *Now, restart Firefox and see if the problems persist.
    Additionally, please check for updates for your graphics driver by following the steps mentioned in the following Knowledge base articles:
    * [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    * [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    Did this fix your problems? Please report back to us!
    Thank you.

Maybe you are looking for

  • Win 8 Pro Recovery

    Hi I can not get to HP for assistance... Warranty expired. I have a HP Pavilion G7 laptop. I had a crash and lost my OS Win 8 Pro w/MCenter  and need a revovery disk. The one I made when I bought the laptop 1 1/2 years ago...has no Boot info so it is

  • How to hide field dynamically in a report while using JRC

    Post Author: prateeti CA Forum: JAVA How can I hide fields in a report dynamically?Say my report now contains 3 fields(columns). Some users want to see the 1st and 3rd column and the 3rd column must be adjusted accordingly so that it appears where th

  • Display resolution problems with Snow Leopard

    I have a 'PC' monitor that when using Leopard worked with the correct resolution at the correct proportions (I'm after 1400 x 960) but since I've installed Snow Leopard that resolution is only available intermittently. I've just switched my Mac on th

  • Cannot buil Essbase Dimension With ODI

    Hi all, i've a problem with an ODI interface to load Metada into Essbase. I must load the account dimension the table contains 4 information: Parent Child Alias Data Storage. I need to load some elements as Dynamic Calc and so I've added the column D

  • AUTOMATIC EXPORT?

    HI ALL, I Need a script to take automatic export of my schema day by day..can u guys drop me some scripts for me? Thanx in advance, SIMBHU.