Keeping a correlated pair of JSpinners in synch

Requests: (1) critique my solution, if you wish, and (2) is there a name
for the technique I'm using, because I know I've seen it and done it before.
Context: I'd like to allow the user to resize images, while preserving their
width:height aspect ratio. The GUI has a pair of JSpinners, for width and height,
and when one is adjusted, the other should change.
Example: if the aspect ratio is 2:1, setting the width spinner to 201 should cause
the height spinner to change to 100 (I truncate), whilst setting the height spinner
to 100 should cause the width spinner to change to 200.
But: I don't want those reactions to cascade: from the example, if the
user sets the width spinner to 201, the height spinner should change to 100, but that
is where it should stop -- the width spinner shouldn't itself react and change to 200.
My solution: I'm a fan of fixing it in the model, and here is my tweak for SpinnerNumberModel:
import javax.swing.*;
public class SafeSpinnerNumberModel extends SpinnerNumberModel {
    public SafeSpinnerNumberModel(int value, int minimum, int maximum, int stepSize) {
        super(value, minimum, maximum, stepSize);
    public void setValue(Object value) {
        if (!inSetValue) {
            inSetValue = true;
            super.setValue(value);
            inSetValue = false;
    private boolean inSetValue;
}In my code, there are two JSpinners (with SafeSpinnerNumberModels),
and each model has a ChangeListener that reacts by adjusting the other model. The
flag stops the potential feedback loop.
So, is how you'd solve this problem? Did I miss anything, and again, what would
you call this technique?
Thanks,
BDLH

Right both BOE servers will point to the FRS on the primary BOE server and the primary CMS database on the SQL server farm.  Then we replicate the primary FRS to the secondary FRS located on the secondary BOE server and the primary CMS database to the secondary CMS database both on the SQL Server farm.
If we need to we'll switch the primary and secondary BOE servers to the secondary FRS (located on the secondary BOE server) and the secondary CMS database on the farm.
I guess what I'm looking for is the best practice for the backup.  I think what I'm hearing is the best route to go is to have the backups as often as you want but the best way to ensure that the backups are in synch is to do them when the CMS and FRS servers are down.  Otherwise they could be out of synch with report requests being executed at the same time.
Right?
Thanks again

Similar Messages

  • HT3917 I am unable to pair my new apple wireless keyboard with my new i-pad.  It keeps says not paired and will not pair.  I do not know what to do now.  Help.

    I am unable to pair my new apple wireless keyboard with my new i-pad.  It keeps saying not paired.  What can I do to pair it?

    Turn off keyboard. (make sure its' off, mabye even take out the batts since people always screw this up).
    Turn off iPad as well..
    Turn on iPad and quicky power up keyboard.
    Now pair it.

  • Why do I keep getting a "Pairing Request" from an Apple Wireless Keyboard that I'm not using?

    Why do I keep getting a "Pairing Request" from an Apple Wireless Keyboard that I'm not using?

    Bluetooth switched off? 
    Care to share which OS you are using? 

  • Why did my macbook bluetooth keep failing to pair with my parrot zik ?

    why did my macbook bluetooth keep failing to pair with my parrot zik ?

    Hi there Alexander_Lee1995,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    Bluetooth Quick Assist
    http://support.apple.com/kb/HT1153
    -Griff W.

  • My wireless Apple keyboard won't connect, it just keeps blinking to pair, but nothing connects. I even tried hooking up another wireless I have and it does the same thing. Should I delete it and set it up again?

    My wireless Apple keyboard won't connect, it just keeps blinking to pair, but nothing connects. I even tried hooking up another wireless I have and it does the same thing. Should I delete it and set it up again?

    Hey Apple Health,
    Welcome to Apple Support Communities! There's an article that helps to resolve issues with wireless keyboards. I'd take a look at it, go through the troubleshooting steps, and see if that resolves the issue for you:
    Troubleshooting wireless mouse and keyboard issues
    http://support.apple.com/kb/TS3048
    Best,
    David

  • How do I keep watermarks and presets ( with their order ) synched between computers

    I have a desktop which I use for heavy picture editing and a mac book air that I use for on the fly picture editing to show clients during photo trips.
    I want to figure out a way for keeping my watermarks and presets ( with their order and folders I created on my desktop ) synched on my laptop.
    What is the best way of doing this? If keeping it synched is not possible, how do you advise importing them to my laptop?
    Thanks for the support,
    JP Jacobsen

    Ps: It is very important that the presets come on the same order and folders I re-arranged them in my desktop.

  • Can my wife and I keep separate accounts on the iPad, each synched to our individual computers?

    I guess the title says it all.

    No. iOS is not designed at this time for multiple account logins. You would be synching over the top of each other.

  • HT201205 How can I keep my phone paired with my car after I leave car?  My 4 had no problem

    I just replaced my iPhone 4 with a 5s.  It pairs with my car and when I leave my car, it uu-pairs.  My 4 did not have this problem.
    I don't want to have to pair my phone everytime I get in the car.

    What do you mean by "unpairs"?
    Do you mean your iPhone forgets it was ever paired to your car?
    Or do you mean your iPhone drops its connection to your car (which it should certainly do)?
    If you mean it forgets it was ever paired, try Settings > General > Reset > Reset Network Settings.  Then pair your iPhone to your car what will hopefully be one last time.

  • Keeping CMS database and FRS backups in synch

    I am in the process of upgrading to BOE XI R3.1 from CE 10 and am looking at our backup and recover plan.
    We are planning on implementing 2 BOE Xi R3.1 servers with a clustered CMS.  Our CMS database will be running on a remote SQL Server (2005) farm that will be immediately replicated to our secondary site using SRDF.
    The FRS will be local to each BOE XI R3.1 server.  We are thinking of immediately replicating the FRS from the primary location to the secondary location using DFS but I worry about the FRS and the CMS possibly being out of synch when we try to restore.
    By trying to have backups up to the latest instant am I looking for trouble?  if this is manageable, am I going about it the right way?
    In our CE 10 deployment we have a CMS database backup at midnight and the FRS is Robocopied at 12:15.  I'm just looking to improve upon this.
    Thanks

    Right both BOE servers will point to the FRS on the primary BOE server and the primary CMS database on the SQL server farm.  Then we replicate the primary FRS to the secondary FRS located on the secondary BOE server and the primary CMS database to the secondary CMS database both on the SQL Server farm.
    If we need to we'll switch the primary and secondary BOE servers to the secondary FRS (located on the secondary BOE server) and the secondary CMS database on the farm.
    I guess what I'm looking for is the best practice for the backup.  I think what I'm hearing is the best route to go is to have the backups as often as you want but the best way to ensure that the backups are in synch is to do them when the CMS and FRS servers are down.  Otherwise they could be out of synch with report requests being executed at the same time.
    Right?
    Thanks again

  • Keeping a Map 1-M collection in synch

    If you use a HashMap to back a 1-M relationship and the key value changes, the Map is not resynched.
    That is, the HashMap still contains the old key and the 1-M relationship is now "corrupt".
    What's the best strategy to keep this current?
    Nate

    That sounds like a better approach. Let me see if I understand. Use a method accessor instead of a field accessor in my object where the name changes (getName/setName(String name)).
    Doing this will cause this method to be called when other nodes are responding to merge events.
    The missing link for me is: what code do I put in this accessor? How do I modify the cache copy holding a reference to this object by name?
    I like the idea of using this setter as an "event hook", but I don't know what the hook code should do.
    This code would be executing on my working copy. How do I use this to tell the parent object to reindex this object?
    Nate

  • Pairing iphone to macbook pro

    my bluetooth for connecting my iphone 5c to my macbook pro is not working, it ends up saying to make sure network is enabled, which ive been looking everywhere and it seems like it is.
    I keep trying to pair, once i do I am able to get the code to show up on my mac and iphone but then it doesn't go through, it doesnt get connected.

    You cannot.
    https://discussions.apple.com/message/17664595#17664595
    Barry

  • Will an Apple wireless keyboard pair with an iPad2?

    Is an Apple wireless keyboard designed to pair with an iPad 2?  The instruction book refers to a Mac computer but never to an iPad.  I keep getting the "Pairing Unsuccessful" message after I type in the 4 digit code that the iPad tells me to enter on the keyboard.  The keyboard gives me the flashing light saying it's ready to pair, but doesn't make the hook-up. The keyboard is just a foot from the iPad.  Any suggestions?

    This might help.
    Note the following:
    The original Apple Wireless Keyboard, introduced in 2003, is not compatible:
    Apple Wireless Keyboard (2003): Features a white case and uses four AA batteries.
    In addition, many third-party Bluetooth keyboards that use the Apple keyboard layout are also compatible. Check with the keyboard manufacturer for additional information.

  • Bluetooth keyboard loosing pairing on logoff/shutdown

    We have a computer in a conferance room with a bluetooth keyboard and mouse attached.  After turning off the HD protection we were able to keep the mouse pairing after a reboot and keep them paired after turning back on the HD protection but still unable to keep the keyboard paired.
    We are able to re-pair the keyboard each time by going through the discovery process but the room is used by various users that don't always know the correct process and this can happen after hours when on IT support on on-site.
    Again, if the HD protection is turned off or even set to allow the changes to be saved, the keyboard will pair automatically at boot and function correctly.  The computer is a Dell as well as the mouse and keyboard.  Any troubleshooting would be helpful as we are required to keep the device locked down.

    Hi Mike,
    Thank you for posting here!
    How about the following process?
    1. Configure Windows Disk Protection (WDP) to “Retain all changes permanently”
    2. Configure the Bluetooth devices.
    3. Restart the computer to save changes.
    4. Restore WDP to “Remove all changes at restart”
    5. Restart the computer to test.
    If this issue persists, there may be conflicts between the device and WDP driver.
    What about "Retain changes temporarily" mode? It will cache the changes temporarily until the time you specified. We can configure it to another day or next week to test.
    Hope the above information helps.
    Best Regards,

  • How do I get my iPad to pair with a device?

    My ipad will not pair with a device. What do I need to do?

    Hi everyone
    Something is missing on the above posts
    My android phone pair with iPad Air but i cannot pair the iPad AIr with MacBook pro.
    For the records they are bith legimit, and both appear with the same number, but after that the connection on MacBook Pro is broken and iPad keep trying to pair, although it find it.
    Can this make some light on the posts above?
    I really don't know if this is a problem as i had allready saw on other post that:
    "iPad only pair with keyboards and speakers".
    Can someone makes light on my mind about this issue?
    MacBook Pro + iPad Air

  • Keyboard and Mouse Settings Keep "resetting"

    Ok so I set up my keyboard's F5 to be the Desktop View ( F11 the old way ) and squeezing my mighty mouse, I set to Expose... but every time I do that, it resets itself after like a day or so..
    Anyone experience this? I have to go back in and check off the F5 option again, and I have to change my mouse from Button 4, to Expose.
    HELP!

    I am having the same problem. I have my system preferences setup to synch with my .mac account. The mouse settings keep resetting on both computers I have synched.
    The problem seems to have ramped up since the update to 10.5.3. It is now happening every synch.

Maybe you are looking for