Hi folks,
I am in the middle of a project where I have combined Spring Web Flow with Spring Rich Client (if anyone else has done this all the way, not just a brief experiment, please let me know as I am running into all kinds of issues) for a project I am working on with a somewhat complex workflow. If anyone is interested, I'll post details of more details of the merging in a new thread. It is an adventure.
My program rips CDs, checking to see if it has seen the CD before. I want one form page which handles all disc editing, complete with validation of all properties. Here are my classes and their properties (without getters and setters).
I want one form where I can edit the disc number, the name, and have a table where I have all track information. I want to have validation then work with all elements in the track information table from the RulesSource I provide.Code:class AlbumDisc { int number; String name; List<Track> tracks; } class Track { int number; String name; }
My form does not properly make a binding for the tracks. My current createComponent() method is below. It at least allows me to edit the tracks, but nothing is there to get the validation in.
Hopefully someone can help me as I keep thrashing about trying to make this work.Code:protected JComponent createFormControl() { BindingFactory bindingFactory = getBindingFactory(); TableFormBuilder formBuilder = new TableFormBuilder(bindingFactory); formBuilder.add(bindingFactory.createBinding("disc.name")); formBuilder.row(); JComponent formComponent = formBuilder.getForm(); // fetch the messageSource instance from the application context MessageSource messageSource = (MessageSource) getApplicationContext() .getBean("messageSource"); // create the Book tracks table model List<Song> songs = getSongs(); BeanTableModel tableModel = new BookTrackTableModel(messageSource); tableModel.setRows(songs); // create the JTable instance JTable table = TableUtils.createStandardSortableTable(tableModel); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); JComponent tableComponent = new JScrollPane(table); JComponent panel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(1, 1, 1, 1); gbc.weightx = 100.0; gbc.gridx = 0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.BOTH; panel.add(formComponent, gbc); gbc.gridy++; gbc.weighty = 100.0; panel.add(tableComponent, gbc); return panel; }
Thanks,
-Keith


Reply With Quote