Design question for CWorkingArea

Hi Beni,

Still working on my application upgrade. Anyway, the user can launch a simple popup (JDialog) from the main JFrame that provides ‘blob’ of information to the user. It has a single DefaultSingleCDockable on the left and CWorkingArea on the right. The CWorkingArea only has 1 dock displayed at a time.
i.e.

cwArea = control.createWorkingArea( "work" );
grid = new CGrid(control);
addToolBar(control, ctcArea);
grid.add( 0, 0, 20, 100, leftDock ); // x,y & w,h
grid.add( 20, 0, 80, 100, cwArea );   // x,y & w,h

Everything is working fine. The user selects different information in the left dock and the dock in the work area is remove then a new one is displayed.

So, I had the bright idea of adding ‘detailed information’ of the blob. If the user clicks ‘blob’ then they get the above layout. If they click ‘detailed’ then I want to remove everything from the working area and add 3 vertical docks. But I don’t think you can do that. My next thought was to create 3 CWorkingArea over top of the initial CWorkingArea and put 1 dock in each work area.
i.e.

cwAreaBlob = control.createWorkingArea( "workBlob" );
grid = new CGrid(control);
addToolBar(control, ctcArea);
grid.add( 0, 0, 20, 100, leftDock );      // x,y & w,h
grid.add( 20, 0, 80, 100, cwAreaBlob );   // x,y & w,h

cwAreaDetail1 = control.createWorkingArea( "workDetail1" );
grid.add( 20, 0, 80, 30, cwAreaDetail1 );   // x,y & w,h
cwAreaDetail2 = control.createWorkingArea( "workDetail2" );
grid.add( 20, 30, 80, 30, cwAreaDetail2 );   // x,y & w,h
cwAreaDetail3 = control.createWorkingArea( "workDetail3" );
grid.add( 20, 60, 80, 40, cwAreaDetail3 );   // x,y & w,h

Question #1: Can I have CWorkingAreas that overlap?

Question #2: Either cwAreaBlob will have a dock or cwAreaDetail1/2/3 will each have a dock but never both at the same time. Is this an acceptable design?

Question #3: Is there anything I should be aware of or things that I should do?

Regards,
Roger

What exactly do you mean with “overlapping”. CWorkingAreas usually try to stay visible all times, but there are some tricks to make them stackable or minimizable.

But you should always be able to use “CWorkingArea.deploy( anotherGrid )” to add multiple Dockable to a working-area (after all a working-area is just a subclass of CGridArea, which is the place where you are deploying the variable you called “grid” in your code). Having more than one working-area is not an issue, but I don’t think that is the solution you are looking for. I’ll write and post a piece of code tomorrow, to show what I mean.

Here is the code I promised.

Just using a second CGrid could help:


import javax.swing.JFrame;

import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CGrid;
import bibliothek.gui.dock.common.CWorkingArea;
import bibliothek.gui.dock.common.DefaultSingleCDockable;

public class TooltipExample extends JFrame {
	public static void main( String[] args ) {
		TooltipExample example = new TooltipExample();
		example.setBounds( 100, 100, 800, 800 );
		example.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		example.setVisible( true );
	}

	private CControl control;

	public TooltipExample() {
		setTitle( "I am a dialog" );
		control = new CControl( this );

		add( control.getContentArea() );
		
		CWorkingArea workingArea = control.createWorkingArea( "work" );
		
		CGrid grid = new CGrid( control );
		grid.add( 0, 0, 20, 100, new DefaultSingleCDockable( "outline", "Outline" ) );
		grid.add( 20, 0, 80, 100, workingArea );
		control.getContentArea().deploy( grid );
		
		CGrid work = new CGrid( control );
		work.add( 0, 0, 30, 30, new DefaultSingleCDockable( "details1", "Details 1" ) );
		work.add( 0, 30, 30, 30, new DefaultSingleCDockable( "details2", "Details 2" ) );
		work.add( 0, 60, 30, 30, new DefaultSingleCDockable( "details3", "Details 3" ) );
		workingArea.deploy( work );
	}
}

A solution that would enable you to switch between “simple” and “detailed” view at any time can be built with the help of perspectives:


import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.SingleCDockable;
import bibliothek.gui.dock.common.SingleCDockableFactory;
import bibliothek.gui.dock.common.perspective.CGridPerspective;
import bibliothek.gui.dock.common.perspective.CPerspective;
import bibliothek.gui.dock.common.perspective.CWorkingPerspective;
import bibliothek.gui.dock.common.perspective.SingleCDockablePerspective;

public class TooltipExample extends JFrame {
	public static void main( String[] args ) {
		TooltipExample example = new TooltipExample();
		example.setBounds( 100, 100, 800, 800 );
		example.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		example.setVisible( true );
	}

	private CControl control;

	public TooltipExample() {
		setTitle( "I am a dialog" );
		control = new CControl( this );

		add( control.getContentArea() );
		saveDetailed();
		saveSimple();

		control.addSingleDockableFactory(
				id -> id.startsWith( "details" ) || id.equals( "outline" ),
				id -> buildDockable(id) );

		control.addSingleDockableFactory(
				id -> id.equals( "work" ),
				id -> control.createWorkingArea( id ) );

		addMenu();
	}

	private void addMenu() {
		JMenuBar menuBar = new JMenuBar();
		JMenu menu = new JMenu( "Layout" );
		menuBar.add( menu );

		JMenuItem simple = new JMenuItem( "Simple" );
		simple.addActionListener( e -> switchToSimpleView() );

		JMenuItem details = new JMenuItem( "Details" );
		details.addActionListener( e -> switchToDetailedView() );

		menu.add( simple );
		menu.add( details );

		setJMenuBar( menuBar );
	}
	
	private SingleCDockable buildDockable(String id){
		DefaultSingleCDockable dockable = new DefaultSingleCDockable( id, id.substring( 0, 1 ).toUpperCase() + id.substring( 1 ) );
		dockable.add( new JScrollPane( new JTextArea() ) );
		return dockable;
	}

	private void switchToSimpleView() {
		control.load( "simple" );
	}

	private void saveSimple() {
		CPerspective perspective = control.getPerspectives().createEmptyPerspective();

		CWorkingPerspective workArea = new CWorkingPerspective( "work" );
		workArea.gridAdd( 0, 0, 100, 100, new SingleCDockablePerspective( "details1" ) );
		workArea.gridDeploy();

		CGridPerspective center = perspective.getContentArea().getCenter();
		center.gridAdd( 0, 0, 20, 100, new SingleCDockablePerspective( "outline" ) );
		center.gridAdd( 20, 0, 80, 100, workArea );
		center.gridDeploy();

		control.getPerspectives().setPerspective( "simple", perspective, true );
	}

	private void switchToDetailedView() {
		control.load( "details" );
	}

	private void saveDetailed() {
		CPerspective perspective = control.getPerspectives().createEmptyPerspective();

		CWorkingPerspective workArea = new CWorkingPerspective( "work" );
		workArea.gridAdd( 0, 0, 100, 30, new SingleCDockablePerspective( "details1" ) );
		workArea.gridAdd( 0, 30, 100, 30, new SingleCDockablePerspective( "details2" ) );
		workArea.gridAdd( 0, 60, 100, 30, new SingleCDockablePerspective( "details3" ) );
		workArea.gridDeploy();

		CGridPerspective center = perspective.getContentArea().getCenter();
		center.gridAdd( 0, 0, 20, 100, new SingleCDockablePerspective( "outline" ) );
		center.gridAdd( 20, 0, 80, 100, workArea );
		center.gridDeploy();

		control.getPerspectives().setPerspective( "details", perspective, true );
	}
}

Thanks. Did you build that with Java 8? (I only have Java 6 & 7.)

Anyway, I realized that my idea was off track. The blob dock would actually be 1 of 3 docks in the CWorkingArea (not 1 of 1). And I need the 2nd & 3rd docks to remain regardless if ‘blob’ or ‘detailed’ is selected.

So now my idea is to put docks within a dock. Is that possible? i.e. Have a dock called ‘flexible’.
(1) When the user clicks ‘blob’ then the contains of the flexible dock are removed and the ‘blob’ content is loaded.
(2) When the user clicks ‘detailed’ then the contains of the flexible dock are removed and 3 vertical docks are loaded into the flexible dock. Docks within a dock.

Can DF handle 3 vertical docks within a dock? If so, how do you do it? Or do you have any ideas?

Regards,
Roger

Yes I was using Java 8, because I really like lambda expressions :slight_smile:

If your „flexible“ Dockable is something like a CWorkingArea, or at least a DockStation, then your idea will be working. But if your „flexible“ is a something like a „DefaultSingleCDockable“ then the behavior could start to be very funny (because DockingFrames might not realize that some Dockables are parents of other Dockables).

You are certain you want Dockables within Dockables? It is like JTabbedPanes within JTabbedPanes: it might look very messy and complicated and not at all user friendly…

Hello Beni,

I did up some screen-shots for what I want to do.

Here is the JDialog with the ‘blob information’:

And here is the JDialog with the ‘detailed information’:

As you can see, when the user flips between blob or detailed, ‘Dock 02’ and ‘Dock 03’ need to be there. When the user is on ‘Detailed Info’ tab, it needs to show ‘Break 1’, ‘Break 2’ and ‘Break 3’ docks (i.e. breakdown of the details). If the user clicks on ‘Dock 02’ then only the components of ‘Dock 02’ are shown.

Does this makes sense? Can it be done? If so, do you have an example that works with Java 6 and/or 7 (non-lambda).

Regards,
Roger

Alright, I can basically post the same application again, this time with some additional settings to make the CWorkingArea more behaving like any other Dockable.

(I would have liked to attach a screenshot, but somehow this forum and my browser seem not to like each other)

I also found a little bug in the framework that will prevent you from stacking the CWorkingArea with the “outline” dockable - that will be fixed in the next release. Have a look at the example and please tell me, if that is going in the direction you want to go.


import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import bibliothek.extension.gui.dock.theme.EclipseTheme;
import bibliothek.gui.DockStation;
import bibliothek.gui.Dockable;
import bibliothek.gui.dock.StackDockStation;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CWorkingArea;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.SingleCDockable;
import bibliothek.gui.dock.common.SingleCDockableFactory;
import bibliothek.gui.dock.common.intern.CDockable;
import bibliothek.gui.dock.common.intern.CommonDockable;
import bibliothek.gui.dock.common.perspective.CGridPerspective;
import bibliothek.gui.dock.common.perspective.CPerspective;
import bibliothek.gui.dock.common.perspective.CWorkingPerspective;
import bibliothek.gui.dock.common.perspective.SingleCDockablePerspective;
import bibliothek.gui.dock.common.theme.ThemeMap;
import bibliothek.gui.dock.common.theme.eclipse.CommonEclipseThemeConnector;
import bibliothek.util.Filter;

public class TooltipExample2 extends JFrame {
	public static void main( String[] args ) {
		TooltipExample2 example = new TooltipExample2();
		example.setBounds( 100, 100, 800, 800 );
		example.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		example.setVisible( true );
	}

	private CControl control;

	public TooltipExample2() {
		setTitle( "I am a dialog" );
		control = new CControl( this );
		setupEclipseTheme();

		add( control.getContentArea() );
		saveDetailed();
		saveSimple();

		control.addSingleDockableFactory(
				singleDockableFilter(),
				buildDockable() );

		control.addSingleDockableFactory(
				workFilter(),
				createWorkingArea() );

		addMenu();
	}

	private void setupEclipseTheme() {
		control.setTheme( ThemeMap.KEY_ECLIPSE_THEME );

		// without a customized theme connector the tab (title) for out CWorkingArea would not show up
		control.putProperty( EclipseTheme.THEME_CONNECTOR, new CommonEclipseThemeConnector( control ) {
			@Override
			public TitleBar getTitleBarKind( DockStation parent, Dockable dockable ) {
				if( dockable instanceof CommonDockable ) {
					CDockable cdockable = ((CommonDockable) dockable).getDockable();
					if( cdockable instanceof SingleCDockable ) {
						if( ((SingleCDockable) cdockable).getUniqueId().equals( "work" ) ) {
							if( !(parent instanceof StackDockStation) ) {
								return TitleBar.ECLIPSE;
							}
						}
					}
				}
				return super.getTitleBarKind( parent, dockable );
			}
		} );
	}

	private Filter<String> singleDockableFilter() {
		return new Filter<String>() {
			@Override
			public boolean includes( String id ) {
				return id.startsWith( "details" ) || id.equals( "outline" );
			}
		};
	}

	private SingleCDockableFactory buildDockable() {
		return new SingleCDockableFactory() {
			@Override
			public SingleCDockable createBackup( String id ) {
				return buildDockable( id );
			}
		};
	}

	private Filter<String> workFilter() {
		return new Filter<String>() {
			@Override
			public boolean includes( String id ) {
				return id.equals( "work" );
			}
		};
	}

	private SingleCDockableFactory createWorkingArea() {
		return new SingleCDockableFactory() {
			@Override
			public SingleCDockable createBackup( String id ) {
				CWorkingArea area = new CWorkingArea( control, id ) {
					// overriding these values is a bit dangerous and out of warranty ;-)
					// (that's why there is no setter for these values)

					@Override
					public boolean isStackable() {
						return true;
					}

					@Override
					public boolean isMinimizable() {
						return true;
					}

					@Override
					public boolean isMaximizable() {
						return true;
					}

					@Override
					public boolean isExternalizable() {
						return true;
					}
				};
				control.addStation( area, true );
				area.setTitleShown( true );
				area.setTitleText( "Blop" );
				area.setSingleTabShown( true );

				return area;
			}
		};
	}

	private void addMenu() {
		JMenuBar menuBar = new JMenuBar();
		JMenu menu = new JMenu( "Layout" );
		menuBar.add( menu );

		JMenuItem simple = new JMenuItem( "Simple" );
		simple.addActionListener( e -> switchToSimpleView() );

		JMenuItem details = new JMenuItem( "Details" );
		details.addActionListener( e -> switchToDetailedView() );

		menu.add( simple );
		menu.add( details );

		setJMenuBar( menuBar );
	}

	private SingleCDockable buildDockable( String id ) {
		DefaultSingleCDockable dockable = new DefaultSingleCDockable( id, id.substring( 0, 1 ).toUpperCase() + id.substring( 1 ) );
		dockable.add( new JScrollPane( new JTextArea() ) );
		return dockable;
	}

	private void switchToSimpleView() {
		control.load( "simple" );
	}

	private void saveSimple() {
		CPerspective perspective = control.getPerspectives().createEmptyPerspective();

		CWorkingPerspective workArea = new CWorkingPerspective( "work" );
		workArea.gridAdd( 0, 0, 100, 100, new SingleCDockablePerspective( "details1" ) );
		workArea.gridDeploy();

		CGridPerspective center = perspective.getContentArea().getCenter();
		center.gridAdd( 0, 0, 20, 100, new SingleCDockablePerspective( "outline" ) );
		center.gridAdd( 20, 0, 80, 100, workArea );
		center.gridDeploy();

		control.getPerspectives().setPerspective( "simple", perspective, true );
	}

	private void switchToDetailedView() {
		control.load( "details" );
	}

	private void saveDetailed() {
		CPerspective perspective = control.getPerspectives().createEmptyPerspective();

		CWorkingPerspective workArea = new CWorkingPerspective( "work" );
		workArea.gridAdd( 0, 0, 100, 30, new SingleCDockablePerspective( "details1" ) );
		workArea.gridAdd( 0, 30, 100, 30, new SingleCDockablePerspective( "details2" ) );
		workArea.gridAdd( 0, 60, 100, 30, new SingleCDockablePerspective( "details3" ) );
		workArea.gridDeploy();

		CGridPerspective center = perspective.getContentArea().getCenter();
		center.gridAdd( 0, 0, 20, 100, new SingleCDockablePerspective( "outline" ) );
		center.gridAdd( 20, 0, 80, 100, workArea );
		center.gridDeploy();

		control.getPerspectives().setPerspective( "details", perspective, true );
	}
}

Hello Beni,

Wow. That’s about 90% of what I was talking about.

I have been playing around with it for awhile trying to make some adjustments but I’m stumped.

First, if you look closely at those 2 screen-shots, you will see ‘Dock 02’ and ‘Dock 03’, next to the ‘Blob’ dock (not Blop). I tried using your ‘buildDockable(“Dock-02”)’ method in the createWorkingArea() but that didn’t work then I tried adding it in saveSimple() & saveDetailed() methods but failed again.

Secondly, in the saveSimple() method, I don’t need ‘details1’ dock but rather just a JTextArea for the entire ‘Blob’ dock. I can’t figure out how to add a component to it.

Finally, can you explain the purpose of the Filters. I don’t get it. In the constructor you have:

control.addSingleDockableFactory(singleDockableFilter(), buildDockable() );
control.addSingleDockableFactory(workFilter(), createWorkingArea() );

I don’t understand why you used the filters.

Regards,
Roger

Hello Beni,

I forgot to mention that ‘Dock 02’ and ‘Dock 03’ are regular docks with a simple component like JTextArea

Regards,
Roger

Adding a JTextArea directly to „blob“ was not possible, because „blob“ is a CWorkingArea and hence only supports Dockables as children. I think the most easiest solution is to replace „Blob“ with a normal Dockable whenever only the text-are should be visible. The method „setLocationAside“ helps a lot, as it allows to place a new Dockable at the same location as an old Dockable. (See the example below).

In the old example I was using some CPerspectives. Perspectives are like a wrapper around the xml-file that usually store the layout of an application. In a perspective one can only add identifiers, that will later be mapped to real Dockable-Objects. The filters and the factories tell the framework how to do the mapping - and what to do if the real Dockable-Object is missing (create it). I guess you missed to adapt the filters, and hence the unknown identifiers were simply dropped?

I will upload version 1.1.2p17a which contains a bugfix that is needed to run the example below :frowning:


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import bibliothek.extension.gui.dock.theme.EclipseTheme;
import bibliothek.gui.DockStation;
import bibliothek.gui.Dockable;
import bibliothek.gui.dock.StackDockStation;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CGrid;
import bibliothek.gui.dock.common.CLocation;
import bibliothek.gui.dock.common.CWorkingArea;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.SingleCDockable;
import bibliothek.gui.dock.common.SingleCDockableFactory;
import bibliothek.gui.dock.common.intern.CDockable;
import bibliothek.gui.dock.common.intern.CommonDockable;
import bibliothek.gui.dock.common.perspective.CGridPerspective;
import bibliothek.gui.dock.common.perspective.CPerspective;
import bibliothek.gui.dock.common.perspective.CWorkingPerspective;
import bibliothek.gui.dock.common.perspective.SingleCDockablePerspective;
import bibliothek.gui.dock.common.theme.ThemeMap;
import bibliothek.gui.dock.common.theme.eclipse.CommonEclipseThemeConnector;
import bibliothek.util.Filter;
import tutorial.support.ColorSingleCDockable;

public class BlobExample extends JFrame {
	public static void main( String[] args ) {
		BlobExample example = new BlobExample();
		example.setBounds( 100, 100, 800, 800 );
		example.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		example.setVisible( true );
	}

	private CControl control;

	private SingleCDockable blobInfo;
	private SingleCDockable detailedInfo;

	public BlobExample() {
		setTitle( "I am a dialog" );
		control = new CControl( this );
		setupEclipseTheme();

		add( control.getContentArea() );

		createInitialLayout();

		addMenu();
	}

	private void setupEclipseTheme() {
		control.setTheme( ThemeMap.KEY_ECLIPSE_THEME );

		// without a customized theme connector the tab (title) for out CWorkingArea would not show up
		control.putProperty( EclipseTheme.THEME_CONNECTOR, new CommonEclipseThemeConnector( control ) {
			@Override
			public TitleBar getTitleBarKind( DockStation parent, Dockable dockable ) {
				if( dockable instanceof CommonDockable ) {
					CDockable cdockable = ((CommonDockable) dockable).getDockable();
					if( cdockable instanceof SingleCDockable ) {
						if( ((SingleCDockable) cdockable).getUniqueId().equals( "blob" ) ) {
							if( !(parent instanceof StackDockStation) ) {
								return TitleBar.ECLIPSE;
							}
						}
					}
				}
				return super.getTitleBarKind( parent, dockable );
			}
		} );
	}

	private void addMenu() {
		JMenuBar menuBar = new JMenuBar();
		JMenu menu = new JMenu( "Layout" );
		menuBar.add( menu );

		JMenuItem simple = new JMenuItem( "Simple" );
		simple.addActionListener( new ActionListener() {

			@Override
			public void actionPerformed( ActionEvent e ) {
				switchToSimpleView();
			}
		} );

		JMenuItem details = new JMenuItem( "Details" );
		details.addActionListener( new ActionListener() {

			@Override
			public void actionPerformed( ActionEvent e ) {
				switchToDetailedView();
			}
		} );

		menu.add( simple );
		menu.add( details );

		setJMenuBar( menuBar );
	}

	private void switchToDetailedView() {
		if( detailedInfo.isVisible() ) {
			blobInfo.setLocationsAside( detailedInfo );
		}
		detailedInfo.setVisible( false );
		blobInfo.setVisible( true );
	}

	private void switchToSimpleView() {
		if( blobInfo.isVisible() ) {
			detailedInfo.setLocationsAside( blobInfo );
		}
		blobInfo.setVisible( false );
		detailedInfo.setVisible( true );
	}

	private void createInitialLayout() {
		// do not show 'blobInfo' yet
		blobInfo = buildBlobInfo();
		control.addDockable( blobInfo );
		blobInfo.setLocation( CLocation.base().normalWest( 0.25 ) );

		// do not show 'details' yet
		detailedInfo = buildDockable( "Details" );
		control.addDockable( detailedInfo );
		detailedInfo.setLocation( CLocation.base().normalWest( 0.25 ) );

		SingleCDockable dock2 = buildDockable( "Dock 02" );
		SingleCDockable dock3 = buildDockable( "Dock 03" );

		CGrid grid = new CGrid( control );
		grid.add( 0, 0, 10, 10, dock2 );
		grid.add( 10, 0, 10, 10, dock3 );
		control.getContentArea().deploy( grid );
	}

	private SingleCDockable buildBlobInfo() {
		CWorkingArea area = new CWorkingArea( control, "blob" ) {
			// overriding these values is a bit dangerous and out of warranty ;-)
			// (that's why there is no setter for these values)

			@Override
			public boolean isStackable() {
				return true;
			}

			@Override
			public boolean isMinimizable() {
				return true;
			}

			@Override
			public boolean isMaximizable() {
				return true;
			}

			@Override
			public boolean isExternalizable() {
				return true;
			}
		};
		control.addStation( area, true );
		area.setTitleShown( true );
		area.setTitleText( "Blob" ); // repaired :-)
		area.setSingleTabShown( true );

		CGrid grid = new CGrid( control );
		grid.add( 0, 0, 100, 20, buildDockable( "Break 1" ) );
		grid.add( 0, 20, 100, 20, buildDockable( "Break 2" ) );
		grid.add( 0, 40, 100, 20, buildDockable( "Break 3" ) );
		area.deploy( grid );

		return area;
	}

	private SingleCDockable buildDockable( String id ) {
		DefaultSingleCDockable dockable = new DefaultSingleCDockable( id, id.substring( 0, 1 ).toUpperCase() + id.substring( 1 ) );
		dockable.add( new JScrollPane( new JTextArea() ) );
		return dockable;
	}
}

Hello Beni,

Thanks. I tried it out with v1.1.2p17a.

I think I found a bug. Try the following:

  • Start BlobExample and click Layout -> Simple. The ‘Details’ dock is inserted into the left side of the JFrame. Exit the BlobExample

  • Start BlobExample and click Layout -> Details. The ‘Blob’ dock is add to the grid after ‘Dock 03’. This is different result.

The code for both looks exactly the same but the function totally different.

Also, another weird issue. I wanted the JFrame to start with the detail view. So I updated the code and added switchToDetailedView() method to the createInitialLayout() method. But it appears the deploy grid call erases it or throws it away.
i.e.

private void createInitialLayout()
{
   // do not show 'blobInfo' yet
   blobInfo = buildBlobInfo();
   control.addDockable( blobInfo );
   blobInfo.setLocation( CLocation.base().normalWest( 0.25 ) );

   // do not show 'details' yet
   detailedInfo = buildDockable( "Details" );
   control.addDockable( detailedInfo );
   detailedInfo.setLocation( CLocation.base().normalWest( 0.25 ) );

   switchToDetailedView();  // Start with detailed dock showing

   SingleCDockable dock2 = buildDockable( "Dock 02" );
   SingleCDockable dock3 = buildDockable( "Dock 03" );

   CGrid grid = new CGrid( control );
   grid.add( 0, 0, 10, 10, dock2 );
   grid.add( 0, 0, 10, 10, dock3 );  // put them together

   control.getContentArea().deploy( grid );
}

Regards,
Roger

About “deploy”. Yes, deploy does erase anything that is on the “content area” - because the goal of the method is to “replace the current layout”. Just move your call to “switchToDetailedView” a bit further down.

About the bug. You are right, there is a bug. A bug that I hopefully have fixed in 1.1.2p17b (it’s already on the website), but the code is tricky there. I hope I did not break something else…

(Because the CWorkingArea is registered as station, it is always “visible”. And when “setLocation” was called the framework immediately tried to apply the new location. But since the CWorkingArea had no parent the location could not be set, and was silently thrown away. The new behavior for stations such as a CWorkingArea is not to apply a new location if there is no parent. Sounds complicated, but should be correct)

Hello Beni,

Yes, version 1.1.2p17b appears to have fixed the issue.

Humm. How do I get all 3 docks (‘Blob’, ’ Dock 02’ & ‘Dock 03’) to be in the same area? When I start BlobExample, then click Layout -> Details it has 2 areas. I can move ’ Dock 02’ & ‘Dock 03’ into the area that ‘Blob’ resides then it looks how I want it.

Here is how it looks now when you click Layout -> Details

And here is how I want it to look (without requiring the user to drag ’ Dock 02’ & ‘Dock 03’ to ‘Blob’ area):

Maybe I’m not using the correct DF terminology but have a look at the screen-shots to see what I mean.

Regards,
Roger