Adding dockables to externals

Hi again, I’ve run into a little problem when generating externalised dockables.

I want to programatically combine dockables into an external frame by giving them the same CLocation.

This works fine for the 1st dockable (ie the second dockable get added to the 1st) but after this a new frame is created even though the CLocation is the same.

I’ve tracked this down to the MultiDockAcceptance of dockables into a StackDockStation. Where after the second dockable is added we are now trying to add dockables to s StackDockStation and the acceptance is denied.

I’ve created a work around in ScreenDockStation where I check to see if we are adding to a StackDockStation and then add it rather than trying to combine.

at line ~1247

        if( bestRatio >= dropOverRatio ){
            DockableProperty successor = property.getSuccessor();
            Dockable dock = best.getDockable();
            if( successor != null ){
                DockStation station = dock.asDockStation();
                if( station != null )
                    done = station.drop( dockable, successor );
            }

            if (!done) {
                Dockable old = best.getDockable();
                if (old instanceof StackDockStation) {
                    StackDockStation sds = ((StackDockStation) old);
                    sds.add(dockable, sds.getDockableCount());
                    done = true;
                } else {
                    if( old.accept( this, dockable ) && dockable.accept( this, old ) && (acceptance == null || acceptance.accept( this, old, dockable ))){
                        combine( old, dockable, property.getSuccessor() );
                        done = true;
                    }
                }
            }
        }

This works fine for me but I’m not sure if this is the best fix.

thanks

Chris

Once you have combined the first two Dockables, ask one of them for their CLocation and use “CLocation.aside()” to create the location for the third one. Or just call “theLocationYouHaveCreated.stack(3)” for the third location.

I agree, that the current behavior is not very intuitive. but it is not a bug, the location is pointing to the window, not to the stack. I’ll think of changing the behavior, although I first need to think a bit about possible side effects.

Unfortunately I can’t do that. The behaviour I’m after is that the user can produce a plot and depending on the type of plot the figure will be a certain size.

If two of the same plot are produced I’d like them to get stacked.

I agree its not really a bug and my workaround isn’t ideal.

I’ve managed to get the workaround working by importing all the source into eclipse but when I compile the latest snapshot using the install/mvn-install.sh I’m running into locale issues like http://forum.byte-welt.de/showthread.php?t=3658&langid=2

Is there a preferred way of compiling?

Thanks again for your help

Use the ANT build file (build.xml in docking-frames-core), it’s much more reliable than the maven thingy (I think I’ll remove maven support in the future, it never worked well and maintaining maven just requires too much time). You might need to modify some of the paths in the ANT file. The names of the projects may be different in your workspace.

[Edit: about “can’t do that”: you can always call “stack”, even if there is nothing to stack. It will just be ignored in that case. A CLocation is a list of path items, the framework tries to apply as many as possible, but ignores the tail of the path if some item cannot be applied]

[Edit2: just using the export mechanism for JAR files of Eclipse might be enough. I have not tried that in a long time, but all the source code and resource files are in only two projects… (docking-frames-core, docking-frames-common)]

Thanks heaps the Stack Location works a treat.