*
* @param group
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void showWinners(String group) {
JocTable jt = new JocTable();
wGroup = group;
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
entityManager = java.beans.Beans.isDesignTime()
? null
: javax.persistence.Persistence.createEntityManagerFactory("ShowManager").createEntityManager();
entryQuery = java.beans.Beans.isDesignTime()
? null
: entityManager.createQuery(
"SELECT e FROM Entry e WHERE e.truckclass =:truckclass ORDER BY e.votes DESC");
entryQuery.setParameter("truckclass", group);
entryList = java.beans.Beans.isDesignTime()
? java.util.Collections.emptyList()
: entryQuery.getResultList();
org.jdesktop.swingbinding.JTableBinding jTableBinding =
org.jdesktop.swingbinding.SwingBindings.createJTableBinding(
org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, entryList, jt);
org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding =
jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${truckid}"));
columnBinding.setColumnName("Truck ID");
columnBinding.setColumnClass(Integer.class);
columnBinding.setEditable(false);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${truckowner}"));
columnBinding.setColumnName("Truck Owner");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${truckmake}"));
columnBinding.setColumnName("Truck Make");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${truckclass}"));
columnBinding.setColumnName("Truck Class");
columnBinding.setColumnClass(String.class);
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${votes}"));
columnBinding.setColumnName("Votes");
columnBinding.setColumnClass(Integer.class);
bindingGroup.addBinding(jTableBinding);
jTableBinding.bind();
js = new JScrollPane();
jt.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jt.getColumnModel().getColumn(0).setMinWidth(70);
jt.getColumnModel().getColumn(0).setPreferredWidth(70);
jt.getColumnModel().getColumn(0).setMaxWidth(70);
jt.getColumnModel().getColumn(1).setMinWidth(150);
jt.getColumnModel().getColumn(1).setPreferredWidth(150);
jt.getColumnModel().getColumn(1).setMaxWidth(150);
jt.getColumnModel().getColumn(2).setMinWidth(80);
jt.getColumnModel().getColumn(2).setPreferredWidth(80);
jt.getColumnModel().getColumn(2).setMaxWidth(80);
jt.getColumnModel().getColumn(3).setMinWidth(80);
jt.getColumnModel().getColumn(3).setPreferredWidth(80);
jt.getColumnModel().getColumn(3).setMaxWidth(80);
jt.getColumnModel().getColumn(4).setMinWidth(70);
jt.getColumnModel().getColumn(4).setPreferredWidth(70);
jt.getColumnModel().getColumn(4).setMaxWidth(70);
jt.setEditable(false);
js.setViewportView(jt);
lblClass = new JLabel("Class Winners for: " + wGroup);
lblClass.setFont(new Font("SansSerif", Font.BOLD, 22));
lblClass.setHorizontalAlignment(SwingConstants.CENTER);
lblClass.setBounds(50, 300, 400, 30);