Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Tasks{
- private int id;
- private Double duration;
- public StakeholderTasks(int i, String string) {
- this.id = id;
- this.taskName=taskName;
- // TODO Auto-generated constructor stub
- }
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public Double getDuration() {
- return duration;
- }
- public void setDuration(Double duration) {
- this.duration = duration;
- }
- }
- public class stakeholderImpl extends CustomComponent {
- private Grid<Tasks> grid1;
- private Binder<Tasks> binder = new Binder<>(Tasks.class);
- cmpy = datastoreinstance.updateTaskList();
- provider1 = new ListDataProvider<>(cmpy );
- grid1 = new Grid<>();
- grid1.addColumn(Tasks::getDuration);
- grid1.asSingleSelect().addValueChangeListener(event -> {
- form.setVisible(false);
- window = createWindow(window,
- ((MainUI) (UI.getCurrent())).getLanguageMessage("general.addnewtask"),
- event.getValue(), "EDIT",form);
- } catch (ClassNotFoundException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (SQLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- }
- });
- binder.forField(duration).asRequired(((MainUI) (UI.getCurrent())).getLanguageMessage("general.required"))
- .withValidator(new RegexpValidator(((MainUI) (UI.getCurrent())).getLanguageMessage("general.numerror"), DBConstants.regex))
- .bind(taskdetails -> nf_out.format(stakeholders.getDuration()),
- (taskdetails, formValue) -> {
- NumberFormat nf_in = NumberFormat.getNumberInstance(Locale.GERMANY);
- double val = 0d;
- try {
- val = nf_in.parse(formValue).doubleValue();
- taskdetails.setDuration(val);
- } catch (ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- });
- }
Add Comment
Please, Sign In to add comment