@Override void doSave() { int order; try { order = Integer.parseInt(listOrderEd.getText().trim()); } catch (NumberFormatException e) { Window.alert( "Enter an integer to indicate the order that this season will appear in a drop down selection box"); listOrderEd.setFocus(true); return; } if (seasonEd.getText().trim().length() == 0) { Window.alert("Enter a Season"); return; } TSe season = new TSe(); if (editRb.getValue()) { season.setId(getLookupId()); } season.setListOrder(order); season.setSeason(seasonEd.getText()); saveBtn.setEnabled(false); service.saveSeason(season); }
public void initLayout() { lang = new ListBox(); lang = Convert.makeSelectedLanguageListBox( (ArrayList<String[]>) MainApp.getLanguage(), tObj.getLang()); lang.setWidth("100%"); lang.setEnabled(false); term = new TextBox(); term.setText(tObj.getLabel()); term.setWidth("100%"); main = new CheckBox(constants.conceptPreferredTerm()); if (tObj.isMainLabel()) { main.setValue(tObj.isMainLabel()); // main.setEnabled(false); } Grid table = new Grid(2, 2); table.setWidget(0, 0, new HTML(constants.conceptTerm())); table.setWidget(1, 0, new HTML(constants.conceptLanguage())); table.setWidget(0, 1, term); table.setWidget(1, 1, lang); table.setWidth("100%"); table.getColumnFormatter().setWidth(1, "80%"); VerticalPanel vp = new VerticalPanel(); vp.add(GridStyle.setTableConceptDetailStyleleft(table, "gslRow1", "gslCol1", "gslPanel1")); vp.add(main); vp.setSpacing(0); vp.setWidth("100%"); vp.setCellHorizontalAlignment(main, HasHorizontalAlignment.ALIGN_RIGHT); addWidget(vp); }
private Panel createNewNameInput(final ScrollPanel contentPanel) { VerticalPanel form = new VerticalPanel(); HorizontalPanel nameForm = new HorizontalPanel(); nameForm.add(new Label("Name")); final TextBox nameTextBox = new TextBox(); nameTextBox.setName("personName"); nameForm.add(nameTextBox); form.add(nameForm); Button saveButton = new Button( "Store", new ClickListener() { public void onClick(Widget sender) { String name = nameTextBox.getText(); RaffleServiceGwtRemoteAsync service = RaffleServiceGwtRemote.App.getInstance(); AsyncCallback callback = new AsyncCallback() { public void onFailure(Throwable caught) { GWT.log("Failure while creating a new name", caught); } public void onSuccess(Object result) { contentPanel.setWidget(new Label("Name is stored")); } }; service.storeName(name, callback); } }); form.add(saveButton); return form; }
private void doFieldLabel() { if (nil(this.editingCol.getFactField())) { fieldLabel.setText(constants.pleaseChooseFactType()); } else { fieldLabel.setText(editingCol.getFactField()); } }
@Override public void setValue( final LabelledFrame<NamedIndividualFrame> frame, HasEntityDataProvider entityDataProvider) { editedFrame = frame.getFrame(); displayNameField.setValue(frame.getDisplayName()); iriField.setValue(editedFrame.getSubject().getIRI().toString()); assertions.setValue(editedFrame.getPropertyValueList()); setDirty(false, EventStrategy.DO_NOT_FIRE_EVENTS); List<OWLPrimitiveData> dataList = new ArrayList<OWLPrimitiveData>(); for (OWLClass cls : editedFrame.getClasses()) { final Optional<OWLEntityData> rendering = entityDataProvider.getEntityData(cls); if (rendering.isPresent()) { dataList.add(rendering.get()); } } OWLPrimitiveDataList list = new OWLPrimitiveDataList(dataList); types.setValue(list); List<OWLPrimitiveData> sameAsList = new ArrayList<OWLPrimitiveData>(); for (OWLNamedIndividual individual : editedFrame.getSameIndividuals()) { Optional<OWLEntityData> individualRendering = entityDataProvider.getEntityData(individual); if (individualRendering.isPresent()) { sameAsList.add(individualRendering.get()); } } sameAs.setValue(new OWLPrimitiveDataList(sameAsList)); }
public YearlyRecurrenceEditor() { setSpacing(6); getElement().removeAttribute("cellpadding"); HorizontalPanel p = new HorizontalPanel(); everyMonthOnNthDayRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$ everyMonthOnNthDayRb.setChecked(true); p.add(everyMonthOnNthDayRb); p.add(monthOfYearLb0); dayOfMonthTb.setStylePrimaryName("DAY_OF_MONTH_TB"); // $NON-NLS-1$ dayOfMonthTb.setWidth("3em"); // $NON-NLS-1$ p.add(dayOfMonthTb); dayOfMonthLabel = new ErrorLabel(p); add(dayOfMonthLabel); p = new HorizontalPanel(); nthDayNameOfMonthNameRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$ p.add(nthDayNameOfMonthNameRb); p.add(whichWeekLb); p.add(dayOfWeekLb); Label l = new Label(Messages.getString("schedule.of")); l.setStyleName("middleLabel"); // $NON-NLS-1$ p.add(l); p.add(monthOfYearLb1); add(p); configureOnChangeHandler(); }
private void turnNameFieldIntoLabel() { String name = patternNameField.getText(); if (name.equalsIgnoreCase(DEFAULT_PATTERN_NAME)) { name = ""; } arrowImage.setVisible(true); patternNameField.setVisible(false); if (name.equals("")) { GWTServiceLookup.getSearchService().deleteSavedSearch(currentSearchId, blackHoleCallback); currentSearchId = 0; starImage.setUrl(STAR_OFF_URL); } else { // NOTE: currently do not support updated a saved search pattern if (currentSearchId == 0) { String pattern = autoCompletePatternField.getText(); createSavedSearch(name, pattern); } else { updateSavedSearchName(currentSearchId, name); } patternNameLabel.setText(elipse(name)); patternNameLabel.setVisible(true); starImage.setUrl(STAR_ON_URL); } }
private Widget addWidget(AddRecord recordTable) { Widget widget = new Widget(); if (recordTable.getFieldType().equals(SQL_TYPE_STRING)) { widget = new TextBox(); if (recordTable.getFieldType() != null) { ((TextBox) widget).setValue(recordTable.getFieldValue()); ((TextBox) widget).setEnabled(recordTable.isEditable()); } } else if (recordTable.getFieldType().equals(SQL_TYPE_DATE)) { widget = new DateBox(); ((DateBox) widget).setEnabled(recordTable.isEditable()); } else if (recordTable.getFieldType().equals(SQL_TYPE_LIST_STRING)) { final ListBox listBox = new ListBox(); listBox.setEnabled(recordTable.isEditable()); for (RefRecord rec : recordTable.getListRefRecord()) { listBox.addItem(rec.getValue(), String.valueOf(rec.getKey())); } widget = listBox; } else { widget = new TextBox(); if (recordTable.getFieldValue() != null) { ((TextBox) widget).setValue(recordTable.getFieldValue()); ((TextBox) widget).setEnabled(recordTable.isEditable()); } } return widget; }
public static TextBox getTextBox(String defaultText) { TextBox t = new TextBox(); t.setStyleName(Constants.CSS_NORMAL_TEXT); t.setText(defaultText); return t; }
private void setup() { textBox = new TextBox(); textBox.setName(name); textBox.setTitle(title); textBox.setTabIndex(0); oracle = new PrincipalSuggestOracle(type); suggestBox = new SuggestBox(oracle, textBox); suggestBox.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { setModified(true); String newValue = event.getValue(); setUndefined(newValue.equals("")); parseValue(newValue); } }); suggestBox.addSelectionHandler( new SelectionHandler<SuggestOracle.Suggestion>() { @Override public void onSelection( SelectionEvent<SuggestOracle.Suggestion> suggestionSelectionEvent) { setModified(true); String newValue = suggestBox.getValue(); setUndefined(newValue.equals("")); parseValue(newValue); } }); wrapper = new InputElementWrapper(suggestBox, this); }
public void updateRoleTotals() { int mint = 0; int maxt = 0; final int rows = roleft.getRowCount() - 2; for (int row = 0; row < rows; ++row) { TextBox minw = (TextBox) roleft.getWidget(row + 1, 1); TextBox maxw = (TextBox) roleft.getWidget(row + 1, 2); mint += Integer.parseInt(minw.getText()); maxt += Integer.parseInt(maxw.getText()); } roleft.setText(rows + 1, 1, "" + mint); roleft.setText(rows + 1, 2, "" + maxt); int size = getRaidSize(); FlexTable.FlexCellFormatter fcf = roleft.getFlexCellFormatter(); if (mint < size) { fcf.addStyleName(rows + 1, 1, "error"); } else { fcf.removeStyleName(rows + 1, 1, "error"); } if (maxt < size) { fcf.addStyleName(rows + 1, 2, "error"); } else { fcf.removeStyleName(rows + 1, 2, "error"); } updateBadgeRoles(); }
public AttributeFilter() { attributeWhere.setName("tests with attribute"); valueWhere.setName("and value"); List<TextBox> textBoxes = Arrays.asList(attributeWhere, valueWhere); setupPanel(textBoxes); }
@Override public void setReadOnly(Boolean readlOnly) { textbox.setReadOnly(readOnly); if (readOnly) { textbox.setEnabled(false); } }
@Override void wireEtc() { lookup.addItem("Select a Season"); listOrderEd.setStylePrimaryName("numbertextbox"); listOrderEd.setTitle( "This determines the order that the Seasons will be displayed in drop down selection boxes"); deleteBtn.setVisible(false); controller.addListener( EditSeasonDoIntialLoad.class, new ControllerListener<EditSeasonDoIntialLoad>() { @Override public void event(EditSeasonDoIntialLoad event) {} }); controller.addListener( LoadSeasonsReturned.class, new ControllerListener<LoadSeasonsReturned>() { @Override public void event(LoadSeasonsReturned result) { lookup.clear(); lookup.addItem("Select a Season"); seasonMap.clear(); int i = 0; for (TSe season : result.getSeasonList()) { String s = season.getSeason(); lookup.addItem(s, season.getId().toString()); seasonMap.put(++i, season); } setLookupLoaded(true); } }); controller.addListener( SaveSeasonReturned.class, new ControllerListener<SaveSeasonReturned>() { @Override public void event(SaveSeasonReturned event) { ContentEventDetail.setLastEventID(null); resetForm(); Window.alert("Data Saved"); saveBtn.setEnabled(true); service.loadSeasons(); } }); controller.addListener( SaveSeasonFailed.class, new ControllerListener<SaveSeasonFailed>() { @Override public void event(SaveSeasonFailed result) { saveBtn.setEnabled(true); } }); }
public VerticalPanel buildUsersListPanel() { DockPanel headerDockPanel = new DockPanel(); headerDockPanel.add(deleteUserBtn, DockPanel.EAST); VerticalPanel spacer = new VerticalPanel(); spacer.setWidth("2"); // $NON-NLS-1$ headerDockPanel.add(spacer, DockPanel.EAST); headerDockPanel.add(addUserBtn, DockPanel.EAST); Label label = new Label("Users"); // $NON-NLS-1$ headerDockPanel.add(label, DockPanel.WEST); headerDockPanel.setCellWidth(label, "100%"); // $NON-NLS-1$ VerticalPanel userListPanel = new VerticalPanel(); userListPanel.add(headerDockPanel); userListPanel.add(usersList); userListPanel.add(new Label(Messages.getString("filter"))); // $NON-NLS-1$ userListPanel.add(filterTextBox); userListPanel.setCellHeight(usersList, "100%"); // $NON-NLS-1$ userListPanel.setCellWidth(usersList, "100%"); // $NON-NLS-1$ userListPanel.setHeight("100%"); // $NON-NLS-1$ userListPanel.setWidth("100%"); // $NON-NLS-1$ usersList.setHeight("100%"); // $NON-NLS-1$ usersList.setWidth("100%"); // $NON-NLS-1$ filterTextBox.setWidth("100%"); // $NON-NLS-1$ deleteUserBtn.setEnabled(false); filterTextBox.addKeyboardListener(this); usersList.addChangeListener(this); addUserBtn.addClickListener(this); deleteUserBtn.addClickListener(this); return userListPanel; }
public PermissionsPanel(final JSONObject entityJsonObject) { // this.center(); this.setAutoHideEnabled(true); VerticalPanel vp = new VerticalPanel(); vp.setSpacing(30); vp.setWidth("300px"); vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); vp.add(new CloseButton(this)); vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); vp.add(new Label("Permissions to Edit this information:")); vp.add(listPermissions(entityJsonObject)); permissionName.setValue(null); permissionName.setWidth("200px"); vp.add(permissionName); vp.add(new ButtonAddPermission(entityJsonObject, this)); this.setWidget(vp); }
private boolean validateDueDate() { dueDateWarningLabel.setText(""); int dateCondition = dueDateCondition.getSelectedIndex(); if (dateCondition == BoardsFilter.DATE_CONDITION_UNSET) { return true; } boolean fromFilled = filterObject.parseDate(dueDateFromBox.getText()) != null; boolean toFilled = filterObject.parseDate(dueDateToBox.getText()) != null; if ((dateCondition == BoardsFilter.DATE_CONDITION_LESS || dateCondition == BoardsFilter.DATE_CONDITION_MORE || dateCondition == BoardsFilter.DATE_CONDITION_EQALS) && !fromFilled) { dueDateWarningLabel.setText("Please fill the date"); return false; } if (dateCondition == BoardsFilter.DATE_CONDITION_BETWEEN && (!fromFilled || !toFilled)) { dueDateWarningLabel.setText("Please fill the date"); return false; } return true; }
private void initMessageUI() { messageBox = new TextBox(); messageBox.setReadOnly(true); messageBox.setWidth(FieldCanvas.SIZE * game.getBoard().getDimension().x + "px"); messageBox.setText("Click field to start game."); add(messageBox); }
public void onClick(ClickEvent event) { Widget source = (Widget) event.getSource(); if (source == btnSubmit) { if (currentUser != null) { txtLogin.setValue(currentUser.getUsername()); txtProject.setValue(lbProjects.getItemText(lbProjects.getSelectedIndex())); form.submit(); } } if (source == hlBack) { if (currentUser.getUsertype().equalsIgnoreCase("user")) { History.newItem("userJobList"); } else { if (tab == 0) { History.newItem("adminJobList"); } else { History.newItem("jobList"); } // AdminPage adminPage = new AdminPage(tab); // RootPanel.get("content").add(adminPage); } /*UserHistory userHistory = new UserHistory(); userHistory.history();*/ } }
/** Called whenever any filter value changes. */ protected void onFilterValueChange() { TaskInboxFilterBean newState = new TaskInboxFilterBean(); int priorityVal = -1; if (priority.getValue().trim().length() > 0) { try { priorityVal = Integer.parseInt(priority.getValue()); } catch (NumberFormatException nfe) { } } newState .setOwner( TaskOwnerEnum.valueOf( ownerAny.getValue(), ownerMine.getValue(), ownerActive.getValue(), ownerGroup.getValue())) .setPriority(priorityVal) .setDateDueFrom(dateDueFrom.getDateValue()) .setDateDueTo(dateDueTo.getDateValue()); TaskInboxFilterBean oldState = this.currentState; this.currentState = newState; // Only fire a change event if something actually changed. ValueChangeEvent.fireIfNotEqual(this, oldState, currentState); }
public PersonSearchPanel() { rootElement = uiBinder.createAndBindUi(this); searchBox.setVisibleLength(40); searchBox.addKeyPressHandler( new EnterKeyHandler( new HandlerAction() { public void actionPerformed() { personServiceAsync.getPersons( new AsyncCallback<List<Person>>() { public void onFailure(Throwable caught) { Window.alert("What? An error has occured. Message: " + caught.getMessage()); caught.printStackTrace(); } public void onSuccess(List<Person> result) { populatePersonResult(result); resultPanel.setVisible(true); } }); } })); resultPanel.setVisible(false); resultPanel.add(new Label("Search Result:")); searchResult = new Grid(0, 2); resultPanel.add(searchResult); }
@Override public void addHandler(final PTInstruction addHandler, final UIService uiService) { if (HANDLER.KEY_.DATE_VALUE_CHANGE_HANDLER.equals(addHandler.getString(HANDLER.KEY))) { final DateBox dateBox = cast(); final TextBox textBox = dateBox.getTextBox(); dateBox.addValueChangeHandler( new ValueChangeHandler<Date>() { @Override public void onValueChange(final ValueChangeEvent<Date> event) { triggerEvent(addHandler, uiService, dateBox); } }); textBox.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(final ValueChangeEvent<String> event) { triggerEvent(addHandler, uiService, dateBox); } }); } else { super.addHandler(addHandler, uiService); } }
private void plot() { if (dygraphs != null) { if (panel.remove(dygraphs)) ; } String eq = textArea.getValue(); double x1 = Double.parseDouble(fromTb.getValue()); double x2 = Double.parseDouble(toTb.getValue()); double xs = 1.0 * (x2 - x1) / width; JsArray<JsArrayMixed> data = JsArray.createArray().cast(); for (int i = 0; i < width; i++) { double x = x1 + i * xs; JsArrayNumber y = evalFn(eq, x); JsArrayMixed row = JsArrayMixed.createArray().cast(); row.push(x); for (int j = 0; j < y.length(); j++) { row.push(y.get(j)); } data.push(row); } dygraphs = new Dygraphs(data, null); dygraphs.setPixelSize(width, height); panel.add(dygraphs); }
/** @param value */ public void setUnformattedValue(Object value, boolean fireEnvents) { if (this.formatter != null) { textBox.setValue(this.formatter.format(value), fireEnvents); } else { textBox.setValue(value != null ? value.toString() : "", fireEnvents); } }
/** * Ajoute une tache dans la table des tâches. Déclenchée par un click sur le addTaskButton ou par * la touche Enter depuis le champ newTaskTextBox. */ private void addTask() { String symbol = newTaskTextBox.getText().trim(); newTaskTextBox.setFocus(true); // Stock code must be between 1 and 10 chars that are numbers, letters, or dots. if (symbol.length() < 3) { Window.alert("le nom de la tâche doit faire plus de 3 caractères."); newTaskTextBox.selectAll(); return; } newTaskTextBox.setText(""); // Rename the task if it's already in the table. if (tasks.contains(symbol)) { int n = 1; while (tasks.contains(symbol + " (" + n + ")")) { n++; } symbol = symbol + " (" + n + ")"; } final String finalSymbol = symbol; addStock(symbol); }
public InlineMultiSelect() { popup.setAutoHideEnabled(true); popup.addAutoHidePartner(textbox.getElement()); multiSelect.addValueChangeHandler( new ValueChangeHandler<List<String>>() { @Override public void onValueChange(ValueChangeEvent<List<String>> event) { int size = event.getValue().size(); textbox.setText(size + " selected"); } }); popup.add(multiSelect); textbox.setText("Make a selection"); textbox.setReadOnly(true); panel.add(textbox); panel.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { popup.showRelativeTo(panel); } }); initWidget(panel); }
private static TextBox createTextBox(boolean isPassword) { TextBox tb; if (isPassword) { tb = new PasswordTextBox() { @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); handlePaste(this, event); } }; } else { tb = new TextBox() { @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); handlePaste(this, event); } }; } tb.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { event.stopPropagation(); } }); tb.sinkEvents(Event.ONPASTE); tb.setVisibleLength(40); return tb; }
public void createDeepLink() { if (tabContent instanceof IFrameTabPanel) { PromptDialogBox dialogBox = new PromptDialogBox( Messages.getString("deepLink"), Messages.getString("ok"), Messages.getString("cancel"), false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ true); String url = Window.Location.getProtocol() + "//" + Window.Location.getHostName() + ":" + Window.Location.getPort() + Window.Location.getPath() // $NON-NLS-1$ //$NON-NLS-2$ + "?name=" + textLabel.getText() + "&startup-url="; //$NON-NLS-1$ //$NON-NLS-2$ String startup = ((IFrameTabPanel) tabContent).getUrl(); TextBox urlbox = new TextBox(); urlbox.setText(url + URL.encodeComponent(startup)); urlbox.setVisibleLength(80); dialogBox.setContent(urlbox); dialogBox.center(); } }
public void onModuleLoad() { // Make some text boxes. The password text box is identical to the text // box, except that the input is visually masked by the browser. PasswordTextBox ptb = new PasswordTextBox(); TextBox tb = new TextBox(); // TODO(ECC) must be tested. tb.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (!Character.isDigit(event.getCharCode())) { ((TextBox) event.getSource()).cancelKey(); } } }); // Let's make an 80x50 text area to go along with the other two. TextArea ta = new TextArea(); ta.setCharacterWidth(80); ta.setVisibleLines(50); // Add them to the root panel. VerticalPanel panel = new VerticalPanel(); panel.add(tb); panel.add(ptb); panel.add(ta); RootPanel.get().add(panel); }
private void createConditionExpressionPanel() { conditionalPanel = new HorizontalPanel(); mainPanel.add(conditionalPanel); conditionalPanel.setVisible(conditionalBox.getValue()); Label conditionalExpressionLabel = new Label(myConstants.conditionalPrompt() + ":"); conditionalExpressionLabel.setStyleName("keyLabel"); conditionalPanel.add(conditionalExpressionLabel); final TextBox conditionText = new TextBox(); conditionText.setText(input.getConditionExpression()); conditionalPanel.add(conditionText); conditionText.addValueChangeHandler( new ValueChangeHandler() { @Override public void onValueChange(ValueChangeEvent arg0) { input.setConditionExpression(conditionText.getText()); } }); conditionalPanel.add( new HTML( " <span style='font-style:italic;font-size:small;" + "text-color:#888888;'>" + "(" + myConstants.eg() + ", " + "q1name < 3" + ")" + "</span>")); }