Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Viewer for collection of text fields
Viewer for collection of text fields [message #466098] Sun, 01 January 2006 01:51 Go to next message
Timothy Vogel is currently offline Timothy VogelFriend
Messages: 82
Registered: July 2009
Member
I'm new to SWT / Jface. I like the JFace viewers for the more complicated
widgets but don't see one for a simple case.

On one page of a multi-page editor, I display a class in a TableViewer and
have created a label provider and a content provider. On another page, I
display the same class as a series of 6 text fields. These correspond to
the six editable attributes on the class.

I want to reuse the content and label providers that I created for the
TableViewer on this second page. The only way I can think to accomplish
this is to create my own viewer inherieted from ContentViewer.

Is there a better way? Has this already been solved? What is a typical
approach for a viewer for a collection of text widgets?

Thanks for taking the time to read my post!
Timothy Vogel
Re: Viewer for collection of text fields [message #466100 is a reply to message #466098] Sun, 01 January 2006 12:05 Go to previous message
venkataramana m is currently offline venkataramana mFriend
Messages: 86
Registered: July 2009
Member
To reuse content and label providers, I can look at that as abstracting view-model to a TableViewer. But then view-model datastructures might need to be specific to the application. So you will end up in the same thing but delegated to view-model instead...I mean something like this ...
class TableInput
{
	TableRow[] fRows;

	public TableRow[] getRows() {
		return fRows;
	}
}

abstract class TableRow
{	
	public abstract String getColumnText(int column);

	...
	...
}

class TableCP implements IStructuredContentProvider
{
	public Object[] getElements(Object inputElement) {
		return ((TableInput)inputElement).getRows();
	}
	..
	..
}

class TableLP implements ITableLabelProvider
{
	public String getColumnText(Object element, int columnIndex) {
		return ((TableRow)element).getColumnText(columnIndex);
	}	
}


Thanks
~Venkat
Previous Topic:What can shell.pack() do ?
Next Topic:is this a tableTree bug?
Goto Forum:
  


Current Time: Thu Mar 28 23:00:17 GMT 2024

Powered by FUDForum. Page generated in 0.05655 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top