Move dockable to other CContentArea?

Hi all!

I am creating an application that contains a CardLayout, which is changed from a “Card” to another using a few buttons.

On each card, I want to add a ContentArea, and each containing its dockable ContentArea. Each Dockable can change from one card to another, coupled with the other dockable that already exist in it.

I have a CControl unique, and every time I create a new card, I add a new CContentArea to CControl. This is the code:

final CControl control = new CControl(frame);
final CustomMultiFactory factory = new CustomMultiFactory();
control.addMultipleDockableFactory("custom", factory);

Random random = new Random();
CustomMultiDockable dockable = new CustomMultiDockable(factory, "Panel " + this.numPanels,
		new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255)));

CContentArea area = control.createContentArea("Panel " + this.numPanels);
cardPanel.addPanel(area, "Panel " + this.numPanels);

CGrid grid = new CGrid(control);
grid.add(0, 0, 1, 1, dockable);
area.deploy(grid);

this.numPanels++;

But I have the following problems:

-If I do a drag & drop dockable to change this in ContentArea, then remove the card that contains the origin ContentArea, The Dockable is removed from the destination card.

Can definitely change ContentArea?

Do I need a different distribution of the components? currently working with: 1 CControl, N ContentArea, N MultiDocker.

How I can access a Dockable, a CContentArea or CStation from a CControl instance?

I hope I can help! If you need more information, let me know.

Thank you very much for everything!

Greetings! (Sorry for my English!)

That should not happen, actually I don’t see any reason why removing one CContentArea should affect any dockable that is not on that area. It would be interesting to see, how exactly you remove a CContentArea.

Can definitely change ContentArea?

Do I need a different distribution of the components? currently working with: 1 CControl, N ContentArea, N MultiDocker.

I do not understand why you use a CardLayout, it sounds very complex to me. But if you insist on using one, then the number of components is correct. And you should be able to move a dockable from one CContentArea to another.

How I can access a Dockable, a CContentArea or CStation from a CControl instance?

There are methods like „getStationContainers“ (a CContentArea is a CStationContainer), „getStations“, „getSingle/MultiDockable“ and „getRegister“ (offering even more methods) to access these things.

I hope I can help! If you need more information, let me know.

Some small example application is always welcome :wink: But in your case seeing how exactly you remove a card would be very interesting.

Thanks for a quick response.

You’re right!, I was removing a CDockable instead of a CStationContainer. :twisted:

I’m doing this because I need a component that contains several panels and can navigate between them. As is done in a smarphone between different desktops.

I changed this code:

control.removeDockable(dockable);

by the following:

   if (sc.getUniqueId().equals(id)) {
      control.removeStationContainer(sc);
      break;
   }
}```

**Another thing I noticed. When I minimize a Dockable and then I double click on the title to restore it, StationContainer disappears and moves to the first StationContainer I created (the "Card" in position 0). You know why this happens?**

Thanks you again!

Which version are you using? In the newest version a dockable should stay with the same CContentArea as long as possible. What could happen is, that there is no location stored for the dockable, and thus the framework just adds it to the default area (which is the first area that was build).

I’ll have to write myself a small app and test the behavior. But the way you describe it there is a small bug in the framework.

I’m using version 1.1.1 (Preview 6b).

Ok, if it is a bug in the framework, you may notify me when solved? :smiley:

Thank you very much!

Sure, I’ll write again if I have any questions or solutions. May take a few days…

I could reproduce the bug. It only happens if you “maximize” a dockable, “normalizing” works as expected.

I’ll fix that in 1.1.1p6c. I hope to upload the new version this or next weekend.

Ok. Thank you very much!

As you put it, I’ll prove it