@Override public void init(TaskDetailsPresenter presenter) { this.presenter = presenter; // Commented out until we add the posibility of adding sub tasks // for (String strategy : subTaskStrategies) { // subTaskStrategyListBox.addItem(strategy); // // } for (int i = 0; i < priorities.length; i++) { final Option option = new Option(); option.setText(priorities[i]); option.setValue(String.valueOf(i)); taskPriorityListBox.add(option); } taskPriorityListBox.refresh(); taskStatusLabel.setText(constants.Status()); userLabel.setText(constants.User()); dueDateLabel.setText(constants.Due_On()); taskPriorityLabel.setText(constants.Priority()); taskDescriptionLabel.setText(constants.Description()); updateTaskButton.setText(constants.Update()); dueDate.getDateBox().setContainer(this); }
// ---------------------------------------------------------------------- // synchronization between text and value protected void syncTextToValue(final Long value) { final Long valueToSelect = text2value(value2text(value)); final Iterator<Widget> iterator = textbox.iterator(); while (iterator.hasNext()) { final Option option = (Option) iterator.next(); final Long optionValue = text2value(option.getValue()); if (optionValue <= valueToSelect) { textbox.setValue(option.getValue()); } } }
private void generateTimeOptions() { int numOptions = (int) (DAY / INTERVAL); // we need to use times for formatting, but we don't keep // them around. the purpose is only to generate text to // insert into the textbox. for (int i = 0; i < numOptions; i++) { long offsetFromMidnight = i * INTERVAL; final String value = generateTimeValue(offsetFromMidnight); Option option = new Option(); option.setText(value); option.setValue(value); textbox.add(option); } Scheduler.get() .scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { textbox.refresh(); } }); }