blob: 3241019734003b8f53b8851bde00e61a5ed198f6 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.app.parts;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.nebula.widgets.nattable.extension.e4.E4NatTableConfiguration;
import org.eclipse.nebula.widgets.nattable.renderer.swt.NatTable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
public class SamplePart {
private Label label;
private NatTable natTable;
@Inject
private IEclipseContext context;
@PostConstruct
public void createComposite(Composite parent) {
parent.setLayout(new GridLayout());
label = new Label(parent, SWT.NONE);
label.setText("Sample table");
natTable = new NatTable(parent, new E4NatTableConfiguration(context));
natTable.setLayoutData(new GridData(GridData.FILL_BOTH));
}
@Focus
public void setFocus() {
natTable.setFocus();
}
}