@Override protected void doSetValue(Object source, Object value) { Container container = (Container) source; @SuppressWarnings("unchecked") Collection<Object> itemIds = (Collection<Object>) value; for (Object id : container.getItemIds().toArray()) { container.removeItem(id); } for (Object id : itemIds) { container.addItem(id); } }
protected void replaceToCombo(String key, String query) { Container container = new HierarchicalContainer(); container.addContainerProperty("id", String.class, ""); String defaultValue = null; try { Connection connection = DriverManager.getConnection("jdbc:sqlite:ivan.db3"); try { ResultSet rs = connection.createStatement().executeQuery(query); while (rs.next()) { defaultValue = rs.getString(1); container.addItem(defaultValue).getItemProperty("id").setValue(defaultValue); } } finally { connection.close(); } } catch (Exception ex) { } replaceToCombo(key, container, defaultValue); }