@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); }
/** Allows a UTCTimeBox to be created with a specified format. */ public UTCTimeBoxImplHtml4() { this.textbox = new Select(); final TextBoxHandler handler = new TextBoxHandler(); textbox.addDomHandler(handler, BlurEvent.getType()); textbox.addValueChangeHandler(handler); textbox.setFixedMenuSize(5); initWidget(textbox); }
// ---------------------------------------------------------------------- // 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()); } } }
@EventHandler("updateTaskButton") public void updateTaskButton(ClickEvent e) { presenter.updateTask( taskDescriptionTextArea.getText(), userText.getText(), // subTaskStrategyListBox.getItemText(subTaskStrategyListBox.getSelectedIndex()), (dueDate.getValue() != null && dueDateTime.getValue() != null) ? UTCDateBox.utc2date(dueDate.getValue() + dueDateTime.getValue()) : null, Integer.valueOf(taskPriorityListBox.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(); } }); }
@Override public void setTabIndex(int tabIndex) { textbox.setTabIndex(tabIndex); }
@Override public void setVisibleLength(int length) { textbox.setFixedMenuSize(length); }
@Override public void setText(String text) { textbox.setValue(text); syncValueToText(); }
@Override public String getText() { return textbox.getValue(); }