public Control createExampleControl(Composite parent) { // Setup the layer stack final MyDataProvider myDataProvider = new MyDataProvider(); SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(myDataProvider)); ILayer columnHeaderLayer = new ColumnHeaderLayer( new DataLayer(new DummyColumnHeaderDataProvider(myDataProvider)), selectionLayer, selectionLayer); CompositeLayer compositeLayer = new CompositeLayer(1, 2); compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0); compositeLayer.setChildLayer(GridRegion.BODY, selectionLayer, 0, 1); NatTable natTable = new NatTable(parent, compositeLayer, false); natTable.addConfiguration(new DefaultNatTableStyleConfiguration()); // Add our custom painting configuration natTable.addConfiguration(new CustomPaintingConfig()); natTable.configure(); return natTable; }
public void createPartControl(Composite parent) { final Font monospaceFont = new Font(parent.getDisplay(), new FontData("Monospace", 12, SWT.NONE)); final Color greenColor = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN); final Color redColor = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_RED); final Color blackColor = parent.getDisplay().getSystemColor(SWT.COLOR_BLACK); final Color greyColor = parent.getDisplay().getSystemColor(SWT.COLOR_GRAY); FillLayout fillLayout = (FillLayout) parent.getLayout(); fillLayout.type = SWT.VERTICAL; Composite terminalComposite = new Composite(parent, SWT.NONE); terminalComposite.setLayout(new FormLayout()); terminalComposite.setBackground(blackColor); TabFolder terminalPane = new TabFolder(terminalComposite, SWT.BOTTOM); terminalPane.setBackground(blackColor); FormData terminalLayoutData = new FormData(); terminalLayoutData.top = new FormAttachment(0); terminalLayoutData.left = new FormAttachment(0); terminalLayoutData.right = new FormAttachment(100); terminalPane.setLayoutData(terminalLayoutData); TabItem outTabItem = new TabItem(terminalPane, SWT.NONE); outTabItem.setText("out"); // terminalDataLayer = new DataLayer(currentlySelectedExecutionRecordDataProvider); SelectionLayer selectionLayer = new SelectionLayer(terminalDataLayer); ViewportLayer viewPortLayer = new ViewportLayer(selectionLayer); viewPortLayer.setRegionName(GridRegion.BODY); ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(columnDataProvider), viewPortLayer, selectionLayer); CompositeLayer compositeLayer = new CompositeLayer(1, 2); compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0); compositeLayer.setChildLayer(GridRegion.BODY, viewPortLayer, 0, 1); compositeLayer.setConfigLabelAccumulatorForRegion(GridRegion.BODY, configLabelAccumulator); terminalGrid = new NatTable(terminalPane, compositeLayer); terminalGrid.setTheme(new EarlGridTheme()); terminalGrid.setBackground(blackColor); outTabItem.setControl(terminalGrid); TabItem errTabItem = new TabItem(terminalPane, SWT.NONE); errTabItem.setText("err"); tabularErrorTable = new Table(terminalPane, SWT.VIRTUAL | SWT.HIDE_SELECTION); tabularErrorTable.setHeaderVisible(false); tabularErrorTable.setLinesVisible(true); // tabularErrorTable.addListener(SWT.SetData, tabularErrorDataHandler); tabularErrorTable.setFont(monospaceFont); tabularErrorTable.setBackground(redColor); tabularErrorTable.setForeground(greyColor); errTabItem.setControl(tabularErrorTable); TabItem logTabItem = new TabItem(terminalPane, SWT.NONE); logTabItem.setText("log"); tabularLogTable = new Table(terminalPane, SWT.VIRTUAL | SWT.HIDE_SELECTION); tabularLogTable.setHeaderVisible(false); tabularLogTable.setLinesVisible(true); // tabularLogTable.addListener(SWT.SetData, tabularErrorDataHandler); tabularLogTable.setFont(monospaceFont); tabularLogTable.setBackground(greenColor); tabularLogTable.setForeground(greyColor); logTabItem.setControl(tabularLogTable); terminalPane.setSelection(0); commandLineTxt = new Text(terminalComposite, SWT.BORDER); FormData commandLineTxtLayoutData = new FormData(); commandLineTxtLayoutData.left = new FormAttachment(terminalPane, 0, SWT.LEFT); commandLineTxtLayoutData.right = new FormAttachment(terminalPane, 0, SWT.RIGHT); commandLineTxtLayoutData.bottom = new FormAttachment(100); commandLineTxt.setLayoutData(commandLineTxtLayoutData); commandLineTxt.addFocusListener(commandLineFocusListener); commandLineTxt.addKeyListener(commandLineKeyListener); commandLineTxt.setFont(monospaceFont); commandLineTxt.setBackground(blackColor); commandLineTxt.setForeground(greyColor); commandLineTxt.addTraverseListener(preventTraversal); terminalLayoutData.bottom = new FormAttachment(commandLineTxt); monospaceFont.dispose(); }