Java Code Examples for org.eclipse.swt.widgets.Table.setHeaderVisible()

The following are Jave code examples for showing how to use setHeaderVisible() of the org.eclipse.swt.widgets.Table class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: n4js   File: TableViewerBuilder.java   View Source Code Vote up 6 votes
@Override
protected TableViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout, final int style) {
	final TableViewer viewer = new TableViewer(parent, style);
	final Table table = viewer.getTable();
	table.setLinesVisible(linesVisible);
	table.setHeaderVisible(headerVisible);

	int columnIndex = 0;
	for (final String columnLabel : columnLabels) {

		final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, NONE);
		final TableColumn column = viewerColumn.getColumn();
		columnLayout.setColumnData(column, createColumnLayoutData(columnIndex));
		column.setText(columnLabel);
		column.setMoveable(moveable);

		columnIndex++;
	}

	return viewer;
}
 
Example 2
Project: eZooKeeper   File: DataModelFormPage.java   View Source Code Vote up 6 votes
protected Section createTableSection(ScrolledForm form, Composite client, FormToolkit toolkit, String title,
        Image image, int sectionStyle, int tableStyle, String[] columnTitles, int[] columnAlignments) {

    Section section = createSection(form, client, toolkit, title, image, sectionStyle);
    Table table = toolkit.createTable(section, tableStyle);

    for (int i = 0; i < columnTitles.length; i++) {
        TableColumn column = new TableColumn(table, SWT.NONE);
        column.setText(columnTitles[i]);
        column.setAlignment(columnAlignments[i]);
    }

    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    section.setClient(table);

    return section;
}
 
Example 3
Project: eZooKeeper   File: BaseZnodeModelTableFormPage.java   View Source Code Vote up 6 votes
protected void createTableColumns() {
    Table table = getTable();
    if (table == null) {
        return;
    }

    String[] titles = getTableColumnTitles();
    if (titles != null && titles.length > 0) {

        int[] columnAlignments = getTableColumnAlignments();

        for (int i = 0; i < titles.length; i++) {
            TableColumn column = new TableColumn(table, SWT.NONE);
            column.setText(titles[i]);

            if (columnAlignments != null) {
                column.setAlignment(columnAlignments[i]);
            }
        }

        table.setHeaderVisible(true);
    }
}
 
Example 4
Project: eZooKeeper   File: ViewerFactory.java   View Source Code Vote up 5 votes
private static void createTableColumns(Table table, IElementType tableElementType) {

        String[] columnTitles = tableElementType.getColumnTitles();
        int[] columnAlignments = tableElementType.getColumnAlignments();

        for (int i = 0; i < columnTitles.length; i++) {
            TableColumn column = new TableColumn(table, SWT.NONE);
            column.setText(columnTitles[i]);
            column.setAlignment(columnAlignments[i]);
            column.setMoveable(true);
        }

        table.setHeaderVisible(true);
    }
 
Example 5
Project: convertigo-eclipse   File: ArrayEditorComposite.java   View Source Code Vote up 5 votes
/**
 * This method initializes table	
 *
 */
private void createTable() {
	int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | 
	SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
	
	table = new Table(this, style);
	
	GridData gridData = new GridData(GridData.FILL_BOTH);
	gridData.grabExcessVerticalSpace = true;
	gridData.horizontalSpan = 3;
	table.setLayoutData(gridData);		
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
}
 
Example 6
Project: convertigo-eclipse   File: TableEditorComposite.java   View Source Code Vote up 5 votes
/**
 * This method initializes table	
 *
 */
private void createTable() {
	int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | 
	SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
	
	table = new Table(this, style);
	
	GridData gridData = new GridData(GridData.FILL_BOTH);
	gridData.grabExcessVerticalSpace = true;
	gridData.horizontalSpan = 3;
	table.setLayoutData(gridData);		
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
}
 
Example 7
Project: convertigo-eclipse   File: XMLTableWizardPage.java   View Source Code Vote up 5 votes
private void createTable(Composite parent) {
	GridData gridData = new GridData();
	gridData.horizontalSpan = numColumns;
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	gridData.grabExcessVerticalSpace = true;
	gridData.verticalAlignment = GridData.FILL;
	table = new Table(parent, SWT.VIRTUAL | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	table.setLayoutData(gridData);
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
}
 
Example 8
Project: convertigo-eclipse   File: SqlConnectorComposite.java   View Source Code Vote up 5 votes
private void createTable() {
	GridData gridData = new org.eclipse.swt.layout.GridData();
	gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	gridData.grabExcessVerticalSpace = true;
	gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
	table = new Table(this, SWT.VIRTUAL | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	table.setLayoutData(gridData);
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
}
 
Example 9
Project: Hydrograph   File: WidgetUtility.java   View Source Code Vote up 5 votes
/**
 * Creates the table columns.
 * 
 * @param table
 *            the table
 * @param fields
 *            the fields
 */
public static void createTableColumns(Table table,String[] fields){
	for (String field : fields) {
		TableColumn tc = new TableColumn(table, SWT.CENTER);
		tc.setText(field);
		tc.setMoveable(true);
	}
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
}
 
Example 10
Project: Hydrograph   File: ELTSWTWidgets.java   View Source Code Vote up 5 votes
public TableViewer createTableViewer(Composite composite, String[] prop,
		int[] bounds, int columnWidth,
		IStructuredContentProvider iStructuredContentProvider,
		ITableLabelProvider iTableLabelProvider) {
	final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER
			| SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);

	Table table = tableViewer.getTable();
	table.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
	tableViewer.setContentProvider(iStructuredContentProvider);
	tableViewer.setLabelProvider(iTableLabelProvider);
	tableViewer.setColumnProperties(prop);
	tableViewer.getTable().addTraverseListener(new TraverseListener() {

		@Override
		public void keyTraversed(TraverseEvent e) {
			if (e.keyCode == SWT.ARROW_UP) {
				e.doit = false;
			} else if (e.keyCode == SWT.ARROW_DOWN) {
				e.doit = false;
			} else if (e.keyCode == SWT.TRAVERSE_ARROW_NEXT) {
				e.doit = false;
			} else if (e.keyCode == SWT.TRAVERSE_ARROW_PREVIOUS) {
				e.doit = false;
			}

		}
	});

	table.setVisible(true);
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
	/*
	 * createTableColumns(table,prop, columnWidth); CellEditor[] editors
	 * =createCellEditorList(table,1); tableViewer.setCellEditors(editors);
	 */

	return tableViewer;
}
 
Example 11
Project: Hydrograph   File: ELTSWTWidgets.java   View Source Code Vote up 5 votes
public void createTableColumns(Table table, String[] fields, int width) {
	for (String field : fields) {
		TableColumn tableColumn = new TableColumn(table, SWT.LEFT);
		tableColumn.setText(field);
		tableColumn.setWidth(width);
		// tableColumn.pack();
	}
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

}
 
Example 12
Project: Hydrograph   File: SchemaPreviewPage.java   View Source Code Vote up 5 votes
@Override
public void createControl(Composite parent) {
	container = new Composite(parent, SWT.NONE);
	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
			
	setControl(container);
	container.setLayout(new GridLayout(1, false));
	
	grpSchemaPreview = new Group(container, SWT.NONE);
	grpSchemaPreview.setText(SCHEMA_PREVIEW);
	grpSchemaPreview.setLayout(new GridLayout(1, false));
	grpSchemaPreview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	
	composite = new Composite(grpSchemaPreview, SWT.NONE);
	composite.setLayout(new GridLayout(1, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	
	availableFieldTableViewer=new TableViewer(composite,SWT.BORDER);
	
	TableViewerColumn availableFieldsColumn = new TableViewerColumn(availableFieldTableViewer, SWT.NONE);
	availableFieldsColumn.setLabelProvider(new AvailableFieldsColumnLabelProvider());
	TableColumn tableColumn = availableFieldsColumn.getColumn();
	tableColumn.setText(AVAILABLE_FIELDS);
	
	Table table=availableFieldTableViewer.getTable();
	table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
	addControlListener(table, tableColumn);
   }
 
Example 13
Project: Hydrograph   File: ELTOperationClassDialog.java   View Source Code Vote up 5 votes
public static void createTableColumns(Table table, String[] fields) {
	for (String field : fields) {
		TableColumn tableColumn = new TableColumn(table, SWT.FILL);
		tableColumn.setText(field);

		tableColumn.setWidth(100);
		tableColumn.pack();
	}
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
}
 
Example 14
Project: Hydrograph   File: JoinMapDialog.java   View Source Code Vote up 5 votes
private Table createMappingTable(Composite composite_6) {
	mappingTableViewer = new TableViewer(composite_6, SWT.BORDER
			| SWT.FULL_SELECTION | SWT.MULTI);
	Table table = mappingTableViewer.getTable();
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
	GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	gd_table.widthHint = 374;
	table.setLayoutData(gd_table);
	mappingTableViewer.setContentProvider(new ArrayContentProvider());
	ColumnViewerToolTipSupport.enableFor(mappingTableViewer);
	return table;
}
 
Example 15
Project: Hydrograph   File: LookupMapDialog.java   View Source Code Vote up 5 votes
private Table createMappingTable(Composite composite_6) {
	mappingTableViewer = new TableViewer(composite_6, SWT.BORDER
			| SWT.FULL_SELECTION | SWT.MULTI);
	Table table = mappingTableViewer.getTable();
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
	GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	gd_table.widthHint = 374;
	table.setLayoutData(gd_table);
	mappingTableViewer.setContentProvider(new ArrayContentProvider());
	ColumnViewerToolTipSupport.enableFor(mappingTableViewer);
	return table;
}
 
Example 16
Project: Hydrograph   File: SecondaryColumnKeysDialog.java   View Source Code Vote up 5 votes
private void createSourceTable(Composite composite_2) {
	sourceTable = new Table(composite_2, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
	sourceTable.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseDoubleClick(MouseEvent e) {
			if(sourceTable.getSelection().length==1){
				addNewProperty(targetTableViewer, sourceTable.getSelection()[0].getText());
				enableControlButtons();
			}
		}
	});
	GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
	gd_table.widthHint = 221;
	gd_table.heightHint = 407;
	sourceTable.setLayoutData(gd_table);
	sourceTable.setHeaderVisible(true);
	sourceTable.setLinesVisible(true);

	TableColumn sourceTableColumnFieldName = new TableColumn(sourceTable, SWT.LEFT);
	if(OSValidator.isMac()){
		sourceTableColumnFieldName.setWidth(212);
	}else{
		sourceTableColumnFieldName.setWidth(202);
	}
	
	sourceTableColumnFieldName.setText(Messages.AVAILABLE_FIELDS_HEADER);
	getSourceFieldsFromPropagatedSchema(sourceTable);
	dragSource = new DragSource(sourceTable, DND.DROP_MOVE);
	dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() });
	dragSource.addDragListener(new DragSourceAdapter() {
		public void dragSetData(DragSourceEvent event) {
			// Set the data to be the first selected item's text
			event.data = formatDataToTransfer(sourceTable.getSelection());
		}

	});
}
 
Example 17
Project: Hydrograph   File: TransformDialog.java   View Source Code Vote up 5 votes
public static void createTableColumns(Table table, String[] fields) {
	for (String field : fields) {
		TableColumn tableColumn = new TableColumn(table, SWT.LEFT);
		tableColumn.setText(field);

		tableColumn.setWidth(100);
		tableColumn.pack();
	}
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
}
 
Example 18
Project: Hydrograph   File: DebugDataWizard.java   View Source Code Vote up 5 votes
private void createTableColumns(Table table, String[] fields, int width) {
	for (String field : fields) {
		TableColumn tableColumn = new TableColumn(table, SWT.LEFT|SWT.BOLD);
		tableColumn.setText(field);
		tableColumn.setWidth(width);
	}
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

}
 
Example 19
Project: visuflow-plugin   File: ResultView.java   View Source Code Vote up 5 votes
private void createViewer(Composite parent) {
	viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.CHECK | SWT.READ_ONLY | SWT.PUSH);
	createColumns(parent, viewer);
	final Table table = viewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

	viewer.getTable().addListener(SWT.Selection, new Listener() {

		@Override
		public void handleEvent(org.eclipse.swt.widgets.Event event) {
			if (highlightNodes.getSelection())
				highlightNodesOnGraph(highlightNodes.getSelection());
		}
	});

	viewer.setContentProvider(new ArrayContentProvider());
	viewer.setInput(this.units);
	getSite().setSelectionProvider(viewer);

	GridData gridData = new GridData();
	gridData.verticalAlignment = GridData.FILL;
	gridData.horizontalSpan = 2;
	gridData.grabExcessHorizontalSpace = true;
	gridData.grabExcessVerticalSpace = true;
	gridData.horizontalAlignment = GridData.FILL;
	viewer.getControl().setLayoutData(gridData);

	Hashtable<String, Object> properties = new Hashtable<>();
	String[] topics = new String[] { DataModel.EA_TOPIC_DATA_SELECTION, DataModel.EA_TOPIC_DATA_UNIT_CHANGED, DataModel.EA_TOPIC_DATA_VIEW_REFRESH };
	properties.put(EventConstants.EVENT_TOPIC, topics);
	ServiceUtil.registerService(EventHandler.class, this, properties);

}
 
Example 20
Project: Hydrograph   File: ViewDataUniqueIdDialog.java   View Source Code Vote up 4 votes
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.getShell().setText("ViewData Execution History");
	container.setLayout(new GridLayout(1, false));
	
	
	Composite composite1 = new Composite(container, SWT.BORDER);
	GridData gd_scrolledComposite1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_scrolledComposite1.heightHint = 236;
	gd_scrolledComposite1.widthHint = 844;
	composite1.setLayoutData(gd_scrolledComposite1);
	
	table = new Table(composite1, SWT.BORDER | SWT.Selection | SWT.FULL_SELECTION );
	table.setBounds(0, 0, 842, 234);
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
	
    for (int i = 0; i < titles.length; i++) {
      TableColumn column = new TableColumn(table, SWT.NONE);
      column.setWidth(212);
      column.setText(titles[i]);
    }
	
    jobDetails.sort((job1, job2)-> job2.getUniqueJobID().compareTo(job1.getUniqueJobID()));
    
    for(JobDetails job : jobDetails){
   		String timeStamp = getTimeStamp(job.getUniqueJobID());
   		TableItem items = new TableItem(table, SWT.None);
   		items.setText(0, job.getUniqueJobID());
   		items.setText(1, timeStamp);
   		String mode = getJobExecutionMode(job.isRemote());
   		items.setText(2, mode);
   		items.setText(3, job.getJobStatus());
    }
    
    table.addListener(SWT.Selection, new Listener() {
		@Override
		public void handleEvent(Event event) {
			TableItem[] item = table.getSelection();
			 for (int i = 0; i < item.length; i++){
				 TableItem selectedItem = item[i];
				 selectedUniqueJobId = selectedItem.getText();
		      }
		}
	});
	return super.createDialogArea(parent);
}