private void createUI() { String newFile = ""; parentShell = ((Spoon) SpoonFactory.getInstance()).getShell(); Display display = parentShell.getDisplay(); comp = new Composite(((Spoon) SpoonFactory.getInstance()).getShell(), SWT.BORDER); comp.setLayout(new GridLayout()); comp.setLayoutData(new GridData(GridData.FILL_BOTH)); lbl = new Label(comp, SWT.CENTER | SWT.TOP); GridData ldata = new GridData(SWT.CENTER, SWT.TOP, true, false); lbl.setLayoutData(ldata); lbl.setText("Preview data returned from HPCC"); Button fileButton = new Button(comp, SWT.PUSH | SWT.SINGLE | SWT.TOP); fileButton.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); fileButton.setText("OPEN FILE"); // Listener for the file open button (fileButton) Listener fileOpenListener = new Listener() { public void handleEvent(Event e) { String newFile = buildFileDialog(); if (newFile != "") { fileName = newFile; // TODO: create new tab for file // openFile(fileName); openResultsXML(fileName); // int len = folder.getChildren().length; int len = folder.getItemCount(); System.out.println("Number of tabs: " + len); folder.setSelection(len - 1); } } }; fileButton.addListener(SWT.Selection, fileOpenListener); folder = new CTabFolder(comp, SWT.CLOSE); folder.setSimple(false); folder.setBorderVisible(true); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); }
private void createUI() { String newFile = ""; System.out.println("create saltResults GUI"); // fileName = System.getProperty("fileName"); // fileName = System.getProperties().getProperty("fileName"); // System.out.println("fileName" + fileName); parentShell = ((Spoon) SpoonFactory.getInstance()).getShell(); Display display = parentShell.getDisplay(); // dpt.createContents(parentShell); comp = new Composite(((Spoon) SpoonFactory.getInstance()).getShell(), SWT.BORDER); comp.setLayout(new GridLayout()); comp.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite btnComp = new Composite(comp, SWT.NONE); GridLayout btnLayout = new GridLayout(); btnLayout.numColumns = 2; btnComp.setLayout(btnLayout); lbl = new Label(comp, SWT.CENTER | SWT.TOP); Label lbl = new Label(comp, SWT.CENTER | SWT.TOP); GridData ldata = new GridData(SWT.CENTER, SWT.TOP, true, false); lbl.setLayoutData(ldata); lbl.setText("Preview data returned from SALt"); Button fileButton = new Button(btnComp, SWT.PUSH | SWT.SINGLE | SWT.TOP); fileButton.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); fileButton.setText("OPEN Data Profile FILE"); // Listener for the file open button (fileButton) Listener fileOpenListener = new Listener() { public void handleEvent(Event e) { String newFile = buildFileDialog(); if (newFile != "") { fileName = newFile; // TODO: create new tab for file // openFile(fileName); buildProfileTab(fileName); // int len = folder.getChildren().length; int len = folder.getItemCount(); System.out.println("Number of tabs: " + len); folder.setSelection(len - 1); } } }; fileButton.addListener(SWT.Selection, fileOpenListener); Button fileButtonSummary = new Button(btnComp, SWT.PUSH | SWT.SINGLE | SWT.TOP); fileButtonSummary.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); fileButtonSummary.setText("OPEN Data Summary FILE"); // Listener for the file open button (fileButton) Listener fileSummaryOpenListener = new Listener() { public void handleEvent(Event e) { String newFile = buildFileDialog(); if (newFile != "") { fileName = newFile; // TODO: create new tab for file // openFile(fileName); buildSummaryTab(fileName); // int len = folder.getChildren().length; int len = folder.getItemCount(); System.out.println("Number of tabs: " + len); folder.setSelection(len - 1); } } }; fileButtonSummary.addListener(SWT.Selection, fileSummaryOpenListener); folder = new CTabFolder(comp, SWT.CLOSE); folder.setSimple(false); folder.setBorderVisible(true); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); }