private void showSearchDialog( final String jid ) {
UserSearch userSearch = new UserSearch();
try {
Form form = userSearch.getSearchForm( parent.getJavwerManager().getConnection(), jid );
Form request = JavwerManager.displayForm( parent.getDisplay(), form );
ReportedData result = userSearch.sendSearchForm( parent.getJavwerManager().getConnection(), request, jid );
if( result != null ) {
Shell resultShell = new Shell( parent.getDisplay() );
if( result.getTitle() != null )
resultShell.setText( result.getTitle() );
resultShell.setLayout( new FillLayout() );
final Table table = new Table( resultShell, SWT.SINGLE );
table.setHeaderVisible( true );
for( Iterator i = result.getColumns(); i.hasNext(); ) {
ReportedData.Column dataColumn = (ReportedData.Column) i.next();
final TableColumn tableColumn = new TableColumn( table, SWT.LEFT );
if( dataColumn.getLabel() != null )
tableColumn.setText( dataColumn.getLabel() );
else
tableColumn.setText( "blubb" );
tableColumn.setWidth( 100 );
tableColumn.setResizable( true );
tableColumn.setMoveable( true );
/*
tableColumn.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent ev ) {
table.setSortColumn( tableColumn );
table.setSortDirection( SWT.DOWN );
TableItem items[] = table.getItems();
Arrays.sort( items, new Comparator<TableItem>() {
public int compare( TableItem o1, TableItem o2 ) {
int col = 0;
for( int i = 0; i < table.getColumnCount(); i++ )
if( table.getSortColumn().equals( table.getColumn( i ) ) )
col = i;
return o1.getText( col ).compareTo( o2.getText( col ) );
}
} );
for( int i = 0; i < items.length; i++ ) {
items[ i ].set
}
}
});
*/
}
for( Iterator i = result.getRows(); i.hasNext(); ) {
ReportedData.Row dataRow = (ReportedData.Row) i.next();
TableItem tableItem = new TableItem( table, SWT.NONE );
//int x = 0;
for( int x = 0; x < table.getColumnCount(); x++ ) {
String text = (String) dataRow.getValues( table.getColumn( x ).getText() ).next();