public static void main(final String[] args) { final Display display = Display.getDefault(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final CompositeTable table = new CompositeTable(shell, SWT.NONE); new Header(table, SWT.NONE); new Row(table, SWT.NONE); table.setRunTime(true); final ICompositeTableRidget ridget = (ICompositeTableRidget) SwtRidgetFactory.createRidget(table); final WritableList input = new WritableList(PersonFactory.createPersonList(), Person.class); ridget.bindToModel(input, Person.class, RowRidget.class); ridget.updateFromModel(); shell.setSize(400, 160); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
public static void main(final String[] args) { final Display display = Display.getDefault(); final Shell shell = new Shell(display); shell.setText(SnippetMasterDetailsRidget003.class.getSimpleName()); shell.setLayout(new FillLayout()); final PersonMasterDetails details = new PersonMasterDetails(shell, SWT.NONE); final IMasterDetailsRidget ridget = (IMasterDetailsRidget) SwtRidgetFactory.createRidget(details); ridget.setDelegate(new PersonDelegate()); final WritableList input = new WritableList(PersonFactory.createPersonList(), Person.class); final String[] properties = {Person.PROPERTY_LASTNAME, Person.PROPERTY_FIRSTNAME}; final String[] headers = {"Last Name", "First Name"}; // $NON-NLS-1$ //$NON-NLS-2$ ridget.bindToModel(input, Person.class, properties, headers); ridget.updateFromModel(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }