PShelf Widget in Eclipse

PShelf Widget is really cool, if you want to implement a kind of Accordion widget in Eclipse. The Accordion widget is been gaining popularity in the end user community, especially with the AJAX and SOA presence.

Currently for simple implementations it looks quite stable. I had no problems till now. I have no idea when this project nebula is going to get integrated, but i am looking forward to it.

One good thing about this widget is that we can increase or decrease the time delay in the shelf roll-out. It also gives a very smooth transition from shelf to shelf. Can be very easily embedded into a View.

I am just adding a small snippet for the PShelf usage in a View. Hope this helps. Also this widget library it self is very very small, so you can include it very easily.

public void createPartControl(Composite parent) {
/* Create a grid layout object so the text and treeviewer
* are layed out the way I want. */
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.verticalSpacing = 2;
layout.marginWidth = 0;
layout.marginHeight = 2;
text = new Text(parent, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER);
// layout the text field above the treeviewer
GridData layoutData = new GridData();
layoutData.grabExcessHorizontalSpace = true;
layoutData.horizontalAlignment = GridData.FILL;
PShelf shelf = new PShelf(parent, SWT.BORDER);
PShelfItem shelfGroup1 = new PShelfItem(shelf, SWT.NONE);
shelfGroup1.setText("Group 1");
shelfGroup1.getBody().setLayout(new FillLayout());
Table componentTable = new Table(shelfGroup1.getBody(), SWT.NONE);
createTableItem(componentTable, "Item11");
PShelfItem shelfGroup2 = new PShelfItem(shelf, SWT.NONE);
shelfGroup2.setText("Group 2");
shelfGroup2.getBody().setLayout(new FillLayout());
Table containerTable = new Table(shelfGroup2.getBody(), SWT.NONE);
createTableItem(containerTable, "Item21");
PShelfItem shelfGroup3 = new PShelfItem(shelf, SWT.NONE);
shelfGroup3.setText("Group 3");
shelfGroup3.getBody().setLayout(new FillLayout());
Table advancedWidgets = new Table(shelfGroup3.getBody(), SWT.NONE);
createTableItem(advancedWidgets, "Item31");
GridData shelfLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);

This entry was posted in eclipse. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *