private TextBox buildParameterTextBox(String text) { TextBox paramBox = new TextBox(); paramBox.setText(text); paramBox.setWidth("135"); paramBox.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { enableSaveButton(); } }); return paramBox; }
@UiHandler("clearSessionFiltersButton") void handleClearSessionFiltersButtonClick(ClickEvent e) { sessionsTo.setValue(null, true); sessionsFrom.setValue(null, true); sessionIdsTextBox.setText(null); stopTypingSessionIdsTimer.schedule(10); }
private void filterSessions(Set<SessionDataDto> sessionDataDtoSet) { if (sessionDataDtoSet == null || sessionDataDtoSet.isEmpty()) { sessionIdsTextBox.setText(null); stopTypingSessionIdsTimer.schedule(10); return; } final StringBuilder builder = new StringBuilder(); boolean first = true; for (SessionDataDto sessionDataDto : sessionDataDtoSet) { if (!first) { builder.append("/"); } builder.append(sessionDataDto.getSessionId()); first = false; } sessionIdsTextBox.setText(builder.toString()); stopTypingSessionIdsTimer.schedule(10); }
/** Ask the user for the URL. */ private void getUrl() { try { if (urlTextBox == null) { urlTextBox = new TextBox( Resource.getString(ResourceConstants.AMS_DISC_APP_WEBSITE_INSTALL), defaultInstallListUrl, 1024, TextField.ANY); urlTextBox.addCommand(endCmd); urlTextBox.addCommand(saveCmd); urlTextBox.addCommand(discoverCmd); urlTextBox.setCommandListener(this); } display.setCurrent(urlTextBox); } catch (Exception ex) { displayException(Resource.getString(ResourceConstants.EXCEPTION), ex.toString()); } }
/** * Respond to a command issued on any Screen. * * @param c command activated by the user * @param s the Displayable the command was on. */ public void commandAction(Command c, Displayable s) { if (c == discoverCmd) { // user wants to discover the suites that can be installed discoverSuitesToInstall(urlTextBox.getString()); } else if (s == installListBox && (c == List.SELECT_COMMAND || c == installCmd)) { installSuite(installListBox.getSelectedIndex()); } else if (c == backCmd) { display.setCurrent(urlTextBox); } else if (c == saveCmd) { saveURLSetting(); } else if (c == endCmd || c == Alert.DISMISS_COMMAND) { // goto back to the manager midlet notifyDestroyed(); } }
/** Save the URL setting the user entered in to the urlTextBox. */ private void saveURLSetting() { String temp; Exception ex; temp = urlTextBox.getString(); ex = GraphicalInstaller.saveSettings(temp, MIDletSuite.INTERNAL_SUITE_ID); if (ex != null) { displayException(Resource.getString(ResourceConstants.EXCEPTION), ex.toString()); return; } defaultInstallListUrl = temp; displaySuccessMessage(Resource.getString(ResourceConstants.AMS_MGR_SAVED)); }
private void setupSessionNumberTextBox() { stopTypingSessionIdsTimer = new Timer() { @Override public void run() { final String currentContent = sessionIdsTextBox.getText().trim(); // If session ID text box is empty then load all sessions if (currentContent == null || currentContent.isEmpty()) { sessionDataProvider.addDataDisplayIfNotExists(sessionsDataGrid); sessionDataForSessionIdsAsyncProvider.removeDataDisplayIfNotExists(sessionsDataGrid); return; } Set<String> sessionIds = new HashSet<String>(); if (currentContent.contains(",") || currentContent.contains(";") || currentContent.contains("/")) { sessionIds.addAll(Arrays.asList(currentContent.split("\\s*[,;/]\\s*"))); } else { sessionIds.add(currentContent); } sessionDataForSessionIdsAsyncProvider.setSessionIds(sessionIds); sessionDataProvider.removeDataDisplayIfNotExists(sessionsDataGrid); sessionDataForDatePeriodAsyncProvider.removeDataDisplayIfNotExists(sessionsDataGrid); sessionDataForSessionIdsAsyncProvider.addDataDisplayIfNotExists(sessionsDataGrid); } }; sessionIdsTextBox.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { sessionsFrom.setValue(null); sessionsTo.setValue(null); stopTypingSessionIdsTimer.schedule(500); } }); }
private String getParameterValue(HorizontalPanel entry) { TextBox key = (TextBox) entry.getWidget(2); return key.getText(); }