srk
srk

Reputation: 5126

Dynamic loading of Components in SWT

I'm working on an RCP application wherein my view has two components named composite 1 and composite 2 which are part of parent composite ofcourse

I've placed composites side by side using gridLayout 2 columns of equal size.Below is snapshot of this enter image description here

indeed as shown in the figure, i wish to load/add some new components(technically widgets) in the composite 2 on right dynamically, based upon user actions performed on links in composite1.

Like for example link1 should apply a layout(Borderlayout) & add a label in composite2 link2 some other layout(rowLayout) and text in composite2

Similarly each link out there has to apply different styles to composite2, My workaround includes the following, for each listener of links over there, i have added the respective code that disposes children of the composite2 if it's(composite2) not null.

I'm looking for an ideas & what's the better and smart programming practice to write amicable code in such a scenario. Any snippets ?

Upvotes: 0

Views: 1362

Answers (2)

Tom Seidel
Tom Seidel

Reputation: 9535

Your scenrao is the standard-scenario for Master-Details Sections in Eclipse Forms, for details see http://www.eclipse.org/articles/Article-Forms/article.html.

In general: Your approach is not bad ui-design, but a typical master-detail view. There is no need to use two views, your approach is fine and the Master-Details-Implementation provided by the Eclipse forms gives you an idea how to implement it.

Upvotes: 1

Kai
Kai

Reputation: 39631

In most cases this is bad UI design.

If you want to provide actions to the user dependent on the selection you should either do this by menu items or commands which you enable/disable regarding to the selection. Or if you want to display more complex data accordingly to the user selection you should use a second view.

Upvotes: 1

Related Questions